Showing
1 changed file
with
5 additions
and
1 deletions
@@ -275,6 +275,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -275,6 +275,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
275 | if (num === 1 || 0 === leftNum - 0) { | 275 | if (num === 1 || 0 === leftNum - 0) { |
276 | return; | 276 | return; |
277 | } | 277 | } |
278 | + if (num < 1) { | ||
279 | + $num.val(1); | ||
280 | + return; | ||
281 | + } | ||
278 | 282 | ||
279 | $num.val(num - 1); | 283 | $num.val(num - 1); |
280 | }).on('touchstart', '.btn-plus', function() { | 284 | }).on('touchstart', '.btn-plus', function() { |
@@ -292,7 +296,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -292,7 +296,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
292 | } | 296 | } |
293 | 297 | ||
294 | //TODO:库存数验证 | 298 | //TODO:库存数验证 |
295 | - if (num > leftNum) { | 299 | + if (num > leftNum - 1) { |
296 | $num.val(leftNum); | 300 | $num.val(leftNum); |
297 | return; | 301 | return; |
298 | } | 302 | } |
-
Please register or login to post a comment