...
|
...
|
@@ -61,6 +61,20 @@ function init() { |
|
|
$curSizeRow = $firstRow;
|
|
|
}
|
|
|
|
|
|
function checkColorSizeNum() {
|
|
|
if (!hasChooseColor && !hasChooseSize) {
|
|
|
tip.show('请选择颜色和尺码~');
|
|
|
return false;
|
|
|
} else if (!hasChooseColor){
|
|
|
tip.show('请选择颜色~');
|
|
|
return false;
|
|
|
} else if (!hasChooseSize){
|
|
|
tip.show('请选择尺码~');
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
init();
|
|
|
|
|
|
function show(data) {
|
...
|
...
|
@@ -84,7 +98,7 @@ function hide() { |
|
|
$('body').css('overflow', 'auto');
|
|
|
}
|
|
|
|
|
|
$('.yoho-page').on('touchstart', '.chose-panel', function(e) {
|
|
|
$('.yoho-page').on('touchstart', '.infos', function(e) {
|
|
|
var $cur = $(e.target);
|
|
|
|
|
|
if ($cur.closest('.main').length > 0) {
|
...
|
...
|
@@ -131,15 +145,15 @@ $('.color-list').on('touchstart', '.block', function(e) { |
|
|
|
|
|
//把当前选中颜色对应的尺码那一行显示出来
|
|
|
$sizeRowList.addClass('hide');
|
|
|
$curSizeRow.toggleClass('hide');
|
|
|
$curSizeRow.removeClass('hide').addClass('show');
|
|
|
|
|
|
// 之前选中的尺码去掉勾选样式
|
|
|
if ($sizeChosed) {
|
|
|
if ($sizeChosed.length > 0) {
|
|
|
$sizeChosed.removeClass('chosed');
|
|
|
curSelectedSizeBlock = $curSizeRow.children().get(scindex);
|
|
|
}
|
|
|
|
|
|
// 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在)
|
|
|
curSelectedSizeBlock = $curSizeRow.children().get(scindex);
|
|
|
if (curSelectedSizeBlock) {
|
|
|
curGoodNum = $(curSelectedSizeBlock).data('num');
|
|
|
$(curSelectedSizeBlock).addClass('chosed');
|
...
|
...
|
@@ -256,7 +270,7 @@ $('.size-list').on('touchstart', '.block', function(e) { |
|
|
hasChooseSize = false;
|
|
|
|
|
|
// 去掉已经选中颜色的 数量为0的样式
|
|
|
if ($colorChosed) {
|
|
|
if ($colorChosed.length > 0) {
|
|
|
$colorChosed.removeClass('zero-stock').addClass('zero-stock');
|
|
|
}
|
|
|
|
...
|
...
|
@@ -362,11 +376,9 @@ $('.size-list').on('touchstart', '.block', function(e) { |
|
|
|
|
|
$('.btn-minus').on('touchstart', function() {
|
|
|
var num = $num.val(),
|
|
|
$chosed = $('.block-list>ul>li.chosed'),
|
|
|
leftNum = re.exec($('.num .left-num').html());
|
|
|
|
|
|
//若颜色和尺码没有被同时选中,则不能点击
|
|
|
if ($chosed.length < 2) {
|
|
|
if (!checkColorSizeNum()) {
|
|
|
return;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -380,11 +392,10 @@ $('.btn-minus').on('touchstart', function() { |
|
|
$('.btn-plus').on('touchstart', function() {
|
|
|
var num = $num.val();
|
|
|
|
|
|
//若颜色和尺码没有被同时选中,则不能点击
|
|
|
if ($('.block-list>ul>li.chosed').length < 2) {
|
|
|
tip.show('请选择颜色和尺码~');
|
|
|
if (!checkColorSizeNum()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
leftNum = re.exec($('.num .left-num').html());
|
|
|
if (num - 0 === leftNum - 0 || 0 === leftNum - 0) {
|
|
|
return;
|
...
|
...
|
@@ -401,10 +412,19 @@ $('#chose-btn-sure').on('touchend', function() { |
|
|
|
|
|
promotionId,
|
|
|
isEdit = 0,
|
|
|
numInCart = $('.num-tag').html() - 0;
|
|
|
numInCart = $('.num-tag').html() - 0,
|
|
|
num = $num.val();
|
|
|
|
|
|
if (!checkColorSizeNum()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// goodsType,
|
|
|
// isEdit;
|
|
|
leftNum = re.exec($('.num .left-num').html());
|
|
|
|
|
|
if (num > leftNum) {
|
|
|
tip.show('您选择的数量超过了最大库存量~');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$chosed = $('.block-list>ul>li.chosed');
|
|
|
|
...
|
...
|
|