diff --git a/public/build/beike/shop/default/js/app.js b/public/build/beike/shop/default/js/app.js index da464239..0469a502 100644 --- a/public/build/beike/shop/default/js/app.js +++ b/public/build/beike/shop/default/js/app.js @@ -2052,6 +2052,127 @@ module.exports = { }; +/***/ }), + +/***/ "./resources/beike/shop/default/js/global.js": +/*!***************************************************!*\ + !*** ./resources/beike/shop/default/js/global.js ***! + \***************************************************/ +/***/ (() => { + +// 创建 bk 对象 +window.bk = window.bk || {}; // 获取购物车数据 + +bk.getCarts = function () { + $http.get('carts/mini', null, { + hload: true + }).then(function (res) { + $('.offcanvas-right-cart-amount').html(res.data.amount_format); + + if (res.data.carts.length) { + $('.navbar-icon-link-badge').html(res.data.carts.length > 99 ? '99+' : res.data.carts.length).show(); + $('.offcanvas-right-cart-count').html(res.data.quantity); + var html = ''; + res.data.carts.forEach(function (e) { + html += '