Authored by Lynnic

购物车面板代码修改 --code reviewed by LZF

@@ -1245,10 +1245,9 @@ @@ -1245,10 +1245,9 @@
1245 'notForSale':'非卖品', 1245 'notForSale':'非卖品',
1246 1246
1247 1247
1248 - thumb: [ 1248 + thumbs: [
1249 { 1249 {
1250 - id:1,  
1251 - url : '' 1250 + img : ''
1252 }, 1251 },
1253 ... 1252 ...
1254 ], 1253 ],
@@ -1256,28 +1255,29 @@ @@ -1256,28 +1255,29 @@
1256 price: '', 1255 price: '',
1257 salePrice: '', 1256 salePrice: '',
1258 colors: [ 1257 colors: [
1259 - {  
1260 - id: 1,  
1261 - chosed: true,  
1262 - name: '黄色',  
1263 - colorNum:10,  
1264 - sizeNumStr:'10/20/30' //对应的商品尺码数目,用斜杠分割  
1265 -  
1266 - },  
1267 - ...  
1268 - ], 1258 + {
  1259 + id: 1,
  1260 + skcId:,
  1261 + chosed: true,
  1262 + name: '黄色',
  1263 + colorNum:10,
  1264 + sizeNumStr:'10/20/30' //对应的商品尺码数目,用斜杠分割
  1265 +
  1266 + },
  1267 + ...
  1268 + ],
1269 sizes: [ 1269 sizes: [
1270 { 1270 {
1271 id: 2, 1271 id: 2,
  1272 + skuId:,
  1273 + goodId:,
1272 chosed: true, 1274 chosed: true,
1273 name: 'X', 1275 name: 'X',
1274 sizeNum: 2, 1276 sizeNum: 2,
1275 colorNumStr:'10/20/30' //对应的商品颜色数目用斜杠分割 1277 colorNumStr:'10/20/30' //对应的商品颜色数目用斜杠分割
1276 }, 1278 },
1277 ... 1279 ...
1278 - ],  
1279 -  
1280 - totalNum: 20 1280 + ]
1281 }, 1281 },
1282 'introUrl' : '', 1282 'introUrl' : '',
1283 'id' : '', 1283 'id' : '',
@@ -78,7 +78,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { @@ -78,7 +78,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
78 78
79 //根据颜色切换图片 79 //根据颜色切换图片
80 if ($this.closest('.block-list').hasClass('color-list')) { 80 if ($this.closest('.block-list').hasClass('color-list')) {
81 - $('.chose-panel .basic-info').find('.thumb').addClass('hide').eq(index).removeClass('hide'); 81 + $('.chose-panel').find('.thumb').addClass('hide').eq(index).removeClass('hide');
82 } 82 }
83 83
84 if ($chosed.length === 0) { 84 if ($chosed.length === 0) {
@@ -120,6 +120,10 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { @@ -120,6 +120,10 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
120 } 120 }
121 numArray = $siblingBlock.find('.chosed').data('numstr').split('/'); 121 numArray = $siblingBlock.find('.chosed').data('numstr').split('/');
122 $that.find('.num .left-num').html('剩余' + numArray[index] + '件'); 122 $that.find('.num .left-num').html('剩余' + numArray[index] + '件');
  123 + if (2 === $chosed.closest('.zero-stock').length) {
  124 + $('#chose-btn-sure').css('background-color', '#c0c0c0');
  125 + $('#chose-btn-sure').html('已售罄');
  126 + }
123 } 127 }
124 128
125 }).on('touchstart', '.btn-minus', function() { 129 }).on('touchstart', '.btn-minus', function() {
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 border-color: #e0e0e0; 113 border-color: #e0e0e0;
114 background: none; 114 background: none;
115 color: #e0e0e0; 115 color: #e0e0e0;
116 - background-color: #f0f0f0; 116 + background-color: #c0c0c0;
117 } 117 }
118 } 118 }
119 119
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 <span>颜色</span> 25 <span>颜色</span>
26 <ul class="clearfix" data-type="color"> 26 <ul class="clearfix" data-type="color">
27 {{# colors}} 27 {{# colors}}
28 - <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-numstr="{{sizeNumStr}}"> 28 + <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-numstr="{{sizeNumStr}}" data-skcid="{{skcId}}">
29 {{name}} 29 {{name}}
30 </li> 30 </li>
31 {{/ colors}} 31 {{/ colors}}
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <span>尺码</span> 35 <span>尺码</span>
36 <ul class="clearfix" data-type="size" > 36 <ul class="clearfix" data-type="size" >
37 {{# sizes}} 37 {{# sizes}}
38 - <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}"> 38 + <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodId}}">
39 {{name}} 39 {{name}}
40 </li> 40 </li>
41 {{/ sizes}} 41 {{/ sizes}}