Task:订单提交页面优化/ 提交订单前,若在商品详情页选择了优惠券,则提交订单页面删除该按钮

This commit is contained in:
linxi
2025-01-15 18:16:01 +08:00
parent 46b858b700
commit f19ac9ad42
3 changed files with 42 additions and 13 deletions
+14 -7
View File
@@ -109,7 +109,7 @@
</view>
</view>
<view class="v12-justify-between v12-align-center">
<view class="v12-mr-2" @click="changeCoupons" v-if="couponList.usable.length !== 0">
<view class="v12-mr-2" @click="changeCoupons" v-if="couponList.usable.length !== 0 && !hasCoupon">
<text class="v12-dark-text v12-font-24" >{{ couponList.usable.length === 0 ? '无' : '去选择' }}</text>
<text class="iconfont icon-jiantou v12-font-24 v12-dark-text"></text>
</view>
@@ -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