diff --git a/.gitignore b/.gitignore index 0402c0df..c2c17003 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ deploy.sh /.vscode/ **/.DS_Store .env -yarn.lock \ No newline at end of file +yarn.lock +package-lock.json \ No newline at end of file diff --git a/package.json b/package.json index 4548e926..55d4d579 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "@hyoga/uni-socket.io": "^1.0.1", "dayjs": "^1.11.6", "lodash": "^4.17.21", + "luch-request": "^3.0.8", "pinia": "^2.0.24", "pinia-plugin-persist-uni": "^1.2.0", "qs-canvas": "^1.0.11", diff --git a/pages/activity/groupon/detail.vue b/pages/activity/groupon/detail.vue index 2bcc52bf..7c90c0c1 100644 --- a/pages/activity/groupon/detail.vue +++ b/pages/activity/groupon/detail.vue @@ -186,7 +186,7 @@ :show="state.showSelectSku" :goodsInfo="state.data.goods" :grouponAction="state.grouponAction" - v-model:grouponNum="state.grouponNum" + :grouponNum="state.grouponNum" @buy="onBuy" @change="onSkuChange" @close="state.showSelectSku = false" diff --git a/pages/goods/groupon.vue b/pages/goods/groupon.vue index efe84a9b..041f7362 100644 --- a/pages/goods/groupon.vue +++ b/pages/goods/groupon.vue @@ -116,8 +116,9 @@ :show="state.showSelectSku" :goodsInfo="state.goodsInfo" :grouponAction="state.grouponAction" - v-model:grouponNum="state.grouponNum" + :grouponNum="state.defaultGrouponNum" @buy="onBuy" + @ladder="onLadder" @change="onSkuChange" @close="onSkuClose" /> @@ -190,16 +191,17 @@ onPageScroll(() => {}); const state = reactive({ - skeletonLoading: true, - goodsId: 0, - goodsInfo: {}, - goodsSwiper: [], - showSelectSku: false, - selectedSkuPrice: {}, - grouponId: 0, - grouponType: '', - grouponNum: 0, - grouponAction: 'create', + skeletonLoading: true, // 骨架屏 + goodsId: 0, // 商品ID + goodsInfo: {}, // 商品信息 + goodsSwiper: [], // 商品轮播图 + showSelectSku: false, // 显示规格弹框 + selectedSkuPrice: {}, // 选中的规格价格 + grouponId: 0, // 团购ID + grouponType: '', // 团购类型 + defaultGrouponNum: 0, // 默认团购人数 + grouponNum: 0, // 团购人数 + grouponAction: 'create', // 团购操作 }); // 商品主价格 @@ -226,6 +228,11 @@ state.selectedSkuPrice = e; } + // 阶梯变更 + function onLadder(e) { + state.grouponNum = e + } + function onSkuClose() { state.showSelectSku = false; } @@ -241,6 +248,7 @@ function onJoinGroupon(groupon) { state.grouponAction = 'join'; state.grouponId = groupon.id; + state.defaultGrouponNum = groupon.num; state.grouponNum = groupon.num; state.showSelectSku = true; } @@ -303,6 +311,7 @@ state.goodsInfo = data; state.grouponType = state.goodsInfo.activity_type; if (state.grouponType === 'groupon') { + state.defaultGrouponNum = state.goodsInfo.activity.rules.team_num; state.grouponNum = state.goodsInfo.activity.rules.team_num; } state.goodsSwiper = formatGoodsSwiper(state.goodsInfo.images); diff --git a/sheep/components/s-select-groupon-sku/s-select-groupon-sku.vue b/sheep/components/s-select-groupon-sku/s-select-groupon-sku.vue index 01d8c173..fb202a4e 100644 --- a/sheep/components/s-select-groupon-sku/s-select-groupon-sku.vue +++ b/sheep/components/s-select-groupon-sku/s-select-groupon-sku.vue @@ -1,5 +1,5 @@