diff --git a/pages/goods/groupon.vue b/pages/goods/groupon.vue index 354d6ed9..3f464ed9 100644 --- a/pages/goods/groupon.vue +++ b/pages/goods/groupon.vue @@ -199,6 +199,7 @@ /** * 去参团 + * * @param record 团长的团购记录 */ function onJoinGroupon(record) { @@ -227,7 +228,6 @@ } // 分享信息 - // TODO @芋艿:分享的接入 const shareInfo = computed(() => { if (isEmpty(state.activity)) return {}; return sheep.$platform.share.getShareInfo( @@ -262,9 +262,21 @@ // 加载商品信息 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 的最低价格 }); + // 价格、库存使用活动的 + spu.skus.forEach((sku) => { + const product = activity.products.find((product) => product.skuId === sku.id); + if (product) { + sku.price = product.combinationPrice; + } else { + // 找不到可能是没配置,则不能发起秒杀 + sku.stock = 0; + } + }); + // 关闭骨架屏 state.skeletonLoading = false; if (code === 0) { diff --git a/pages/goods/index.vue b/pages/goods/index.vue index bf0b0cb9..dc3f73aa 100644 --- a/pages/goods/index.vue +++ b/pages/goods/index.vue @@ -157,7 +157,7 @@ items: [{ skuId: e.id, count: e.goods_num, - categoryId: state.goodsInfo.categoryId + categoryId: state.goodsInfo.categoryId }] }), }); diff --git a/pages/goods/seckill.vue b/pages/goods/seckill.vue index 6ae46d6e..34708d62 100644 --- a/pages/goods/seckill.vue +++ b/pages/goods/seckill.vue @@ -196,7 +196,7 @@ }); } - // 分享信息 TODO 芋艿:待接入 + // 分享信息 const shareInfo = computed(() => { if (isEmpty(unref(activity))) return {}; return sheep.$platform.share.getShareInfo( @@ -220,6 +220,7 @@ const activity = ref(); const timeStatusEnum = ref(''); + // 查询活动 const getActivity = async (id) => { const { data } = await SeckillApi.getSeckillActivity(id); @@ -230,9 +231,9 @@ await getSpu(data.spuId); }; + // 查询商品 const getSpu = async (id) => { const { data } = await SpuApi.getSpuDetail(id); - // 模拟 data.activity_type = 'seckill'; state.goodsInfo = data; // 处理轮播图 diff --git a/pages/index/category.vue b/pages/index/category.vue index cb87b0b5..4c88f388 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -131,12 +131,13 @@ getGoodsList(); } - onLoad(async () => { + onLoad(async (params) => { await getList(); - // 如果是 first 风格,需要加载商品分页 - if (state.style === 'first_one' || state.style === 'first_two') { - onMenu(0); - } + + // 首页点击分类的处理:查找满足条件的分类 + const foundCategory = state.categoryList.find(category => category.id === params.id); + // 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类 + onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0); }); onReachBottom(() => { diff --git a/sheep/components/s-block-item/s-block-item.vue b/sheep/components/s-block-item/s-block-item.vue index 9cd60073..5e65b36b 100644 --- a/sheep/components/s-block-item/s-block-item.vue +++ b/sheep/components/s-block-item/s-block-item.vue @@ -9,7 +9,7 @@ - + @@ -47,13 +47,13 @@ - + - + - + - + diff --git a/sheep/components/s-coupon-card/s-coupon-card.vue b/sheep/components/s-coupon-card/s-coupon-card.vue index bd5705bb..dac69e31 100644 --- a/sheep/components/s-coupon-card/s-coupon-card.vue +++ b/sheep/components/s-coupon-card/s-coupon-card.vue @@ -1,6 +1,6 @@