Showing
1 changed file
with
11 additions
and
2 deletions
@@ -477,8 +477,17 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -477,8 +477,17 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
477 | url = $('#limitProductPay').val() + '?limitproductcode=' + limitProductCode + '&sku=' + | 477 | url = $('#limitProductPay').val() + '?limitproductcode=' + limitProductCode + '&sku=' + |
478 | productSku + '&skn=' + skn + '&buy_number=' + buyNumber; | 478 | productSku + '&skn=' + skn + '&buy_number=' + buyNumber; |
479 | 479 | ||
480 | - //打开结算页面,结束函数执行。 | ||
481 | - window.location.href = url; | 480 | + // 调用接口判断商品是否可以购买 |
481 | + $.ajax({ | ||
482 | + url: url | ||
483 | + }).then(function(res) { | ||
484 | + | ||
485 | + // 如果有错,则商品不可购买,执行页面刷新,否则跳到结算页面 | ||
486 | + res.error ? window.location.reload() : window.location.href = url; | ||
487 | + }).fail(function() { | ||
488 | + window.location.reload(); | ||
489 | + }); | ||
490 | + | ||
482 | return false; | 491 | return false; |
483 | 492 | ||
484 | } else { | 493 | } else { |
-
Please register or login to post a comment