Authored by 郝肖肖

套餐去除隐藏选中的情况

... ... @@ -68,6 +68,10 @@ function toggleAll(obj, roleType) {
var $t = $(this);
var poolId = $t.data('pool-id');
if ($t.find('[data-role=cart-item-check]').is(':hidden')) {
return true;
}
if (poolId && parseInt($t.data('pool-type'), 10) === 3) { // 套餐
$t.closest('.promotion-pool').find('li[data-pool-id="' + poolId + '"]').each(function() {
if (!$(this).data('id')) {
... ... @@ -174,7 +178,7 @@ Cart = {
var $item = $this.closest('li[data-role="pitem"]');
var selectArray = [];
var content = '<div><i class="iconfont">&#xe684;</i>删除商品</div><p>确定要从购物车中删除该商品?</p>';
var countJSON;
var countJSON = [];
var poolId = $item.data('pool-id');
// 套餐删除
... ... @@ -199,19 +203,19 @@ Cart = {
});
if (!$this.data('gift') && !$item.hasClass('tr-disabled')) {
countJSON = {
countJSON.push({
productPrice: $item.find('.product-price').text(),
productTitle: $item.find('.pay-pro-info a').text(),
link: $item.find('.pay-pro-info a').attr('href'),
productNum: $item.data('productnum'),
productSku: $item.data('id'),
promotionId: $item.data('promotionid')
};
});
}
}
new RConfirm(content, function() {
capi.cartItemDel(selectArray, true, countJSON ? [countJSON] : '');
capi.cartItemDel(selectArray, true, countJSON);
});
},
delAll: function() {
... ... @@ -226,7 +230,7 @@ Cart = {
var $item = $chk.closest('[data-role=pitem]');
var poolId = $item.data('pool-id');
if (!$chk.hasClass('cart-item-checked')) {
if (!$chk.hasClass('cart-item-checked') || $chk.is(':hidden')) {
return true;
}
... ... @@ -282,6 +286,10 @@ Cart = {
var $item = $(this);
var poolId = $item.data('pool-id');
if ($item.find('[data-role=cart-item-check]').is(':hidden')) {
return true;
}
if (poolId && parseInt($item.data('pool-type'), 10) === 3) {
$item.closest('.promotion-pool').find('li[data-pool-id="' + poolId + '"]').each(function() {
... ...
... ... @@ -165,7 +165,6 @@ function choiceOut(items) {
}
}).then(function(d) {
if (d.code === 200) {
// window.history.go(0);
refreshCart(d.data);
}
}).always(function() {
... ... @@ -206,13 +205,6 @@ function cartItemDel(items, type, cookieList, isReFav) {
}
}).then(function(d) {
if (d.code === 200) {
/* if (cookieList) {
window.setCookie('cart-del-list', JSON.stringify(cookieList), {
domain: '.yohobuy.com',
path: '/'
});
}*/
// window.history.go(0);
refreshCart(d.data);
} else if (d.code === 300) {
new Alert(d.message).show();
... ... @@ -246,7 +238,6 @@ cartItemNumChg = (function() {
}).then(function(d) {
if (d.code === 200) {
// window.history.go(0);
refreshCart(d.data);
} else {
new Alert(d.message === '' ? '加入购物车失败哦~~' : d.message).show();
... ... @@ -278,8 +269,6 @@ function addcart(data, cookieList) {
}).then(function(d) {
if (d.code === 200) {
// window.history.go(0);
refreshCart(d.data);
if (cookieList) {
window.setCookie('cart-del-list', JSON.stringify(cookieList), {
... ... @@ -349,7 +338,6 @@ function parseProductInfo(productInfo, defaultInfo) {
for (sizeIdx = 0; sizeIdx < curSize.length; sizeIdx++) {
if (curColor.hasActiveColor && curSize[sizeIdx].sku === defaultInfo.sku) {
// console.log(curSize[sizeIdx]);
curSize[sizeIdx].sizeActive = true;
break;
}
... ... @@ -388,7 +376,6 @@ function updateCartItem(newSku, oldSku) {
}
}).then(function(d) {
if (d.code === 200) {
// window.history.go(0);
refreshCart(d.data);
} else {
new Alert(d.message === '' ? '修改商品失败哦~~' : d.message).show();
... ... @@ -408,7 +395,6 @@ function updateCartGiftItem(promotionId, newSkn, newSku) {
}
}).then(function(d) {
if (d.code === 200) {
// window.history.go(0);
refreshCart(d.data);
} else {
new Alert(d.message === '' ? '修改商品失败哦~~' : d.message).show();
... ...
... ... @@ -118,12 +118,12 @@ function Dialog(options) {
Dialog.prototype.close = function() {
this.$mask && this.$mask.addClass('hide');
this.$el.remove();
this.$el && this.$el.remove();
};
Dialog.prototype.show = function() {
this.$mask && this.$mask.removeClass('hide');
this.$el.removeClass('hide').css({
this.$el && this.$el.removeClass('hide').css({
'margin-top': -this.$el.outerHeight() / 2,
'margin-left': -this.$el.outerWidth() / 2
});
... ...
... ... @@ -527,7 +527,7 @@
text-align: right;
}
&:nth-child(1) {
&:first-child {
padding-left: 20px;
}
}
... ...