From 50363edc6e4585492cc4a38c5f35dc40bbd1674f Mon Sep 17 00:00:00 2001 From: linxi <957440651@qq.com> Date: Tue, 21 Jul 2026 17:09:35 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A5498=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=E5=B0=86=E6=8A=BD=E5=A5=96?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=8A=A0=E5=85=A5=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=EF=BC=8C=E4=BB=8E=E8=B4=AD=E7=89=A9=E8=BD=A6=E8=BF=9B=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E3=80=90=E9=80=81=E7=BB=99=E6=9C=8B=E5=8F=8B=E3=80=91=E4=BB=8D?= =?UTF-8?q?=E5=8F=AF=E4=BD=BF=E7=94=A8=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=8D=E5=8F=AF=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/shop/GoodsCon/index.vue | 21 ++++++++++++++---- pkg_user/views/gift/gift.vue | 40 +++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/pages/shop/GoodsCon/index.vue b/pages/shop/GoodsCon/index.vue index e2142d0..b2bd15f 100644 --- a/pages/shop/GoodsCon/index.vue +++ b/pages/shop/GoodsCon/index.vue @@ -732,6 +732,7 @@ export default { console.log("getLaunchOptionsSync", uni.getLaunchOptionsSync()) console.log("getEnterOptionsSync", uni.getEnterOptionsSync()) uni.removeStorageSync('couponId') + const pageQuery = Object.assign({}, this.resolvePageQuery(), options || {}) const from = options.from const id = options.id switch (from) { @@ -779,10 +780,10 @@ export default { if (url && url.productId) { this.id = url.productId } else if (options.id) { - this.id = options.id || null - this.partnerId = options.partnerId || null - this.activityId = this._route.query.activityId - this.source = this._route.query.from || '' + this.id = pageQuery.id || options.id || null + this.partnerId = pageQuery.partnerId || options.partnerId || null + this.activityId = Number(pageQuery.activityId || pageQuery.drawActivityId || 0) + this.source = pageQuery.from || '' } else { const obj = uni.getEnterOptionsSync() if (options.scene != null || obj.query.scene != null) { @@ -847,6 +848,18 @@ export default { } }, methods: { + resolvePageQuery() { + if (this.$yroute && this.$yroute.query) { + return this.$yroute.query + } + if (this.$route && this.$route.query) { + return this.$route.query + } + if (this._route && this._route.query) { + return this._route.query + } + return {} + }, gift() { this.goCat(2) }, diff --git a/pkg_user/views/gift/gift.vue b/pkg_user/views/gift/gift.vue index 04568d3..dd26b6a 100644 --- a/pkg_user/views/gift/gift.vue +++ b/pkg_user/views/gift/gift.vue @@ -299,11 +299,12 @@ export default { } }, onLoad(opts) { - this.cartId = opts.cartId - this.isGroupBuy = opts.isGroupBuy === '1' - this.isCountyLotteryGift = opts.from === 'countyLottery' || opts.isCountyLotteryGift === '1' || !!opts.drawActivityId + const pageQuery = Object.assign({}, this.resolvePageQuery(), opts || {}) + this.cartId = pageQuery.cartId + this.isGroupBuy = pageQuery.isGroupBuy === '1' + this.isCountyLotteryGift = pageQuery.from === 'countyLottery' || pageQuery.isCountyLotteryGift === '1' || !!pageQuery.drawActivityId // this.couponId = opts.couponId || 0 - this.discount = opts.discount + this.discount = pageQuery.discount if(this.isGroupBuy) { this.getGroupBuyInfo() } else { @@ -332,10 +333,39 @@ export default { } }, methods: { + resolvePageQuery() { + if (this.$yroute && this.$yroute.query) { + return this.$yroute.query + } + if (this.$route && this.$route.query) { + return this.$route.query + } + if (this._route && this._route.query) { + return this._route.query + } + return {} + }, getCouponId() { if (this.isCountyLotteryGift) return 0 return this.couponId || 0 }, + isCountyLotteryCartItem(item) { + return Number( + (item && item.drawActivityId) || + (item && item.productInfo && item.productInfo.drawActivityId) || + 0 + ) > 0 + }, + syncCountyLotteryGiftFlag(item) { + if (!this.isCountyLotteryGift && this.isCountyLotteryCartItem(item)) { + this.isCountyLotteryGift = true + } + if (!this.isCountyLotteryGift) return + this.couponTitle = '' + if (Number(this.couponId || 0) !== 0) { + this.couponId = 0 + } + }, adjustCoverListForProductStory(coverList, productInfo, defaultTemplate) { if (!productInfo || !productInfo.productStory) { return { @@ -436,6 +466,7 @@ export default { this.giftNotice = res.data.giftCardGiftNotice this.orderKey = res.data.orderKey this.goodsInfo = goodsInfo + this.syncCountyLotteryGiftFlag(goodsInfo) this.templateId = template.id this.defaultIndex = this.coverList.findIndex(item => item.id === this.templateId) console.log(this.defaultIndex, 'defaultIndex'); @@ -522,6 +553,7 @@ export default { this.giftNotice = res.data.giftCardGiftNotice this.orderKey = res.data.orderKey this.goodsInfo = goodsInfo + this.syncCountyLotteryGiftFlag(goodsInfo) this.templateId = template.id this.selectedCover = template.cover this.giftImage = template.image