From eb9138a66896e944c4b73cb98c38843f5daa9f4c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 6 Jan 2024 09:09:13 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=9A=E6=BB=A1=E5=87=8F=E9=80=81=E7=9A=84=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/index.vue | 36 +++++++++++-------- sheep/api/goods.js | 11 ------ .../s-activity-pop/s-activity-pop.vue | 29 ++++++--------- 3 files changed, 33 insertions(+), 43 deletions(-) diff --git a/pages/goods/index.vue b/pages/goods/index.vue index 6d783f33..7e436ce4 100644 --- a/pages/goods/index.vue +++ b/pages/goods/index.vue @@ -8,12 +8,12 @@ + actionText="再逛逛" actionUrl="/pages/goods/list" /> + otStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" /> @@ -31,12 +31,12 @@ - +
- - {{ promos.title }} + + {{ promos.name }}
@@ -55,12 +55,12 @@ + @tap="state.showSelectSku = true" /> + @buy="onBuy" @change="onSkuChange" @close="state.showSelectSku = false" />
@@ -120,6 +120,7 @@ import detailContentCard from './components/detail/detail-content-card.vue'; import detailActivityTip from './components/detail/detail-activity-tip.vue'; import { isEmpty } from 'lodash'; + import SpuApi from '@/sheep/api/product/spu'; onPageScroll(() => {}); @@ -141,7 +142,7 @@ state.selectedSku = e; } - // 添加购物车 TODO 芋艿:待测试 + // 添加购物车 function onAddCart(e) { if (!e.id) { sheep.$helper.toast('请选择商品规格'); @@ -169,13 +170,12 @@ }); } - // 营销活动 TODO 芋艿:待测试 + // 营销活动 function onActivity() { - state.activityInfo = state.goodsInfo.promos; state.showActivityModel = true; } - // 立即领取 TODO 芋艿:待测试 + // 立即领取 async function onGet(id) { const { code } = await CouponApi.takeCoupon(id); if (code !== 0) { @@ -225,7 +225,7 @@ } state.goodsId = options.id; // 1. 加载商品信息 - sheep.$api.goods.detail(state.goodsId).then((res) => { + SpuApi.getSpuDetail(state.goodsId).then((res) => { // 未找到商品 if (res.code !== 0 || !res.data) { state.goodsInfo = null; @@ -252,7 +252,15 @@ if (res.code !== 0) { return; } - state.activityList = res.data; + res.data.forEach(activity => { + if ([1, 2, 3].includes(activity.type)) { // 情况一:拼团/秒杀/砍价 + state.activityList.push(activity); + } else if (activity.type === 5) { // 情况二:满减送 + state.activityInfo.push(activity); + } else { // 情况三:限时折扣 TODO 芋艿 + console.log('待实现!优先级不高'); + } + }) }); }); diff --git a/sheep/api/goods.js b/sheep/api/goods.js index 61f422a6..1beb233c 100644 --- a/sheep/api/goods.js +++ b/sheep/api/goods.js @@ -49,17 +49,6 @@ export default { showError: false, }, }), - // 商品评价类型 - getType: (id) => - request({ - url: 'goods/comment/getType/' + id, - method: 'GET', - custom: { - showLoading: false, - showError: false, - }, - }), - // 活动商品查询 // 商品查询 activity: (params = {}) => request({ diff --git a/sheep/components/s-activity-pop/s-activity-pop.vue b/sheep/components/s-activity-pop/s-activity-pop.vue index 551053db..ee6024f4 100644 --- a/sheep/components/s-activity-pop/s-activity-pop.vue +++ b/sheep/components/s-activity-pop/s-activity-pop.vue @@ -1,3 +1,4 @@ +