...
|
...
|
@@ -58,21 +58,51 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { |
|
|
}).on('touchstart', '#chose-btn-sure', function() {
|
|
|
|
|
|
//确定
|
|
|
}).on('touchstart', '.block', function() {
|
|
|
}).on('touchstart', '.block', function(e) {
|
|
|
|
|
|
//尺寸颜色点选
|
|
|
var $this = $(this);
|
|
|
|
|
|
if ($this.hasClass('.chosed') || $this.hasClass('disable')) {
|
|
|
var $this = $(this),
|
|
|
$that = $(e.target).closest('.chose-items'),
|
|
|
numArray,
|
|
|
index;
|
|
|
|
|
|
if ($this.hasClass('chosed')) {
|
|
|
$this.parent().find('.block').removeClass('chosed');
|
|
|
$that.find('.num .left-num').html('');
|
|
|
} else if ($this.hasClass('disable')) {
|
|
|
$this.css('background-color', '#000');
|
|
|
return;
|
|
|
} else if (!$this.hasClass('chosed')) {
|
|
|
$this.siblings('.chosed').removeClass('chosed');
|
|
|
$this.addClass('chosed');
|
|
|
index = $this.index();
|
|
|
|
|
|
|
|
|
//根据颜色切换图片
|
|
|
if ($this.closest('.block-list').hasClass('color-list')) {
|
|
|
$('.chose-panel .basic-info').find('.thumb').addClass('hide').eq(index).removeClass('hide');
|
|
|
}
|
|
|
|
|
|
//剩余的商品数
|
|
|
if ($that.find('.color-list ul>li').hasClass('chosed') && $that.find('.size-list ul>li').hasClass('chosed')) {
|
|
|
numArray = $this.closest('.block-list').siblings(':first').find('.chosed').data('numstr').split('/');
|
|
|
$that.find('.num .left-num').html('剩余' + numArray[index] + '件');
|
|
|
} else {
|
|
|
$that.find('.num .left-num').html('');
|
|
|
}
|
|
|
|
|
|
//点击切换
|
|
|
}
|
|
|
|
|
|
$this.siblings('.chosed').removeClass('chosed');
|
|
|
$this.addClass('chosed');
|
|
|
}).on('touchstart', '.btn-minus', function() {
|
|
|
var num = +$num.val();
|
|
|
|
|
|
if (num === 1) {
|
|
|
//若颜色和尺码没有被同时选中,则不能点击
|
|
|
if ($('.block-list>ul>li.chosed').length < 2) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (num === 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -80,6 +110,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { |
|
|
}).on('touchstart', '.btn-plus', function() {
|
|
|
var num = +$num.val();
|
|
|
|
|
|
//若颜色和尺码没有被同时选中,则不能点击
|
|
|
if ($('.block-list>ul>li.chosed').length < 2) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//TODO:库存数验证
|
|
|
$num.val(num + 1);
|
|
|
});
|
...
|
...
|
|