Merge branch 'feature/cart' of git.dev.yoho.cn:web/yohobuy into feature/cart
Showing
15 changed files
with
221 additions
and
84 deletions
@@ -571,9 +571,10 @@ class Helpers | @@ -571,9 +571,10 @@ class Helpers | ||
571 | $oneGoods['id'] = $value['product_sku']; | 571 | $oneGoods['id'] = $value['product_sku']; |
572 | $oneGoods['skn'] = $value['product_skn']; | 572 | $oneGoods['skn'] = $value['product_skn']; |
573 | $oneGoods['name'] = $value['product_name']; | 573 | $oneGoods['name'] = $value['product_name']; |
574 | - $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 120) : ''; | 574 | + $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : ''; |
575 | $oneGoods['color'] = $value['color_name']; | 575 | $oneGoods['color'] = $value['color_name']; |
576 | $oneGoods['size'] = $value['size_name']; | 576 | $oneGoods['size'] = $value['size_name']; |
577 | + $oneGoods['isSelected'] = $value['selected'] === 'Y'; | ||
577 | $oneGoods['price'] = self::transPrice($value['sales_price']); | 578 | $oneGoods['price'] = self::transPrice($value['sales_price']); |
578 | $oneGoods['count'] = $value['buy_number']; | 579 | $oneGoods['count'] = $value['buy_number']; |
579 | $oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']); | 580 | $oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']); |
@@ -633,7 +634,7 @@ class Helpers | @@ -633,7 +634,7 @@ class Helpers | ||
633 | $arr[] = $gift; | 634 | $arr[] = $gift; |
634 | 635 | ||
635 | // 计算加价购商品数目 | 636 | // 计算加价购商品数目 |
636 | - $count += count($value['goods_list']); | 637 | + $count += $value['max_select_number']; |
637 | } | 638 | } |
638 | 639 | ||
639 | return $arr; | 640 | return $arr; |
@@ -127,7 +127,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -127,7 +127,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
127 | i; | 127 | i; |
128 | 128 | ||
129 | var $siblingBlock = $this.closest('.block-list').siblings(':first'), | 129 | var $siblingBlock = $this.closest('.block-list').siblings(':first'), |
130 | - currentNumArray = $this.data('numstr').split('/'); | 130 | + currentNumArray = ($this.data('numstr') + '').split('/'); |
131 | 131 | ||
132 | $this.siblings('.chosed').removeClass('chosed'); | 132 | $this.siblings('.chosed').removeClass('chosed'); |
133 | $this.toggleClass('chosed'); | 133 | $this.toggleClass('chosed'); |
@@ -167,7 +167,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -167,7 +167,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
167 | }); | 167 | }); |
168 | } | 168 | } |
169 | 169 | ||
170 | - numArray = $chosed.data('numstr').split('/'); | 170 | + numArray = ($chosed.data('numstr') + '').split('/'); |
171 | $siblingBlock.find('.block').removeClass('zero-stock'); | 171 | $siblingBlock.find('.block').removeClass('zero-stock'); |
172 | for (i = 0; i < numArray.length; i++) { | 172 | for (i = 0; i < numArray.length; i++) { |
173 | if (0 === numArray[i] - 0) { | 173 | if (0 === numArray[i] - 0) { |
@@ -35,9 +35,13 @@ function getProductInfo(skn, promotionId) { | @@ -35,9 +35,13 @@ function getProductInfo(skn, promotionId) { | ||
35 | tip.show('网络错误'); | 35 | tip.show('网络错误'); |
36 | return; | 36 | return; |
37 | } | 37 | } |
38 | - console.log(res); | 38 | + if (!panelTmpl) { |
39 | + return; | ||
40 | + } | ||
39 | if (res.code === 200) { | 41 | if (res.code === 200) { |
40 | - $chosePanel.html(panelTmpl(res.data)); | 42 | + $chosePanel.html(panelTmpl({ |
43 | + cartInfo: res.data | ||
44 | + })); | ||
41 | chosePanel.show(); | 45 | chosePanel.show(); |
42 | } else { | 46 | } else { |
43 | tip.show(res.message || '网络错误'); | 47 | tip.show(res.message || '网络错误'); |
@@ -12,18 +12,10 @@ var $ = require('jquery'), | @@ -12,18 +12,10 @@ 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 | +var $names, | ||
16 | + $selectAllBtn = $('.balance .iconfont'); | ||
15 | 17 | ||
16 | -var $names; | ||
17 | - | ||
18 | -//var $curDelPanel; | ||
19 | - | ||
20 | -////删除面板显示后任何点击行为都将触发隐藏面板 | ||
21 | -//function docTouchEvt() { | ||
22 | -// $curDelPanel && $curDelPanel.addClass('hide'); | ||
23 | -// | ||
24 | -// // | ||
25 | -// $(document).off('touchstart', docTouchEvt); | ||
26 | -//} | 18 | +var requesting = false; |
27 | 19 | ||
28 | ellipsis.init(); | 20 | ellipsis.init(); |
29 | 21 | ||
@@ -55,25 +47,26 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -55,25 +47,26 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
55 | } else { | 47 | } else { |
56 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); | 48 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); |
57 | } | 49 | } |
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); | 50 | + $.ajax({ |
51 | + type: 'GET', | ||
52 | + url: '/cart/index/getCartData', | ||
53 | + data: { | ||
54 | + skuList: JSON.stringfy(id) | ||
55 | + }, | ||
56 | + success: function(data) { | ||
57 | + if (data) { | ||
58 | + $('#good-totalprice').html('¥' + data.commonCart.price); | ||
59 | + $('#good-activityPrice').html('¥' + data.commonCart.activityPrice); | ||
60 | + $('#good-total').html('总计:¥' + data.commonCart.sumPrice + ' (' + data.commonCart.count + '件)'); | ||
61 | + } | ||
62 | + }, | ||
63 | + error: function() { | ||
64 | + tip.show('网络错误'); | ||
70 | } | 65 | } |
71 | - }, | ||
72 | - error: function() { | ||
73 | - tip.show('网络错误'); | ||
74 | - } | ||
75 | - }); | ||
76 | - | 66 | + }); |
67 | + } else if (data.code === 200) { | ||
68 | + tip.show('网络错误'); | ||
69 | + } | ||
77 | }).fail(function() { | 70 | }).fail(function() { |
78 | tip.show('网络错误'); | 71 | tip.show('网络错误'); |
79 | }); | 72 | }); |
@@ -167,30 +160,122 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -167,30 +160,122 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
167 | // }); | 160 | // }); |
168 | //}) | 161 | //}) |
169 | 162 | ||
170 | -$('.down').on('touchend', function() { | ||
171 | - chosePanel.show(); | ||
172 | -}); | ||
173 | -$('.cut').on('touchend', function() { | ||
174 | - var id = $(this).closest('.shopping-cart-good').data('id'); | ||
175 | - | 163 | +function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { |
164 | + if (requesting) { | ||
165 | + return; | ||
166 | + } | ||
167 | + requesting = true; | ||
176 | $.ajax({ | 168 | $.ajax({ |
177 | - type: 'GET', | ||
178 | - url: '/cart/index/modify', | ||
179 | - data: { | ||
180 | - old_product_sku: id, | ||
181 | - new_product_sku: id, | ||
182 | - buy_number: '0', | ||
183 | - selected: 'Y' | ||
184 | - }, | ||
185 | - success: function(data) { | ||
186 | - if (data.code === 200) { | ||
187 | - window.history.go(0); | ||
188 | - } | ||
189 | - }, | ||
190 | - error: function() { | ||
191 | - tip.show('网络错误'); | 169 | + url: 'select', |
170 | + type: 'post', | ||
171 | + data: { | ||
172 | + skuList: JSON.stringify(theGoods) | ||
173 | + }, | ||
174 | + success: function(res) { | ||
175 | + if (res.code === 200) { | ||
176 | + successHandeler(); | ||
177 | + } else { | ||
178 | + tip.show(res.message); | ||
192 | } | 179 | } |
180 | + }, | ||
181 | + error: function(err) { | ||
182 | + tip.show('网络异常'); | ||
183 | + }, | ||
184 | + complete: function() { | ||
185 | + requesting = false; | ||
186 | + } | ||
187 | + }); | ||
188 | +} | ||
189 | + | ||
190 | +function didUpdateAllGoodsCheckStatus() { | ||
191 | + var $checkedBoxs = $('.shopping-cart-good .icon-cb-checked'), | ||
192 | + $uncheckedBoxs = $('.shopping-cart-good .icon-checkbox'); | ||
193 | + | ||
194 | + var shouldSelectAll; | ||
195 | + | ||
196 | + if ($selectAllBtn.hasClass('icon-cb-checked')) { | ||
197 | + $selectAllBtn.removeClass('icon-cb-checked').addClass('icon-checkbox'); | ||
198 | + shouldSelectAll = true; | ||
199 | + } else { | ||
200 | + $selectAllBtn.removeClass('icon-checkbox').addClass('icon-cb-checked'); | ||
201 | + shouldSelectAll = false; | ||
202 | + } | ||
203 | + | ||
204 | + if (!shouldSelectAll) { | ||
205 | + $uncheckedBoxs.each(function(idx, uncheckedBox) { | ||
206 | + $(uncheckedBox).removeClass('icon-checkbox').addClass('icon-cb-checked'); | ||
207 | + }); | ||
208 | + } else { | ||
209 | + $checkedBoxs.each(function(idx, checkedBox) { | ||
210 | + $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox'); | ||
193 | }); | 211 | }); |
212 | + } | ||
213 | +} | ||
214 | + | ||
215 | +function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | ||
216 | + var goodInfo = {}; | ||
217 | + var $goods = $('.cart-content:not(.hide) .shopping-cart-good'); | ||
218 | + var $good = null; | ||
219 | + var goodsList = []; | ||
220 | + | ||
221 | + function GoodInfo(properties) { | ||
222 | + this.goods_type = properties.goods_type; | ||
223 | + this.buy_number = properties.buy_number; | ||
224 | + this.product_sku = properties.product_sku; | ||
225 | + this.selected = properties.selected; | ||
226 | + } | ||
227 | + | ||
228 | + goodInfo.goods_type = type; | ||
229 | + goodInfo.selected = isSelected ? 'Y' : 'N'; | ||
230 | + | ||
231 | + $goods.each(function(idx, good) { | ||
232 | + $good = $(good); | ||
233 | + | ||
234 | + goodInfo.product_sku = $(good).data('id'); | ||
235 | + goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', ''); | ||
236 | + | ||
237 | + goodsList.push(new GoodInfo(goodInfo)); | ||
238 | + }); | ||
239 | + console.log(goodsList); | ||
240 | + | ||
241 | + requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch); | ||
242 | +} | ||
243 | + | ||
244 | +//获取当前购物车类型 | ||
245 | +function getCartType() { | ||
246 | + var $navItem = $('.cart-nav ').find('li'), | ||
247 | + type = 'ordinary'; | ||
194 | 248 | ||
249 | + if ($navItem.eq(0).hasClass('active')) { | ||
250 | + type = 'ordinary'; | ||
251 | + } else { | ||
252 | + type = 'advance'; | ||
253 | + } | ||
254 | + | ||
255 | + return type; | ||
256 | +} | ||
257 | + | ||
258 | +//是否要全选 | ||
259 | +function willBeSelected() { | ||
260 | + var isSelected = true; | ||
261 | + var $this = $(this); | ||
262 | + | ||
263 | + if ($this.hasClass('icon-cb-checked')) { | ||
264 | + isSelected = true; | ||
265 | + } else { | ||
266 | + isSelected = false; | ||
267 | + } | ||
268 | + | ||
269 | + return isSelected; | ||
270 | +} | ||
271 | + | ||
272 | +//全选按钮点击事件 | ||
273 | +$selectAllBtn.on('touchend', function() { | ||
274 | + bottomCheckBoxHandeler(willBeSelected(), getCartType(), didUpdateAllGoodsCheckStatus); | ||
275 | +}); | ||
276 | + | ||
277 | +$('.down').on('touchend', function() { | ||
278 | + chosePanel.show(); | ||
195 | }); | 279 | }); |
196 | 280 | ||
281 | + |
@@ -80,7 +80,7 @@ optHammer.on('tap', function(e) { | @@ -80,7 +80,7 @@ optHammer.on('tap', function(e) { | ||
80 | } else { | 80 | } else { |
81 | tip.show(res.message || '网络错误'); | 81 | tip.show(res.message || '网络错误'); |
82 | } | 82 | } |
83 | - window.location.reload(); | 83 | + window.location.href = '/home/orders'; |
84 | }).fail(function() { | 84 | }).fail(function() { |
85 | tip.show('网络错误'); | 85 | tip.show('网络错误'); |
86 | }); | 86 | }); |
@@ -40,10 +40,10 @@ | @@ -40,10 +40,10 @@ | ||
40 | height: 25rem / $pxConvertRem; | 40 | height: 25rem / $pxConvertRem; |
41 | color: #fff; | 41 | color: #fff; |
42 | text-align: center; | 42 | text-align: center; |
43 | - background: #a1ce4e; | 43 | + background: #eb76aa; |
44 | 44 | ||
45 | &:before { | 45 | &:before { |
46 | - content: '赠品'; | 46 | + content: '加价购'; |
47 | display: block; | 47 | display: block; |
48 | font-size: 12px; | 48 | font-size: 12px; |
49 | line-height: 25rem / $pxConvertRem; | 49 | line-height: 25rem / $pxConvertRem; |
@@ -56,6 +56,7 @@ | @@ -56,6 +56,7 @@ | ||
56 | } | 56 | } |
57 | 57 | ||
58 | .name { | 58 | .name { |
59 | + margin-bottom: 20rem / $pxConvertRem; | ||
59 | width: 440rem / $pxConvertRem; | 60 | width: 440rem / $pxConvertRem; |
60 | font-size: 28rem / $pxConvertRem; | 61 | font-size: 28rem / $pxConvertRem; |
61 | } | 62 | } |
@@ -114,10 +115,10 @@ | @@ -114,10 +115,10 @@ | ||
114 | background: #f8f8f8; | 115 | background: #f8f8f8; |
115 | } | 116 | } |
116 | 117 | ||
117 | - .advance-block .tag { | ||
118 | - background: #eb76aa; | 118 | + .gift-block .tag { |
119 | + background: #a1ce4e; | ||
119 | &:before { | 120 | &:before { |
120 | - content: '加价购'; | 121 | + content: '赠品'; |
121 | } | 122 | } |
122 | } | 123 | } |
123 | } | 124 | } |
@@ -11,7 +11,12 @@ | @@ -11,7 +11,12 @@ | ||
11 | {{/ advanceBuy}} | 11 | {{/ advanceBuy}} |
12 | {{else}} | 12 | {{else}} |
13 | {{# freebie}} | 13 | {{# freebie}} |
14 | - {{> cart/gift-advance-good}} | 14 | + <div class="advance-block gift-block" data-promotion-id="{{promotionId}}"> |
15 | + <p class="title">{{title}}</p> | ||
16 | + {{#goods}} | ||
17 | + {{> cart/gift-advance-good}} | ||
18 | + {{/goods}} | ||
19 | + </div> | ||
15 | {{/ freebie}} | 20 | {{/ freebie}} |
16 | {{/if}} | 21 | {{/if}} |
17 | 22 |
@@ -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> |
@@ -7,11 +7,13 @@ | @@ -7,11 +7,13 @@ | ||
7 | <p class="name row">{{name}}</p> | 7 | <p class="name row">{{name}}</p> |
8 | <p class="row"> | 8 | <p class="row"> |
9 | <span class="price"> | 9 | <span class="price"> |
10 | - ¥{{price}} | 10 | + ¥{{#if price}}{{price}}{{else}}{{marketPrice}}{{/if}} |
11 | </span> | 11 | </span> |
12 | + {{#if price}} | ||
12 | <span class="price market-price"> | 13 | <span class="price market-price"> |
13 | ¥{{marketPrice}} | 14 | ¥{{marketPrice}} |
14 | </span> | 15 | </span> |
16 | + {{/if}} | ||
15 | <span class="count"> | 17 | <span class="count"> |
16 | ×{{count}} | 18 | ×{{count}} |
17 | </span> | 19 | </span> |
@@ -75,6 +75,7 @@ | @@ -75,6 +75,7 @@ | ||
75 | ×{{count}} | 75 | ×{{count}} |
76 | </span> | 76 | </span> |
77 | </div> | 77 | </div> |
78 | + </div> | ||
78 | <!--<div class="opt-panel hide"> | 79 | <!--<div class="opt-panel hide"> |
79 | <div class="put-in-favorite"> | 80 | <div class="put-in-favorite"> |
80 | <span class="iconfont"></span> | 81 | <span class="iconfont"></span> |
@@ -6,6 +6,9 @@ | @@ -6,6 +6,9 @@ | ||
6 | {{#navHome}} | 6 | {{#navHome}} |
7 | <a href="{{.}}" class="iconfont nav-home"></a> | 7 | <a href="{{.}}" class="iconfont nav-home"></a> |
8 | {{/navHome}} | 8 | {{/navHome}} |
9 | + {{#navPhone}} | ||
10 | + <a href="{{.}}" class="iconfont nav-home"></a> | ||
11 | + {{/navPhone}} | ||
9 | {{#navTitle}} | 12 | {{#navTitle}} |
10 | <p class="nav-title">{{.}}</p> | 13 | <p class="nav-title">{{.}}</p> |
11 | {{/navTitle}} | 14 | {{/navTitle}} |
@@ -34,4 +37,4 @@ | @@ -34,4 +37,4 @@ | ||
34 | </li> | 37 | </li> |
35 | </ul> | 38 | </ul> |
36 | </div> | 39 | </div> |
37 | -{{/pageHeader}} | ||
40 | +{{/pageHeader}} |
@@ -849,10 +849,11 @@ class HomeController extends AbstractAction | @@ -849,10 +849,11 @@ class HomeController extends AbstractAction | ||
849 | } | 849 | } |
850 | 850 | ||
851 | $this->setTitle('订单详情'); | 851 | $this->setTitle('订单详情'); |
852 | - $this->setNavHeader('订单详情'); | 852 | + $this->setNavHeader('订单详情', true, false); |
853 | 853 | ||
854 | $this->_view->display('order-detail', array( | 854 | $this->_view->display('order-detail', array( |
855 | 'orderDetailPage' => true, | 855 | 'orderDetailPage' => true, |
856 | + 'navPhone' => 'tel:400-889-9646', | ||
856 | 'orderDetail' => $orderDetail, | 857 | 'orderDetail' => $orderDetail, |
857 | )); | 858 | )); |
858 | } | 859 | } |
@@ -582,18 +582,14 @@ class CartModel | @@ -582,18 +582,14 @@ class CartModel | ||
582 | { | 582 | { |
583 | $data = array(); | 583 | $data = array(); |
584 | 584 | ||
585 | - // 品牌信息 | ||
586 | - if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
587 | - $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
588 | - } | ||
589 | - | ||
590 | $data['name'] = $productData['product_name']; | 585 | $data['name'] = $productData['product_name']; |
591 | - $data['price'] = $productData['market_price']; | ||
592 | - $data['salePrice'] = $productData['sales_price']; | 586 | + $data['price'] = Helpers::transPrice($productData['market_price']); |
587 | + $data['salePrice'] = Helpers::transPrice($productData['sales_price']); | ||
593 | 588 | ||
594 | if (isset($productData['storage_sum'])) { | 589 | if (isset($productData['storage_sum'])) { |
595 | $data['storage'] = $productData['storage_sum']; | 590 | $data['storage'] = $productData['storage_sum']; |
596 | } | 591 | } |
592 | + $data['num'] = 1; | ||
597 | if ($num !== null) { | 593 | if ($num !== null) { |
598 | $data['num'] = $num; | 594 | $data['num'] = $num; |
599 | } | 595 | } |
@@ -606,25 +602,62 @@ class CartModel | @@ -606,25 +602,62 @@ class CartModel | ||
606 | $oneColor = array(); | 602 | $oneColor = array(); |
607 | $sizes = array(); | 603 | $sizes = array(); |
608 | $oneSize = array(); | 604 | $oneSize = array(); |
605 | + $thumbImageList = array(); | ||
606 | + $colorNum = 0; | ||
607 | + $totalStorageNum = 0; // 总库存数 | ||
608 | + $colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔 | ||
609 | foreach ($goodsList as $val) { | 609 | foreach ($goodsList as $val) { |
610 | - // 颜色 | ||
611 | - $oneColor = array(); | ||
612 | - $oneColor['id'] = $val['color_id']; | ||
613 | - $oneColor['name'] = $val['color_name']; | 610 | + $colorNum = 0; |
611 | + $sizeStorageStr = ''; | ||
614 | 612 | ||
615 | // 尺码 | 613 | // 尺码 |
616 | foreach ($val['size_list'] as $one) { | 614 | foreach ($val['size_list'] as $one) { |
617 | $oneSize = array(); | 615 | $oneSize = array(); |
618 | $oneSize['id'] = $one['size_id']; | 616 | $oneSize['id'] = $one['size_id']; |
617 | + $oneSize['skuId'] = $one['product_sku']; | ||
618 | + $oneSize['goodsId'] = $val['goods_id']; | ||
619 | + $oneSize['colorId'] = $val['color_id']; | ||
619 | $oneSize['name'] = $one['size_name']; | 620 | $oneSize['name'] = $one['size_name']; |
621 | + $oneSize['sizeNum'] = $one['storage_number']; | ||
622 | + | ||
623 | + $colorNum += $one['storage_number']; | ||
624 | + $sizeStorageStr .= $one['storage_number'] . '/'; | ||
625 | + | ||
626 | + $sizes[] = $oneSize; | ||
627 | + | ||
628 | + $colorStorageGroup[$one['size_name']][$val['color_name']] = $one['storage_number']; | ||
620 | } | 629 | } |
621 | - $sizes[] = $oneSize; | ||
622 | 630 | ||
623 | - $oneColor['sizes'] = $sizes; | 631 | + // 统计尺码对应的各个颜色的库存量 |
632 | + foreach ($sizes as &$sizeArr) { | ||
633 | + $sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) ); | ||
634 | + } | ||
635 | + | ||
636 | + // 颜色 | ||
637 | + $oneColor = array(); | ||
638 | + $oneColor['id'] = $val['color_id']; | ||
639 | + $oneColor['skcId'] = $val['product_skc']; | ||
640 | + $oneColor['name'] = $val['color_name']; | ||
641 | + $oneColor['goodsName'] = $productData['product_name']; | ||
642 | + $oneColor['colorNum'] = $colorNum; | ||
643 | + $oneColor['sizeNumStr'] = rtrim($sizeStorageStr, '/'); | ||
624 | $colors[] = $oneColor; | 644 | $colors[] = $oneColor; |
645 | + | ||
646 | + // 缩略图 | ||
647 | + foreach ($val['images_list'] as $image) { | ||
648 | + $thumbImageList[] = array( | ||
649 | + 'img' => Helpers::getImageUrl($image['image_url'], 60, 60) | ||
650 | + ); | ||
651 | + } | ||
652 | + | ||
653 | + // 商品库存总数 | ||
654 | + $totalStorageNum += $colorNum; | ||
625 | } | 655 | } |
626 | 656 | ||
657 | + $data['thumbs'] = $thumbImageList; | ||
627 | $data['colors'] = $colors; | 658 | $data['colors'] = $colors; |
659 | + $data['sizes'] = $sizes; | ||
660 | + $data['totalNum'] = $totalStorageNum; | ||
628 | } | 661 | } |
629 | 662 | ||
630 | return $data; | 663 | return $data; |
@@ -668,7 +701,7 @@ class CartModel | @@ -668,7 +701,7 @@ class CartModel | ||
668 | // 失效商品列表 | 701 | // 失效商品列表 |
669 | $notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']); | 702 | $notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']); |
670 | if (!empty($notValidGoods)) { | 703 | if (!empty($notValidGoods)) { |
671 | - $result['$notValidGoods'] = $notValidGoods; | 704 | + $result['notValidGoods'] = $notValidGoods; |
672 | } | 705 | } |
673 | 706 | ||
674 | // 赠品和加价购商品 | 707 | // 赠品和加价购商品 |
@@ -78,7 +78,7 @@ class IndexController extends AbstractAction | @@ -78,7 +78,7 @@ class IndexController extends AbstractAction | ||
78 | $result = array(); | 78 | $result = array(); |
79 | 79 | ||
80 | if ($this->isAjax()) { | 80 | if ($this->isAjax()) { |
81 | - $productId = $this->post('id', 0); | 81 | + $productId = $this->post('skuList', 0); |
82 | $uid = $this->getUid(true); | 82 | $uid = $this->getUid(true); |
83 | $shoppingKey = $this->getSession('shoppingKey'); | 83 | $shoppingKey = $this->getSession('shoppingKey'); |
84 | $result = CartModel::selectGoods($uid, $productId, $shoppingKey); | 84 | $result = CartModel::selectGoods($uid, $productId, $shoppingKey); |
@@ -207,11 +207,11 @@ class IndexController extends AbstractAction | @@ -207,11 +207,11 @@ class IndexController extends AbstractAction | ||
207 | { | 207 | { |
208 | $result = array(); | 208 | $result = array(); |
209 | 209 | ||
210 | - if ($this->isAjax()) { | 210 | +// if ($this->isAjax()) { |
211 | $skn = $this->get('skn', null); | 211 | $skn = $this->get('skn', null); |
212 | $promotionId = $this->get('promotionId', null); | 212 | $promotionId = $this->get('promotionId', null); |
213 | $result = CartModel::giftProductData($skn, $promotionId); | 213 | $result = CartModel::giftProductData($skn, $promotionId); |
214 | - } | 214 | +// } |
215 | 215 | ||
216 | if (empty($result)) { | 216 | if (empty($result)) { |
217 | echo ' '; | 217 | echo ' '; |
-
Please register or login to post a comment