Commit a2601669 by 谢中龙

修改bug

parent ede5f6a3
......@@ -39,6 +39,7 @@ wxService.page({
plusMemberPrice: 0, // plus 默认价
plusMemberName: '',
defalutCoupon: '',
useNotUserCoupon: false,
defalutCouponId: '', // 默认第一项
addressId: '', // 收货地址id
totalGoodsPrice: 0,
......@@ -224,6 +225,7 @@ wxService.page({
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券
if (!e.detail) {
this.setData({
useNotUserCoupon : true,
defalutCoupon: 0,
couponId: '',
couponSettingId: '',
......@@ -243,6 +245,7 @@ wxService.page({
let finCouponName = id ? 'couponId' : 'couponSettingId';
if (type == 1) {
this.setData({
useNotUserCoupon: false,
defalutCoupon: true,
defalutCouponId: finCouponId ? '' : defalutCouponId,
[finCouponName]: finCouponId,
......@@ -257,6 +260,7 @@ wxService.page({
// let spread = Math.round(orderPrice - discounPrice)
this.setData({
defalutCoupon: true,
useNotUserCoupon: false,
[finCouponName]: finCouponId,
defalutCouponId: finCouponId ? '' : defalutCouponId,
// couponId: id,
......@@ -270,6 +274,7 @@ wxService.page({
this.setData({
defalutCoupon: true,
useNotUserCoupon: false,
defalutCouponId: finCouponId ? '' : defalutCouponId,
[finCouponName]: finCouponId,
haveCoupon: true,
......@@ -606,34 +611,47 @@ wxService.page({
}
//如果没有couponId则认为是第一次进来没有自己选择优惠券
if (!this.data.couponId) {
//获取优惠券信息
let defalutCoupon = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0].couponSettingDTO.type == 1 ?
data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0].couponSettingDTO.faceAmount / 100 : data &&
data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] &&
data.couponDiscountPreviews[0].couponDiscount;
let defalutCouponId = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] &&
data.couponDiscountPreviews[0].couponDTOS[0].id || '';
let couponSettingId = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] &&
data.couponDiscountPreviews[0].couponDTOS[0].couponSettingId || '';
data.couponDiscountPreviews = data.couponDiscountPreviews ? data.couponDiscountPreviews : [];
this.data.couponDiscountPreviews = data.couponDiscountPreviews;
// id / couponSettingId
this.setData({
currentOrderList: data,
couponDiscountPreviews: this.data.couponDiscountPreviews,
defalutCoupon: defalutCoupon,
defalutCouponId: defalutCouponId,
couponSettingId: couponSettingId,
orderInitPrice: data.amount,
totalGoodsPrice: this.data.totalGoodsPrice
}, () => {
// 实付款
this.setPayPrice()
})
if(!this.data.useNotUserCoupon){
//获取优惠券信息
let defalutCoupon = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0].couponSettingDTO.type == 1 ?
data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0].couponSettingDTO.faceAmount / 100 : data &&
data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] &&
data.couponDiscountPreviews[0].couponDiscount;
let defalutCouponId = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] &&
data.couponDiscountPreviews[0].couponDTOS[0].id || '';
let couponSettingId = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] &&
data.couponDiscountPreviews[0].couponDTOS[0].couponSettingId || '';
data.couponDiscountPreviews = data.couponDiscountPreviews ? data.couponDiscountPreviews : [];
this.data.couponDiscountPreviews = data.couponDiscountPreviews;
// id / couponSettingId
this.setData({
currentOrderList: data,
couponDiscountPreviews: this.data.couponDiscountPreviews,
defalutCoupon: defalutCoupon,
defalutCouponId: defalutCouponId,
couponSettingId: couponSettingId,
orderInitPrice: data.amount,
totalGoodsPrice: this.data.totalGoodsPrice
}, () => {
// 实付款
this.setPayPrice()
})
}
//用户取消使用优惠券
else{
this.setData({
currentOrderList: data,
orderInitPrice: data.amount,
totalGoodsPrice: this.data.totalGoodsPrice
}, () => {
// 实付款
this.setPayPrice()
})
}
}
else{
//重新调用之后 不刷新优惠券列表
......
......@@ -135,7 +135,7 @@
<button class="btn btn-primary btn-lg" data-id="{{detail.id}}" bindtap="handelToPay">立即支付</button>
<button class="btn btn-lg btn-gray" data-id="{{detail.id}}" bindtap="handelCancelOrder">取消订单</button>
</view>
<view class="button-wrap" wx:if="{{detail.orderCanRefund && (detail.status != 'N' || detail.status != 'C')}}">
<view class="button-wrap" wx:if="{{detail.orderCanRefund && (detail.status != 'N' && detail.status != 'C')}}">
<button
class="btn btn-gray btn-lg"
data-id="{{detail.id}}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment