Fix(商品/订单):[#1021]商品详情页购买时选择优惠券,点击“立即购买”后已显示扣除优惠金额,但点开提交订单页面的优惠券时,优惠券未勾选

This commit is contained in:
lifizer
2024-03-29 23:23:39 +08:00
parent 6eedbfd240
commit 78f1c7b3b6
4 changed files with 122 additions and 76 deletions
+47 -27
View File
@@ -185,8 +185,18 @@
</view>
<!-- v9 优惠券开始 -->
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons">
<CouponsPopup :two-list="couponList" @close="changeCoupons" v-if="couponList.usable"/>
<u-popup
:show="show"
:round="10"
mode="bottom"
close-on-click-overlay
@close="changeCoupons"
>
<CouponsPopup
v-if="couponList.usable.length > 0"
:two-list="couponList"
@change="changeCoupons"
/>
</u-popup>
<!-- v9 优惠券结束 -->
@@ -272,8 +282,11 @@ export default {
lotteryRecordId:'',
payPassword: null,
// v9-2
couponList: {},
couponId: 0,
couponList: {
unusable: [],
usable: []
},
couponId: uni.getStorageSync('couponId') || 0,
couponIndex: -1,
show: false
};
@@ -354,35 +367,42 @@ export default {
});
},
getCartInfo() {
var that = this;
// const cartIds = this.$yroute.query.id;
if (!that.cartid && !that.lotteryRecordId) {
const _this = this
if (!_this.cartid && !_this.lotteryRecordId) {
uni.showToast({
title: "参数有误",
icon: "none",
duration: 2000
});
return this.$yrouter.back();
})
return this.$yrouter.back()
}
postOrderConfirm(that.cartid,that.lotteryRecordId)
.then(res => {
that.offlinePayStatus = res.data.offline_pay_status;
that.orderGroupInfo = res.data;
that.deduction = res.data.deduction;
that.couponList = res.data.couponList
that.addressInfo = res.data.addressInfo || {};
that.systemStore = res.data.systemStore || {};
that.storeSelfMention = res.data.storeSelfMention;
that.couponId = uni.getStorageSync('couponId') || 0
that.computedPrice()
postOrderConfirm(_this.cartid,_this.lotteryRecordId).then(res => {
const { data } = res
_this.offlinePayStatus = data.offline_pay_status
_this.orderGroupInfo = data
_this.deduction = data.deduction
_this.couponList = data.couponList
if (_this.couponId > 0) {
_this.couponList['usable'].map((item, index) => {
if (item.id === _this.couponId) {
item.checked = true
_this.couponIndex = index
} else {
item.checked = false
}
})
.catch(err => {
uni.showToast({
title: err.msg,
icon: "none",
duration: 2000
});
});
}
_this.addressInfo = data.addressInfo || {}
_this.systemStore = data.systemStore || {}
_this.storeSelfMention = data.storeSelfMention
_this.computedPrice()
}).catch(err => {
uni.showToast({
title: err.msg,
icon: "none",
duration: 2000
})
})
},
addressTap: function () {
//改用跳转页面方式
+1 -1
View File
@@ -202,7 +202,7 @@
<!-- v9 优惠券开始 -->
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
<CouponsPopup :two-list="couponList" @close="changeCoupons"/>
<CouponsPopup :two-list="couponList" @change="changeCoupons"/>
</u-popup>
<!-- v9 优惠券结束 -->