Authored by bevishuang

优化确认订单页

... ... @@ -3,16 +3,16 @@ Component({
show: {
type: Boolean,
value: false,
observer: '_show'
// observer: '_show'
},
coupons: {
type: Array,
value: []
value: [],
},
selectedCode: {
type: String,
value: '',
observer: '_showselectedCode'
},
chosenIdx: {
type: String,
... ... @@ -28,7 +28,6 @@ Component({
let codeType = item && item.coupon_type|| '';
let code = item && item.coupon_code || '';
let amount = item && item.coupon_value_str || '';
this.triggerEvent('confirmselect', { code, amount, codeType})
},
cancel: function () {
... ... @@ -59,16 +58,11 @@ Component({
});
this.data.chosenIdx = '';
},
_showselectedCode(selectedCode){
console.log(selectedCode)
},
_show: function (show) {
console.log('selectedCode')
if (show) {
if (this.data.selectedCode) {
this.data.coupons.forEach((item, index) => {
if (item.coupon_code === this.data.selectedCode) {
if (item.selected === 'Y') {
this.setData({
[`coupons[${index}].isChosen`]: true
});
... ... @@ -88,6 +82,7 @@ Component({
this.data.chosenIdx = '';
}
}
console.log(this.data.coupons)
}
}
});
... ...
... ... @@ -68,20 +68,15 @@ Page({
},
showSelectCoupon: function () {
console.log('console.log(this.coupon)')
console.log(this.data)
this.setData({
selectingCoupon: true
});
},
async confirmSelectCoupon({detail}) {
console.log('detail')
let code = detail.code;
let codeType = detail.codeType;
console.log(code)
// let codeType = detail.coupon
let amount = detail.amount || '';
this.setData({
... ... @@ -95,6 +90,7 @@ Page({
let info;
//如果选择了非运费券,促销不选择
let promotion_id = this.data.promotionTips.promotionIds;
//判断优惠劵的类型
if (codeType !== 110){
promotion_id = '';
}
... ... @@ -120,13 +116,7 @@ Page({
});
}
console.log('data===');
console.log(this.data)
console.log('params')
console.log(params)
info = await api.orderCompute(params, () => wx.hideLoading());
console.log('info')
console.log(info)
}
} catch(e) {}
... ... @@ -183,15 +173,7 @@ console.log(this.data)
}
}
console.log('data');
console.log(data);
// await api.orderSelectCoupon(this.data.skup, () => wx.hideLoading()).then(data => {
// let coupons = data || [];
// console.log('===coupons====');
// console.log(coupons);
// this.setData(coupons)
// });
let that = this;
... ... @@ -202,17 +184,11 @@ console.log(this.data)
let selected = item.selected;
if (selected === 'Y'){
item.isChosen = true;
// selectCouponCode = item.code;
// that.setData({
// selectCouponCode
// })
data.selectCouponAmount = item.coupon_value_str;
}else {
item.isChosen = false;
}
// coupons.push(item);
});
// data.couponList = coupons;
// data.selectCouponCode = selectCouponCode;
}
if (data.good && data.good.goodImg) {
... ...