suspend-cart.js 881 Bytes
/**
 * 悬浮购物车
 * @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');
}