Authored by 梁志锋

购物车功能开发

@@ -73,14 +73,13 @@ if (addToCartHammer) { @@ -73,14 +73,13 @@ if (addToCartHammer) {
73 addToCartHammer.on('tap', function(e) { 73 addToCartHammer.on('tap', function(e) {
74 chosePanel.show(); 74 chosePanel.show();
75 75
76 - // 统计代码:用于统计用户加入购物车的动作  
77 - // if (window._yas) {  
78 - // window._yas.sendCustomInfo({  
79 - // pd: productId,  
80 - // by: 1  
81 - // }, false);  
82 - // }  
83 - 76 + //统计代码:用于统计用户加入购物车的动作
  77 + if (window._yas) {
  78 + window._yas.sendCustomInfo({
  79 + pd: productId,
  80 + by: 1
  81 + }, true);
  82 + }
84 83
85 }); 84 });
86 } 85 }
@@ -11,19 +11,19 @@ var chosePanel = require('./chose-panel'); @@ -11,19 +11,19 @@ var chosePanel = require('./chose-panel');
11 11
12 lazyLoad($('.lazy')); 12 lazyLoad($('.lazy'));
13 13
14 -$('.gift-advance-page').on('touchstart', '.chose', function() {  
15 - var id = $(this).closest('.gift-advance-good').data('id');  
16 -  
17 - $.ajax({  
18 - type: 'GET',  
19 - url: '/shoppingCart/goodinfo',  
20 - data: {  
21 - id: id  
22 - },  
23 - success: function(data) {  
24 - if (data.code === 200) {  
25 - chosePanel.show(data.data);  
26 - }  
27 - }  
28 - });  
29 -});  
  14 +//$('.gift-advance-page').on('touchstart', '.chose', function() {
  15 +// var id = $(this).closest('.gift-advance-good').data('id');
  16 +//
  17 +// $.ajax({
  18 +// type: 'GET',
  19 +// url: '/shoppingCart/goodinfo',
  20 +// data: {
  21 +// id: id
  22 +// },
  23 +// success: function(data) {
  24 +// if (data.code === 200) {
  25 +// chosePanel.show(data.data);
  26 +// }
  27 +// }
  28 +// });
  29 +//});
@@ -9,7 +9,8 @@ var $ = require('jquery'), @@ -9,7 +9,8 @@ var $ = require('jquery'),
9 lazyLoad = require('yoho.lazyload'); 9 lazyLoad = require('yoho.lazyload');
10 10
11 var dialog = require('../me/dialog'), 11 var dialog = require('../me/dialog'),
12 - tip = require('../plugin/tip'); 12 + tip = require('../plugin/tip'),
  13 + chosePanel = require('./chose-panel');
13 14
14 var $names; 15 var $names;
15 16
1 {{> layout/header}} 1 {{> layout/header}}
2 -<div id="mainCart" class="shopping-cart-page yoho-page" style="display: none;"> 2 +<div id="mainCart" class="shopping-cart-page yoho-page">
3 3
4 {{# shoppingCart}} 4 {{# shoppingCart}}
5 {{#if cartNav}} 5 {{#if cartNav}}
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 {{/ shoppingCart}} 61 {{/ shoppingCart}}
62 </div> 62 </div>
63 63
64 -<div class="shopping-cart-zero yoho-page"> 64 +<div class="shopping-cart-zero yoho-page hide">
65 <div class="cart-zero"> 65 <div class="cart-zero">
66 <i class="iconfont">&#xe62c</i> 66 <i class="iconfont">&#xe62c</i>
67 <p>您的购物车暂无商品</p> 67 <p>您的购物车暂无商品</p>
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <li class="advance-buy"> 20 <li class="advance-buy">
21 <span class="iconfont">&#xe61b;</span> 21 <span class="iconfont">&#xe61b;</span>
22 加价购 22 加价购
23 - <a href="/shoppingCart/getCartData"> 23 + <a>
24 <span class="count">{{count}}</span> 24 <span class="count">{{count}}</span>
25 <span class="iconfont icon-right-arrow">&#xe614;</span> 25 <span class="iconfont icon-right-arrow">&#xe614;</span>
26 </a> 26 </a>