Commit bf754c0a089b63a013391a408b85d1e932b6375f

Authored by yvan.ni
1 parent 8977094c

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

pages/cart/cart2_pt/cart2_pt.js
... ... @@ -153,6 +153,7 @@ Page({
153 153 if (su.data.code == 0) {
154 154 var yuer = parseFloat(th.data.userinfo.user_money -
155 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 157 th.setData({ txmon: su.data.data.summoney, yuer: yuer });
157 158 }
158 159 }
... ... @@ -451,13 +452,13 @@ Page({
451 452 var txt = "formData.user_money";
452 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 456 if ( parseFloat(th.data.yuer) > total_m) {
456 457 th.setData({ [txt]: total_m, [txt2]:0 })
457 458 }else{
458 459 order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
459 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 463 }else{
463 464 th.setData({ [txt]: 0, [txt2]: order_m })
... ...
pages/cart/cart2_pt/cart2_pt.wxml
... ... @@ -125,7 +125,7 @@
125 125  
126 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 129 <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;">
130 130 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon>
131 131 <view class="yu_er">使用余额 :¥{{yuer}} </view>
... ...