...
|
...
|
@@ -21,13 +21,13 @@ var panelTmpl, |
|
|
re = /\d+/,
|
|
|
leftNum,
|
|
|
$sizeList,
|
|
|
colorIndex,
|
|
|
confirming,
|
|
|
hasChooseColor = false,
|
|
|
hasChooseSize = false,
|
|
|
curColorIndex,
|
|
|
curSizeIndex,
|
|
|
$curSizeRow,
|
|
|
$curSizeBlock = null,
|
|
|
$sizeRowList = $('.size-list ul');
|
|
|
|
|
|
// 读取模板
|
...
|
...
|
@@ -102,7 +102,7 @@ $('.color-list').on('touchstart', '.block', function(e) { |
|
|
curSelectedSizeBlock,
|
|
|
$sizeChosed,
|
|
|
scindex,
|
|
|
i;
|
|
|
curGoodNum;
|
|
|
|
|
|
var $siblingBlock = $this.closest('.block-list').siblings(':first');
|
|
|
|
...
|
...
|
@@ -141,11 +141,11 @@ $('.color-list').on('touchstart', '.block', function(e) { |
|
|
// 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在)
|
|
|
curSelectedSizeBlock = $curSizeRow.children().get(scindex);
|
|
|
if (curSelectedSizeBlock) {
|
|
|
var curGoodNum = $(curSelectedSizeBlock).data('num');
|
|
|
curGoodNum = $(curSelectedSizeBlock).data('num');
|
|
|
$(curSelectedSizeBlock).addClass('chosed');
|
|
|
|
|
|
//如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式
|
|
|
if(curGoodNum > 0) {
|
|
|
if (curGoodNum > 0) {
|
|
|
$that.find('.num .left-num').html('剩余' + curGoodNum + '件');
|
|
|
} else {
|
|
|
$(curSelectedSizeBlock).removeClass('zero-stock').addClass('zero-stock');
|
...
|
...
|
@@ -234,12 +234,10 @@ $('.color-list').on('touchstart', '.block', function(e) { |
|
|
$('.size-list').on('touchstart', '.block', function(e) {
|
|
|
var $this = $(this),
|
|
|
$that = $(e.target).closest('.chose-items'),
|
|
|
numArray,
|
|
|
index,
|
|
|
curSelectedSizeBlock,
|
|
|
$colorChosed,
|
|
|
selectedColorindex,
|
|
|
i;
|
|
|
curGoodNum;
|
|
|
|
|
|
var $siblingBlock = $this.closest('.block-list').siblings(':first');
|
|
|
|
...
|
...
|
@@ -266,15 +264,15 @@ $('.size-list').on('touchstart', '.block', function(e) { |
|
|
} else {
|
|
|
hasChooseSize = true;
|
|
|
|
|
|
var curGoodNum = $this.data('num');
|
|
|
curGoodNum = $this.data('num');
|
|
|
|
|
|
// 之前选中的尺码去掉勾选样式
|
|
|
if (preSelectedSizeBlock) {
|
|
|
$(preSelectedSizeBlock).removeClass('chosed');
|
|
|
if ($curSizeBlock) {
|
|
|
$curSizeBlock.removeClass('chosed');
|
|
|
}
|
|
|
|
|
|
// 如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式, 否则显示剩余件数
|
|
|
if(curGoodNum > 0) {
|
|
|
if (curGoodNum > 0) {
|
|
|
$that.find('.num .left-num').html('剩余' + curGoodNum + '件');
|
|
|
} else {
|
|
|
$colorChosed.removeClass('zero-stock').addClass('zero-stock');
|
...
|
...
|
@@ -284,6 +282,7 @@ $('.size-list').on('touchstart', '.block', function(e) { |
|
|
|
|
|
$this.toggleClass('chosed');
|
|
|
curSizeIndex = index;
|
|
|
$curSizeBlock = $this;
|
|
|
|
|
|
// 设置按钮的样式和文字
|
|
|
$chosed = $('.chose-items').find('.chosed');
|
...
|
...
|
|