【修复】当无优惠价格时,商品无法显示的问题

Signed-off-by: 杨宇庆 <hiyyq@qq.com>
This commit is contained in:
杨宇庆
2024-10-16 16:51:52 +00:00
committed by Gitee
parent 3051aed6b2
commit 959fe83d72
2 changed files with 2 additions and 2 deletions

View File

@@ -361,7 +361,7 @@
// 选择有 promotionPrice 且最小的
state.settlementSku = state.goodsInfo.skus
.filter((sku) => sku.stock > 0 && sku.promotionPrice > 0)
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr));
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr), []);
// 设置满减送活动
if (data.rewardActivity) {

View File

@@ -416,7 +416,7 @@ export function appendSettlementProduct(spus, settlementInfos) {
// 选择价格最小的 SKU 设置到 SPU 上
const settlementSku = settlementInfo.skus
.filter((sku) => sku.promotionPrice > 0)
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr));
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr), []);
if (settlementSku) {
spu.promotionType = settlementSku.promotionType;
spu.promotionPrice = settlementSku.promotionPrice;