Commit a2601669 by 谢中龙

修改bug

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