Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Showing
6 changed files
with
79 additions
and
36 deletions
@@ -26,6 +26,8 @@ var inAjax = false; | @@ -26,6 +26,8 @@ var inAjax = false; | ||
26 | 26 | ||
27 | var loading = require('../plugin/loading'); | 27 | var loading = require('../plugin/loading'); |
28 | 28 | ||
29 | +var dialog = require('./dialog'); | ||
30 | + | ||
29 | var orderHammer; | 31 | var orderHammer; |
30 | 32 | ||
31 | //加载订单 | 33 | //加载订单 |
@@ -110,36 +112,52 @@ orderHammer.on('tap', function(e) { | @@ -110,36 +112,52 @@ orderHammer.on('tap', function(e) { | ||
110 | if ($cur.closest('.del').length > 0) { | 112 | if ($cur.closest('.del').length > 0) { |
111 | 113 | ||
112 | //Order delete | 114 | //Order delete |
113 | - $.ajax({ | ||
114 | - type: 'GET', | ||
115 | - url: '/home/delOrder', | ||
116 | - data: { | ||
117 | - id: id | ||
118 | - }, | ||
119 | - success: function(data) { | ||
120 | - if (data.code === 200) { | ||
121 | - | ||
122 | - //删除订单页面刷新 | ||
123 | - location.href = location.href; | ||
124 | - } | 115 | + dialog.showDialog({ |
116 | + dialogText: '确定删除订单吗?', | ||
117 | + hasFooter: { | ||
118 | + leftBtnText: '取消', | ||
119 | + rightBtnText: '确定' | ||
125 | } | 120 | } |
121 | + }, function() { | ||
122 | + $.ajax({ | ||
123 | + type: 'GET', | ||
124 | + url: '/home/delOrder', | ||
125 | + data: { | ||
126 | + id: id | ||
127 | + }, | ||
128 | + success: function(data) { | ||
129 | + if (data.code === 200) { | ||
130 | + | ||
131 | + //删除订单页面刷新 | ||
132 | + location.href = location.href; | ||
133 | + } | ||
134 | + } | ||
135 | + }); | ||
126 | }); | 136 | }); |
127 | } else if ($cur.closest('.cancel').length > 0) { | 137 | } else if ($cur.closest('.cancel').length > 0) { |
128 | 138 | ||
129 | //Order cancel | 139 | //Order cancel |
130 | - $.ajax({ | ||
131 | - type: 'GET', | ||
132 | - url: '/home/cancelOrder', | ||
133 | - data: { | ||
134 | - id: id | ||
135 | - }, | ||
136 | - success: function(data) { | ||
137 | - if (data.code === 200) { | ||
138 | - | ||
139 | - //取消订单页面刷新 | ||
140 | - location.href = location.href; | ||
141 | - } | 140 | + dialog.showDialog({ |
141 | + dialogText: '确定取消订单吗?', | ||
142 | + hasFooter: { | ||
143 | + leftBtnText: '取消', | ||
144 | + rightBtnText: '确定' | ||
142 | } | 145 | } |
146 | + }, function() { | ||
147 | + $.ajax({ | ||
148 | + type: 'GET', | ||
149 | + url: '/home/cancelOrder', | ||
150 | + data: { | ||
151 | + id: id | ||
152 | + }, | ||
153 | + success: function(data) { | ||
154 | + if (data.code === 200) { | ||
155 | + | ||
156 | + //取消订单页面刷新 | ||
157 | + location.href = location.href; | ||
158 | + } | ||
159 | + } | ||
160 | + }); | ||
143 | }); | 161 | }); |
144 | } else { | 162 | } else { |
145 | 163 |
@@ -7,18 +7,24 @@ var $ = require('jquery'), | @@ -7,18 +7,24 @@ var $ = require('jquery'), | ||
7 | Hammer = require('yoho.hammer'), | 7 | Hammer = require('yoho.hammer'), |
8 | tip = require('../../plugin/tip'); | 8 | tip = require('../../plugin/tip'); |
9 | 9 | ||
10 | -var likeHammer = new Hammer(document.getElementById('likeBtn')); | 10 | +var likeHammer = new Hammer(document.getElementById('likeBtn')), |
11 | + addToCartHammer = new Hammer(document.getElementById('addtoCart')); | ||
12 | + | ||
13 | +var productId = $('#productId').val(); | ||
11 | 14 | ||
12 | likeHammer.on('tap', function(e) { | 15 | likeHammer.on('tap', function(e) { |
13 | - var productId = $('#productId').val(), | ||
14 | - opt; | 16 | + var opt, |
17 | + favorite; | ||
18 | + | ||
15 | 19 | ||
16 | var $this = $(this); | 20 | var $this = $(this); |
17 | 21 | ||
18 | if ($this.hasClass('liked')) { | 22 | if ($this.hasClass('liked')) { |
19 | opt = 'cancel'; | 23 | opt = 'cancel'; |
24 | + favorite = 0; | ||
20 | } else { | 25 | } else { |
21 | opt = 'ok'; | 26 | opt = 'ok'; |
27 | + favorite = 1; | ||
22 | } | 28 | } |
23 | 29 | ||
24 | $.ajax({ | 30 | $.ajax({ |
@@ -36,6 +42,14 @@ likeHammer.on('tap', function(e) { | @@ -36,6 +42,14 @@ likeHammer.on('tap', function(e) { | ||
36 | } else { | 42 | } else { |
37 | tip.show(data.message); | 43 | tip.show(data.message); |
38 | } | 44 | } |
45 | + | ||
46 | + // 统计代码:用于统计用户加入或取消商品收藏的动作 | ||
47 | + if (window._yas) { | ||
48 | + window._yas.sendCustomInfo({ | ||
49 | + pd: productId, | ||
50 | + fa: favorite | ||
51 | + }); | ||
52 | + } | ||
39 | }, | 53 | }, |
40 | error: function() { | 54 | error: function() { |
41 | tip.show('网络断开连接了~'); | 55 | tip.show('网络断开连接了~'); |
@@ -44,6 +58,15 @@ likeHammer.on('tap', function(e) { | @@ -44,6 +58,15 @@ likeHammer.on('tap', function(e) { | ||
44 | 58 | ||
45 | }); | 59 | }); |
46 | 60 | ||
47 | -// $('#likeBtn').on('click', function(e) { | ||
48 | -// return false; | ||
49 | -// }); | ||
61 | +addToCartHammer.on('tap', function(e) { | ||
62 | + | ||
63 | + // 统计代码:用于统计用户加入购物车的动作 | ||
64 | + if (window._yas) { | ||
65 | + window._yas.sendCustomInfo({ | ||
66 | + pd: productId, | ||
67 | + by: 1 | ||
68 | + }); | ||
69 | + } | ||
70 | +}); | ||
71 | + | ||
72 | + |
@@ -442,3 +442,8 @@ $listNav.on('touchstart', 'li', function() { | @@ -442,3 +442,8 @@ $listNav.on('touchstart', 'li', function() { | ||
442 | }).on('touchend touchcancel', 'li', function() { | 442 | }).on('touchend touchcancel', 'li', function() { |
443 | $listNav.find('li').removeClass('bytouch'); | 443 | $listNav.find('li').removeClass('bytouch'); |
444 | }); | 444 | }); |
445 | + | ||
446 | +// 用于统计点击了商品列表的第几个商品,序号从1开始计算。 | ||
447 | +if (window._yas) { | ||
448 | + window._yas(1 * new Date(), '1.0.13.1', 'yohobuy_m', window._ozuid, '#goods-container >div >div .good-thumb >img'); | ||
449 | +} |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | {{^ used}} | 15 | {{^ used}} |
16 | <div class="null"> | 16 | <div class="null"> |
17 | <i></i> | 17 | <i></i> |
18 | - <p>您还没有未使用的优惠券</p> | 18 | + <p>您还没有优惠券!</p> |
19 | <a href="{{topURL}}">随便逛逛</a> | 19 | <a href="{{topURL}}">随便逛逛</a> |
20 | </div> | 20 | </div> |
21 | {{/ used}} | 21 | {{/ used}} |
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | {{^ unused}} | 32 | {{^ unused}} |
33 | <div class="null"> | 33 | <div class="null"> |
34 | <i></i> | 34 | <i></i> |
35 | - <p>您还没有已使用的优惠券</p> | 35 | + <p>您还没有使用的优惠券!</p> |
36 | <a href="{{topURL}}">随便逛逛</a> | 36 | <a href="{{topURL}}">随便逛逛</a> |
37 | </div> | 37 | </div> |
38 | {{/ unused}} | 38 | {{/ unused}} |
@@ -124,7 +124,7 @@ | @@ -124,7 +124,7 @@ | ||
124 | {{/if}} | 124 | {{/if}} |
125 | <a href="/shoppingCart" class="num-incart iconfont"></a> | 125 | <a href="/shoppingCart" class="num-incart iconfont"></a> |
126 | {{#if goodsInstore}} | 126 | {{#if goodsInstore}} |
127 | - <a href="/shoppingCart" class="addto-cart ">加入购物车</a> | 127 | + <a href="/shoppingCart" id="addtoCart" class="addto-cart">加入购物车</a> |
128 | {{else}} | 128 | {{else}} |
129 | <a href="javascript:;" class="sold-out">已售罄</a> | 129 | <a href="javascript:;" class="sold-out">已售罄</a> |
130 | {{/if}} | 130 | {{/if}} |
@@ -132,11 +132,9 @@ | @@ -132,11 +132,9 @@ | ||
132 | <a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}"></a> | 132 | <a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}"></a> |
133 | </div> | 133 | </div> |
134 | {{/cartInfo}} | 134 | {{/cartInfo}} |
135 | - | ||
136 | {{#if introUrl}} | 135 | {{#if introUrl}} |
137 | <input id="introUrl" type="hidden" value={{introUrl}}> | 136 | <input id="introUrl" type="hidden" value={{introUrl}}> |
138 | {{/if}} | 137 | {{/if}} |
139 | - | ||
140 | {{#if id}} | 138 | {{#if id}} |
141 | <input id="productId" type="hidden" value={{id}}> | 139 | <input id="productId" type="hidden" value={{id}}> |
142 | {{/if}} | 140 | {{/if}} |
-
Please register or login to post a comment