Authored by 郝肖肖

套餐加入购物车滑动到 新加入购物车商品位置

... ... @@ -348,7 +348,8 @@ Cart = {
var $this = $(this);
var $item = $this.closest('li[data-role="pitem"]');
var content = '<div><i class="iconfont">&#xe68e;</i>移入收藏</div><p>确定要将该商品从购物车中移入收藏夹吗?<br/>移入收藏后该商品将不在购物车中显示</p>';
var content = '<div><i class="iconfont">&#xe68e;</i>移入收藏</div>' +
'<p>确定要将该商品从购物车中移入收藏夹吗?<br/>移入收藏后该商品将不在购物车中显示</p>';
var item = {
product_sku: $item.data('id'),
... ... @@ -373,21 +374,42 @@ Cart = {
var $chk = $(this);
var $item = $chk.closest('li[data-role=pitem]');
var poolId = $item.data('pool-id');
var batchNo = $item.data('batch-no');
if (!$chk.hasClass('cart-item-checked') || !$item.data('id')) {
if (!$chk.hasClass('cart-item-checked') || !$item.data('id') ||
$item.find('.pay-pro').hasClass('is-check')) {
return true;
}
selectArray.push({
product_sku: $item.data('id'),
buy_number: $item.data('productnum'),
promotion_id: $item.data('promotionid') || 0
});
if (poolId && parseInt($item.data('pool-type'), 10) === 3) { // 套餐
$item.closest('.promotion-pool').find('li[data-pool-id="' + poolId + '"]').each(function() {
if (!$(this).data('id')) {
return true;
}
selectArray.push({
activity_id: poolId,
batch_no: batchNo,
product_sku: $(this).data('id'),
buy_number: $(this).data('productnum'),
promotion_id: $(this).data('promotionid') || 0
});
});
} else {
selectArray.push({
product_sku: $item.data('id'),
buy_number: $item.data('productnum'),
promotion_id: $item.data('promotionid') || 0
});
}
});
if (!$.isEmptyObject(selectArray)) {
content = '<div><i class="iconfont">&#xe68e;</i>移入收藏</div><p>确定要将已选中的商品从购物车中移入收藏夹吗?<br/>移入收藏后已选中的商品将不在购物车中显示</p>'; // eslint-disable-line
content = '<div><i class="iconfont">&#xe68e;</i>移入收藏</div>' +
'<p>确定要将已选中的商品从购物车中移入收藏夹吗?' +
'<br/>移入收藏后已选中的商品将不在购物车中显示</p>'; // eslint-disable-line
new RConfirm(content, function() { // eslint-disable-line
capi.cartItemDel(selectArray);
});
... ... @@ -417,7 +439,7 @@ Cart = {
capi.cartItemNumChg($.extend(countJSON, {
sku: $item.data('id'),
batch_no: $item.data('batch-no'),
activity_id: $item.data('pool-id'),
activity_id: $item.data('pool-id')
}));
if (!$btn.hasClass('cart-item-checked')) {
... ... @@ -450,7 +472,12 @@ Cart = {
buyNumber: 1,
promotionId: $li.data('promotionid')
}).then(function() {
var $liDom = $('li[data-id="' + $li.data('id') + '"').eq(0);
$this.removeClass('is-execu');
if ($liDom.length) {
$('html,body').animate({scrollTop: ($liDom.offset().top - 10) + 'px'}, 500);
}
});
},
reFav: function() {
... ...
... ... @@ -302,8 +302,11 @@
}
}
.is-check i.cart-item-check {
visibility: hidden !important;
.is-check {
i.cart-item-check,
i.cart-item-disabled {
visibility: hidden !important;
}
}
.cart-label {
... ...