商品详情:接入优惠劵 API

pull/26/head^2
YunaiV 2023-12-10 19:08:43 +08:00
parent 0e189711a8
commit 6326cf80c5
2 changed files with 31 additions and 26 deletions

View File

@ -87,8 +87,12 @@
<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
</view>
</detail-tabbar>
<!-- 优惠劵弹窗 -->
<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false"
@get="onGet" />
<!-- TODO 芋艿待接入 -->
<s-activity-pop v-model="state.activityInfo" :show="state.showActivityModel"
@close="state.showActivityModel = false" />
</block>
@ -100,6 +104,7 @@
import { reactive, computed } from 'vue';
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import CouponApi from '@/sheep/api/promotion/coupon';
import { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
import detailNavbar from './components/detail/detail-navbar.vue';
import detailCellSku from './components/detail/detail-cell-sku.vue';
@ -114,9 +119,6 @@
isEmpty
} from 'lodash';
// import detailActivityTip from './components/detail/detail-activity-tip.vue';
// import detailTab from './components/detail/detail-tab.vue';
// import detailCoupon from './components/detail/detail-coupon.vue';
onPageScroll(() => {});
const state = reactive({
@ -125,8 +127,8 @@
goodsInfo: {}, // SPU
showSelectSku: false, // SKU
selectedSku: {}, // SKU
showModel: false,
couponInfo: [],
showModel: false, // Coupon
couponInfo: [], // Coupon
showActivityModel: false,
activityInfo: [],
});
@ -161,7 +163,7 @@
state.showActivityModel = true;
}
// TODO
// TODO
async function onGet(id) {
const {
error,
@ -215,19 +217,14 @@
state.skeletonLoading = false;
state.goodsInfo = res.data;
});
// TODO
if (true) {
return
}
// 2.
const {
error,
data
} = await sheep.$api.coupon.listByGoods(state.goodsId);
if (error === 0) {
state.couponInfo = data;
}
CouponApi.getCouponTemplateList(state.goodsId,2, 10).then((res) => {
if (res.code !== 0) {
return;
}
state.couponInfo = res.data;
});
});
</script>

View File

@ -1,12 +1,20 @@
import request from '@/sheep/request';
export default {
// 获得优惠劵模板列表
getCouponTemplateListByIds: (ids) => {
return request({
url: '/app-api/promotion/coupon-template/list-by-ids',
method: 'GET',
params: { ids }
});
}
}
// 获得优惠劵模板列表
getCouponTemplateListByIds: (ids) => {
return request({
url: '/app-api/promotion/coupon-template/list-by-ids',
method: 'GET',
params: { ids },
});
},
// 获得优惠劵模版列表
getCouponTemplateList: (spuId, productScope, count) => {
return request({
url: '/app-api/promotion/coupon-template/list',
method: 'GET',
params: { spuId, productScope, count },
});
},
};