...
|
...
|
@@ -38,7 +38,8 @@ var $cartGoodsDetail = $('#goodsTogetherDetail'), |
|
|
selectArray,
|
|
|
shopNumAll,
|
|
|
confirm,
|
|
|
hasPromotion = false;
|
|
|
hasPromotion = false,
|
|
|
$sellBox = $('.cart-table .pre-sell-box');
|
|
|
|
|
|
// 优惠券 显示和隐藏
|
|
|
$('.sale-info').mouseenter(function() {
|
...
|
...
|
@@ -198,10 +199,66 @@ function loadSlideGoods() { |
|
|
}
|
|
|
loadSlideGoods();
|
|
|
|
|
|
|
|
|
|
|
|
$(function() {
|
|
|
$('.bottom-tab .change').click(function() {
|
|
|
$('.img-brand-switch .next').trigger('click');
|
|
|
});
|
|
|
|
|
|
// 判断商品是否已收藏,是否全选
|
|
|
function isCheckFav() {
|
|
|
var pidArray = [],
|
|
|
isAllCheck = true;
|
|
|
|
|
|
$sellBox.each(function() {
|
|
|
var $checkItem = $(this).find('.cart-item-check');
|
|
|
//有一个没选中,跳出循环
|
|
|
if (!$checkItem.hasClass('cart-item-checked')) {
|
|
|
isAllCheck = false;
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (isAllCheck) {
|
|
|
//头部全选
|
|
|
$('.cart-title .cart-item-check').addClass('cart-item-checked');
|
|
|
//底部全选
|
|
|
$('#cbSelAllGoods').addClass('cart-item-checked');
|
|
|
}
|
|
|
|
|
|
$sellBox.each(function () {
|
|
|
pidArray.push($(this).data('pid'));
|
|
|
});
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/cart/index/checkFav',
|
|
|
data: {
|
|
|
pidList: pidArray.join(',')
|
|
|
}
|
|
|
}).then(function(result) {
|
|
|
$.each(result.data,function(pid,obj) {
|
|
|
|
|
|
if (obj.code !== 200) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (obj.data) {
|
|
|
$sellBox.each(function () {
|
|
|
|
|
|
if (String($(this).data('pid')) === String(pid)) {
|
|
|
$(this).find('.cart-col-btn').addClass('has-col-btn').html('已收藏');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
isCheckFav();
|
|
|
});
|
|
|
|
|
|
// ----------------底部 为你优选,最近浏览 end--------------
|
...
|
...
|
|