Commit c3372aa0e36de9382d40342a6b8b1140369e1fe5
1 parent
4ae8afcc
fix购物结算
Showing
1 changed file
with
7 additions
and
11 deletions
pages/cart/cart/cart.js
| ... | ... | @@ -2057,7 +2057,7 @@ Page({ |
| 2057 | 2057 | |
| 2058 | 2058 | th.data.sele_g = res.data.data; |
| 2059 | 2059 | th.data.sele_g.viplimited = res.data.data.buy_limit; |
| 2060 | - buylimit = res.data.data.buy_limit; | |
| 2060 | + buylimit = !res.data.data.buy_limit ? 0 : res.data.data.buy_limit; | |
| 2061 | 2061 | }; |
| 2062 | 2062 | }); |
| 2063 | 2063 | |
| ... | ... | @@ -2066,29 +2066,25 @@ Page({ |
| 2066 | 2066 | }).then(tt => { |
| 2067 | 2067 | if (tt.data.code == 0) { |
| 2068 | 2068 | th.setData({ |
| 2069 | - promcardbuynum: tt.data.data.promcardbuynum, | |
| 2069 | + promcardbuynum: !th.data.promcardbuynum ? 0 : th.data.promcardbuynum, | |
| 2070 | 2070 | cardbuynum: tt.data.data.cardbuynum, |
| 2071 | 2071 | }); |
| 2072 | 2072 | }; |
| 2073 | 2073 | }); |
| 2074 | - var gd_buy_num = th.data.promcardbuynum; | |
| 2075 | 2074 | |
| 2075 | + var gd_buy_num = !th.data.promcardbuynum ? 0 : th.data.promcardbuynum; | |
| 2076 | 2076 | |
| 2077 | 2077 | if(t.goods_num > redis_num) { |
| 2078 | + wx.showToast({ | |
| 2079 | + title: '超出活动库存', | |
| 2080 | + icon: 'none', | |
| 2081 | + }); | |
| 2078 | 2082 | // 开启限购 |
| 2079 | 2083 | if (buylimit > 0) { |
| 2080 | - wx.showToast({ | |
| 2081 | - title: '超出活动限购', | |
| 2082 | - icon: 'none', | |
| 2083 | - }); | |
| 2084 | 2084 | let num = buylimit - gd_buy_num; |
| 2085 | 2085 | if (num > redis_num) { |
| 2086 | 2086 | th.setData({[txt]: redis_num}); |
| 2087 | 2087 | } else { |
| 2088 | - wx.showToast({ | |
| 2089 | - title: '超出活动库存', | |
| 2090 | - icon: 'none', | |
| 2091 | - }); | |
| 2092 | 2088 | th.setData({[txt]: num}); |
| 2093 | 2089 | } |
| 2094 | 2090 | } else { | ... | ... |