购物车功能修改 review br xuqi
Showing
1 changed file
with
5 additions
and
6 deletions
@@ -43,9 +43,10 @@ $.get('/cart/index/giftinfoTpl', function(html) { | @@ -43,9 +43,10 @@ $.get('/cart/index/giftinfoTpl', function(html) { | ||
43 | 43 | ||
44 | //初始化购物车面板显示 | 44 | //初始化购物车面板显示 |
45 | function init() { | 45 | function init() { |
46 | - var $firstRow = $sizeRowList.eq(0); | 46 | + var $firstRow; |
47 | 47 | ||
48 | $sizeRowList = $('.size-list ul'); | 48 | $sizeRowList = $('.size-list ul'); |
49 | + $firstRow = $sizeRowList.eq(0); | ||
49 | $curSizeBlock = null, | 50 | $curSizeBlock = null, |
50 | 51 | ||
51 | hasChooseSize = false, | 52 | hasChooseSize = false, |
@@ -68,8 +69,6 @@ function checkColorSizeNum() { | @@ -68,8 +69,6 @@ function checkColorSizeNum() { | ||
68 | return true; | 69 | return true; |
69 | } | 70 | } |
70 | 71 | ||
71 | -init(); | ||
72 | - | ||
73 | function show(data) { | 72 | function show(data) { |
74 | if (data) { | 73 | if (data) { |
75 | $chosePanel.html(panelTmpl(data)); | 74 | $chosePanel.html(panelTmpl(data)); |
@@ -128,6 +127,8 @@ function changeGoodImgWhenClickColor() { | @@ -128,6 +127,8 @@ function changeGoodImgWhenClickColor() { | ||
128 | } | 127 | } |
129 | } | 128 | } |
130 | 129 | ||
130 | +init(); | ||
131 | + | ||
131 | $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | 132 | $('.yoho-page').on('touchstart', '.chose-panel', function(e) { |
132 | var $cur = $(e.target); | 133 | var $cur = $(e.target); |
133 | 134 | ||
@@ -205,7 +206,6 @@ $('.color-list').on('touchstart', '.block', function(e) { | @@ -205,7 +206,6 @@ $('.color-list').on('touchstart', '.block', function(e) { | ||
205 | 206 | ||
206 | // 修改颜色时修改商品图片 | 207 | // 修改颜色时修改商品图片 |
207 | changeGoodImgWhenClickColor(); | 208 | changeGoodImgWhenClickColor(); |
208 | - | ||
209 | }); | 209 | }); |
210 | 210 | ||
211 | $('.size-list').on('touchstart', '.block', function(e) { | 211 | $('.size-list').on('touchstart', '.block', function(e) { |
@@ -244,8 +244,6 @@ $('.size-list').on('touchstart', '.block', function(e) { | @@ -244,8 +244,6 @@ $('.size-list').on('touchstart', '.block', function(e) { | ||
244 | $that.find('.num .left-num').html('剩余' + curGoodNum + '件'); | 244 | $that.find('.num .left-num').html('剩余' + curGoodNum + '件'); |
245 | $('#left-num').val(curGoodNum); | 245 | $('#left-num').val(curGoodNum); |
246 | } else { | 246 | } else { |
247 | - | ||
248 | - //$colorChosed.removeClass('zero-stock').addClass('zero-stock'); | ||
249 | $that.find('.num .left-num').html(''); | 247 | $that.find('.num .left-num').html(''); |
250 | $('#left-num').val(0); | 248 | $('#left-num').val(0); |
251 | } | 249 | } |
@@ -308,6 +306,7 @@ $('#chose-btn-sure').on('touchstart', function() { | @@ -308,6 +306,7 @@ $('#chose-btn-sure').on('touchstart', function() { | ||
308 | numInCart = $('.num-tag').html() - 0, | 306 | numInCart = $('.num-tag').html() - 0, |
309 | num = $num.val(); | 307 | num = $num.val(); |
310 | 308 | ||
309 | + //颜色尺码没有选择 | ||
311 | if (!checkColorSizeNum()) { | 310 | if (!checkColorSizeNum()) { |
312 | return; | 311 | return; |
313 | } | 312 | } |
-
Please register or login to post a comment