From f19ac9ad42f218c5fb2059a16ff129928068e915 Mon Sep 17 00:00:00 2001 From: linxi Date: Wed, 15 Jan 2025 18:16:01 +0800 Subject: [PATCH] =?UTF-8?q?Task=EF=BC=9A=E8=AE=A2=E5=8D=95=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96/=20=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E8=AE=A2=E5=8D=95=E5=89=8D=EF=BC=8C=E8=8B=A5=E5=9C=A8?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=BA=86=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=8C=E5=88=99=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AF=A5=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CouponsPopup.vue | 18 +++++++++++++++++- pages/order/OrderSubmission/index.vue | 21 ++++++++++++++------- pages/shop/GoodsCon/index.vue | 16 +++++++++++----- 3 files changed, 42 insertions(+), 13 deletions(-) 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