Commit 296ab86eeb9c0a7a25a9d725e03d695bf43b5208
1 parent
8b9fa552
fix购物车输入数量修正
Showing
1 changed file
with
14 additions
and
5 deletions
packageA/pages/goodsInfo/goodsInfo.js
@@ -921,13 +921,22 @@ Page({ | @@ -921,13 +921,22 @@ Page({ | ||
921 | // 开启限购 | 921 | // 开启限购 |
922 | if (th.data.sele_g.viplimited > 0) { | 922 | if (th.data.sele_g.viplimited > 0) { |
923 | 923 | ||
924 | - if (t > num) { | ||
925 | - th.setData({goodsInputNum: num}); | 924 | + if (action != "buy") { |
925 | + if (t > num) { | ||
926 | + th.setData({goodsInputNum: num - cartGoodsNum < 0 ? 0 : num - cartGoodsNum}); | ||
927 | + } | ||
928 | + if (redisNum < num) { | ||
929 | + th.setData({goodsInputNum: redisNum - cartGoodsNum < 0 ? 0 : redisNum - cartGoodsNum}); | ||
930 | + } | ||
931 | + } else { | ||
932 | + if (num > redisNum) { | ||
933 | + th.setData({goodsInputNum: redisNum}); | ||
934 | + } else { | ||
935 | + th.setData({goodsInputNum: num}); | ||
936 | + } | ||
926 | } | 937 | } |
927 | 938 | ||
928 | - if (redisNum < num) { | ||
929 | - th.setData({goodsInputNum: redisNum}); | ||
930 | - } | 939 | + |
931 | 940 | ||
932 | 941 | ||
933 | } else { | 942 | } else { |