Authored by Lynnic

购物车逻辑修改

... ... @@ -17,14 +17,15 @@ var $num,
leftNum,
$colorList = $('.color-list ul>li'),
$sizeList = $('.size-list ul>li'),
firstColorId = $colorList.eq(0).data('id');
firstColorId = $colorList.eq(0).data('id'),
colorIndex;
//初始化购物车面板显示
$sizeList.each(function() {
var id = $(this).data('colorid');
colorIndex = $(this).data('colorid');
if (id === firstColorId) {
if (colorIndex === firstColorId) {
$(this).removeClass('hide');
}
});
... ... @@ -149,6 +150,19 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
}
});
} else if ($chosed.length === 1 && $this.hasClass('chosed')) {
if ($this.closest('.block-list').hasClass('color-list')) {
$sizeList.addClass('hide');
//切换尺码信息
$sizeList.each(function() {
colorIndex = $(this).data('colorid');
if (colorIndex === $this.data('id')) {
$(this).removeClass('hide');
}
});
}
numArray = $chosed.data('numstr').split('/');
$siblingBlock.find('.block').removeClass('zero-stock');
for (i = 0; i < numArray.length; i++) {
... ...