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" >