Fix:抽奖送礼还能选择优惠券

This commit is contained in:
linxi
2026-07-07 09:56:07 +08:00
parent 27ac2a086d
commit 80078cae78
2 changed files with 49 additions and 15 deletions
+18 -8
View File
@@ -32,9 +32,9 @@
<image :src="webUrl+'/20210806121714655368.png'" mode="" style="width: 36rpx;height: 36rpx;"></image>
</view>
</view>
<view v-if="couponListLimit2ToShow.length > 0 || attr.productSelect.earnPoints" class="v12-mt-1 v12-mb-1">
<view v-if="(!isCountyLotteryGoodsDetail() && couponListLimit2ToShow.length > 0) || attr.productSelect.earnPoints" class="v12-mt-1 v12-mb-1">
<view class="cell flex jc-between ai-center">
<view v-if="couponListLimit2ToShow.length > 0" class="v12-justify-start">
<view v-if="!isCountyLotteryGoodsDetail() && couponListLimit2ToShow.length > 0" class="v12-justify-start">
<view
v-for="(item, index) in couponListLimit2ToShow"
:key="index"
@@ -48,7 +48,7 @@
</view>
<view
v-if="couponListLimit2ToShow.length > 0"
v-if="!isCountyLotteryGoodsDetail() && couponListLimit2ToShow.length > 0"
class="value value2 v12-font-24 v12-primary-text"
@click="changeCoupons()"
>
@@ -201,7 +201,7 @@
</view>
<!-- v9 优惠券开始 -->
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
<u-popup v-if="!isCountyLotteryGoodsDetail()" :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
<CouponsPopup
:two-list="couponList"
@ok="setCoupon"
@@ -1504,12 +1504,17 @@ export default {
that.isOpen = false
that.attr.cartAttr = false
if (news === 1) {
const orderQuery = {
id: res.data.cartId,
discount: that.storeInfo.discount,
}
if (that.source === 'countyLottery') {
orderQuery.from = 'countyLottery'
orderQuery.drawActivityId = Number(that.activityId || 0)
}
that.$yrouter.push({
path: "/pages/order/OrderSubmission/index",
query: {
id: res.data.cartId,
discount: that.storeInfo.discount,
}
query: orderQuery
})
return
}
@@ -1576,11 +1581,16 @@ export default {
listenerActionClose() {
this.posters = false
},
isCountyLotteryGoodsDetail() {
return this.source === 'countyLottery' && Number(this.activityId || 0) > 0
},
// v9-2
changeCoupons(e) {
if (this.isCountyLotteryGoodsDetail()) return
this.show = !this.show
},
setCoupon(couponId) {
if (this.isCountyLotteryGoodsDetail()) return
this.couponId = couponId
},
async checkFavorite() {
+31 -7
View File
@@ -95,7 +95,7 @@
<text class="v12-dark-text v12-font-30">{{ computedResult.discountPrice }}</text>
</view>
</view>
<view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1">
<view v-if="!isCountyLotteryGift" class="v12-justify-between v12-align-center v12-font-28 v12-mt-1">
<view class="v12-font-24 v12-dark-text v12-align-center">
<view class="">
优惠券
@@ -163,6 +163,7 @@
@confirm="onPayConfirm"
/>
<u-popup
v-if="!isCountyLotteryGift"
:show="showPopup"
:round="10"
mode="bottom"
@@ -281,6 +282,13 @@ export default {
},
watch: {
async couponId(value) {
if (this.isCountyLotteryGift) {
this.couponTitle = ''
if (Number(value || 0) !== 0) {
this.couponId = 0
return
}
}
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value)
this.couponTitle = this.couponList['usable']?.[this.couponIndex]?.couponTitle
if(this.isGroupBuy) {
@@ -324,6 +332,10 @@ export default {
}
},
methods: {
getCouponId() {
if (this.isCountyLotteryGift) return 0
return this.couponId || 0
},
adjustCoverListForProductStory(coverList, productInfo, defaultTemplate) {
if (!productInfo || !productInfo.productStory) {
return {
@@ -356,14 +368,19 @@ export default {
computedTravelGroupPrice(useDefaultCouponId) {
const params = {
key: this.orderKey,
couponId: this.couponId
couponId: this.getCouponId()
}
computedSojoumGroupBuyGiftOrderPrice(params).then(res => {
this.computedResult = res.data.result
this.couponList = res.data.result.couponList
this.payPrice = res.data.result.payPrice
this.$forceUpdate()
if(useDefaultCouponId) {
if (this.isCountyLotteryGift) {
this.couponTitle = ''
if (this.couponId !== 0) {
this.couponId = 0
}
} else if(useDefaultCouponId) {
this.couponId = res.data.result.defaultCouponId || 0
}
})
@@ -372,6 +389,7 @@ export default {
this.showCoverPicker = true
},
showCouponsPopup() {
if (this.isCountyLotteryGift) return
if (this.couponList.usable && this.couponList.usable.length === 0) return
if(this.isPayOk) return
this.showPopup = !this.showPopup
@@ -380,6 +398,7 @@ export default {
this.showPopup = !this.showPopup
},
changeCoupons(item) {
if (this.isCountyLotteryGift) return
if(!item) return
if (this.couponList.usable && this.couponList.usable.length === 0) return
this.showPopup = !this.showPopup
@@ -448,7 +467,7 @@ export default {
computedPrice(num, f) {
const params = {
cartId: this.cartId,
couponId: this.couponId,
couponId: this.getCouponId(),
cartNum : num
}
if(this.discount) {
@@ -456,7 +475,12 @@ export default {
}
getGiftCardSendOrderAmount(this.orderKey, params).then(res => {
this.couponList = res.data.result.couponList
if(!f) {
if (this.isCountyLotteryGift) {
this.couponTitle = ''
if (this.couponId !== 0) {
this.couponId = 0
}
} else if(!f) {
this.couponId = res.data.result.defaultCouponId || 0
this.$forceUpdate()
}
@@ -564,13 +588,13 @@ export default {
message : this.message || '礼笺轻启,礼藏心意',
canTransfer: this.canTransfer ? 1 : 0,
passwordPay: this.payPassword || '',
couponId: this.couponId,
couponId: this.getCouponId(),
payType: this.payType,
} : {
orderKey: this.orderKey,
from: 'routine',
cartId: this.cartId,
couponId: this.couponId,
couponId: this.getCouponId(),
recipientsNum: this.goodsInfo.cartNum,
templateId: this.templateId,
message : this.message || '礼笺轻启,礼藏心意',