Merge branch 'hotfix/yohocoinuse' into beta
Conflicts: static/js/cart/cart.js static/js/cart/order-info.js
Showing
5 changed files
with
13 additions
and
11 deletions
@@ -113,6 +113,10 @@ function showChooseGifDialog() { | @@ -113,6 +113,10 @@ function showChooseGifDialog() { | ||
113 | }, function() { | 113 | }, function() { |
114 | window.location.href = cartContentShow().find('.freebie > a').attr('href'); | 114 | window.location.href = cartContentShow().find('.freebie > a').attr('href'); |
115 | }, function() { | 115 | }, function() { |
116 | + var info = window.cookie('order-info'); | ||
117 | + if (info) { | ||
118 | + window.setCookie('order-info', ''); | ||
119 | + } | ||
116 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 120 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
117 | }); | 121 | }); |
118 | } | 122 | } |
@@ -188,6 +192,7 @@ if ($('.freebie').length > 0) { | @@ -188,6 +192,7 @@ if ($('.freebie').length > 0) { | ||
188 | 192 | ||
189 | $('.btn-balance').on('touchend', function() { | 193 | $('.btn-balance').on('touchend', function() { |
190 | lowStockCount = 0; | 194 | lowStockCount = 0; |
195 | + var info = window.cookie('order-info'); | ||
191 | if (shouldLowStocks()) { | 196 | if (shouldLowStocks()) { |
192 | tip.show('所选商品中有' + lowStockCount + '种库存不足的商品'); | 197 | tip.show('所选商品中有' + lowStockCount + '种库存不足的商品'); |
193 | return false; | 198 | return false; |
@@ -199,6 +204,9 @@ $('.btn-balance').on('touchend', function() { | @@ -199,6 +204,9 @@ $('.btn-balance').on('touchend', function() { | ||
199 | } | 204 | } |
200 | 205 | ||
201 | if (hasChecked()) { | 206 | if (hasChecked()) { |
207 | + if (info) { | ||
208 | + window.setCookie('order-info', ''); | ||
209 | + } | ||
202 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 210 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
203 | } else { | 211 | } else { |
204 | tip.show('请先勾选商品'); | 212 | tip.show('请先勾选商品'); |
@@ -105,7 +105,7 @@ $('.icon-del').on('touchstart', function(e) { | @@ -105,7 +105,7 @@ $('.icon-del').on('touchstart', function(e) { | ||
105 | autoHide: true, | 105 | autoHide: true, |
106 | fast: true | 106 | fast: true |
107 | }); | 107 | }); |
108 | - window.setCookie('order-info', ''); | 108 | + //window.setCookie('order-info', ''); |
109 | window.setCookie('_yoho-cart-refreshByDelete', true); | 109 | window.setCookie('_yoho-cart-refreshByDelete', true); |
110 | window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); | 110 | window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); |
111 | } else { | 111 | } else { |
@@ -88,11 +88,8 @@ $('.invoice').on('touchend', '.checkbox', function() { | @@ -88,11 +88,8 @@ $('.invoice').on('touchend', '.checkbox', function() { | ||
88 | } | 88 | } |
89 | }); | 89 | }); |
90 | 90 | ||
91 | -function orderCompute(firstEnter) { | 91 | +function orderCompute() { |
92 | var yohoCoin = orderInfo('yohoCoin'); | 92 | var yohoCoin = orderInfo('yohoCoin'); |
93 | - if (firstEnter) { | ||
94 | - yohoCoin = 0; | ||
95 | - } | ||
96 | $.ajax({ | 93 | $.ajax({ |
97 | method: 'POST', | 94 | method: 'POST', |
98 | url: '/cart/index/orderCompute', | 95 | url: '/cart/index/orderCompute', |
@@ -130,9 +127,6 @@ function orderCompute(firstEnter) { | @@ -130,9 +127,6 @@ function orderCompute(firstEnter) { | ||
130 | }); | 127 | }); |
131 | } | 128 | } |
132 | 129 | ||
133 | -// 进入页面计算一次价格 | ||
134 | -//orderCompute(1); | ||
135 | - | ||
136 | function submitOrder() { | 130 | function submitOrder() { |
137 | var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), | 131 | var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), |
138 | msg = $('#msg').find('input').val() || orderInfo('msg'); | 132 | msg = $('#msg').find('input').val() || orderInfo('msg'); |
@@ -11,7 +11,7 @@ require('../common'); | @@ -11,7 +11,7 @@ require('../common'); | ||
11 | function init() { | 11 | function init() { |
12 | info = { | 12 | info = { |
13 | uid: window.getUid(), | 13 | uid: window.getUid(), |
14 | - deliveryId: 1, | 14 | + deliveryId: $('.dispatch-mode .chosed').data('id') || 1, |
15 | deliveryTimeId: 1, | 15 | deliveryTimeId: 1, |
16 | paymentTypeId: 1, | 16 | paymentTypeId: 1, |
17 | yohoCoin: 0, | 17 | yohoCoin: 0, |
@@ -32,7 +32,7 @@ try { | @@ -32,7 +32,7 @@ try { | ||
32 | info = JSON.parse(info); | 32 | info = JSON.parse(info); |
33 | 33 | ||
34 | // 2015/12/31 hf: fixes bug to 购物车页面调用该JS, 会导致有YOHO币,值却没有传给服务端. 因此需要再设置一下 | 34 | // 2015/12/31 hf: fixes bug to 购物车页面调用该JS, 会导致有YOHO币,值却没有传给服务端. 因此需要再设置一下 |
35 | - // info.yohoCoin = $('.coin').data('yoho-coin') || 0; | 35 | + //info['yohoCoin'] = $('.coin').data('yoho-coin') || 0; |
36 | } catch (e) { | 36 | } catch (e) { |
37 | init(); | 37 | init(); |
38 | } | 38 | } |
@@ -283,7 +283,7 @@ class IndexController extends AbstractAction | @@ -283,7 +283,7 @@ class IndexController extends AbstractAction | ||
283 | $cartType = $this->get('cartType', ''); | 283 | $cartType = $this->get('cartType', ''); |
284 | $cookieData = $this->getCookie('order-info', null); | 284 | $cookieData = $this->getCookie('order-info', null); |
285 | $orderInfo = array(); | 285 | $orderInfo = array(); |
286 | - if (empty($cartType) && !empty($cookieData)) { | 286 | + if (!empty($cookieData)) { |
287 | $orderInfo = json_decode($cookieData, true); | 287 | $orderInfo = json_decode($cookieData, true); |
288 | $cartType = $orderInfo['cartType']; | 288 | $cartType = $orderInfo['cartType']; |
289 | } | 289 | } |
-
Please register or login to post a comment