...
|
...
|
@@ -32,7 +32,7 @@ var $chosePanel = $('#chose-panel'), |
|
|
$sizeRowList,
|
|
|
cbFn,
|
|
|
$allChoseItems,
|
|
|
$yohoPage= $('.yoho-page');
|
|
|
$yohoPage = $('.yoho-page');
|
|
|
|
|
|
//初始化购物车面板显示
|
|
|
function init() {
|
...
|
...
|
@@ -44,7 +44,7 @@ function init() { |
|
|
$imgsThumb = $('.chose-panel').find('.thumb'),
|
|
|
$allChoseItems = $('.chose-items'),
|
|
|
$sizeRowList = $('.size-list ul'),
|
|
|
$leftNum = $('#left-num')
|
|
|
$leftNum = $('#left-num'),
|
|
|
$firstRow = $sizeRowList.eq(0);
|
|
|
$firstRow.toggleClass('hide');
|
|
|
$curSizeRow = $firstRow;
|
...
|
...
|
@@ -70,18 +70,13 @@ function show(html, cb) { |
|
|
init();
|
|
|
}
|
|
|
$('.chose-panel').show();
|
|
|
|
|
|
//$('body').css('overflow', 'hidden');
|
|
|
$num = $('#good-num');
|
|
|
|
|
|
cbFn = cb;
|
|
|
}
|
|
|
|
|
|
//隐藏当前Panel
|
|
|
function hide() {
|
|
|
$('.chose-panel').hide();
|
|
|
//$('body').css('overflow', 'auto');
|
|
|
|
|
|
cbFn = null;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -141,7 +136,7 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) { |
|
|
var $this = $(this),
|
|
|
index,
|
|
|
curSizeBlock,
|
|
|
$preSizeBlock,
|
|
|
$preSiblingBlock,
|
|
|
scindex,
|
|
|
curGoodNum;
|
|
|
|
...
|
...
|
@@ -151,7 +146,7 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) { |
|
|
index = $this.index();
|
|
|
|
|
|
$preSiblingBlock = $siblingBlock.find('.chosed');
|
|
|
scindex = $preSizeBlock.index();
|
|
|
scindex = $preSiblingBlock.index();
|
|
|
$curSizeRow = $sizeRowList.eq(index);
|
|
|
|
|
|
// 当前颜色已经是选中状态,再点击时
|
...
|
...
|
@@ -171,12 +166,13 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) { |
|
|
$curSizeRow.removeClass('hide').addClass('show');
|
|
|
|
|
|
// 之前选中的尺码去掉勾选样式
|
|
|
if ($preSizeBlock.length > 0) {
|
|
|
$preSizeBlock.removeClass('chosed');
|
|
|
if ($preSiblingBlock.length > 0) {
|
|
|
$preSiblingBlock.removeClass('chosed');
|
|
|
|
|
|
}
|
|
|
|
|
|
curSizeBlock = $curSizeRow.children().get(scindex);
|
|
|
|
|
|
// 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在)
|
|
|
if (curSizeBlock) {
|
|
|
curGoodNum = $(curSizeBlock).data('num');
|
...
|
...
|
@@ -257,7 +253,7 @@ $yohoPage.on('touchstart', '.size-list .block', function(e) { |
|
|
|
|
|
});
|
|
|
|
|
|
$yohoPage.on('touchstart','.btn-minus', function() {
|
|
|
$yohoPage.on('touchstart', '.btn-minus', function() {
|
|
|
var num = parseInt($num.val(), 10);
|
|
|
|
|
|
leftNum = $('#left-num').val();
|
...
|
...
|
@@ -341,7 +337,7 @@ $yohoPage.on('touchstart','.btn-minus', function() { |
|
|
confirming = false;
|
|
|
hide();
|
|
|
|
|
|
if (cbFb) {
|
|
|
if (cbFn) {
|
|
|
cbFn(res.location);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -355,7 +351,7 @@ $yohoPage.on('touchstart','.btn-minus', function() { |
|
|
});
|
|
|
}
|
|
|
|
|
|
});;
|
|
|
});
|
|
|
|
|
|
exports.init = init;
|
|
|
exports.show = show; |
...
|
...
|
|