Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
19 changed files
with
319 additions
and
79 deletions
framework @ e9d066dd
@@ -190,7 +190,7 @@ class Helpers | @@ -190,7 +190,7 @@ class Helpers | ||
190 | */ | 190 | */ |
191 | public static function transPrice($price) | 191 | public static function transPrice($price) |
192 | { | 192 | { |
193 | - return (!empty($price) && !is_float($price)) ? $price . '.00' : $price; | 193 | + return (!empty($price) && !is_float($price)) ? $price . '.00' : number_format($price, 2, '.', ''); |
194 | } | 194 | } |
195 | 195 | ||
196 | /** | 196 | /** |
@@ -114,7 +114,7 @@ function search() { | @@ -114,7 +114,7 @@ function search() { | ||
114 | } | 114 | } |
115 | 115 | ||
116 | function scrollHandler() { | 116 | function scrollHandler() { |
117 | - if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) { | 117 | + if (!end || $(window).scrollTop() + winH >= $(document).height() - 200) { |
118 | search(); | 118 | search(); |
119 | } | 119 | } |
120 | } | 120 | } |
@@ -18,11 +18,6 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'), | @@ -18,11 +18,6 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'), | ||
18 | 18 | ||
19 | var $cart = $('.cart-bar'); | 19 | var $cart = $('.cart-bar'); |
20 | 20 | ||
21 | - | ||
22 | -require('./desc'); | ||
23 | -require('./comments-consults'); | ||
24 | -require('../recommend-for-you-product-desc'); | ||
25 | - | ||
26 | //add extra marign-bottom for footer to show the yoho copyright | 21 | //add extra marign-bottom for footer to show the yoho copyright |
27 | function showFooter() { | 22 | function showFooter() { |
28 | var $cartBar = $('.cart-bar'); | 23 | var $cartBar = $('.cart-bar'); |
@@ -74,6 +69,10 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { | @@ -74,6 +69,10 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { | ||
74 | }); | 69 | }); |
75 | } | 70 | } |
76 | 71 | ||
72 | +require('./desc'); | ||
73 | +require('./comments-consults'); | ||
74 | +require('../recommend-for-you-product-desc'); | ||
75 | + | ||
77 | //购物车商品数量 | 76 | //购物车商品数量 |
78 | $.ajax({ | 77 | $.ajax({ |
79 | type: 'GET', | 78 | type: 'GET', |
@@ -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,7 +11,8 @@ var $ = require('jquery'); | @@ -11,7 +11,8 @@ var $ = require('jquery'); | ||
11 | 11 | ||
12 | // var $page = $('.yoho-page'); | 12 | // var $page = $('.yoho-page'); |
13 | 13 | ||
14 | -var $num; | 14 | +var $num, |
15 | + $chosed; | ||
15 | 16 | ||
16 | // var tpl; | 17 | // var tpl; |
17 | 18 | ||
@@ -64,41 +65,69 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -64,41 +65,69 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
64 | var $this = $(this), | 65 | var $this = $(this), |
65 | $that = $(e.target).closest('.chose-items'), | 66 | $that = $(e.target).closest('.chose-items'), |
66 | numArray, | 67 | numArray, |
67 | - index; | 68 | + index, |
69 | + i; | ||
70 | + | ||
71 | + var $siblingBlock = $this.closest('.block-list').siblings(':first'), | ||
72 | + currentNumArray = $this.data('numstr').split('/'); | ||
68 | 73 | ||
69 | - if ($this.hasClass('chosed')) { | ||
70 | - $this.parent().find('.block').removeClass('chosed'); | ||
71 | - $that.find('.num .left-num').html(''); | ||
72 | - } else if ($this.hasClass('disable')) { | ||
73 | - $this.css('background-color', '#000'); | ||
74 | - return; | ||
75 | - } else if (!$this.hasClass('chosed')) { | ||
76 | $this.siblings('.chosed').removeClass('chosed'); | 74 | $this.siblings('.chosed').removeClass('chosed'); |
77 | - $this.addClass('chosed'); | 75 | + $this.toggleClass('chosed'); |
78 | index = $this.index(); | 76 | index = $this.index(); |
79 | - | 77 | + $chosed = $('.block-list>ul>li.chosed'); |
80 | 78 | ||
81 | //根据颜色切换图片 | 79 | //根据颜色切换图片 |
82 | if ($this.closest('.block-list').hasClass('color-list')) { | 80 | if ($this.closest('.block-list').hasClass('color-list')) { |
83 | $('.chose-panel .basic-info').find('.thumb').addClass('hide').eq(index).removeClass('hide'); | 81 | $('.chose-panel .basic-info').find('.thumb').addClass('hide').eq(index).removeClass('hide'); |
84 | } | 82 | } |
85 | 83 | ||
86 | - //剩余的商品数 | ||
87 | - if ($that.find('.color-list ul>li').hasClass('chosed') && $that.find('.size-list ul>li').hasClass('chosed')) { | ||
88 | - numArray = $this.closest('.block-list').siblings(':first').find('.chosed').data('numstr').split('/'); | ||
89 | - $that.find('.num .left-num').html('剩余' + numArray[index] + '件'); | ||
90 | - } else { | ||
91 | - $that.find('.num .left-num').html(''); | 84 | + if ($chosed.length === 0) { |
85 | + $this.closest('ul>li').each(function() { | ||
86 | + $(this).removeClass('zero-stock'); | ||
87 | + if (0 === $(this).data('num') - 0) { | ||
88 | + $(this).addClass('zero-stock'); | ||
92 | } | 89 | } |
90 | + }); | ||
93 | 91 | ||
94 | - //点击切换 | 92 | + $siblingBlock.find('ul>li').each(function() { |
93 | + $(this).removeClass('zero-stock'); | ||
94 | + if (0 === $(this).data('num') - 0) { | ||
95 | + $(this).addClass('zero-stock'); | ||
96 | + } | ||
97 | + }); | ||
98 | + } else if ($chosed.length === 1 && $this.hasClass('chosed')) { | ||
99 | + numArray = $chosed.data('numstr').split('/'); | ||
100 | + $siblingBlock.find('.block').removeClass('zero-stock'); | ||
101 | + for (i = 0; i < numArray.length; i++) { | ||
102 | + if (0 === numArray[i] - 0) { | ||
103 | + $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | ||
104 | + } | ||
105 | + } | ||
106 | + } else if ($chosed.length === 1 && !$this.hasClass('chosed')) { | ||
107 | + $siblingBlock.find('ul>li').each(function() { | ||
108 | + $(this).removeClass('zero-stock'); | ||
109 | + if (0 === $(this).data('num') - 0) { | ||
110 | + $(this).addClass('zero-stock'); | ||
111 | + } | ||
112 | + }); | ||
113 | + $that.find('.num .left-num').html(''); | ||
114 | + } else if ($chosed.length === 2) { | ||
115 | + $siblingBlock.find('.block').removeClass('zero-stock'); | ||
116 | + for (i = 0; i < currentNumArray.length; i++) { | ||
117 | + if (0 === currentNumArray[i] - 0) { | ||
118 | + $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | ||
119 | + } | ||
120 | + } | ||
121 | + numArray = $siblingBlock.find('.chosed').data('numstr').split('/'); | ||
122 | + $that.find('.num .left-num').html('剩余' + numArray[index] + '件'); | ||
95 | } | 123 | } |
96 | 124 | ||
97 | }).on('touchstart', '.btn-minus', function() { | 125 | }).on('touchstart', '.btn-minus', function() { |
98 | - var num = +$num.val(); | 126 | + var num = +$num.val(), |
127 | + $chosed = $('.block-list>ul>li.chosed'); | ||
99 | 128 | ||
100 | //若颜色和尺码没有被同时选中,则不能点击 | 129 | //若颜色和尺码没有被同时选中,则不能点击 |
101 | - if ($('.block-list>ul>li.chosed').length < 2) { | 130 | + if ($chosed.length < 2) { |
102 | return; | 131 | return; |
103 | } | 132 | } |
104 | 133 |
@@ -7,23 +7,23 @@ | @@ -7,23 +7,23 @@ | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | lazyLoad = require('yoho.lazyload'); | 8 | lazyLoad = require('yoho.lazyload'); |
9 | 9 | ||
10 | -var chosePanel = require('./chose-panel'); | 10 | +//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 | ||
@@ -33,6 +34,7 @@ lazyLoad({ | @@ -33,6 +34,7 @@ lazyLoad({ | ||
33 | try_again_css: 'order-failure' | 34 | try_again_css: 'order-failure' |
34 | }); | 35 | }); |
35 | 36 | ||
37 | + | ||
36 | $names = $('.name'); | 38 | $names = $('.name'); |
37 | if ($names.length > 0) { | 39 | if ($names.length > 0) { |
38 | $names[0].mlellipsis(2); | 40 | $names[0].mlellipsis(2); |
@@ -155,4 +157,23 @@ $('.btn-balance').on('touchend', function() { | @@ -155,4 +157,23 @@ $('.btn-balance').on('touchend', function() { | ||
155 | window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType; | 157 | window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType; |
156 | }); | 158 | }); |
157 | 159 | ||
160 | +$('.advance-buy').on('touchend', function() { | ||
161 | + var $advanceBuy = $('#advanceBuy'), | ||
162 | + $mainCart = $('#mainCart'); | ||
163 | + | ||
164 | + if ($advanceBuy.hasClass('hide')) { | ||
165 | + $mainCart.removeClass('show').addClass('hide'); | ||
166 | + $advanceBuy.removeClass('hide').addClass('show'); | ||
167 | + } else { | ||
168 | + $advanceBuy.removeClass('show').addClass('hide'); | ||
169 | + $mainCart.removeClass('hide').addClass('show'); | ||
170 | + } | ||
171 | +}); | ||
172 | + | ||
173 | + | ||
174 | +$('.chose').on('touchend', function() { | ||
175 | + | ||
176 | + //var id = $(this).closest('.gift-advance-good').data('id'); | ||
177 | + chosePanel.show(); | ||
178 | +}); | ||
158 | 179 |
@@ -81,6 +81,7 @@ function orderCompute() { | @@ -81,6 +81,7 @@ function orderCompute() { | ||
81 | sumPrice: res.order_amount, | 81 | sumPrice: res.order_amount, |
82 | salePrice: res.discount_amount, | 82 | salePrice: res.discount_amount, |
83 | freight: res.promotion_formula_list[1].promotion_amount, | 83 | freight: res.promotion_formula_list[1].promotion_amount, |
84 | + couponPrice: res.coupon_amount, | ||
84 | yohoCoin: res.use_yoho_coin, | 85 | yohoCoin: res.use_yoho_coin, |
85 | price: res.last_order_amount | 86 | price: res.last_order_amount |
86 | }); | 87 | }); |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | * @author: bikai<kai.bi@yoho.cn> | 3 | * @author: bikai<kai.bi@yoho.cn> |
4 | * @date: 2015/12/14 | 4 | * @date: 2015/12/14 |
5 | */ | 5 | */ |
6 | +var $ = require('jquery'); | ||
6 | var info = window.cookie('order-info'); | 7 | var info = window.cookie('order-info'); |
7 | 8 | ||
8 | // info 必须是 JSON 字符串 | 9 | // info 必须是 JSON 字符串 |
@@ -10,10 +11,10 @@ try { | @@ -10,10 +11,10 @@ try { | ||
10 | info = JSON.parse(info); | 11 | info = JSON.parse(info); |
11 | } catch (e) { | 12 | } catch (e) { |
12 | info = { | 13 | info = { |
13 | - deliveryId: null, | ||
14 | - deliveryTimeId: null, | ||
15 | - paymentTypeId: null, | ||
16 | - yohoCoin: null, | 14 | + deliveryId: 1, |
15 | + deliveryTimeId: 1, | ||
16 | + paymentTypeId: 1, | ||
17 | + yohoCoin: $('.coin').data('yoho-coin') || 0, | ||
17 | addressId: null, | 18 | addressId: null, |
18 | couponCode: null, | 19 | couponCode: null, |
19 | couponValue: null, | 20 | couponValue: null, |
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | "yoho.iswiper": "3.0.1", | 21 | "yoho.iswiper": "3.0.1", |
22 | "iscroll": "5.1.2", | 22 | "iscroll": "5.1.2", |
23 | "import-style": "1.0.0", | 23 | "import-style": "1.0.0", |
24 | - "yoho.lazyload": "1.1.3", | 24 | + "yoho.lazyload": "1.1.4", |
25 | "yoho.handlebars": "3.0.3", | 25 | "yoho.handlebars": "3.0.3", |
26 | "yoho.hammer": "2.0.4" | 26 | "yoho.hammer": "2.0.4" |
27 | }, | 27 | }, |
@@ -105,10 +105,16 @@ | @@ -105,10 +105,16 @@ | ||
105 | color: #e10; | 105 | color: #e10; |
106 | } | 106 | } |
107 | 107 | ||
108 | - &.disable { | 108 | + &.zero-stock { |
109 | color: #e0e0e0; | 109 | color: #e0e0e0; |
110 | border-color: #e0e0e0; | 110 | border-color: #e0e0e0; |
111 | } | 111 | } |
112 | + &.zero-stock.chosed { | ||
113 | + border-color: #e0e0e0; | ||
114 | + background: none; | ||
115 | + color: #e0e0e0; | ||
116 | + background-color: #f0f0f0; | ||
117 | + } | ||
112 | } | 118 | } |
113 | 119 | ||
114 | .num { | 120 | .num { |
@@ -177,4 +177,148 @@ | @@ -177,4 +177,148 @@ | ||
177 | font-size: 28rem / $pxConvertRem; | 177 | font-size: 28rem / $pxConvertRem; |
178 | } | 178 | } |
179 | } | 179 | } |
180 | + | ||
181 | + .gift-advance-good { | ||
182 | + position: relative; | ||
183 | + padding: 20rem / $pxConvertRem 0; | ||
184 | + margin-left: 34rem / $pxConvertRem; | ||
185 | + height: 160rem / $pxConvertRem; | ||
186 | + border-bottom: 1px solid #e0e0e0; | ||
187 | + | ||
188 | + &:last-child { | ||
189 | + border-bottom: none; | ||
190 | + } | ||
191 | + } | ||
192 | + | ||
193 | + | ||
194 | + .advance-block .gift-advance-good:last-child { | ||
195 | + border-bottom: none; | ||
196 | + } | ||
197 | + | ||
198 | + .advance-block:last-child .gift-advance-good:last-child { | ||
199 | + border-bottom: 1px solid #e0e0e0; | ||
200 | + } | ||
201 | + | ||
202 | + .thumb-wrap { | ||
203 | + position: relative; | ||
204 | + float: left; | ||
205 | + width: 120rem / $pxConvertRem; | ||
206 | + height: 160rem / $pxConvertRem; | ||
207 | + | ||
208 | + .thumb { | ||
209 | + width: 100%; | ||
210 | + height: 100%; | ||
211 | + } | ||
212 | + } | ||
213 | + | ||
214 | + .tag { | ||
215 | + position: absolute; | ||
216 | + bottom: 0; | ||
217 | + left: 0; | ||
218 | + right: 0; | ||
219 | + height: 25rem / $pxConvertRem; | ||
220 | + color: #fff; | ||
221 | + text-align: center; | ||
222 | + background: #a1ce4e; | ||
223 | + | ||
224 | + &:before { | ||
225 | + content: '赠品'; | ||
226 | + } | ||
227 | + } | ||
228 | + | ||
229 | + .deps { | ||
230 | + margin-left: 135rem / $pxConvertRem; | ||
231 | + } | ||
232 | + | ||
233 | + .name { | ||
234 | + font-size: 28rem / $pxConvertRem; | ||
235 | + } | ||
236 | + | ||
237 | + .row:nth-child(2) { | ||
238 | + font-size: 22rem / $pxConvertRem; | ||
239 | + height: 45rem / $pxConvertRem; | ||
240 | + line-height: 45rem / $pxConvertRem; | ||
241 | + | ||
242 | + > span { | ||
243 | + margin-right: 15rem / $pxConvertRem; | ||
244 | + } | ||
245 | + } | ||
246 | + | ||
247 | + .row:nth-child(3) { | ||
248 | + position: relative; | ||
249 | + } | ||
250 | + | ||
251 | + .color, .size { | ||
252 | + color: #b6b6b6; | ||
253 | + } | ||
254 | + | ||
255 | + .price { | ||
256 | + font-size: 24rem / $pxConvertRem; | ||
257 | + color: #000; | ||
258 | + } | ||
259 | + | ||
260 | + .count { | ||
261 | + font-size: 20rem / $pxConvertRem; | ||
262 | + color: #999; | ||
263 | + margin-left: 22rem / $pxConvertRem; | ||
264 | + } | ||
265 | + | ||
266 | + .chose { | ||
267 | + position: absolute; | ||
268 | + width: 88rem / $pxConvertRem; | ||
269 | + height: 58rem / $pxConvertRem; | ||
270 | + background: #f8f8f8; | ||
271 | + border: 1px solid #ccc; | ||
272 | + right: 20rem / $pxConvertRem; | ||
273 | + top: 71rem / $pxConvertRem; | ||
274 | + font-size: 26rem / $pxConvertRem; | ||
275 | + } | ||
276 | + | ||
277 | + .title { | ||
278 | + height: 50rem / $pxConvertRem; | ||
279 | + line-height: 50rem / $pxConvertRem; | ||
280 | + padding-left: 20rem / $pxConvertRem; | ||
281 | + font-size: 24rem / $pxConvertRem; | ||
282 | + background: #f8f8f8; | ||
283 | + } | ||
284 | + | ||
285 | + .advance-block .tag { | ||
286 | + background: #eb76aa; | ||
287 | + &:before { | ||
288 | + content: '加价购'; | ||
289 | + } | ||
290 | + } | ||
291 | +} | ||
292 | +.shopping-cart-zero{ | ||
293 | + .cart-zero{ | ||
294 | + width: 100%; | ||
295 | + height: auto; | ||
296 | + padding-top:2rem; | ||
297 | + padding-bottom:20%; | ||
298 | + i{ | ||
299 | + font-size: 6em; | ||
300 | + display: block; | ||
301 | + margin: 0 auto; | ||
302 | + text-align: center; | ||
303 | + color: #505050; | ||
304 | + } | ||
305 | + p{ | ||
306 | + display: block; | ||
307 | + text-align: center; | ||
308 | + font-size: 1.2em; | ||
309 | + color: #505050; | ||
310 | + padding:.6rem 0; | ||
311 | + } | ||
312 | + a{ | ||
313 | + width: 27%; | ||
314 | + height: 1.2rem; | ||
315 | + overflow: hidden; | ||
316 | + line-height: 1.2rem; | ||
317 | + border:1px solid #505050; | ||
318 | + border-radius:.2rem; | ||
319 | + display: block; | ||
320 | + margin: 0 auto; | ||
321 | + text-align: center; | ||
322 | + } | ||
323 | + } | ||
180 | } | 324 | } |
1 | {{> layout/header}} | 1 | {{> layout/header}} |
2 | -<div class="shopping-cart-page yoho-page"> | 2 | +<div id="mainCart" class="shopping-cart-page yoho-page"> |
3 | + | ||
3 | {{# shoppingCart}} | 4 | {{# shoppingCart}} |
4 | {{#if cartNav}} | 5 | {{#if cartNav}} |
5 | <ul class="cart-nav clearfix"> | 6 | <ul class="cart-nav clearfix"> |
@@ -44,4 +45,29 @@ | @@ -44,4 +45,29 @@ | ||
44 | 45 | ||
45 | {{/ shoppingCart}} | 46 | {{/ shoppingCart}} |
46 | </div> | 47 | </div> |
48 | + | ||
49 | +<div id="advanceBuy" class="shopping-cart-page yoho-page hide"> | ||
50 | +{{# shoppingCart}} | ||
51 | + {{# commonCart}} | ||
52 | + {{# advanceBuy}} | ||
53 | + <span> | ||
54 | + {{promotionTitle}} | ||
55 | + </span> | ||
56 | + {{# goods}} | ||
57 | + {{> shopping-cart/gift-advance-good}} | ||
58 | + {{/ goods}} | ||
59 | + {{/ advanceBuy}} | ||
60 | + {{/ commonCart}} | ||
61 | +{{/ shoppingCart}} | ||
62 | +</div> | ||
63 | + | ||
64 | +<div class="shopping-cart-zero yoho-page hide"> | ||
65 | + <div class="cart-zero"> | ||
66 | + <i class="iconfont"></i> | ||
67 | + <p>您的购物车暂无商品</p> | ||
68 | + <a href="">随便逛逛</a> | ||
69 | + </div> | ||
70 | + {{> product/recommend-for-you}} | ||
71 | +</div> | ||
72 | + | ||
47 | {{> layout/footer}} | 73 | {{> layout/footer}} |
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | 41 | ||
42 | <section class="block"> | 42 | <section class="block"> |
43 | <ul class="sale-invoice"> | 43 | <ul class="sale-invoice"> |
44 | - {{#if coupon}} | 44 | + {{# coupon}} |
45 | <li class="coupon"> | 45 | <li class="coupon"> |
46 | <a href="/shoppingCart/selectCoupon"> | 46 | <a href="/shoppingCart/selectCoupon"> |
47 | <!-- <a href="{{url}}"> --> | 47 | <!-- <a href="{{url}}"> --> |
@@ -65,7 +65,7 @@ | @@ -65,7 +65,7 @@ | ||
65 | {{/if}} | 65 | {{/if}} |
66 | </a> | 66 | </a> |
67 | </li> | 67 | </li> |
68 | - {{/if}} | 68 | + {{/coupon}} |
69 | 69 | ||
70 | <li class="coin" data-yoho-coin="{{yohoCoin}}"> | 70 | <li class="coin" data-yoho-coin="{{yohoCoin}}"> |
71 | <span class="title">YOHO币</span> | 71 | <span class="title">YOHO币</span> |
@@ -112,11 +112,17 @@ | @@ -112,11 +112,17 @@ | ||
112 | </li> | 112 | </li> |
113 | <li> | 113 | <li> |
114 | <span>运费</span> | 114 | <span>运费</span> |
115 | - + ¥{{freight}} | 115 | + + {{freight}} |
116 | + </li> | ||
117 | + {{#couponPrice}} | ||
118 | + <li> | ||
119 | + <span>优惠券</span> | ||
120 | + - ¥{{.}} | ||
116 | </li> | 121 | </li> |
122 | + {{/couponPrice}} | ||
117 | <li> | 123 | <li> |
118 | <span>YOHO币</span> | 124 | <span>YOHO币</span> |
119 | - - ¥{{yohoCoin}} | 125 | + - {{yohoCoin}} |
120 | </li> | 126 | </li> |
121 | <li class="cost"> | 127 | <li class="cost"> |
122 | 应付金额: <em>¥{{price}}</em> | 128 | 应付金额: <em>¥{{price}}</em> |
@@ -154,6 +160,12 @@ | @@ -154,6 +160,12 @@ | ||
154 | <span>运费</span> | 160 | <span>运费</span> |
155 | + \{{freight}} | 161 | + \{{freight}} |
156 | </li> | 162 | </li> |
163 | + \{{#couponPrice}} | ||
164 | + <li> | ||
165 | + <span>优惠券</span> | ||
166 | + - ¥\{{.}} | ||
167 | + </li> | ||
168 | + \{{/couponPrice}} | ||
157 | <li> | 169 | <li> |
158 | <span>YOHO币</span> | 170 | <span>YOHO币</span> |
159 | - ¥\{{yohoCoin}} | 171 | - ¥\{{yohoCoin}} |
@@ -206,6 +206,7 @@ | @@ -206,6 +206,7 @@ | ||
206 | {{#if shoppingCartPage}} | 206 | {{#if shoppingCartPage}} |
207 | <script> | 207 | <script> |
208 | seajs.use('js/shopping-cart/cart'); | 208 | seajs.use('js/shopping-cart/cart'); |
209 | + seajs.use('js/product/recommend-for-you'); | ||
209 | </script> | 210 | </script> |
210 | {{/if}} | 211 | {{/if}} |
211 | {{#if giftAdvancePage}} | 212 | {{#if giftAdvancePage}} |
@@ -16,16 +16,16 @@ | @@ -16,16 +16,16 @@ | ||
16 | </a> | 16 | </a> |
17 | </li> | 17 | </li> |
18 | {{/ freebie}} | 18 | {{/ freebie}} |
19 | - {{# advanceBuy}} | 19 | + {{#if advanceBuy}} |
20 | <li class="advance-buy"> | 20 | <li class="advance-buy"> |
21 | <span class="iconfont"></span> | 21 | <span class="iconfont"></span> |
22 | 加价购 | 22 | 加价购 |
23 | - <a href={{url}}> | 23 | + <a> |
24 | <span class="count">{{count}}</span> | 24 | <span class="count">{{count}}</span> |
25 | <span class="iconfont icon-right-arrow"></span> | 25 | <span class="iconfont icon-right-arrow"></span> |
26 | </a> | 26 | </a> |
27 | </li> | 27 | </li> |
28 | - {{/ advanceBuy}} | 28 | + {{/if}} |
29 | </ul> | 29 | </ul> |
30 | {{/if}} | 30 | {{/if}} |
31 | 31 |
@@ -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}}disable{{/unless}}" data-id={{id}} data-numstr="{{sizeNumStr}}"> | 28 | + <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-numstr="{{sizeNumStr}}"> |
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}}disable{{/unless}}" data-id={{id}} 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}}"> |
39 | {{name}} | 39 | {{name}} |
40 | </li> | 40 | </li> |
41 | {{/ sizes}} | 41 | {{/ sizes}} |
@@ -23,7 +23,7 @@ class CartModel | @@ -23,7 +23,7 @@ class CartModel | ||
23 | * @param int $productSku 商品SKU | 23 | * @param int $productSku 商品SKU |
24 | * @param int $buyNumber 购买数量 | 24 | * @param int $buyNumber 购买数量 |
25 | * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 | 25 | * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 |
26 | - * @param int int $isEdit 是否是编辑商品SKU,0表示不是编辑 | 26 | + * @param int $isEdit 是否是编辑商品SKU,0表示不是编辑 |
27 | * @param null|int $promotionId 促销id,默认null(加价购有关) | 27 | * @param null|int $promotionId 促销id,默认null(加价购有关) |
28 | * @param null|int $uid 用户UID,可以不传 | 28 | * @param null|int $uid 用户UID,可以不传 |
29 | * @return array 加入购物车接口返回的数据 | 29 | * @return array 加入购物车接口返回的数据 |
@@ -406,7 +406,7 @@ class CartModel | @@ -406,7 +406,7 @@ class CartModel | ||
406 | $oneGoods['name'] = $single['product_name']; | 406 | $oneGoods['name'] = $single['product_name']; |
407 | $oneGoods['color'] = $single['color_name']; | 407 | $oneGoods['color'] = $single['color_name']; |
408 | $oneGoods['size'] = $single['size_name']; | 408 | $oneGoods['size'] = $single['size_name']; |
409 | - $oneGoods['price'] = Helpers::transPrice($single['real_price']); // last_price有些带.00,有些不带,real_price都不带.00 | 409 | + $oneGoods['price'] = Helpers::transPrice($single['sales_price']); |
410 | $oneGoods['count'] = $single['buy_number']; | 410 | $oneGoods['count'] = $single['buy_number']; |
411 | 411 | ||
412 | $result['goods'][] = $oneGoods; | 412 | $result['goods'][] = $oneGoods; |
@@ -428,18 +428,20 @@ class CartModel | @@ -428,18 +428,20 @@ class CartModel | ||
428 | } | 428 | } |
429 | 429 | ||
430 | // 有货币 | 430 | // 有货币 |
431 | - $result['yohoCoin'] = isset($orderCompute['use_yoho_coin']) ? isset($orderCompute['use_yoho_coin']) : $payReturn['yoho_coin']; | 431 | + $result['yohoCoin'] = (isset($orderCompute['use_yoho_coin']) && !empty($orderCompute['use_yoho_coin'])) ? $orderCompute['use_yoho_coin'] : $payReturn['yoho_coin']; |
432 | 432 | ||
433 | // 订单数据 | 433 | // 订单数据 |
434 | if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { | 434 | if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { |
435 | $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount']; | 435 | $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount']; |
436 | - $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount']; | 436 | + $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list'][1]['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount']; |
437 | + $couponPrice = isset($orderCompute['coupon_amount']) ? $orderCompute['coupon_amount'] : false; | ||
438 | + $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][3]['promotion_amount']; | ||
437 | $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount']; | 439 | $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount']; |
438 | - $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list']['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount']; | ||
439 | $result['sumPrice'] = Helpers::transPrice($sumPrice); | 440 | $result['sumPrice'] = Helpers::transPrice($sumPrice); |
440 | $result['salePrice'] = Helpers::transPrice($salePrice); | 441 | $result['salePrice'] = Helpers::transPrice($salePrice); |
441 | $result['price'] = Helpers::transPrice($price); | 442 | $result['price'] = Helpers::transPrice($price); |
442 | - $result['freight'] = strtr($freight, array('¥'=>'','¥'=>'')) . '.00'; | 443 | + $result['freight'] = $freight; |
444 | + $result['couponPrice'] = $couponPrice; | ||
443 | } | 445 | } |
444 | 446 | ||
445 | // 发票有关数据 | 447 | // 发票有关数据 |
@@ -468,7 +470,7 @@ class CartModel | @@ -468,7 +470,7 @@ class CartModel | ||
468 | // 优惠券数据 | 470 | // 优惠券数据 |
469 | $coupons = array(); | 471 | $coupons = array(); |
470 | !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue']; | 472 | !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue']; |
471 | - $coupons += self::getCouponList($uid, 0, 1, true); | 473 | + $coupons += self::getCouponList($uid, true); |
472 | $result['coupon'] = $coupons; | 474 | $result['coupon'] = $coupons; |
473 | } | 475 | } |
474 | 476 | ||
@@ -535,7 +537,7 @@ class CartModel | @@ -535,7 +537,7 @@ class CartModel | ||
535 | if (isset($coupons['data'])) { | 537 | if (isset($coupons['data'])) { |
536 | 538 | ||
537 | if ($onlyTotal) { | 539 | if ($onlyTotal) { |
538 | - $result['count'] = $coupons['data']['total']; | 540 | + $result['count'] = count($coupons['data']['couponList']); |
539 | } else { | 541 | } else { |
540 | $couponArr = array(); | 542 | $couponArr = array(); |
541 | isset($coupons['data']['couponList']) && $couponArr = $coupons['data']['couponList']; | 543 | isset($coupons['data']['couponList']) && $couponArr = $coupons['data']['couponList']; |
@@ -605,7 +607,6 @@ class CartModel | @@ -605,7 +607,6 @@ class CartModel | ||
605 | { | 607 | { |
606 | $result = array(); | 608 | $result = array(); |
607 | 609 | ||
608 | - $oneGoods = array(); | ||
609 | // 购买的可用商品列表 | 610 | // 购买的可用商品列表 |
610 | $validGoods = Helpers::formatCartGoods($data['goods_list']); | 611 | $validGoods = Helpers::formatCartGoods($data['goods_list']); |
611 | !empty($validGoods) && $result['goods'] = $validGoods; | 612 | !empty($validGoods) && $result['goods'] = $validGoods; |
-
Please register or login to post a comment