Merge branch 'feature/cart' of http://git.dev.yoho.cn/web/yohobuy into fix/cart
Showing
1 changed file
with
12 additions
and
4 deletions
@@ -117,6 +117,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -117,6 +117,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
117 | $('.num-tag').html(numInCart + buyNumber); | 117 | $('.num-tag').html(numInCart + buyNumber); |
118 | $('.num-tag').removeClass('hide'); | 118 | $('.num-tag').removeClass('hide'); |
119 | confirming = false; | 119 | confirming = false; |
120 | + tip.show('选择成功'); | ||
120 | remove(); | 121 | remove(); |
121 | } | 122 | } |
122 | }).fail(function() { | 123 | }).fail(function() { |
@@ -147,14 +148,21 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -147,14 +148,21 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
147 | } | 148 | } |
148 | 149 | ||
149 | if ($chosed.length === 0) { | 150 | if ($chosed.length === 0) { |
150 | - $this.closest('ul>li').each(function() { | 151 | + $colorList.each(function() { |
151 | $(this).removeClass('zero-stock'); | 152 | $(this).removeClass('zero-stock'); |
152 | if (0 === $(this).data('num') - 0) { | 153 | if (0 === $(this).data('num') - 0) { |
153 | $(this).addClass('zero-stock'); | 154 | $(this).addClass('zero-stock'); |
154 | } | 155 | } |
155 | }); | 156 | }); |
156 | 157 | ||
157 | - $siblingBlock.find('ul>li').each(function() { | 158 | + $sizeList.each(function() { |
159 | + colorIndex = $(this).data('colorid'); | ||
160 | + if (colorIndex === firstColorId) { | ||
161 | + $(this).removeClass('hide'); | ||
162 | + } | ||
163 | + }); | ||
164 | + | ||
165 | + $sizeList.not('.hide').each(function() { | ||
158 | $(this).removeClass('zero-stock'); | 166 | $(this).removeClass('zero-stock'); |
159 | if (0 === $(this).data('num') - 0) { | 167 | if (0 === $(this).data('num') - 0) { |
160 | $(this).addClass('zero-stock'); | 168 | $(this).addClass('zero-stock'); |
@@ -178,7 +186,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -178,7 +186,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
178 | $siblingBlock.find('.block').removeClass('zero-stock'); | 186 | $siblingBlock.find('.block').removeClass('zero-stock'); |
179 | for (i = 0; i < numArray.length; i++) { | 187 | for (i = 0; i < numArray.length; i++) { |
180 | if (0 === numArray[i] - 0) { | 188 | if (0 === numArray[i] - 0) { |
181 | - $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | 189 | + $siblingBlock.find('.block').not('.hide').eq(i).addClass('zero-stock'); |
182 | } | 190 | } |
183 | } | 191 | } |
184 | } else if ($chosed.length === 1 && !$this.hasClass('chosed')) { | 192 | } else if ($chosed.length === 1 && !$this.hasClass('chosed')) { |
@@ -199,7 +207,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -199,7 +207,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
199 | $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | 207 | $siblingBlock.find('.block').eq(i).addClass('zero-stock'); |
200 | } | 208 | } |
201 | } | 209 | } |
202 | - numArray = $siblingBlock.find('.chosed').data('numstr').split('/'); | 210 | + numArray = ($siblingBlock.find('.chosed').data('numstr') + '').split('/'); |
203 | $that.find('.num .left-num').html('剩余' + numArray[index] + '件'); | 211 | $that.find('.num .left-num').html('剩余' + numArray[index] + '件'); |
204 | if (2 === $chosed.closest('.zero-stock').length) { | 212 | if (2 === $chosed.closest('.zero-stock').length) { |
205 | $('#chose-btn-sure').css('background-color', '#c0c0c0'); | 213 | $('#chose-btn-sure').css('background-color', '#c0c0c0'); |
-
Please register or login to post a comment