Fix:4127 【商城小程序】订单结算页面的优惠详情弹窗—勾选其他优惠券后点击【×】关闭按钮,再次打开弹窗会显示勾选新选择的优惠券

This commit is contained in:
linxi
2025-08-05 16:47:21 +08:00
parent a2250ccc9a
commit a9a7a46807
3 changed files with 32 additions and 13 deletions
+20 -6
View File
@@ -142,6 +142,10 @@ export default {
id: {
type: Number,
default: 0
},
couponId1: {
type: Number,
default: 0
}
},
data() {
@@ -155,10 +159,11 @@ export default {
}
},
watch: {
id: {
couponId1: {
immediate: true,
handler(value) {
console.log('couponId', value);
console.log(value);
if(value) {
this.selectCoupon(value)
}
@@ -169,7 +174,7 @@ export default {
list() {
const temp = this.current === 0 ? this.twoList['usable'] : this.twoList['unusable']
if (this.current === 0) {
const localCouponId = uni.getStorageSync('couponId') || 0
const localCouponId = this.couponId1 || 0
temp.map(item => {
item.checked = localCouponId === item.id
})
@@ -193,8 +198,8 @@ export default {
},
largOne() {
if(this.list[this.maxIndex]) {
this.selectCoupon(this.list[this.maxIndex].id)
uni.setStorageSync('couponId', this.list[this.maxIndex].id)
// this.selectCoupon(this.list[this.maxIndex].id)
// uni.setStorageSync('couponId', this.list[this.maxIndex].id)
}
// this.$emit('max', this.list[this.maxIndex] || {})
return this.list[this.maxIndex] || {}
@@ -206,7 +211,17 @@ export default {
},
methods: {
close() {
this.couponId = this.couponId1
this.selectItem = this.list.find(e => e.id === this.couponId1) || {}
// this.$emit('select', this.selectItem)
this.list.map(item => {
item.checked = this.couponId1 === item.id
})
this.$emit('close')
// uni.setStorageSync('couponId', this.couponId)
// this.$emit('change', this.selectItem || {})
// this.$emit('ok', this.couponId)
},
force2Decimal(value) {
return this.$force2Decimal(value);
@@ -224,7 +239,6 @@ export default {
},
setCoupon() {
if (this.current === 1) return
console.log(this.current, '====1=======');
uni.setStorageSync('couponId', this.couponId)
this.$emit('change', this.selectItem || {})
this.$emit('ok', this.couponId)