...
|
...
|
@@ -133,10 +133,17 @@ function displayGoodNum(curGoodNum) { |
|
|
}
|
|
|
|
|
|
//老的选中尺码去掉勾选,新的选中尺码加上勾选
|
|
|
function changeSizeChosed(oldSizeIndex) {
|
|
|
function changeSizeChosed(newSizeIndex) {
|
|
|
if (curColorIndex && $curSizeBlock && $curSizeBlock.length > 0) {
|
|
|
$curSizeBlock.removeClass('chosed');
|
|
|
$curSizeBlock = $($sizeRowList.eq(oldSizeIndex).children().get(curColorIndex - 1));
|
|
|
var sizes = $sizeRowList.eq(newSizeIndex).children();
|
|
|
for(var i = 0; i < sizes.length; i++){
|
|
|
if($(sizes[i]).data('name') === $curSizeBlock.data('name')){
|
|
|
$curSizeBlock = $(sizes[i]);
|
|
|
curColorIndex = $("#" + $curSizeBlock.data('name')).data('index');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$curSizeBlock.addClass('chosed');
|
|
|
return $curSizeBlock.data('num');
|
|
|
}
|
...
|
...
|
@@ -144,10 +151,10 @@ function changeSizeChosed(oldSizeIndex) { |
|
|
}
|
|
|
|
|
|
//老的选中颜色去掉勾选,新的选中颜色加上勾选
|
|
|
function changeColorChosed(oldColorIndex) {
|
|
|
function changeColorChosed(newColorIndex) {
|
|
|
if (curSizeIndex && $curColorBlock && $curColorBlock.length > 0) {
|
|
|
$curColorBlock.removeClass('chosed');
|
|
|
$curColorBlock = $($colorRowList.eq(oldColorIndex).children().get(curSizeIndex - 1));
|
|
|
$curColorBlock = $($colorRowList.eq(newColorIndex).children().get(curSizeIndex - 1));
|
|
|
$curColorBlock.addClass('chosed');
|
|
|
return $curColorBlock.data('num');
|
|
|
}
|
...
|
...
|
@@ -195,15 +202,15 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
|
} else {
|
|
|
hasChooseColor = true;
|
|
|
|
|
|
// 尺码行当前行隐藏
|
|
|
$sizeRowList.eq(curSizeIndex).addClass('hide');
|
|
|
|
|
|
//老的选中尺码去掉勾选,新的选中尺码加上勾选
|
|
|
curGoodNum = changeSizeChosed(index + 1);
|
|
|
|
|
|
// 显示剩余数量
|
|
|
displayGoodNum(curGoodNum);
|
|
|
|
|
|
// 尺码行当前行隐藏
|
|
|
$sizeRowList.eq(curSizeIndex).addClass('hide');
|
|
|
|
|
|
//尺码对应行显示
|
|
|
$sizeRowList.eq(index + 1).removeClass('hide');
|
|
|
|
...
|
...
|
@@ -224,6 +231,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
|
}).on('touchstart', '.size-list .block', function() {
|
|
|
var $this = $(this),
|
|
|
index = $this.index(),
|
|
|
colorName,
|
|
|
curGoodNum;
|
|
|
|
|
|
// 当前尺码已经是选中状态,再点击时
|
...
|
...
|
@@ -235,10 +243,10 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
|
hasChooseSize = false;
|
|
|
|
|
|
//当前颜色行隐藏
|
|
|
$colorRowList.eq(curColorIndex).removeClass('show').addClass('hide');
|
|
|
$colorRowList.eq(curColorIndex).addClass('hide');
|
|
|
|
|
|
//目标颜色行显示
|
|
|
$colorRowList.eq(0).removeClass('hide').addClass('show');
|
|
|
$colorRowList.eq(0).removeClass('hide');
|
|
|
|
|
|
curColorIndex = 0;
|
|
|
|
...
|
...
|
@@ -249,17 +257,20 @@ $yohoPage.on('touchstart', '.color-list .block', function() { |
|
|
} else {
|
|
|
hasChooseSize = true;
|
|
|
|
|
|
colorName = $this.data('name');
|
|
|
index = $("#"+colorName).data('index') -1;
|
|
|
|
|
|
// 颜色当前行隐藏
|
|
|
$colorRowList.eq(curColorIndex).addClass('hide');
|
|
|
|
|
|
//老的选中颜色去掉勾选,新的选中颜色加上勾选
|
|
|
curGoodNum = changeColorChosed(index + 1);
|
|
|
|
|
|
// 显示剩余数量
|
|
|
displayGoodNum(curGoodNum);
|
|
|
|
|
|
// 颜色当前行隐藏
|
|
|
$colorRowList.eq(curColorIndex).removeClass('show').addClass('hide');
|
|
|
|
|
|
//颜色对应行显示
|
|
|
$colorRowList.eq(index + 1).removeClass('hide').addClass('show');
|
|
|
$colorRowList.eq(index + 1).removeClass('hide');
|
|
|
|
|
|
curColorIndex = index + 1;
|
|
|
$curSizeBlock = $this;
|
...
|
...
|
|