Authored by 梁志锋

购物车切换

... ... @@ -5,7 +5,6 @@
*/
var $ = require('jquery'),
lazyLoad = require('yoho.lazyload'),
Hammer = require('yoho.hammer');
var chosePanel = require('./chose-panel'),
... ... @@ -40,9 +39,15 @@ function shouldSelectGift() {
}
function shouldLowStocks() {
var $lowStocks = $('.low-stocks'),
var $lowStocks,
result = false;
if ('ordinary' === cartType) {
$lowStocks = $('.common .low-stocks');
} else if ('advance' === cartType) {
$lowStocks = $('.presell .low-stocks');
}
if ($lowStocks.length <= 0) {
return result;
}
... ... @@ -73,7 +78,7 @@ function showChooseGifDialog() {
require('./good');
lazyLoad($('img.lazy'));
//lazyLoad($('img.lazy'));
if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) {
$('#presell-tip').removeClass('show').addClass('hide');
... ... @@ -151,7 +156,7 @@ if ($('.freebie').length > 0) {
$('.btn-balance').on('touchend', function() {
if (shouldLowStocks()) {
tip.show('库存不足无法结算');
tip.show('所选商品中含有库存不足的商品');
return false;
}
... ...
... ... @@ -192,13 +192,22 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
//全选按钮点击事件
$selectAllBtn.on('touchend', function() {
var isSelect = $(this).hasClass('icon-cb-checked');
var cartType = $('#cartType').val(),
isSelect = $(this).hasClass('icon-cb-checked');
if (!isSelect && $('.low-stocks').length > 0) {
tip.show('所选商品中含有库存不足的商品');
return false;
if ('ordinary' === cartType) {
if (!isSelect && $('.common .low-stocks').length > 0) {
tip.show('所选商品中含有库存不足的商品');
return false;
}
} else if ('advance' === cartType) {
if (!isSelect && $('.presell .low-stocks').length > 0) {
tip.show('所选商品中含有库存不足的商品');
return false;
}
}
bottomCheckBoxHandeler(isSelect, $('#cartType').val(), didUpdateAllGoodsCheckStatus);
bottomCheckBoxHandeler(isSelect, cartType, didUpdateAllGoodsCheckStatus);
});
$('.down').on('touchend', function() {
... ...