suspend-cart.js
695 Bytes
/**
* 悬浮购物车
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/1
*/
let $ = require('yoho-jquery');
let $cart = $('#suspend-cart');
if ($('#remove-cart-count').length) {
$.ajax({
type: 'GET',
url: '/cart/index/count',
success: function(data) {
let count;
if (data.code === 200) {
count = data.data.cart_goods_count;
if (count > 99) {
count = '99+';
}
if (count === 0) {
$('.cart-count').remove();
}
$cart.find('.cart-count').html(count).removeClass('hide');
}
}
});
}