code review by hf: merge master code to develop
Showing
4 changed files
with
30 additions
and
6 deletions
@@ -5380,6 +5380,7 @@ var $chosePanel = $('#chose-panel'), | @@ -5380,6 +5380,7 @@ var $chosePanel = $('#chose-panel'), | ||
5380 | queryString, | 5380 | queryString, |
5381 | $yohoPage = $('.yoho-page'); | 5381 | $yohoPage = $('.yoho-page'); |
5382 | 5382 | ||
5383 | + | ||
5383 | //初始化购物车面板显示 | 5384 | //初始化购物车面板显示 |
5384 | function init() { | 5385 | function init() { |
5385 | hasChooseColor = false; | 5386 | hasChooseColor = false; |
@@ -5408,7 +5409,19 @@ function checkColorSizeNum() { | @@ -5408,7 +5409,19 @@ function checkColorSizeNum() { | ||
5408 | return true; | 5409 | return true; |
5409 | } | 5410 | } |
5410 | 5411 | ||
5412 | + | ||
5411 | function show(html, cb) { | 5413 | function show(html, cb) { |
5414 | + var scrollPosition = [ | ||
5415 | + document.documentElement.scrollLeft || document.body.scrollLeft, | ||
5416 | + document.documentElement.scrollTop || document.body.scrollTop | ||
5417 | + ], | ||
5418 | + $html = $('html'); // it would make more sense to apply this to body, but IE7 won't have that | ||
5419 | + | ||
5420 | + $html.data('scroll-position', scrollPosition); | ||
5421 | + $html.data('previous-overflow', $html.css('overflow')); | ||
5422 | + $html.css('overflow', 'hidden'); | ||
5423 | + window.scrollTo(scrollPosition[0], scrollPosition[1]); | ||
5424 | + | ||
5412 | if (html) { | 5425 | if (html) { |
5413 | $chosePanel.html(html); | 5426 | $chosePanel.html(html); |
5414 | if ($('#promotionId').val() !== '') { | 5427 | if ($('#promotionId').val() !== '') { |
@@ -5424,6 +5437,12 @@ function show(html, cb) { | @@ -5424,6 +5437,12 @@ function show(html, cb) { | ||
5424 | 5437 | ||
5425 | //隐藏当前Panel | 5438 | //隐藏当前Panel |
5426 | function hide() { | 5439 | function hide() { |
5440 | + var $html = $('html'), | ||
5441 | + scrollPosition = $html.data('scroll-position'); | ||
5442 | + | ||
5443 | + // un-lock scroll position | ||
5444 | + $html.css('overflow', $html.data('previous-overflow')); | ||
5445 | + window.scrollTo(scrollPosition[0], scrollPosition[1]); | ||
5427 | $('.chose-panel').hide(); | 5446 | $('.chose-panel').hide(); |
5428 | } | 5447 | } |
5429 | 5448 | ||
@@ -6496,7 +6515,7 @@ optHammer.on('tap', function(e) { | @@ -6496,7 +6515,7 @@ optHammer.on('tap', function(e) { | ||
6496 | } | 6515 | } |
6497 | }).then(function(res) { | 6516 | }).then(function(res) { |
6498 | $('#dialog-wrapper').hide(); | 6517 | $('#dialog-wrapper').hide(); |
6499 | - if (!res) { | 6518 | + if ($.type(res) !== 'object') { |
6500 | return; | 6519 | return; |
6501 | } | 6520 | } |
6502 | if (res.message) { | 6521 | if (res.message) { |
@@ -6525,7 +6544,7 @@ optHammer.on('tap', function(e) { | @@ -6525,7 +6544,7 @@ optHammer.on('tap', function(e) { | ||
6525 | } | 6544 | } |
6526 | }).then(function(res) { | 6545 | }).then(function(res) { |
6527 | $('#dialog-wrapper').hide(); | 6546 | $('#dialog-wrapper').hide(); |
6528 | - if (!res) { | 6547 | + if ($.type(res) !== 'object') { |
6529 | return; | 6548 | return; |
6530 | } | 6549 | } |
6531 | if (res.message) { | 6550 | if (res.message) { |
@@ -8775,15 +8794,16 @@ if ($('.freebie').length > 0) { | @@ -8775,15 +8794,16 @@ if ($('.freebie').length > 0) { | ||
8775 | } | 8794 | } |
8776 | 8795 | ||
8777 | $('.btn-balance').on('touchend', function() { | 8796 | $('.btn-balance').on('touchend', function() { |
8778 | - if (shouldSelectGift()) { | ||
8779 | - showChooseGifDialog(); | ||
8780 | - return false; | ||
8781 | - } | ||
8782 | if (shouldLowStocks()) { | 8797 | if (shouldLowStocks()) { |
8783 | tip.show('库存不足无法结算'); | 8798 | tip.show('库存不足无法结算'); |
8784 | return false; | 8799 | return false; |
8785 | } | 8800 | } |
8786 | 8801 | ||
8802 | + if (shouldSelectGift()) { | ||
8803 | + showChooseGifDialog(); | ||
8804 | + return false; | ||
8805 | + } | ||
8806 | + | ||
8787 | if (hasChecked) { | 8807 | if (hasChecked) { |
8788 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 8808 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
8789 | } else { | 8809 | } else { |
@@ -9007,6 +9027,10 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | @@ -9007,6 +9027,10 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | ||
9007 | 9027 | ||
9008 | //全选按钮点击事件 | 9028 | //全选按钮点击事件 |
9009 | $selectAllBtn.on('touchend', function() { | 9029 | $selectAllBtn.on('touchend', function() { |
9030 | + if ($('.low-stocks').length > 0) { | ||
9031 | + tip.show('所选商品中含有库存不足的商品'); | ||
9032 | + return false; | ||
9033 | + } | ||
9010 | bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), $('#cartType').val(), didUpdateAllGoodsCheckStatus); | 9034 | bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), $('#cartType').val(), didUpdateAllGoodsCheckStatus); |
9011 | }); | 9035 | }); |
9012 | 9036 |
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.
-
Please register or login to post a comment