✨ 商品详情:满减送的活动接入
parent
74e6680880
commit
eb9138a668
|
@ -13,7 +13,7 @@
|
||||||
<view class="detail-swiper-selector">
|
<view class="detail-swiper-selector">
|
||||||
<!-- 商品轮播图 -->
|
<!-- 商品轮播图 -->
|
||||||
<su-swiper class="ss-m-b-14" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)"
|
<su-swiper class="ss-m-b-14" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)"
|
||||||
dotStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
|
otStyle="tag" imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
|
||||||
|
|
||||||
<!-- 价格+标题 -->
|
<!-- 价格+标题 -->
|
||||||
<view class="title-card detail-card ss-p-y-40 ss-p-x-20">
|
<view class="title-card detail-card ss-p-y-40 ss-p-x-20">
|
||||||
|
@ -31,12 +31,12 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="discounts-box ss-flex ss-row-between ss-m-b-28">
|
<view class="discounts-box ss-flex ss-row-between ss-m-b-28">
|
||||||
<!-- 满减送/限时折扣活动的提示 TODO 芋艿:promos 未写 -->
|
<!-- 满减送/限时折扣活动的提示 -->
|
||||||
<div class="tag-content">
|
<div class="tag-content">
|
||||||
<view class="tag-box ss-flex">
|
<view class="tag-box ss-flex">
|
||||||
<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos"
|
<view class="tag ss-m-r-10" v-for="promos in state.activityInfo"
|
||||||
:key="promos.id" @tap="onActivity">
|
:key="promos.id" @tap="onActivity">
|
||||||
{{ promos.title }}
|
{{ promos.name }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,6 +120,7 @@
|
||||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||||
import detailActivityTip from './components/detail/detail-activity-tip.vue';
|
import detailActivityTip from './components/detail/detail-activity-tip.vue';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
|
|
||||||
onPageScroll(() => {});
|
onPageScroll(() => {});
|
||||||
|
|
||||||
|
@ -141,7 +142,7 @@
|
||||||
state.selectedSku = e;
|
state.selectedSku = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加购物车 TODO 芋艿:待测试
|
// 添加购物车
|
||||||
function onAddCart(e) {
|
function onAddCart(e) {
|
||||||
if (!e.id) {
|
if (!e.id) {
|
||||||
sheep.$helper.toast('请选择商品规格');
|
sheep.$helper.toast('请选择商品规格');
|
||||||
|
@ -169,13 +170,12 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 营销活动 TODO 芋艿:待测试
|
// 营销活动
|
||||||
function onActivity() {
|
function onActivity() {
|
||||||
state.activityInfo = state.goodsInfo.promos;
|
|
||||||
state.showActivityModel = true;
|
state.showActivityModel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 立即领取 TODO 芋艿:待测试
|
// 立即领取
|
||||||
async function onGet(id) {
|
async function onGet(id) {
|
||||||
const { code } = await CouponApi.takeCoupon(id);
|
const { code } = await CouponApi.takeCoupon(id);
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
|
@ -225,7 +225,7 @@
|
||||||
}
|
}
|
||||||
state.goodsId = options.id;
|
state.goodsId = options.id;
|
||||||
// 1. 加载商品信息
|
// 1. 加载商品信息
|
||||||
sheep.$api.goods.detail(state.goodsId).then((res) => {
|
SpuApi.getSpuDetail(state.goodsId).then((res) => {
|
||||||
// 未找到商品
|
// 未找到商品
|
||||||
if (res.code !== 0 || !res.data) {
|
if (res.code !== 0 || !res.data) {
|
||||||
state.goodsInfo = null;
|
state.goodsInfo = null;
|
||||||
|
@ -252,7 +252,15 @@
|
||||||
if (res.code !== 0) {
|
if (res.code !== 0) {
|
||||||
return;
|
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('待实现!优先级不高');
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -49,17 +49,6 @@ export default {
|
||||||
showError: false,
|
showError: false,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
// 商品评价类型
|
|
||||||
getType: (id) =>
|
|
||||||
request({
|
|
||||||
url: 'goods/comment/getType/' + id,
|
|
||||||
method: 'GET',
|
|
||||||
custom: {
|
|
||||||
showLoading: false,
|
|
||||||
showError: false,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
// 活动商品查询
|
|
||||||
// 商品查询
|
// 商品查询
|
||||||
activity: (params = {}) =>
|
activity: (params = {}) =>
|
||||||
request({
|
request({
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- 商品信息:满减送等营销活动的弹窗 -->
|
||||||
<template>
|
<template>
|
||||||
<su-popup :show="show" type="bottom" round="20" @close="emits('close')" showClose>
|
<su-popup :show="show" type="bottom" round="20" @close="emits('close')" showClose>
|
||||||
<view class="model-box">
|
<view class="model-box">
|
||||||
|
@ -9,28 +10,20 @@
|
||||||
:enable-back-to-top="true"
|
:enable-back-to-top="true"
|
||||||
>
|
>
|
||||||
<view v-for="item in state.activityInfo" :key="item.id">
|
<view v-for="item in state.activityInfo" :key="item.id">
|
||||||
<!-- <uni-list :border="false">
|
|
||||||
<uni-list-item showArrow clickable @tap="sheep.$router.go('/pages/goods/list')">
|
|
||||||
<template v-slot:header>
|
|
||||||
<view class="model-content-tag ss-flex ss-row-center">{{ item.type_text }}</view>
|
|
||||||
</template>
|
|
||||||
<template v-slot:body>
|
|
||||||
<view class="ss-m-l-20 model-content-title">
|
|
||||||
<view class="ss-m-b-24" v-for="text in item.texts" :key="text">
|
|
||||||
{{ text }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</uni-list-item>
|
|
||||||
</uni-list> -->
|
|
||||||
<view class="ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(item)">
|
<view class="ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(item)">
|
||||||
<view class="model-content-tag ss-flex ss-row-center">{{ item.type_text }}</view>
|
<view class="model-content-tag ss-flex ss-row-center">满减</view>
|
||||||
|
<!-- TODO 芋艿:先简单做;未来再搞成满 xxx 减 yyy 元 -->
|
||||||
|
<!-- <view class="ss-m-l-20 model-content-title ss-flex-1">-->
|
||||||
|
<!-- <view class="ss-m-b-24" v-for="text in item.texts" :key="text">-->
|
||||||
|
<!-- {{ text }}-->
|
||||||
|
<!-- </view>-->
|
||||||
|
<!-- </view>-->
|
||||||
<view class="ss-m-l-20 model-content-title ss-flex-1">
|
<view class="ss-m-l-20 model-content-title ss-flex-1">
|
||||||
<view class="ss-m-b-24" v-for="text in item.texts" :key="text">
|
<view class="ss-m-b-24">
|
||||||
{{ text }}
|
{{ item.name }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text class="cicon-forward"></text>
|
<text class="cicon-forward" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
Loading…
Reference in New Issue