diff --git a/public/build/beike/shop/default/js/app.js b/public/build/beike/shop/default/js/app.js index 7f9cd8a4..ea85dcb2 100644 --- a/public/build/beike/shop/default/js/app.js +++ b/public/build/beike/shop/default/js/app.js @@ -2218,6 +2218,10 @@ $(document).on('click', '.quantity-wrap .right i', function (event) { return; } + if (input.val() * 1 <= 1) { + return; + } + input.val(input.val() * 1 - 1); input.get(0).dispatchEvent(new Event('input')); }); @@ -2659,8 +2663,24 @@ __webpack_require__.r(__webpack_exports__); window.bk = _common__WEBPACK_IMPORTED_MODULE_1__["default"]; window.$http = _js_http__WEBPACK_IMPORTED_MODULE_0__["default"]; +var token = document.querySelector('meta[name="csrf-token"]').content; +var base = document.querySelector('base').href; +$(document).ready(function ($) { + $.ajaxSetup({ + headers: { + 'X-CSRF-TOKEN': token + }, + // beforeSend: function() { layer.load(2, {shade: [0.3,'#fff'] }); }, + // complete: function() { layer.closeAll('loading'); }, + error: function error(xhr, ajaxOptions, thrownError) { + if (xhr.responseJSON.message) { + layer.msg(xhr.responseJSON.message, function () {}); + } + } + }); +}); bk.getCarts(); // 页面初始加载购物车数据 bk.slidingFixed(); diff --git a/resources/beike/shop/default/js/product.js b/resources/beike/shop/default/js/product.js index 050d9e11..1238d09a 100644 --- a/resources/beike/shop/default/js/product.js +++ b/resources/beike/shop/default/js/product.js @@ -12,6 +12,10 @@ $(document).on('click', '.quantity-wrap .right i', function(event) { return; } + if (input.val () * 1 <= 1) { + return; + } + input.val(input.val() * 1 - 1) input.get(0).dispatchEvent(new Event('input')); }); \ No newline at end of file