Authored by hf

code review by hf: merge master code to develop

... ... @@ -5380,6 +5380,7 @@ var $chosePanel = $('#chose-panel'),
queryString,
$yohoPage = $('.yoho-page');
//初始化购物车面板显示
function init() {
hasChooseColor = false;
... ... @@ -5408,7 +5409,19 @@ function checkColorSizeNum() {
return true;
}
function show(html, cb) {
var scrollPosition = [
document.documentElement.scrollLeft || document.body.scrollLeft,
document.documentElement.scrollTop || document.body.scrollTop
],
$html = $('html'); // it would make more sense to apply this to body, but IE7 won't have that
$html.data('scroll-position', scrollPosition);
$html.data('previous-overflow', $html.css('overflow'));
$html.css('overflow', 'hidden');
window.scrollTo(scrollPosition[0], scrollPosition[1]);
if (html) {
$chosePanel.html(html);
if ($('#promotionId').val() !== '') {
... ... @@ -5424,6 +5437,12 @@ function show(html, cb) {
//隐藏当前Panel
function hide() {
var $html = $('html'),
scrollPosition = $html.data('scroll-position');
// un-lock scroll position
$html.css('overflow', $html.data('previous-overflow'));
window.scrollTo(scrollPosition[0], scrollPosition[1]);
$('.chose-panel').hide();
}
... ... @@ -6496,7 +6515,7 @@ optHammer.on('tap', function(e) {
}
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
if ($.type(res) !== 'object') {
return;
}
if (res.message) {
... ... @@ -6525,7 +6544,7 @@ optHammer.on('tap', function(e) {
}
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
if ($.type(res) !== 'object') {
return;
}
if (res.message) {
... ... @@ -8775,15 +8794,16 @@ if ($('.freebie').length > 0) {
}
$('.btn-balance').on('touchend', function() {
if (shouldSelectGift()) {
showChooseGifDialog();
return false;
}
if (shouldLowStocks()) {
tip.show('库存不足无法结算');
return false;
}
if (shouldSelectGift()) {
showChooseGifDialog();
return false;
}
if (hasChecked) {
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
} else {
... ... @@ -9007,6 +9027,10 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
//全选按钮点击事件
$selectAllBtn.on('touchend', function() {
if ($('.low-stocks').length > 0) {
tip.show('所选商品中含有库存不足的商品');
return false;
}
bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), $('#cartType').val(), didUpdateAllGoodsCheckStatus);
});
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.