Fix:3358 【商城小程序】商详页优惠券弹窗—无法取消勾选优惠券

This commit is contained in:
linxi
2025-03-14 10:57:20 +08:00
parent 6b1dd27294
commit 26b6c14141
3 changed files with 11 additions and 3 deletions
+2 -1
View File
@@ -204,13 +204,14 @@ export default {
selectCoupon(id) { selectCoupon(id) {
this.couponId = id this.couponId = id
this.selectItem = this.list.find(e => e.id === id) || {} this.selectItem = this.list.find(e => e.id === id) || {}
this.$emit('max', this.selectItem) // this.$emit('select', this.selectItem)
this.list.map(item => { this.list.map(item => {
item.checked = id === item.id item.checked = id === item.id
}) })
}, },
setCoupon() { setCoupon() {
if (this.current === 1) return if (this.current === 1) return
console.log(this.current, '====1=======');
uni.setStorageSync('couponId', this.couponId) uni.setStorageSync('couponId', this.couponId)
this.$emit('change', this.selectItem || {}) this.$emit('change', this.selectItem || {})
this.$emit('ok', this.couponId) this.$emit('ok', this.couponId)
+2 -1
View File
@@ -388,7 +388,8 @@ export default {
this.computedPrice('shipping_type'); this.computedPrice('shipping_type');
}, },
async couponId(value) { async couponId(value) {
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === value) this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value)
this.couponTitle = this.couponList['usable']?.[this.couponIndex]?.couponTitle
await this.computedPrice('couponId') await this.computedPrice('couponId')
} }
}, },
+7 -1
View File
@@ -192,7 +192,13 @@
<!-- v9 优惠券开始 --> <!-- v9 优惠券开始 -->
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()"> <u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
<CouponsPopup :two-list="couponList" @ok="setCoupon" @change="changeCoupons" @close="changeCoupons()" :showTab="false" :currentPrice="storeInfo.price" /> <CouponsPopup
:two-list="couponList"
@ok="setCoupon"
@change="changeCoupons"
@close="changeCoupons()"
:showTab="false"
:currentPrice="storeInfo.price" />
</u-popup> </u-popup>
<!-- v9 优惠券结束 --> <!-- v9 优惠券结束 -->