Authored by 梁志锋

优化尺码颜色选择

... ... @@ -118,6 +118,26 @@ function updateConformButtonClassAndText() {
}
}
//显示剩余件数
function displayGoodNum(curGoodNum) {
//数量大于0
if (curGoodNum > 0) {
if ($soonSoldOut.length > 0) {
$allChoseItems.find('.num .left-num').html('即将售罄');
} else {
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
}
$leftNum.val(curGoodNum);
//数量小于0
} else {
$allChoseItems.find('.num .left-num').html('');
$leftNum.val(0);
}
}
init();
$yohoPage.on('touchstart', '.chose-panel', function(e) {
... ... @@ -187,23 +207,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$curSizeBlock.addClass('chosed');
}
//数量大于0
if (curGoodNum > 0) {
if ($soonSoldOut.length > 0) {
$allChoseItems.find('.num .left-num').html('即将售罄');
} else {
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
}
$leftNum.val(curGoodNum);
//数量小于0
} else {
$allChoseItems.find('.num .left-num').html('');
$leftNum.val(0);
}
}
// 显示剩余数量
displayGoodNum(curGoodNum);
// 尺码行当前行隐藏
$sizeRowList.eq(curSizeIndex).removeClass('show').addClass('hide');
... ... @@ -271,30 +279,16 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 之前选中的颜色去掉勾选样式,新颜色块勾选
if ($curColorBlock && $curColorBlock.length > 0) {
$curColorBlock.removeClass('chosed');
//curColorBlock = $colorRowList.eq(curColorIndex + 1).children().get(curSizeIndex - 1);
curColorBlock = $colorRowList.eq(index + 1).children().get(curSizeIndex - 1);
$curColorBlock = $(curColorBlock);
curGoodNum = $curColorBlock.data('num');
$curColorBlock.addClass('chosed');
}
//数量大于0
if (curGoodNum > 0) {
if ($soonSoldOut.length > 0) {
$allChoseItems.find('.num .left-num').html('即将售罄');
} else {
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
}
$leftNum.val(curGoodNum);
//数量小于0
} else {
$allChoseItems.find('.num .left-num').html('');
$leftNum.val(0);
}
}
// 显示剩余数量
displayGoodNum(curGoodNum);
// 颜色当前行隐藏
$colorRowList.eq(curColorIndex).removeClass('show').addClass('hide');
... ...