购物车交互
This commit is contained in:
parent
5b66c075a6
commit
7976bb7d3a
|
|
@ -2492,6 +2492,8 @@ $(document).ready(function ($) {
|
|||
var cartId = $(this).data('id');
|
||||
$http["delete"]("/carts/".concat(cartId)).then(function (res) {
|
||||
$this.parents('.product-list').remove();
|
||||
$('.offcanvas-right-cart-count').html(res.data.quantity);
|
||||
$('.offcanvas-right-cart-amount').html(res.data.amount_format);
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.quantity-wrap .right i', function (event) {
|
||||
|
|
@ -2570,7 +2572,7 @@ bk.getCarts = function () {
|
|||
|
||||
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.carts.length);
|
||||
$('.offcanvas-right-cart-count').html(res.data.quantity);
|
||||
var html = '';
|
||||
res.data.carts.forEach(function (e) {
|
||||
html += '<div class="product-list d-flex align-items-center">';
|
||||
|
|
@ -2578,7 +2580,7 @@ bk.getCarts = function () {
|
|||
html += '<div class="right flex-grow-1">';
|
||||
html += "<div class=\"name fs-sm fw-bold mb-2\">".concat(e.name, "</div>");
|
||||
html += '<div class="product-bottom d-flex justify-content-between align-items-center">';
|
||||
html += "<div class=\"price\">".concat(e.price_format, "</div>");
|
||||
html += "<div class=\"price\">".concat(e.price_format, " <span class=\"text-muted\">x ").concat(e.quantity, "<span></div>");
|
||||
html += "<span class=\"offcanvas-products-delete\" data-id=\"".concat(e.cart_id, "\"><i class=\"bi bi-x-lg\"></i> \u5220\u9664</span>");
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
|
|
|||
|
|
@ -111,24 +111,23 @@
|
|||
labels: ['新注册', '最近访问', '活跃用户', '近期下单'],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [112, 19, 3, 5, 2, 3],
|
||||
data: [12, 19, 3, 5],
|
||||
// borderRadius: 5,
|
||||
borderWidth: 2,
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)'
|
||||
// 'rgba(153, 102, 255, 0.2)',
|
||||
// 'rgba(255, 159, 64, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255, 99, 132, 1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
// 'rgba(153, 102, 255, 1)',
|
||||
// 'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
borderWidth: 1
|
||||
}]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ $(document).ready(function ($) {
|
|||
|
||||
$http.delete(`/carts/${cartId}`).then((res) => {
|
||||
$this.parents('.product-list').remove()
|
||||
$('.offcanvas-right-cart-count').html(res.data.quantity);
|
||||
$('.offcanvas-right-cart-amount').html(res.data.amount_format);
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -87,7 +89,7 @@ bk.getCarts = function () {
|
|||
|
||||
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.carts.length);
|
||||
$('.offcanvas-right-cart-count').html(res.data.quantity);
|
||||
|
||||
let html = '';
|
||||
res.data.carts.forEach(e => {
|
||||
|
|
@ -96,7 +98,7 @@ bk.getCarts = function () {
|
|||
html += '<div class="right flex-grow-1">';
|
||||
html += `<div class="name fs-sm fw-bold mb-2">${e.name}</div>`;
|
||||
html += '<div class="product-bottom d-flex justify-content-between align-items-center">';
|
||||
html += `<div class="price">${e.price_format}</div>`;
|
||||
html += `<div class="price">${e.price_format} <span class="text-muted">x ${e.quantity}<span></div>`;
|
||||
html += `<span class="offcanvas-products-delete" data-id="${e.cart_id}"><i class="bi bi-x-lg"></i> 删除</span>`;
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
|
|
|||
Loading…
Reference in New Issue