Authored by 梁志锋

加价购链接改成hammer

... ... @@ -14,6 +14,8 @@ var chosePanel = require('./chose-panel'),
var $cartContent = $('.cart-content');
var navHammer,
advanceBuyHammer,
freebieHammer,
cartType = $('#cartType').val();
var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
... ... @@ -56,13 +58,27 @@ if ($('.cart-nav').length > 0) {
}, 3000);
}
$('.advance-buy').on('touchend', function() {
if ($('.advance-buy').length > 0) {
advanceBuyHammer = new Hammer(document.getElementsByClassName('advance-buy')[0]);
advanceBuyHammer.on('tap', function(e) {
window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
});
});
}
$('.freebie').on('touchend', function() {
if ($('.freebie').length > 0) {
freebieHammer = new Hammer(document.getElementsByClassName('freebie')[0]);
freebieHammer.on('tap', function(e) {
window.location.href = '/cart/index/gift?cartType=' + cartType;
});
});
}
//$('.advance-buy').on('touchend', function() {
// window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
//});
//
//$('.freebie').on('touchend', function() {
// window.location.href = '/cart/index/gift?cartType=' + cartType;
//});
$('.btn-balance').on('touchend', function() {
if ($('.low-stocks').length > 0) {
... ... @@ -78,8 +94,6 @@ $('.btn-balance').on('touchend', function() {
});
$('.chose').on('touchend', function() {
//var id = $(this).closest('.gift-advance-good').data('id');
chosePanel.show();
});
... ...
... ... @@ -208,11 +208,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
curColorIndex = index;
$('#good-num').val(1);
// 设置按钮的样式和文字
updateConformButtonClassAndText();
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor();
// 设置按钮的样式和文字
updateConformButtonClassAndText();
}).on('touchstart', '.size-list .block', function() {
var $this = $(this),
index,
... ... @@ -232,11 +232,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$allChoseItems.find('.num .left-num').html('');
$('#left-num').val(0);
hasChooseSize = false;
curSizeIndex = null;
$curSizeBlock = null;
// 当前尺码不是选中状态,选中时
} else {
hasChooseSize = true;
curGoodNum = $this.data('num');
// 之前选中的尺码去掉勾选样式
... ... @@ -253,18 +254,21 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$('#left-num').val(0);
}
if (curGoodNum === 0 && hasChooseColor) {
$this.addClass('zero-stock');
}
$this.toggleClass('chosed');
curSizeIndex = index;
$curSizeBlock = $this;
$('#good-num').val(1);
}
// 设置按钮的样式和文字
updateConformButtonClassAndText();
$this.toggleClass('chosed');
$('#good-num').val(1);
// 重置颜色块的样式
resetColorZeroStock($siblingBlock);
// 设置按钮的样式和文字
updateConformButtonClassAndText();
});
$yohoPage.on('touchstart', '.btn-minus', function() {
... ... @@ -281,7 +285,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return;
}
if (num < 0) {
tip.show('您选择的数量不能为~');
tip.show('您选择的数量不能为负数~');
return;
}
... ... @@ -295,7 +299,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return;
}
if (num - 0 === leftNum || 0 === leftNum) {
return;
}
... ...