suspend-cart.js
878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* 悬浮购物车
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/1
*/
let $ = require('yoho-jquery');
let $cart = $('#suspend-cart');
require('common');
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');
}
}
});
}
/* tar add 161121 app del suspend cart */
if (window.queryString.app_version || window.queryString.appVersion) {
$('.suspend-cart').css('display', 'none');
}