【订单确认】

1. 将 coupon 优惠劵的变量、方法先整理一下
pull/1/MERGE
YunaiV 2023-06-29 00:37:30 +08:00
parent ec0e0ee234
commit 3d4400f198
1 changed files with 76 additions and 67 deletions

View File

@ -148,7 +148,15 @@
<view class='settlement' style='z-index:100' @tap="SubOrder"></view>
</view>
</view>
<couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' @ChangCoupons="ChangCoupons" :orderShow="orderShow"></couponListWindow>
<!-- 优惠劵的弹窗选择 -->
<couponListWindow
:coupon='coupon'
@ChangCouponsClone="ChangCouponsClone"
:openType='openType'
@ChangCoupons="ChangCoupons"
:orderShow="orderShow"
/>
<!-- 收货地址的弹窗选择 -->
<addressWindow
@ -190,7 +198,6 @@
},
data() {
return {
orderShow: 'orderShow', //使tab
textareaStatus: true,
//
cartArr: [{
@ -209,18 +216,10 @@
}
],
payType: 'weixin', //
openType: 1, // 1=使
active: 0, //
coupon: {
coupon: false,
list: [],
statusTile: '立即使用'
}, //
couponId: 0, //id
userInfo: {}, //
mark: '', //
couponTitle: '请选择', //
coupon_price: 0, //
useIntegral: false, //使
integral_price: 0, //
@ -234,7 +233,6 @@
animated: false,
totalPrice: 0,
pagesUrl: "",
offlinePostage: "",
payChannel: '',
bargain: false, //
combination: false, //
@ -243,6 +241,15 @@
orderProNum: 0,
preOrderNo: '', //
// ========== ==========
couponId: 0, // id
couponTitle: '请选择', //
coupon: { //
coupon: false,
list: [],
statusTile: '立即使用'
},
// ========== ==========
shippingType: 0, // 0 - 1 -
addressId: 0, // param id
@ -251,6 +258,8 @@
address: false, // addressWindow
addressId: 0 // address addressId
},
openType: 1, // 1=使
orderShow: 'orderShow', // 使 tab
// ========== ==========
store_self_mention: false, //
@ -288,6 +297,10 @@
// address
this.addressId = options.addressId || 0;
this.getaddressInfo();
//
DeliveryApi.getDeliveryConfig().then(res => {
this.store_self_mention = res.data.pickUpEnable && this.productType === 'normal';
})
},
/**
* 生命周期函数--监听页面显示
@ -295,10 +308,12 @@
onShow: function() {
let _this = this
this.textareaStatus = true;
//
if (this.isLogin && !this.toPay) {
this.getaddressInfo();
}
// goods_details_store/index.vue
uni.$on("handClick", res => {
if (res) {
_this.system_store = res.address
@ -329,11 +344,6 @@
title: err
});
})
//
DeliveryApi.getDeliveryConfig().then(res => {
this.store_self_mention = res.data.pickUpEnable && this.productType === 'normal';
})
},
//
computedPrice: function() {
@ -363,14 +373,7 @@
});
});
},
bindPickerChange: function(e) {
let value = e.detail.value;
this.shippingType = value;
this.computedPrice();
},
ChangCouponsClone: function() {
this.$set(this.coupon, 'coupon', false);
},
changeTextareaStatus: function() {
for (let i = 0, len = this.coupon.list.length; i < len; i++) {
this.coupon.list[i].use_title = '';
@ -380,39 +383,6 @@
this.status = 0;
this.$set(this.coupon, 'list', this.coupon.list);
},
/**
* 处理点击优惠券后的事件
*/
ChangCoupons: function(e) {
// this.usableCoupon = e
// this.coupon.coupon = false
let index = e,
list = this.coupon.list,
couponTitle = '请选择',
couponId = 0;
for (let i = 0, len = list.length; i < len; i++) {
if (i != index) {
list[i].use_title = '';
list[i].isUse = 0;
}
}
if (list[index].isUse) {
//使
list[index].use_title = '';
list[index].isUse = 0;
} else {
//使
list[index].use_title = '不使用';
list[index].isUse = 1;
couponTitle = list[index].name;
couponId = list[index].id;
}
this.couponTitle = couponTitle;
this.couponId = couponId;
this.$set(this.coupon, 'coupon', false);
this.$set(this.coupon, 'list', list);
this.computedPrice();
},
/**
* 使用积分抵扣
*/
@ -423,16 +393,7 @@
bindHideKeyboard: function(e) {
this.mark = e.detail.value;
},
/**
* 获取当前金额可用优惠券
*
*/
getCouponList: function() {
getCouponsOrderPrice(this.preOrderNo).then(res => {
this.$set(this.coupon, 'list', res.data);
this.openType = 1;
});
},
payItem: function(e) {
let that = this;
let active = e;
@ -815,6 +776,54 @@
// #endif
},
// ========== ==========
/**
* 获取当前金额可用优惠券 TODO
*/
getCouponList: function() {
getCouponsOrderPrice(this.preOrderNo).then(res => {
this.$set(this.coupon, 'list', res.data);
this.openType = 1;
});
},
/**
* 处理点击优惠券后的事件 TODO
*/
ChangCoupons: function(e) {
// this.usableCoupon = e
// this.coupon.coupon = false
let index = e,
list = this.coupon.list,
couponTitle = '请选择',
couponId = 0;
for (let i = 0, len = list.length; i < len; i++) {
if (i != index) {
list[i].use_title = '';
list[i].isUse = 0;
}
}
if (list[index].isUse) {
//使
list[index].use_title = '';
list[index].isUse = 0;
} else {
//使
list[index].use_title = '不使用';
list[index].isUse = 1;
couponTitle = list[index].name;
couponId = list[index].id;
}
this.couponTitle = couponTitle;
this.couponId = couponId;
this.$set(this.coupon, 'coupon', false);
this.$set(this.coupon, 'list', list);
this.computedPrice();
},
// TODO
ChangCouponsClone: function() {
this.$set(this.coupon, 'coupon', false);
},
// ========== ==========
/**
* 打开选择地址的弹窗