From f132942cd3ce7737e953ed0c4929c3dde45896ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Tue, 13 Jan 2026 16:29:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=92=E5=BA=8F=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E8=AE=A9=E6=B2=A1=E6=9C=89=E9=94=80=E5=94=AE?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E7=9A=84=E5=95=86=E5=93=81=E6=8E=92=E5=9C=A8?= =?UTF-8?q?=E6=9C=80=E5=89=8D=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/goods/index.js b/pages/goods/index.js index 0de3cde..846828d 100644 --- a/pages/goods/index.js +++ b/pages/goods/index.js @@ -416,15 +416,15 @@ Page({ publishedGoods = this.filterGoodsList(publishedGoods) } - // 排序逻辑:有销售价格的商品排在最前面,然后按时间倒序排序 + // 排序逻辑:没有销售价格的商品排在最前面,然后按时间倒序排序 publishedGoods.sort((a, b) => { // 检查是否有销售价格 const hasPriceA = !!(a.price && a.price.trim() !== ''); const hasPriceB = !!(b.price && b.price.trim() !== ''); - // 有销售价格的排在前面 + // 没有销售价格的排在前面 if (hasPriceA !== hasPriceB) { - return hasPriceA ? -1 : 1; + return hasPriceA ? 1 : -1; } // 都有或都没有销售价格时,按时间倒序排序 @@ -484,15 +484,15 @@ Page({ soldOutGoods = this.filterGoodsList(soldOutGoods) } - // 排序逻辑:有销售价格的商品排在最前面,然后按时间倒序排序 + // 排序逻辑:没有销售价格的商品排在最前面,然后按时间倒序排序 soldOutGoods.sort((a, b) => { // 检查是否有销售价格 const hasPriceA = !!(a.price && a.price.trim() !== ''); const hasPriceB = !!(b.price && b.price.trim() !== ''); - // 有销售价格的排在前面 + // 没有销售价格的排在前面 if (hasPriceA !== hasPriceB) { - return hasPriceA ? -1 : 1; + return hasPriceA ? 1 : -1; } // 都有或都没有销售价格时,按时间倒序排序