From 154a706af4365c4fec38e6b2b7e351487005017f Mon Sep 17 00:00:00 2001 From: puhui999 Date: Wed, 14 Aug 2024 11:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E6=8B=BC=E5=9B=A2=EF=BC=9A=E5=85=B6=E5=AE=83=E7=94=A8?= =?UTF-8?q?=E6=88=B7=EF=BC=8C=E6=89=93=E5=BC=80=E5=9B=A2=E9=95=BF=E7=9A=84?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/activity/groupon/detail.vue | 48 +++++++++++++++++++------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/pages/activity/groupon/detail.vue b/pages/activity/groupon/detail.vue index 54388bdd..66976f3c 100644 --- a/pages/activity/groupon/detail.vue +++ b/pages/activity/groupon/detail.vue @@ -181,11 +181,11 @@ - - + + + @@ -207,21 +208,24 @@ import { showShareModal } from '@/sheep/hooks/useModal'; import { isEmpty } from 'lodash-es'; import CombinationApi from '@/sheep/api/promotion/combination'; + import SpuApi from '@/sheep/api/product/spu'; const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png'); const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; const state = reactive({ data: {}, // 拼团详情 - loading: true, - grouponAction: 'create', - showSelectSku: false, - grouponNum: 0, - number: 0, - activity: {}, + goodsId: 0, // 商品ID + goodsInfo: {}, // 商品信息 + showSelectSku: false, // 显示规格弹框 + selectedSkuPrice: {}, // 选中的规格价格 + activity: {}, // 团购活动 + grouponId: 0, // 团购ID + grouponNum: 0, // 团购人数 + grouponAction: 'create', // 团购操作 combinationHeadId: null, // 拼团团长编号 + loading: true, }); - // todo 芋艿:分享要再接下 const shareInfo = computed(() => { if (isEmpty(state.data)) return {}; return sheep.$platform.share.getShareInfo( @@ -250,33 +254,33 @@ }); } - // 去开团 TODO 芋艿:这里没接入 + // 去开团 function onCreateGroupon() { state.grouponAction = 'create'; state.grouponId = 0; state.showSelectSku = true; } - // 规格变更 TODO 芋艿:这里没接入 + // 规格变更 function onSkuChange(e) { state.selectedSkuPrice = e; } - // 立即参团 TODO 芋艿:这里没接入 + // 立即参团 function onJoinGroupon() { state.grouponAction = 'join'; - state.grouponId = state.data.activityId; - state.combinationHeadId = state.data.id; - state.grouponNum = state.data.num; + state.grouponId = state.data.headRecord.activityId; + state.combinationHeadId = state.data.headRecord.id; + state.grouponNum = state.data.headRecord.userSize; state.showSelectSku = true; } - // 立即购买 TODO 芋艿:这里没接入 + // 立即购买 function onBuy(sku) { sheep.$router.go('/pages/order/confirm', { data: JSON.stringify({ order_type: 'goods', - combinationActivityId: state.data.activity.id, + combinationActivityId: state.activity.id, combinationHeadId: state.combinationHeadId, items: [ { @@ -305,6 +309,14 @@ data.headRecord.activityId, ); state.activity = activity; + state.grouponNum = activity.userSize; + // 加载商品信息 + const { data: spu } = await SpuApi.getSpuDetail(activity.spuId); + state.goodsId = spu.id; + activity.products.forEach((product) => { + spu.price = Math.min(spu.price, product.combinationPrice); // 设置 SPU 的最低价格 + }); + state.goodsInfo = spu; } else { state.data = null; }