From a9a7a4680730666f74f7902399e528cc67a6958f Mon Sep 17 00:00:00 2001 From: linxi Date: Tue, 5 Aug 2025 16:47:21 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A4127=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E8=AE=A2=E5=8D=95=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E9=A1=B5=E9=9D=A2=E7=9A=84=E4=BC=98=E6=83=A0=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=BC=B9=E7=AA=97=E2=80=94=E5=8B=BE=E9=80=89=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E4=BC=98=E6=83=A0=E5=88=B8=E5=90=8E=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E3=80=90=C3=97=E3=80=91=E5=85=B3=E9=97=AD=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=89=93=E5=BC=80=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E4=BC=9A=E6=98=BE=E7=A4=BA=E5=8B=BE=E9=80=89=E6=96=B0=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9A=84=E4=BC=98=E6=83=A0=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CouponsPopup.vue | 26 ++++++++++++++++++++------ pages/order/OrderSubmission/index.vue | 14 +++++++++----- pkg_user/views/gift/gift.vue | 5 +++-- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/components/CouponsPopup.vue b/components/CouponsPopup.vue index e5ef8d9..1d3e1af 100644 --- a/components/CouponsPopup.vue +++ b/components/CouponsPopup.vue @@ -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) diff --git a/pages/order/OrderSubmission/index.vue b/pages/order/OrderSubmission/index.vue index b68e6df..f0db243 100644 --- a/pages/order/OrderSubmission/index.vue +++ b/pages/order/OrderSubmission/index.vue @@ -130,7 +130,7 @@ {{ couponList.usable.length === 0 ? '无' : '去选择' }} --> - + -¥ {{ force2Decimal(orderPrice.couponPrice) }} @@ -255,20 +255,21 @@ @@ -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 diff --git a/pkg_user/views/gift/gift.vue b/pkg_user/views/gift/gift.vue index 89312e6..0af4060 100644 --- a/pkg_user/views/gift/gift.vue +++ b/pkg_user/views/gift/gift.vue @@ -192,15 +192,16 @@ :round="10" mode="bottom" close-on-click-overlay - @close="changeCoupons" + @close="close" >