Authored by 梁志锋

Merge remote-tracking branch 'origin/develop' into beta

@@ -133,10 +133,22 @@ function displayGoodNum(curGoodNum) { @@ -133,10 +133,22 @@ function displayGoodNum(curGoodNum) {
133 } 133 }
134 134
135 //老的选中尺码去掉勾选,新的选中尺码加上勾选 135 //老的选中尺码去掉勾选,新的选中尺码加上勾选
136 -function changeSizeChosed(oldSizeIndex) { 136 +function changeSizeChosed(newSizeIndex) {
  137 + var sizes,
  138 + queryString,
  139 + i;
  140 +
137 if (curColorIndex && $curSizeBlock && $curSizeBlock.length > 0) { 141 if (curColorIndex && $curSizeBlock && $curSizeBlock.length > 0) {
138 $curSizeBlock.removeClass('chosed'); 142 $curSizeBlock.removeClass('chosed');
139 - $curSizeBlock = $($sizeRowList.eq(oldSizeIndex).children().get(curColorIndex - 1)); 143 + sizes = $sizeRowList.eq(newSizeIndex).children();
  144 + for (i = 0; i < sizes.length; i++) {
  145 + if ($(sizes[i]).data('name') === $curSizeBlock.data('name')) {
  146 + $curSizeBlock = $(sizes[i]);
  147 + queryString = '#' + $curSizeBlock.data('name');
  148 + curColorIndex = $(queryString).data('index');
  149 + }
  150 + }
  151 +
140 $curSizeBlock.addClass('chosed'); 152 $curSizeBlock.addClass('chosed');
141 return $curSizeBlock.data('num'); 153 return $curSizeBlock.data('num');
142 } 154 }
@@ -144,10 +156,10 @@ function changeSizeChosed(oldSizeIndex) { @@ -144,10 +156,10 @@ function changeSizeChosed(oldSizeIndex) {
144 } 156 }
145 157
146 //老的选中颜色去掉勾选,新的选中颜色加上勾选 158 //老的选中颜色去掉勾选,新的选中颜色加上勾选
147 -function changeColorChosed(oldColorIndex) { 159 +function changeColorChosed(newColorIndex) {
148 if (curSizeIndex && $curColorBlock && $curColorBlock.length > 0) { 160 if (curSizeIndex && $curColorBlock && $curColorBlock.length > 0) {
149 $curColorBlock.removeClass('chosed'); 161 $curColorBlock.removeClass('chosed');
150 - $curColorBlock = $($colorRowList.eq(oldColorIndex).children().get(curSizeIndex - 1)); 162 + $curColorBlock = $($colorRowList.eq(newColorIndex).children().get(curSizeIndex - 1));
151 $curColorBlock.addClass('chosed'); 163 $curColorBlock.addClass('chosed');
152 return $curColorBlock.data('num'); 164 return $curColorBlock.data('num');
153 } 165 }
@@ -195,15 +207,15 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -195,15 +207,15 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
195 } else { 207 } else {
196 hasChooseColor = true; 208 hasChooseColor = true;
197 209
  210 + // 尺码行当前行隐藏
  211 + $sizeRowList.eq(curSizeIndex).addClass('hide');
  212 +
198 //老的选中尺码去掉勾选,新的选中尺码加上勾选 213 //老的选中尺码去掉勾选,新的选中尺码加上勾选
199 curGoodNum = changeSizeChosed(index + 1); 214 curGoodNum = changeSizeChosed(index + 1);
200 215
201 // 显示剩余数量 216 // 显示剩余数量
202 displayGoodNum(curGoodNum); 217 displayGoodNum(curGoodNum);
203 218
204 - // 尺码行当前行隐藏  
205 - $sizeRowList.eq(curSizeIndex).addClass('hide');  
206 -  
207 //尺码对应行显示 219 //尺码对应行显示
208 $sizeRowList.eq(index + 1).removeClass('hide'); 220 $sizeRowList.eq(index + 1).removeClass('hide');
209 221
@@ -223,7 +235,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -223,7 +235,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
223 updateConformButtonClassAndText(); 235 updateConformButtonClassAndText();
224 }).on('touchstart', '.size-list .block', function() { 236 }).on('touchstart', '.size-list .block', function() {
225 var $this = $(this), 237 var $this = $(this),
226 - index = $this.index(), 238 + index,
227 curGoodNum; 239 curGoodNum;
228 240
229 // 当前尺码已经是选中状态,再点击时 241 // 当前尺码已经是选中状态,再点击时
@@ -235,10 +247,10 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -235,10 +247,10 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
235 hasChooseSize = false; 247 hasChooseSize = false;
236 248
237 //当前颜色行隐藏 249 //当前颜色行隐藏
238 - $colorRowList.eq(curColorIndex).removeClass('show').addClass('hide'); 250 + $colorRowList.eq(curColorIndex).addClass('hide');
239 251
240 //目标颜色行显示 252 //目标颜色行显示
241 - $colorRowList.eq(0).removeClass('hide').addClass('show'); 253 + $colorRowList.eq(0).removeClass('hide');
242 254
243 curColorIndex = 0; 255 curColorIndex = 0;
244 256
@@ -249,17 +261,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -249,17 +261,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
249 } else { 261 } else {
250 hasChooseSize = true; 262 hasChooseSize = true;
251 263
  264 + index = $('#' + $this.data('name')).data('index') - 1;
  265 +
  266 + // 颜色当前行隐藏
  267 + $colorRowList.eq(curColorIndex).addClass('hide');
  268 +
252 //老的选中颜色去掉勾选,新的选中颜色加上勾选 269 //老的选中颜色去掉勾选,新的选中颜色加上勾选
253 curGoodNum = changeColorChosed(index + 1); 270 curGoodNum = changeColorChosed(index + 1);
254 271
255 // 显示剩余数量 272 // 显示剩余数量
256 displayGoodNum(curGoodNum); 273 displayGoodNum(curGoodNum);
257 274
258 - // 颜色当前行隐藏  
259 - $colorRowList.eq(curColorIndex).removeClass('show').addClass('hide');  
260 -  
261 //颜色对应行显示 275 //颜色对应行显示
262 - $colorRowList.eq(index + 1).removeClass('hide').addClass('show'); 276 + $colorRowList.eq(index + 1).removeClass('hide');
263 277
264 curColorIndex = index + 1; 278 curColorIndex = index + 1;
265 $curSizeBlock = $this; 279 $curSizeBlock = $this;
@@ -165,7 +165,7 @@ if ($('.brand-search-page').length) { @@ -165,7 +165,7 @@ if ($('.brand-search-page').length) {
165 if ($keyword.val().length) { 165 if ($keyword.val().length) {
166 $icon.css('color', '#000'); 166 $icon.css('color', '#000');
167 $(this).closest('.search-box').css('width', '11.25rem'); 167 $(this).closest('.search-box').css('width', '11.25rem');
168 - $searchAction.show(); 168 + $searchAction.show().find('.clear-text').show();
169 } else { 169 } else {
170 $icon.css('color', '#b2b2b2'); 170 $icon.css('color', '#b2b2b2');
171 $(this).closest('.search-box').css('width', '12.5rem'); 171 $(this).closest('.search-box').css('width', '12.5rem');
@@ -177,7 +177,7 @@ if ($('.brand-search-page').length) { @@ -177,7 +177,7 @@ if ($('.brand-search-page').length) {
177 // 2016.1.13 产品(高扬)要求进入页面默认显示取消按钮 177 // 2016.1.13 产品(高扬)要求进入页面默认显示取消按钮
178 $icon.css('color', '#000'); 178 $icon.css('color', '#000');
179 $keyword.closest('.search-box').css('width', '11.25rem'); 179 $keyword.closest('.search-box').css('width', '11.25rem');
180 - $searchAction.show(); 180 + $searchAction.show().find('.clear-text').hide();
181 181
182 clearTextHammer = new Hammer($('.clear-text')[0]); 182 clearTextHammer = new Hammer($('.clear-text')[0]);
183 clearTextHammer.on('tap', function(e) { 183 clearTextHammer.on('tap', function(e) {
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <div class="color-list block-list"> 20 <div class="color-list block-list">
21 <span>颜色</span> 21 <span>颜色</span>
22 {{# colors}} 22 {{# colors}}
23 - <ul class="size-row clearfix {{#unless @first}}hide{{/if}}"> 23 + <ul id="{{sizeName}}" data-index="{{@index}}" class="size-row clearfix {{#unless @first}}hide{{/if}}">
24 {{# color}} 24 {{# color}}
25 <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}"> 25 <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}">
26 {{name}} 26 {{name}}
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 {{# sizes}} 34 {{# sizes}}
35 <ul class="size-row clearfix {{#unless @first}}hide{{/if}}"> 35 <ul class="size-row clearfix {{#unless @first}}hide{{/if}}">
36 {{# size}} 36 {{# size}}
37 - <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-num="{{sizeNum}}" data-skuid="{{skuId}}"> 37 + <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-num="{{sizeNum}}" data-name="{{name}}" data-skuid="{{skuId}}">
38 {{name}} 38 {{name}}
39 </li> 39 </li>
40 {{/ size}} 40 {{/ size}}