Feat:抽奖优化

This commit is contained in:
linxi
2026-07-02 10:06:50 +08:00
parent 7aeff7ece1
commit df87d0f9c8
2 changed files with 100 additions and 6 deletions
+32 -6
View File
@@ -117,7 +117,7 @@
<text class="v12-font-28">{{ force2Decimal(orderPrice.payPostage) }}</text>
</view>
</view> -->
<view class="v12-justify-between v12-align-center v12-py-1">
<view v-if="!isLotteryOrder()" class="v12-justify-between v12-align-center v12-py-1">
<view class="v12-font-24 v12-dark-text v12-align-center">
<text>优惠券</text>
<view class="v12-align-center v12-ml-1" v-if="couponTitle">
@@ -255,7 +255,7 @@
</view>
<!-- v9 优惠券开始 -->
<u-popup
v-if="show"
v-if="!isLotteryOrder() && show"
:show="show"
:round="10"
mode="bottom"
@@ -263,7 +263,7 @@
@close="close"
>
<CouponsPopup
v-if="couponList.usable.length > 0 && show"
v-if="!isLotteryOrder() && couponList.usable.length > 0 && show"
:two-list="couponList"
@change="changeCoupons"
@close="close"
@@ -452,6 +452,25 @@ export default {
},
methods: {
isNullOrEmpty,
isLotteryOrder() {
const cartInfo = Array.isArray(this.orderGroupInfo && this.orderGroupInfo.cartInfo)
? this.orderGroupInfo.cartInfo
: []
return Boolean(
this.lotteryRecordId ||
this.$yroute.query.from === 'countyLottery' ||
Number(this.$yroute.query.drawActivityId || 0) > 0 ||
cartInfo.some(item => Number(
item.drawActivityId ||
(item.productInfo && item.productInfo.drawActivityId) ||
0
) > 0)
)
},
getOrderCouponId() {
if (this.isLotteryOrder()) return 0
return this.couponList.usable.length === 0 ? 0 : (this.couponId || 0)
},
couponMax(e) {
// this.couponTitle = e.couponTitle
// this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0
@@ -477,12 +496,17 @@ export default {
postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId,
couponId: this.getOrderCouponId(),
usePoints: this.usePointsCheck ? 1 : 0,
shipping_type: parseInt(this.shipping_type) + 1
}).then(res => {
this.couponList = res.data.result.couponList
if(!f) {
if (this.isLotteryOrder()) {
this.couponTitle = ''
if (this.couponId !== 0) {
this.couponId = 0
}
} else if(!f) {
this.couponId = res.data.result.defaultCouponId
}
const data = res.data;
@@ -683,7 +707,7 @@ export default {
phone: this.contactsTel,
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId || 0,
couponId: this.getOrderCouponId(),
usePoints: this.usePointsNumber || 0,
payType: this.active,
pinkId: this.pinkId,
@@ -811,11 +835,13 @@ export default {
this.show = !this.show
},
showCouponsPopup() {
if (this.isLotteryOrder()) return
if (this.couponList.usable.length === 0) return
this.show = !this.show
},
// v9-2
changeCoupons(item) {
if (this.isLotteryOrder()) return
if(!item) return
if (this.couponList.usable.length === 0) return
this.show = !this.show