Authored by Lynnic

购物车逻辑修改

... ... @@ -117,6 +117,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
$('.num-tag').html(numInCart + buyNumber);
$('.num-tag').removeClass('hide');
confirming = false;
tip.show('选择成功');
remove();
}
}).fail(function() {
... ... @@ -147,14 +148,21 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
}
if ($chosed.length === 0) {
$this.closest('ul>li').each(function() {
$colorList.each(function() {
$(this).removeClass('zero-stock');
if (0 === $(this).data('num') - 0) {
$(this).addClass('zero-stock');
}
});
$siblingBlock.find('ul>li').each(function() {
$sizeList.each(function() {
colorIndex = $(this).data('colorid');
if (colorIndex === firstColorId) {
$(this).removeClass('hide');
}
});
$sizeList.not('.hide').each(function() {
$(this).removeClass('zero-stock');
if (0 === $(this).data('num') - 0) {
$(this).addClass('zero-stock');
... ... @@ -178,7 +186,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
$siblingBlock.find('.block').removeClass('zero-stock');
for (i = 0; i < numArray.length; i++) {
if (0 === numArray[i] - 0) {
$siblingBlock.find('.block').eq(i).addClass('zero-stock');
$siblingBlock.find('.block').not('.hide').eq(i).addClass('zero-stock');
}
}
} else if ($chosed.length === 1 && !$this.hasClass('chosed')) {
... ...