From 3dc02f728269713544e90e4f915d074724e86c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E8=B6=8A?= <552369664@qq.com> Date: Fri, 6 Sep 2024 22:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=91=E4=BF=AE=E5=A4=8D=E6=8B=BC=E5=9B=A2=E7=9A=84=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/combination/combinationActivity.ts | 1 + .../mobile/PromotionCombination/index.vue | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/mall/promotion/combination/combinationActivity.ts b/src/api/mall/promotion/combination/combinationActivity.ts index 87053085..64002672 100644 --- a/src/api/mall/promotion/combination/combinationActivity.ts +++ b/src/api/mall/promotion/combination/combinationActivity.ts @@ -16,6 +16,7 @@ export interface CombinationActivityVO { virtualGroup?: number status?: number limitDuration?: number + combinationPrice?: number products: CombinationProductVO[] } diff --git a/src/components/DiyEditor/components/mobile/PromotionCombination/index.vue b/src/components/DiyEditor/components/mobile/PromotionCombination/index.vue index efe18902..d41bf1c1 100644 --- a/src/components/DiyEditor/components/mobile/PromotionCombination/index.vue +++ b/src/components/DiyEditor/components/mobile/PromotionCombination/index.vue @@ -152,13 +152,12 @@ watch( // 更新 SPU 的最低价格 combinationActivityList.value.forEach((activity) => { - activity.products.forEach((product) => { - const spu = spuList.value.find((spu) => spu.id === product.spuId) - if (spu) { - // 哪个最便宜就赋值哪个 - spu.price = Math.min(product.combinationPrice || Infinity, spu.price || Infinity) - } - }) + // 匹配spuId + const spu = spuList.value.find((spu) => spu.id === activity.spuId) + if (spu) { + // 赋值活动价格,哪个最便宜就赋值哪个 + spu.price = Math.min(activity.combinationPrice || Infinity, spu.price || Infinity) + } }) } } catch (error) {