Authored by hf

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - lazyLoad = require('yoho.lazyload'),  
9 Hammer = require('yoho.hammer'); 8 Hammer = require('yoho.hammer');
10 9
11 var chosePanel = require('./chose-panel'), 10 var chosePanel = require('./chose-panel'),
@@ -40,9 +39,15 @@ function shouldSelectGift() { @@ -40,9 +39,15 @@ function shouldSelectGift() {
40 } 39 }
41 40
42 function shouldLowStocks() { 41 function shouldLowStocks() {
43 - var $lowStocks = $('.low-stocks'), 42 + var $lowStocks,
44 result = false; 43 result = false;
45 44
  45 + if ('ordinary' === cartType) {
  46 + $lowStocks = $('.common .low-stocks');
  47 + } else if ('advance' === cartType) {
  48 + $lowStocks = $('.presell .low-stocks');
  49 + }
  50 +
46 if ($lowStocks.length <= 0) { 51 if ($lowStocks.length <= 0) {
47 return result; 52 return result;
48 } 53 }
@@ -73,7 +78,7 @@ function showChooseGifDialog() { @@ -73,7 +78,7 @@ function showChooseGifDialog() {
73 78
74 require('./good'); 79 require('./good');
75 80
76 -lazyLoad($('img.lazy')); 81 +//lazyLoad($('img.lazy'));
77 82
78 if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) { 83 if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) {
79 $('#presell-tip').removeClass('show').addClass('hide'); 84 $('#presell-tip').removeClass('show').addClass('hide');
@@ -151,7 +156,7 @@ if ($('.freebie').length > 0) { @@ -151,7 +156,7 @@ if ($('.freebie').length > 0) {
151 156
152 $('.btn-balance').on('touchend', function() { 157 $('.btn-balance').on('touchend', function() {
153 if (shouldLowStocks()) { 158 if (shouldLowStocks()) {
154 - tip.show('库存不足无法结算'); 159 + tip.show('所选商品中含有库存不足的商品');
155 return false; 160 return false;
156 } 161 }
157 162
@@ -192,13 +192,22 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { @@ -192,13 +192,22 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
192 192
193 //全选按钮点击事件 193 //全选按钮点击事件
194 $selectAllBtn.on('touchend', function() { 194 $selectAllBtn.on('touchend', function() {
195 - var isSelect = $(this).hasClass('icon-cb-checked'); 195 + var cartType = $('#cartType').val(),
  196 + isSelect = $(this).hasClass('icon-cb-checked');
196 197
197 - if (!isSelect && $('.low-stocks').length > 0) { 198 + if ('ordinary' === cartType) {
  199 + if (!isSelect && $('.common .low-stocks').length > 0) {
198 tip.show('所选商品中含有库存不足的商品'); 200 tip.show('所选商品中含有库存不足的商品');
199 return false; 201 return false;
200 } 202 }
201 - bottomCheckBoxHandeler(isSelect, $('#cartType').val(), didUpdateAllGoodsCheckStatus); 203 + } else if ('advance' === cartType) {
  204 + if (!isSelect && $('.presell .low-stocks').length > 0) {
  205 + tip.show('所选商品中含有库存不足的商品');
  206 + return false;
  207 + }
  208 + }
  209 +
  210 + bottomCheckBoxHandeler(isSelect, cartType, didUpdateAllGoodsCheckStatus);
202 }); 211 });
203 212
204 $('.down').on('touchend', function() { 213 $('.down').on('touchend', function() {