From b093f99ab5ac9f308c561c64aec6bc20092e488c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E8=B6=8A?= <552369664@qq.com> Date: Fri, 9 Aug 2024 20:16:56 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E4=BB=8E=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E7=82=B9=E5=87=BB=E6=9F=90=E4=B8=AA=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E5=88=86=E7=B1=BB=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E8=87=AA=E5=8A=A8=E9=80=89=E4=B8=AD=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E7=BA=A7=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/category.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pages/index/category.vue b/pages/index/category.vue index cb87b0b..619220b 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -131,8 +131,16 @@ getGoodsList(); } - onLoad(async () => { + onLoad(async (params) => { await getList(); + // 从主页点进来的时候自动选中左侧一级菜单 + const cateList = state.categoryList + for (let index = 0; index < cateList.length;index++) { + if (cateList[index].id == params.id) { + state.activeMenu = index + break; + } + } // 如果是 first 风格,需要加载商品分页 if (state.style === 'first_one' || state.style === 'first_two') { onMenu(0); From fd83bcf02a3bf60e0a2441450060016e18a5d2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E8=B6=8A?= <552369664@qq.com> Date: Fri, 9 Aug 2024 21:26:29 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E6=97=B6=E5=80=99=E8=87=AA=E5=8A=A8=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E5=B7=A6=E4=BE=A7=E4=B8=80=E7=BA=A7=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/category.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/index/category.vue b/pages/index/category.vue index 619220b..52e46aa 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -135,9 +135,9 @@ await getList(); // 从主页点进来的时候自动选中左侧一级菜单 const cateList = state.categoryList - for (let index = 0; index < cateList.length;index++) { + for (let index = 0; index < cateList.length; index++) { if (cateList[index].id == params.id) { - state.activeMenu = index + onMenu(index); break; } } From cc9f31f8c39e6c29bc3b416e67d8c92722e65793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E8=B6=8A?= <552369664@qq.com> Date: Fri, 9 Aug 2024 22:06:35 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E6=97=B6=E5=80=99=E8=87=AA=E5=8A=A8=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E5=B7=A6=E4=BE=A7=E4=B8=80=E7=BA=A7=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/category.vue | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pages/index/category.vue b/pages/index/category.vue index 52e46aa..b4ab3b0 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -133,14 +133,12 @@ onLoad(async (params) => { await getList(); - // 从主页点进来的时候自动选中左侧一级菜单 - const cateList = state.categoryList - for (let index = 0; index < cateList.length; index++) { - if (cateList[index].id == params.id) { - onMenu(index); - break; - } - } + + // 首页点击分类的处理:查找满足条件的分类 + const foundCategory = state.categoryList.find(category => category.id == params.id); + // 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类 + onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0); + // 如果是 first 风格,需要加载商品分页 if (state.style === 'first_one' || state.style === 'first_two') { onMenu(0); From 51ba185e8111cae754e3eb8e87c8235cdad386f6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 10 Aug 2024 10:25:51 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E8=BF=9B=E5=85=A5=E5=88=86=E7=B1=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E5=B7=A6=E4=BE=A7=E4=B8=80=E7=BA=A7=E5=88=86=E7=B1=BB?= =?UTF-8?q?=EF=BC=88=E6=AF=94=E5=A6=82=E4=BB=8E=E9=A6=96=E9=A1=B5=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/index.vue | 2 +- pages/goods/seckill.vue | 2 +- pages/index/category.vue | 15 +++++---------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/pages/goods/index.vue b/pages/goods/index.vue index bf0b0cb..dc3f73a 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 6ae46d6..30a6430 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( diff --git a/pages/index/category.vue b/pages/index/category.vue index b4ab3b0..4c88f38 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -133,16 +133,11 @@ onLoad(async (params) => { await getList(); - - // 首页点击分类的处理:查找满足条件的分类 - const foundCategory = state.categoryList.find(category => category.id == params.id); - // 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类 - onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0); - - // 如果是 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(() => { From 5feab41b3df75397619ead3635fa04bac3093197 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 10 Aug 2024 11:36:02 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=91=E6=8B=BC=E5=9B=A2=EF=BC=9A=E6=9C=AA=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E6=8B=BC=E5=9B=A2=E7=9A=84=20SKU=20=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/groupon.vue | 14 +++++++++++++- pages/goods/seckill.vue | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pages/goods/groupon.vue b/pages/goods/groupon.vue index 354d6ed..3f464ed 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/seckill.vue b/pages/goods/seckill.vue index 30a6430..34708d6 100644 --- a/pages/goods/seckill.vue +++ b/pages/goods/seckill.vue @@ -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; // 处理轮播图 From 19d3cb33e2d3f78b2399c87b4032eaa650acfd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E8=B6=8A?= <552369664@qq.com> Date: Sun, 11 Aug 2024 14:03:20 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E3=80=91=E4=BF=AE=E5=A4=8D=E8=A3=85=E4=BF=AE=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8D=A1=E7=89=87=E4=BD=BF=E7=94=A8=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=97=A0=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/s-block-item/s-block-item.vue | 2 +- sheep/components/s-user-card/s-user-card.vue | 28 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/sheep/components/s-block-item/s-block-item.vue b/sheep/components/s-block-item/s-block-item.vue index 9cd6007..ee1ff8d 100644 --- a/sheep/components/s-block-item/s-block-item.vue +++ b/sheep/components/s-block-item/s-block-item.vue @@ -47,7 +47,7 @@ - + diff --git a/sheep/components/s-user-card/s-user-card.vue b/sheep/components/s-user-card/s-user-card.vue index d234098..2d32745 100644 --- a/sheep/components/s-user-card/s-user-card.vue +++ b/sheep/components/s-user-card/s-user-card.vue @@ -1,6 +1,6 @@