Fix:3982 【商城小程序】送礼页面优惠券改为选填模式

This commit is contained in:
linxi
2025-07-30 14:06:25 +08:00
parent 6df8cda11c
commit 615f7d9064
5 changed files with 130 additions and 33 deletions
+22 -5
View File
@@ -380,7 +380,7 @@ export default {
unusable: [],
usable: []
},
couponId: uni.getStorageSync('couponId') || 0,
couponId: null,
couponIndex: -1,
show: false,
// 是否使用积分开关
@@ -449,8 +449,8 @@ export default {
methods: {
isNullOrEmpty,
couponMax(e) {
this.couponTitle = e.couponTitle
this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0
// this.couponTitle = e.couponTitle
// this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0
},
showStoreList() {
this.$store.commit("get_to", "orders")
@@ -464,7 +464,11 @@ export default {
usePointsCheckChange(e) {
this.computedPrice()
},
// 计算订单金额
/**
* 计算订单金额
* @param {*} f 有值时 couponId不取默认值
*/
computedPrice(f) {
postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id,
@@ -473,6 +477,10 @@ export default {
usePoints: this.usePointsCheck ? 1 : 0,
shipping_type: parseInt(this.shipping_type) + 1
}).then(res => {
this.couponList = res.data.result.couponList
if(!f) {
this.couponId = res.data.result.defaultCouponId
}
const data = res.data;
if (data.status === "EXTEND_ORDER") {
this.$yrouter.replace({
@@ -797,8 +805,17 @@ export default {
if(!item) return
if (this.couponList.usable.length === 0) return
this.show = !this.show
this.couponId = uni.getStorageSync('couponId') || 0
if(!item.id) {
this.couponId = 0
this.couponTitle = ''
this.computedPrice(1)
return
}
this.couponId = item.id
this.couponTitle = item.couponTitle
this.computedPrice(1)
// this.couponId = uni.getStorageSync('couponId') || 0
// this.couponTitle = item.couponTitle
}
}
};