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
+68
View File
@@ -29,6 +29,13 @@
</view>
<view class="card form-card">
<view class="form-card-header">
<view class="form-card-title">填写收货地址</view>
<view class="select-address-entry" @click="chooseExistingAddress">
<text class="select-address-text" style="margin-bottom: 4rpx;">选择现有地址 </text>
<u-icon name="arrow-right" size="14" color="#BD3124"></u-icon>
</view>
</view>
<view class="form-row">
<text class="label">收货人</text>
<input v-model="form.realName" class="input" placeholder="请填写收货人" placeholder-style="color:#b2b2b2;" />
@@ -190,6 +197,7 @@ export default {
this.fetchRealnameStatus()
},
onShow() {
this.handleChooseAddress()
const done = uni.getStorageSync('countyClaimAuthDone')
const needAutoSubmit = uni.getStorageSync('countyClaimNeedAutoSubmit')
if (done && (this.waitSubmitAfterRealname || needAutoSubmit)) {
@@ -219,6 +227,41 @@ export default {
goBack() {
uni.navigateBack()
},
chooseExistingAddress() {
uni.setStorageSync('sourceAddress', {
realName: this.form.realName || '',
phone: this.form.phone || '',
userAddress: `${this.address.province || ''}${this.address.city || ''}${this.address.district || ''}${this.form.detail || ''}`,
province: this.address.province || '',
city: this.address.city || '',
district: this.address.district || '',
detail: this.form.detail || ''
})
this.$yrouter.push({
path: '/pages/user/address/AddressManagement/index',
query: {
choosMode: 1
}
})
},
handleChooseAddress() {
const chooseAddress = uni.getStorageSync('chooseAddress') || {}
if (!chooseAddress.id) return
uni.setStorageSync('chooseAddress', {})
this.fillAddressForm(chooseAddress)
},
fillAddressForm(address = {}) {
this.form.realName = address.realName || address.real_name || ''
this.form.phone = address.phone || ''
this.form.detail = address.detail || ''
this.address = {
province: address.province || '',
city: address.city || '',
district: address.district || '',
city_id: address.city_id || address.cityId || address.city_id
}
this.addressText = `${this.address.province} ${this.address.city} ${this.address.district}`.trim()
},
getCityList() {
getCity().then(res => {
this.district = res.data || []
@@ -585,6 +628,31 @@ export default {
padding: 0 24rpx 24rpx;
}
.form-card-header {
min-height: 88rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx dashed #e5e5e5;
}
.form-card-title {
color: #262626;
font-size: 30rpx;
font-weight: 700;
}
.select-address-entry {
display: flex;
align-items: center;
color: #BD3124;
}
.select-address-text {
font-size: 26rpx;
margin-right: 8rpx;
}
.form-row {
min-height: 92rpx;
display: flex;