Authored by 梁志锋

购物车功能开发

@@ -12,7 +12,6 @@ var $ = require('jquery'), @@ -12,7 +12,6 @@ var $ = require('jquery'),
12 var dialog = require('../me/dialog'), 12 var dialog = require('../me/dialog'),
13 tip = require('../plugin/tip'); 13 tip = require('../plugin/tip');
14 14
15 -  
16 var $names; 15 var $names;
17 16
18 //var $curDelPanel; 17 //var $curDelPanel;
@@ -55,25 +54,26 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -55,25 +54,26 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
55 } else { 54 } else {
56 $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); 55 $this.removeClass('icon-checkbox').addClass('icon-cb-checked');
57 } 56 }
58 - }  
59 - $.ajax({  
60 - type: 'GET',  
61 - url: '/cart/index/getCartData',  
62 - data: {  
63 - id: id  
64 - },  
65 - success: function(data) {  
66 - if (data) {  
67 - $('#good-totalprice').html('¥' + data.commonCart.price);  
68 - $('#good-activityPrice').html('¥' + data.commonCart.activityPrice);  
69 - $('#good-total').html(data.commonCart.count + '件总计:¥' + data.commonCart.sumPrice); 57 + $.ajax({
  58 + type: 'GET',
  59 + url: '/cart/index/getCartData',
  60 + data: {
  61 + skuList: JSON.stringfy(id)
  62 + },
  63 + success: function(data) {
  64 + if (data) {
  65 + $('#good-totalprice').html('¥' + data.commonCart.price);
  66 + $('#good-activityPrice').html('¥' + data.commonCart.activityPrice);
  67 + $('#good-total').html('总计:¥' + data.commonCart.sumPrice +' (' + data.commonCart.count + '件)');
  68 + }
  69 + },
  70 + error: function() {
  71 + tip.show('网络错误');
70 } 72 }
71 - },  
72 - error: function() {  
73 - tip.show('网络错误');  
74 - }  
75 - });  
76 - 73 + });
  74 + } else if(data.code === 200) {
  75 + tip.show('网络错误');
  76 + }
77 }).fail(function() { 77 }).fail(function() {
78 tip.show('网络错误'); 78 tip.show('网络错误');
79 }); 79 });
@@ -157,6 +157,7 @@ @@ -157,6 +157,7 @@
157 display: block; 157 display: block;
158 height: 40rem / $pxConvertRem; 158 height: 40rem / $pxConvertRem;
159 line-height: 40rem / $pxConvertRem; 159 line-height: 40rem / $pxConvertRem;
  160 + color: #d0253b;
160 } 161 }
161 162
162 .tip { 163 .tip {
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <span class="iconfont icon-cb-checked"></span> 52 <span class="iconfont icon-cb-checked"></span>
53 <p> 53 <p>
54 <span id="good-total"> 54 <span id="good-total">
55 - {{count}}件总计:¥{{sumPrice}} 55 + 总计:¥{{sumPrice}} ({{count}}件)
56 </span> 56 </span>
57 <span class="tip">(不含运费)</span> 57 <span class="tip">(不含运费)</span>
58 </p> 58 </p>