-
+
-
- {{ 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 @@
+