Authored by 梁志锋

尺码颜色优化

@@ -134,13 +134,18 @@ function displayGoodNum(curGoodNum) { @@ -134,13 +134,18 @@ function displayGoodNum(curGoodNum) {
134 134
135 //老的选中尺码去掉勾选,新的选中尺码加上勾选 135 //老的选中尺码去掉勾选,新的选中尺码加上勾选
136 function changeSizeChosed(newSizeIndex) { 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 - var sizes = $sizeRowList.eq(newSizeIndex).children();  
140 - for(var i = 0; i < sizes.length; i++){  
141 - if($(sizes[i]).data('name') === $curSizeBlock.data('name')){ 143 + sizes = $sizeRowList.eq(newSizeIndex).children();
  144 + for (i = 0; i < sizes.length; i++) {
  145 + if ($(sizes[i]).data('name') === $curSizeBlock.data('name')) {
142 $curSizeBlock = $(sizes[i]); 146 $curSizeBlock = $(sizes[i]);
143 - curColorIndex = $("#" + $curSizeBlock.data('name')).data('index'); 147 + queryString = '#' + $curSizeBlock.data('name');
  148 + curColorIndex = $(queryString).data('index');
144 } 149 }
145 } 150 }
146 151
@@ -230,8 +235,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -230,8 +235,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
230 updateConformButtonClassAndText(); 235 updateConformButtonClassAndText();
231 }).on('touchstart', '.size-list .block', function() { 236 }).on('touchstart', '.size-list .block', function() {
232 var $this = $(this), 237 var $this = $(this),
233 - index = $this.index(),  
234 - colorName, 238 + index,
235 curGoodNum; 239 curGoodNum;
236 240
237 // 当前尺码已经是选中状态,再点击时 241 // 当前尺码已经是选中状态,再点击时
@@ -257,8 +261,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -257,8 +261,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
257 } else { 261 } else {
258 hasChooseSize = true; 262 hasChooseSize = true;
259 263
260 - colorName = $this.data('name');  
261 - index = $("#"+colorName).data('index') -1; 264 + index = $('#' + $this.data('name')).data('index') - 1;
262 265
263 // 颜色当前行隐藏 266 // 颜色当前行隐藏
264 $colorRowList.eq(curColorIndex).addClass('hide'); 267 $colorRowList.eq(curColorIndex).addClass('hide');