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)
+9 -5
View File
@@ -130,7 +130,7 @@
<text class="v12-dark-text v12-font-24" >{{ couponList.usable.length === 0 ? '无' : '去选择' }}</text>
<text class="iconfont icon-jiantou v12-font-24 v12-dark-text"></text>
</view> -->
<view class="v12-secondary-dark-text v12-align-center" @click="changeCoupons">
<view class="v12-secondary-dark-text v12-align-center" @click="showCouponsPopup">
<text class="v12-font-22 ">-</text>
<text class="v12-font-28">{{ force2Decimal(orderPrice.couponPrice) }}</text>
<text class="iconfont icon-jiantou v12-font-24 v12-dark-text"></text>
@@ -255,20 +255,21 @@
</view>
<!-- v9 优惠券开始 -->
<u-popup
v-if="show"
:show="show"
:round="10"
mode="bottom"
close-on-click-overlay
@close="changeCoupons"
@close="close"
>
<CouponsPopup
v-if="couponList.usable.length > 0"
v-if="couponList.usable.length > 0 && show"
:two-list="couponList"
@change="changeCoupons"
@close="close"
:currentPrice="force2Decimal(orderPrice.totalPrice)"
:id="couponId"
@max="couponMax"
:couponId1="couponId"
:show-tab="false"
/>
</u-popup>
@@ -473,7 +474,7 @@ export default {
postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId || 0,
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId,
usePoints: this.usePointsCheck ? 1 : 0,
shipping_type: parseInt(this.shipping_type) + 1
}).then(res => {
@@ -800,6 +801,9 @@ export default {
close() {
this.show = !this.show
},
showCouponsPopup() {
this.show = !this.show
},
// v9-2
changeCoupons(item) {
if(!item) return
+3 -2
View File
@@ -192,15 +192,16 @@
:round="10"
mode="bottom"
close-on-click-overlay
@close="changeCoupons"
@close="close"
>
<CouponsPopup
v-if="couponList.usable && couponList.usable.length > 0"
v-if="couponList.usable && couponList.usable.length > 0 && showPopup"
:two-list="couponList"
@change="changeCoupons"
:currentPrice="computedResult.canUseCouponPrice"
@close="close"
:id="couponId"
:couponId1="couponId"
:show-tab="false"
/>
</u-popup>