diff --git a/components/CouponsPopup.vue b/components/CouponsPopup.vue index 42463d8..6e42d75 100644 --- a/components/CouponsPopup.vue +++ b/components/CouponsPopup.vue @@ -4,7 +4,7 @@ 优惠详情 - + - + {{ couponList.usable.length === 0 ? '无' : '去选择' }} @@ -251,7 +251,9 @@ v-if="couponList.usable.length > 0" :two-list="couponList" @change="changeCoupons" + @close="close" :currentPrice="force2Decimal(orderPrice.totalPrice)" + :id="couponId" @max="couponMax" :show-tab="false" /> @@ -372,7 +374,8 @@ export default { maxPoints: 0, pageKeyId: Object.freeze('orderConfirm'), total: 0, - couponTitle: '' + couponTitle: '', + hasCoupon: false, }; }, computed: mapGetters(["userInfo", "storeItems"]), @@ -383,9 +386,9 @@ export default { shipping_type() { this.computedPrice('shipping_type'); }, - couponId() { - this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === this.couponId) - this.computedPrice('couponId') + async couponId(value) { + this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === value) + await this.computedPrice('couponId') } }, onLoad() { @@ -400,10 +403,11 @@ export default { if (that.$yroute.query.lotteryRecordId !== undefined) { that.lotteryRecordId = that.$yroute.query.lotteryRecordId } - that.getCartInfo() + that.hasCoupon = that.$yroute.query.couponId !== '' }, onShow() { const _this = this + _this.getCartInfo() //获取用户信息 _this.$store.dispatch("getUser", true) const chooseAddress = uni.getStorageSync('chooseAddress') || {} @@ -433,7 +437,7 @@ export default { isNullOrEmpty, couponMax(e) { this.couponTitle = e.couponTitle - this.couponId = uni.getStorageSync('couponId') || 0 + this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0 }, showStoreList() { this.$store.commit("get_to", "orders"); @@ -785,6 +789,9 @@ export default { that.$refs.payPwdPop.close();//关闭支付密码弹窗 }); }, + close() { + this.show = !this.show + }, // v9-2 changeCoupons(item) { if(!item) return diff --git a/pages/shop/GoodsCon/index.vue b/pages/shop/GoodsCon/index.vue index fdedb05..47227cb 100644 --- a/pages/shop/GoodsCon/index.vue +++ b/pages/shop/GoodsCon/index.vue @@ -57,7 +57,7 @@ 预计获得{{ attr.productSelect.earnPoints }}积分 @@ -183,7 +183,7 @@ - + @@ -618,7 +618,8 @@ export default { isFavorite: false, pageKeyId: '', couponListLimit2ToShow: [], - qualifications: [] + qualifications: [], + couponId: null } }, computed: mapGetters(['isLogin', 'location', 'userInfo']), @@ -1383,11 +1384,13 @@ export default { postCartAdd(q).then(function (res) { that.isOpen = false that.attr.cartAttr = false + console.log( that.couponId) if (news) { that.$yrouter.push({ path: "/pages/order/OrderSubmission/index", query: { - id: res.data.cartId + id: res.data.cartId, + couponId: that.couponId } }) } else { @@ -1438,9 +1441,12 @@ export default { this.posters = false }, // v9-2 - changeCoupons() { + changeCoupons(e) { this.show = !this.show }, + setCoupon(couponId) { + this.couponId = couponId + }, async checkFavorite() { const res = await checkProduct(this.id, this.uniqueId) if (res.success) this.isFavorite = res.data.hasFavorite