✨ 商品详情:优惠劵信息的接入
This commit is contained in:
+11
-8
@@ -209,18 +209,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 领取优惠劵
|
||||
async function getCoupon() {
|
||||
const { error, msg } = await sheep.$api.coupon.get(state.id);
|
||||
if (error === 0) {
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
});
|
||||
setTimeout(() => {
|
||||
getCouponContent(state.id, state.couponId);
|
||||
}, 1000);
|
||||
const { code } = await CouponApi.takeCoupon(state.id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: '领取成功',
|
||||
});
|
||||
setTimeout(() => {
|
||||
getCouponContent();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// 加载优惠劵信息
|
||||
async function getCouponContent() {
|
||||
const { code, data } = state.id > 0 ? await CouponApi.getCouponTemplate(state.id)
|
||||
: await CouponApi.getCoupon(state.couponId);
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
state.currentTab = e.index;
|
||||
state.type = e.value;
|
||||
resetPagination(state.pagination)
|
||||
if (state.currentTab == 0) {
|
||||
if (state.currentTab === 0) {
|
||||
getData();
|
||||
} else {
|
||||
getCoupon();
|
||||
|
||||
Reference in New Issue
Block a user