|
|
@ -416,15 +416,15 @@ Page({ |
|
|
publishedGoods = this.filterGoodsList(publishedGoods) |
|
|
publishedGoods = this.filterGoodsList(publishedGoods) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 排序逻辑:有销售价格的商品排在最前面,然后按时间倒序排序
|
|
|
// 排序逻辑:没有销售价格的商品排在最前面,然后按时间倒序排序
|
|
|
publishedGoods.sort((a, b) => { |
|
|
publishedGoods.sort((a, b) => { |
|
|
// 检查是否有销售价格
|
|
|
// 检查是否有销售价格
|
|
|
const hasPriceA = !!(a.price && a.price.trim() !== ''); |
|
|
const hasPriceA = !!(a.price && a.price.trim() !== ''); |
|
|
const hasPriceB = !!(b.price && b.price.trim() !== ''); |
|
|
const hasPriceB = !!(b.price && b.price.trim() !== ''); |
|
|
|
|
|
|
|
|
// 有销售价格的排在前面
|
|
|
// 没有销售价格的排在前面
|
|
|
if (hasPriceA !== hasPriceB) { |
|
|
if (hasPriceA !== hasPriceB) { |
|
|
return hasPriceA ? -1 : 1; |
|
|
return hasPriceA ? 1 : -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 都有或都没有销售价格时,按时间倒序排序
|
|
|
// 都有或都没有销售价格时,按时间倒序排序
|
|
|
@ -484,15 +484,15 @@ Page({ |
|
|
soldOutGoods = this.filterGoodsList(soldOutGoods) |
|
|
soldOutGoods = this.filterGoodsList(soldOutGoods) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 排序逻辑:有销售价格的商品排在最前面,然后按时间倒序排序
|
|
|
// 排序逻辑:没有销售价格的商品排在最前面,然后按时间倒序排序
|
|
|
soldOutGoods.sort((a, b) => { |
|
|
soldOutGoods.sort((a, b) => { |
|
|
// 检查是否有销售价格
|
|
|
// 检查是否有销售价格
|
|
|
const hasPriceA = !!(a.price && a.price.trim() !== ''); |
|
|
const hasPriceA = !!(a.price && a.price.trim() !== ''); |
|
|
const hasPriceB = !!(b.price && b.price.trim() !== ''); |
|
|
const hasPriceB = !!(b.price && b.price.trim() !== ''); |
|
|
|
|
|
|
|
|
// 有销售价格的排在前面
|
|
|
// 没有销售价格的排在前面
|
|
|
if (hasPriceA !== hasPriceB) { |
|
|
if (hasPriceA !== hasPriceB) { |
|
|
return hasPriceA ? -1 : 1; |
|
|
return hasPriceA ? 1 : -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 都有或都没有销售价格时,按时间倒序排序
|
|
|
// 都有或都没有销售价格时,按时间倒序排序
|
|
|
|