Commit a38fab6d6104496b0e1182f923b14206023bae42

Authored by 泉州测试
1 parent 2f71cbd8

fix:购物车先判断库存

Showing 1 changed file with 9 additions and 10 deletions
pages/cart/cart/cart.js
@@ -2048,6 +2048,15 @@ Page({ @@ -2048,6 +2048,15 @@ Page({
2048 return false; 2048 return false;
2049 }; 2049 };
2050 2050
  2051 + if(t.goods_num > redis_num) {
  2052 + wx.showToast({
  2053 + title: '超出活动库存',
  2054 + icon: 'none',
  2055 + });
  2056 + th.setData({[txt]: redis_num});
  2057 + return false;
  2058 + };
  2059 +
2051 // 个人限购 2060 // 个人限购
2052 //----获取用户活动购买数---- 2061 //----获取用户活动购买数----
2053 await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.goods_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, { 2062 await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.goods_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, {
@@ -2090,16 +2099,6 @@ Page({ @@ -2090,16 +2099,6 @@ Page({
2090 }; 2099 };
2091 2100
2092 } 2101 }
2093 -  
2094 - if(t.goods_num > redis_num) {  
2095 - wx.showToast({  
2096 - title: '超出活动库存',  
2097 - icon: 'none',  
2098 - });  
2099 - th.setData({[txt]: redis_num});  
2100 - return false;  
2101 - };  
2102 -  
2103 2102
2104 2103
2105 } 2104 }