Commit bf754c0a089b63a013391a408b85d1e932b6375f

Authored by yvan.ni
1 parent 8977094c

使用余额的bug优化,拼团,余额+钱一起购买的时候

pages/cart/cart2_pt/cart2_pt.js
@@ -153,6 +153,7 @@ Page({ @@ -153,6 +153,7 @@ Page({
153 if (su.data.code == 0) { 153 if (su.data.code == 0) {
154 var yuer = parseFloat(th.data.userinfo.user_money - 154 var yuer = parseFloat(th.data.userinfo.user_money -
155 (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2); 155 (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);
  156 + if(yuer<0) yuer=0;
156 th.setData({ txmon: su.data.data.summoney, yuer: yuer }); 157 th.setData({ txmon: su.data.data.summoney, yuer: yuer });
157 } 158 }
158 } 159 }
@@ -451,13 +452,13 @@ Page({ @@ -451,13 +452,13 @@ Page({
451 var txt = "formData.user_money"; 452 var txt = "formData.user_money";
452 var txt2 = "formData.order_amount"; 453 var txt2 = "formData.order_amount";
453 //--------------如果使用余额--------------------- 454 //--------------如果使用余额---------------------
454 - if (th.data.bn_use_money == 1) { 455 + if (th.data.bn_use_money == 1 && th.data.yuer>0) {
455 if ( parseFloat(th.data.yuer) > total_m) { 456 if ( parseFloat(th.data.yuer) > total_m) {
456 th.setData({ [txt]: total_m, [txt2]:0 }) 457 th.setData({ [txt]: total_m, [txt2]:0 })
457 }else{ 458 }else{
458 order_m = parseFloat(order_m) - parseFloat(th.data.yuer); 459 order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
459 order_m = order_m.toFixed(2); 460 order_m = order_m.toFixed(2);
460 - th.setData({ [txt]: th.data.userinfo.yuer, [txt2]: order_m }) 461 + th.setData({ [txt]: th.data.yuer, [txt2]: order_m })
461 } 462 }
462 }else{ 463 }else{
463 th.setData({ [txt]: 0, [txt2]: order_m }) 464 th.setData({ [txt]: 0, [txt2]: order_m })
pages/cart/cart2_pt/cart2_pt.wxml
@@ -125,7 +125,7 @@ @@ -125,7 +125,7 @@
125 125
126 <view class="information bdr14"> 126 <view class="information bdr14">
127 <!-----使用余额------> 127 <!-----使用余额------>
128 - <view class="set-mes" wx:if="{{userinfo.user_money>0}}"> 128 + <view class="set-mes" wx:if="{{userinfo.user_money>0 && yuer>0}}">
129 <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;"> 129 <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;">
130 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> 130 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon>
131 <view class="yu_er">使用余额 :¥{{yuer}} </view> 131 <view class="yu_er">使用余额 :¥{{yuer}} </view>