Authored by Lynnic

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/cart

Conflicts:
	docs/data-structure.md
Showing 31 changed files with 800 additions and 426 deletions
@@ -817,7 +817,7 @@ @@ -817,7 +817,7 @@
817 }, 817 },
818 ... 818 ...
819 ], 819 ],
820 - 820 +
821 totalNum: 20 821 totalNum: 20
822 } 822 }
823 823
@@ -1266,6 +1266,7 @@ @@ -1266,6 +1266,7 @@
1266 }, 1266 },
1267 ... 1267 ...
1268 ], 1268 ],
  1269 +
1269 sizes: [ 1270 sizes: [
1270 { 1271 {
1271 id: 2, 1272 id: 2,
@@ -1283,7 +1284,7 @@ @@ -1283,7 +1284,7 @@
1283 'id' : '', 1284 'id' : '',
1284 'preferenceUrl' :'', 1285 'preferenceUrl' :'',
1285 } 1286 }
1286 -### 评价列表页面 1287 +### 评价列表页面
1287 { 1288 {
1288 'comments':{ 1289 'comments':{
1289 'list' : [ 1290 'list' : [
@@ -1375,5 +1376,7 @@ @@ -1375,5 +1376,7 @@
1375 'entitle' : 'LIFESTYLE', 1376 'entitle' : 'LIFESTYLE',
1376 } 1377 }
1377 ], 1378 ],
1378 - 'showYohood' : true/false 1379 + 'showYohood' : true/false,
  1380 + 'yohoodHref' : '/yohood'
1379 } 1381 }
  1382 +
@@ -25,6 +25,21 @@ class HelpData @@ -25,6 +25,21 @@ class HelpData
25 return Yohobuy::post(Yohobuy::API_URL, $param, $param); 25 return Yohobuy::post(Yohobuy::API_URL, $param, $param);
26 } 26 }
27 27
  28 +
  29 +
  30 + /*
  31 + * 获取帮助中心列表
  32 + */
  33 + public static function serviceDetail($code)
  34 + {
  35 + //构建必传参数
  36 + $param = Yohobuy::param();
  37 + $param['method'] = 'app.help.detail';
  38 + $param['code'] = $code;
  39 + $param['return_type'] = 'html';
  40 + $param['client_secret'] = Sign::getSign($param);
  41 + return Yohobuy::post(Yohobuy::API_URL, $param, true);
  42 + }
28 43
29 44
30 } 45 }
@@ -67,5 +67,17 @@ class IndexData @@ -67,5 +67,17 @@ class IndexData
67 67
68 return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param); 68 return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param);
69 } 69 }
  70 +
  71 + /**
  72 + * 获取频道选择页数据
  73 + *
  74 + * @return array
  75 + */
  76 + public static function channelData()
  77 + {
  78 + $param = Yohobuy::param();
  79 + $param['client_secret'] = Sign::getSign($param);
  80 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/entrance/getEntrance',$param,3600);
  81 + }
70 82
71 } 83 }
@@ -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 }
@@ -10,28 +10,51 @@ var Swiper = require('yoho.iswiper'), @@ -10,28 +10,51 @@ var Swiper = require('yoho.iswiper'),
10 10
11 var recommendSwiper, 11 var recommendSwiper,
12 $recommendForYou = $('.recommend-for-you'), 12 $recommendForYou = $('.recommend-for-you'),
13 - preferenceUrl = $('#preferenceUrl').val();  
14 -  
15 -if (preferenceUrl) {  
16 - $.get(preferenceUrl).then(function(html) {  
17 - if (html.length < 5) {  
18 - $recommendForYou.css('display', 'none');  
19 - } else {  
20 - $recommendForYou.html(html).show();  
21 - if ($('#swiper-recommend').length) {  
22 - recommendSwiper = new Swiper('#swiper-recommend', {  
23 - slidesPerView: 'auto',  
24 - grabCursor: true,  
25 - slideElement: 'a',  
26 - lazyLoading: true,  
27 - watchSlidesVisibility: true  
28 - }); 13 + preferenceUrl = $('#preferenceUrl').val(),
  14 + winH = $(window).height(),
  15 + end = false,
  16 + requesting = false;
  17 +
  18 +
  19 +function request() {
  20 + if (requesting || end) {
  21 + return;
  22 + }
  23 +
  24 + requesting = true;
  25 +
  26 + if (preferenceUrl) {
  27 + $.get(preferenceUrl).then(function(html) {
  28 + if (html.length < 5) {
  29 + $recommendForYou.css('display', 'none');
  30 + } else {
  31 + $recommendForYou.html(html).show();
  32 + if ($('#swiper-recommend').length) {
  33 + recommendSwiper = new Swiper('#swiper-recommend', {
  34 + slidesPerView: 'auto',
  35 + grabCursor: true,
  36 + slideElement: 'a',
  37 + lazyLoading: true,
  38 + watchSlidesVisibility: true
  39 + });
  40 + }
29 } 41 }
30 - }  
31 42
32 - window.rePosFooter(); 43 + requesting = false;
  44 + end = true;
33 45
34 - }).fail(function() {  
35 - $recommendForYou.hide();  
36 - }); 46 + }).fail(function() {
  47 + $recommendForYou.hide();
  48 + });
  49 + }
37 } 50 }
  51 +
  52 +function scrollHandler() {
  53 + if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) {
  54 + request();
  55 + }
  56 +}
  57 +
  58 +$(window).scroll(function() {
  59 + window.requestAnimationFrame(scrollHandler);
  60 +});
@@ -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
@@ -156,4 +157,23 @@ $('.btn-balance').on('touchend', function() { @@ -156,4 +157,23 @@ $('.btn-balance').on('touchend', function() {
156 window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType; 157 window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType;
157 }); 158 });
158 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 +});
159 179
@@ -15,6 +15,7 @@ var dispatchModeHammer, @@ -15,6 +15,7 @@ var dispatchModeHammer,
15 dispatchTimeHammer, 15 dispatchTimeHammer,
16 $invoice = $('.invoice'), 16 $invoice = $('.invoice'),
17 $price = $('.price-cal'), 17 $price = $('.price-cal'),
  18 + payType,
18 priceTmpl = Handlebars.compile($('#tmpl-price').html()); 19 priceTmpl = Handlebars.compile($('#tmpl-price').html());
19 20
20 lazyLoad(); 21 lazyLoad();
@@ -80,6 +81,7 @@ function orderCompute() { @@ -80,6 +81,7 @@ function orderCompute() {
80 sumPrice: res.order_amount, 81 sumPrice: res.order_amount,
81 salePrice: res.discount_amount, 82 salePrice: res.discount_amount,
82 freight: res.promotion_formula_list[1].promotion_amount, 83 freight: res.promotion_formula_list[1].promotion_amount,
  84 + couponPrice: res.coupon_amount,
83 yohoCoin: res.use_yoho_coin, 85 yohoCoin: res.use_yoho_coin,
84 price: res.last_order_amount 86 price: res.last_order_amount
85 }); 87 });
@@ -98,24 +100,34 @@ function submitOrder() { @@ -98,24 +100,34 @@ function submitOrder() {
98 data: { 100 data: {
99 addressId: orderInfo('addressId'), 101 addressId: orderInfo('addressId'),
100 cartType: orderInfo('cartType'), 102 cartType: orderInfo('cartType'),
101 - deliveryId: orderInfo('deliveryId') || 1,  
102 - deliveryTimeId: orderInfo('deliveryTimeId') || 1,  
103 - invoiceText: orderInfo('invoiceText'),  
104 - invoiceType: orderInfo('invoiceType'),  
105 - msg: orderInfo('msg'), 103 + deliveryId: orderInfo('deliveryId'),
  104 + deliveryTimeId: orderInfo('deliveryTimeId'),
  105 + invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
  106 + invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'),
  107 + msg: $('#msg').find('input').val() || orderInfo('msg'),
106 paymentTypeId: orderInfo('paymentTypeId'), 108 paymentTypeId: orderInfo('paymentTypeId'),
107 paymentType: orderInfo('paymentType'), //支付方式 109 paymentType: orderInfo('paymentType'), //支付方式
108 couponCode: orderInfo('couponCode'), 110 couponCode: orderInfo('couponCode'),
109 yohoCoin: orderInfo('yohoCoin') 111 yohoCoin: orderInfo('yohoCoin')
110 } 112 }
111 }).then(function(res) { 113 }).then(function(res) {
  114 + var url;
  115 +
112 if (!res) { 116 if (!res) {
113 tip.show('网络出错'); 117 tip.show('网络出错');
  118 + return;
114 } 119 }
115 - if (res.code !== 200) {  
116 - tip.show(res.message || '网络出错'); 120 + if (res.code === 200) {
  121 + if (payType === 2) {
  122 +
  123 + // 货到付款的进入订单页面
  124 + url = '/home/orderDetail?order_code=' + res.data.order_code;
  125 + } else {
  126 + url = '/home/pay?order_code=' + res.data.order_code;
  127 + }
  128 + window.location.href = url;
117 } else { 129 } else {
118 - console.log(1); 130 + tip.show(res.messege || '网络出错');
119 } 131 }
120 }).fail(function() { 132 }).fail(function() {
121 tip.show('网络出错'); 133 tip.show('网络出错');
@@ -124,7 +136,7 @@ function submitOrder() { @@ -124,7 +136,7 @@ function submitOrder() {
124 136
125 // 界面点击,状态存 cookie 137 // 界面点击,状态存 cookie
126 if (!orderInfo('addressId')) { 138 if (!orderInfo('addressId')) {
127 - orderInfo('addressId', $('.address-wrap').data('address-id')); 139 + orderInfo('addressId', $('.address-wrap').data('id'));
128 } 140 }
129 141
130 $('.dispatch-mode').on('touchend', 'li', function() { 142 $('.dispatch-mode').on('touchend', 'li', function() {
@@ -166,7 +178,10 @@ $('#msg').find('input').on('blur', function() { @@ -166,7 +178,10 @@ $('#msg').find('input').on('blur', function() {
166 }); 178 });
167 179
168 $('.pay-mode').on('click', 'li', function() { 180 $('.pay-mode').on('click', 'li', function() {
169 - orderInfo('paymentTypeId', $(this).data('pay-id'));  
170 - orderInfo('paymentType', $(this).data('pay-type')); 181 + var $this = $(this);
  182 +
  183 + orderInfo('paymentTypeId', $this.data('pay-id'));
  184 + orderInfo('paymentType', $this.data('pay-type'));
  185 + payType = $this.data('pay-type');
171 submitOrder(); 186 submitOrder();
172 }); 187 });
@@ -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,
@@ -30,6 +30,7 @@ $newCoupon.on('submit', function() { @@ -30,6 +30,7 @@ $newCoupon.on('submit', function() {
30 if (res.code === 200) { 30 if (res.code === 200) {
31 tip.show('优惠券可用'); 31 tip.show('优惠券可用');
32 orderInfo('couponCode', res.data.coupon_code); 32 orderInfo('couponCode', res.data.coupon_code);
  33 + orderInfo('couponValue', res.data.coupon_value);
33 window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code; 34 window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code;
34 } else { 35 } else {
35 tip.show(res.message); 36 tip.show(res.message);
@@ -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 },
@@ -2,6 +2,16 @@ @@ -2,6 +2,16 @@
2 width: 100%; 2 width: 100%;
3 overflow: hidden; 3 overflow: hidden;
4 margin: 0 auto; 4 margin: 0 auto;
  5 + #yohood {
  6 + background-color: transparent;
  7 + background-image: image-url('yohood.png');
  8 + background-size: 40%;
  9 + background-repeat: no-repeat;
  10 + background-position-x: 26%;
  11 + background-position-y: 36%;
  12 + border: none;
  13 + border-bottom: 4px solid #fff;
  14 + }
5 .index-header { 15 .index-header {
6 box-sizing: border-box; 16 box-sizing: border-box;
7 padding: 0 20rem / $pxConvertRem; 17 padding: 0 20rem / $pxConvertRem;
@@ -177,6 +177,117 @@ @@ -177,6 +177,117 @@
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 + }
180 } 291 }
181 .shopping-cart-zero{ 292 .shopping-cart-zero{
182 .cart-zero{ 293 .cart-zero{
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 } 93 }
94 94
95 .coupon-count { 95 .coupon-count {
96 - padding: 5rem / $pxConvertRem; 96 + padding: 5rem / $pxConvertRem 15rem / $pxConvertRem;
97 background: #f00; 97 background: #f00;
98 color: #fff; 98 color: #fff;
99 @include border-radius(10px); 99 @include border-radius(10px);
@@ -104,6 +104,14 @@ @@ -104,6 +104,14 @@
104 .coin-check { 104 .coin-check {
105 float: right; 105 float: right;
106 color: #999; 106 color: #999;
  107 +
  108 + &.used {
  109 + color: #f00;
  110 + }
  111 +
  112 + .iconfont {
  113 + color: #999;
  114 + }
107 } 115 }
108 116
109 .coin-check { 117 .coin-check {
@@ -115,6 +123,10 @@ @@ -115,6 +123,10 @@
115 color: #000; 123 color: #000;
116 } 124 }
117 125
  126 + em {
  127 + color: #f00;
  128 + }
  129 +
118 } 130 }
119 131
120 .checkbox.icon-checkbox { 132 .checkbox.icon-checkbox {
@@ -187,6 +199,10 @@ @@ -187,6 +199,10 @@
187 } 199 }
188 } 200 }
189 201
  202 + .price-cal {
  203 + font-family: monospace;
  204 + }
  205 +
190 .cost { 206 .cost {
191 border-top: 1px solid #f7f7f7; 207 border-top: 1px solid #f7f7f7;
192 line-height: 100rem / $pxConvertRem; 208 line-height: 100rem / $pxConvertRem;
1 {{> layout/header}} 1 {{> layout/header}}
2 - {{ iHelp}} 2 +{{{iHelp}}}
3 {{> layout/footer}} 3 {{> layout/footer}}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="iHelp"> 2 <div class="iHelp">
3 <ul> 3 <ul>
4 {{# iHelp}} 4 {{# iHelp}}
5 - <li><a href="/home/helpDetail?code={{ code}}"><span>{{ name}}</span><i class="iconfont num">&#xe604;</i></a></li> 5 + <li><a href="{{url}}"><span>{{ name}}</span><i class="iconfont num">&#xe604;</i></a></li>
6 {{/ iHelp}} 6 {{/ iHelp}}
7 </ul> 7 </ul>
8 </div> 8 </div>
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <a href="{{href}}" class="list-item">{{title}} <span class="lighter">{{entitle}}</span> <span class="iconfont right-icon">&#xe614;</span></a> 23 <a href="{{href}}" class="list-item">{{title}} <span class="lighter">{{entitle}}</span> <span class="iconfont right-icon">&#xe614;</span></a>
24 {{/channelList}} 24 {{/channelList}}
25 {{#showYohood}} 25 {{#showYohood}}
26 - <a href="/yohood" id="yohood" class="list-item"> <span class="iconfont right-icon">&#xe614;</span></a> 26 + <a href="{{yohoodHref}}" id="yohood" class="list-item"> <span class="iconfont right-icon">&#xe614;</span></a>
27 {{/showYohood}} 27 {{/showYohood}}
28 </div> 28 </div>
29 </div> 29 </div>
1 {{> layout/header}} 1 {{> layout/header}}
2 -<div class="shopping-cart-page yoho-page" style="display: none;"> 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,7 +45,23 @@ @@ -44,7 +45,23 @@
44 45
45 {{/ shoppingCart}} 46 {{/ shoppingCart}}
46 </div> 47 </div>
47 -<div class="shopping-cart-zero yoho-page"> 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">
48 <div class="cart-zero"> 65 <div class="cart-zero">
49 <i class="iconfont">&#xe62c</i> 66 <i class="iconfont">&#xe62c</i>
50 <p>您的购物车暂无商品</p> 67 <p>您的购物车暂无商品</p>
@@ -52,4 +69,5 @@ @@ -52,4 +69,5 @@
52 </div> 69 </div>
53 {{> product/recommend-for-you}} 70 {{> product/recommend-for-you}}
54 </div> 71 </div>
  72 +
55 {{> layout/footer}} 73 {{> layout/footer}}
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="order-ensure-page yoho-page"> 2 <div class="order-ensure-page yoho-page">
3 {{# orderEnsure}} 3 {{# orderEnsure}}
4 - <a class="address-wrap block" href="/shoppingCart/selectAddress" data-address-id="{{addressId}}"> 4 + <a class="address-wrap block" data-id="{{addressId}}" href="/shoppingCart/selectAddress">
5 <p class="infos"> 5 <p class="infos">
6 收货地址 6 收货地址
7 <span class="per-info">{{name}} {{phoneNum}}</span> 7 <span class="per-info">{{name}} {{phoneNum}}</span>
@@ -41,10 +41,9 @@ @@ -41,10 +41,9 @@
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}}"> -->  
48 <span class="title">优惠券</span> 47 <span class="title">优惠券</span>
49 {{#if count}} 48 {{#if count}}
50 <span class="coupon-count"> 49 <span class="coupon-count">
@@ -65,18 +64,16 @@ @@ -65,18 +64,16 @@
65 {{/if}} 64 {{/if}}
66 </a> 65 </a>
67 </li> 66 </li>
68 - {{/if}} 67 + {{/coupon}}
69 68
70 - {{# yohoCoin}}  
71 - <li class="coin" data-yoho-coin="{{.}}">  
72 - <span class="title">YOHO币</span>  
73 - <span class="desc">可抵用¥{{.}}</span>  
74 - <span class="coin-check">  
75 - <em>- ¥ {{.}}</em>  
76 - <i class="iconfont checkbox icon-cb-checked"></i>  
77 - </span>  
78 - </li>  
79 - {{/ yohoCoin}} 69 + <li class="coin" data-yoho-coin="{{yohoCoin}}">
  70 + <span class="title">YOHO币</span>
  71 + <span class="desc">可抵用¥{{yohoCoin}}</span>
  72 + <span class="coin-check">
  73 + <em>- ¥ {{yohoCoin}}</em>
  74 + <i class="iconfont checkbox icon-cb-checked"></i>
  75 + </span>
  76 + </li>
80 77
81 {{#if invoice}} 78 {{#if invoice}}
82 <li class="invoice {{#if needInvoice}}focus{{/if}}"> 79 <li class="invoice {{#if needInvoice}}focus{{/if}}">
@@ -114,8 +111,14 @@ @@ -114,8 +111,14 @@
114 </li> 111 </li>
115 <li> 112 <li>
116 <span>运费</span> 113 <span>运费</span>
117 - + ¥{{freight}} 114 + + {{freight}}
118 </li> 115 </li>
  116 + {{#couponPrice}}
  117 + <li>
  118 + <span>优惠券</span>
  119 + - ¥{{.}}
  120 + </li>
  121 + {{/couponPrice}}
119 <li> 122 <li>
120 <span>YOHO币</span> 123 <span>YOHO币</span>
121 - ¥{{yohoCoin}} 124 - ¥{{yohoCoin}}
@@ -156,6 +159,12 @@ @@ -156,6 +159,12 @@
156 <span>运费</span> 159 <span>运费</span>
157 + \{{freight}} 160 + \{{freight}}
158 </li> 161 </li>
  162 + \{{#couponPrice}}
  163 + <li>
  164 + <span>优惠券</span>
  165 + - ¥\{{.}}
  166 + </li>
  167 + \{{/couponPrice}}
159 <li> 168 <li>
160 <span>YOHO币</span> 169 <span>YOHO币</span>
161 - ¥\{{yohoCoin}} 170 - ¥\{{yohoCoin}}
@@ -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">&#xe61b;</span> 21 <span class="iconfont">&#xe61b;</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">&#xe614;</span> 25 <span class="iconfont icon-right-arrow">&#xe614;</span>
26 </a> 26 </a>
27 </li> 27 </li>
28 - {{/ advanceBuy}} 28 + {{/if}}
29 </ul> 29 </ul>
30 {{/if}} 30 {{/if}}
31 31
@@ -54,4 +54,4 @@ @@ -54,4 +54,4 @@
54 <a class="btn-balance"> 54 <a class="btn-balance">
55 结算 55 结算
56 </a> 56 </a>
57 -</div>  
  57 +</div>
@@ -845,37 +845,45 @@ class HomeController extends AbstractAction @@ -845,37 +845,45 @@ class HomeController extends AbstractAction
845 845
846 $this->_view->display('order-detail', array( 846 $this->_view->display('order-detail', array(
847 'orderDetailPage' => true, 847 'orderDetailPage' => true,
848 - 'orderDetail' => OrderModel::orderDetail($orderCode, $this->_uid, $this->_session), 848 + 'orderDetail' => OrderModel::orderDetail($orderCode, $this->_uid, $this->_usession),
849 )); 849 ));
850 } 850 }
851 851
852 - /**  
853 - * 帮助列表页  
854 - */ 852 + /**
  853 + * 帮助中心列表页
  854 + */
855 public function helpAction() 855 public function helpAction()
856 - { 856 + {
  857 + $service = Home\HelpModel::serviceInfo();
857 $this->setTitle('帮助中心'); 858 $this->setTitle('帮助中心');
858 $this->setNavHeader('帮助中心'); 859 $this->setNavHeader('帮助中心');
859 $data = array( 860 $data = array(
860 - 'iHelp' => Home\HelpModel::serviceInfo(), 861 + 'iHelp' =>$service,
861 ); 862 );
862 $this->_view->display('i-help', $data); 863 $this->_view->display('i-help', $data);
863 } 864 }
864 865
  866 +
865 /** 867 /**
866 - * 帮助列表页 868 + * 帮助中心列表详细信息
867 */ 869 */
868 - public function helpDetailAction()  
869 - {  
870 - $this->setTitle('帮助中心');  
871 - $this->setNavHeader('帮助中心');  
872 - $data = array(  
873 - 'iHelp' => array(  
874 - array('name' => '新用户注册'),  
875 - )  
876 - );  
877 - $this->_view->display('helpDetail', $data); 870 + public function helpDetailAction() {
  871 + $caption = $this->get('caption', '帮助中心');
  872 + $code = $this->get('code', 0);
  873 + if (empty($code)) {
  874 + $this->error();
  875 + }
  876 +
  877 + $this->setTitle($caption);
  878 + $this->setNavHeader($caption);
  879 +
  880 + $service = Home\HelpModel::serviceDetail($code);
  881 + $this->_view->display('helpDetail', array(
  882 + 'iHelp' => $service,
  883 + ));
878 } 884 }
  885 +
  886 +
879 /** 887 /**
880 * YOHO币详情 新版 888 * YOHO币详情 新版
881 */ 889 */
@@ -23,16 +23,16 @@ class IndexController extends AbstractAction @@ -23,16 +23,16 @@ class IndexController extends AbstractAction
23 // 设置浏览器缓存5分钟 23 // 设置浏览器缓存5分钟
24 $this->setExpires(300); 24 $this->setExpires(300);
25 } 25 }
26 - 26 + $result = Index\HomeModel::getChannel();
  27 + $result['background'] = Index\HomeModel::getBgImage();
  28 + $result['channelPage'] = true;
  29 + $result['showDownloadApp'] = true;
  30 + $result['searchUrl'] = Helpers::url('', null, 'search');
  31 + $result['pageFooter'] = true;
27 // 渲染模板 32 // 渲染模板
28 - $this->_view->display('index', array(  
29 - 'background' => Index\HomeModel::getBgImage(),  
30 - 'channelPage' => true,  
31 - 'showDownloadApp'=>true,  
32 - 'searchUrl' => Helpers::url('', null, 'search'),  
33 - 'pageFooter' => true,  
34 - )); 33 + $this->_view->display('index', $result);
35 } 34 }
  35 +
36 /** 36 /**
37 * 设置升级公告路由 37 * 设置升级公告路由
38 * 38 *
@@ -13,6 +13,7 @@ class ShoppingCartController extends AbstractAction @@ -13,6 +13,7 @@ class ShoppingCartController extends AbstractAction
13 /* 13 /*
14 * 购物车首页 14 * 购物车首页
15 */ 15 */
  16 +
16 public function indexAction() 17 public function indexAction()
17 { 18 {
18 $this->setTitle('购物车'); 19 $this->setTitle('购物车');
@@ -29,239 +30,243 @@ class ShoppingCartController extends AbstractAction @@ -29,239 +30,243 @@ class ShoppingCartController extends AbstractAction
29 // 渲染模板 30 // 渲染模板
30 $this->_view->display('index', $data); 31 $this->_view->display('index', $data);
31 } 32 }
  33 +
32 /* 34 /*
33 * 异步获取购物车数据 35 * 异步获取购物车数据
34 */ 36 */
  37 +
35 public function getCartDataAction() 38 public function getCartDataAction()
36 { 39 {
37 - $result = array(); 40 + $result = array();
  41 +
  42 + if ($this->isAjax()) {
  43 + $shoppingKey = Helpers::getShoppingKeyByCookie();
  44 + $uid = $this->getUid(true);
  45 +
  46 + $result = CartModel::getCartData($uid, $shoppingKey);
  47 + }
  48 +
  49 + if (empty($result)) {
  50 + echo ' ';
  51 + } else {
  52 + $this->echoJson($result);
  53 + }
  54 + }
  55 +
  56 + /**
  57 + * 购物车商品选择与取消
  58 + */
  59 + public function selectAction()
  60 + {
  61 + $result = array();
  62 +
  63 + if ($this->isAjax()) {
  64 + $productId = $this->post('id', 0);
  65 + $uid = $this->getUid(true);
  66 + $shoppingKey = $this->getSession('shoppingKey');
  67 + $result = CartModel::selectGoods($uid, $productId, $shoppingKey);
  68 + }
  69 +
  70 + if (empty($result)) {
  71 + echo ' ';
  72 + } else {
  73 + $this->echoJson($result);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * 移出购物车
  79 + */
  80 + public function delAction()
  81 + {
  82 + $result = array();
  83 +
  84 + if ($this->isAjax()) {
  85 + $productId = $this->post('id', 0);
  86 + $uid = $this->getUid(true);
  87 + $shoppingKey = $this->getSession('shoppingKey');
  88 + $result = CartModel::removeFromCart($uid, $productId, $shoppingKey);
  89 + }
  90 +
  91 + if (empty($result)) {
  92 + echo ' ';
  93 + } else {
  94 + $this->echoJson($result);
  95 + }
  96 + }
  97 +
  98 + /**
  99 + * 移入收藏夹
  100 + */
  101 + public function colAction()
  102 + {
  103 + $result = array();
  104 +
  105 + if ($this->isAjax()) {
  106 + $productId = $this->post('id', 0);
  107 + $uid = $this->getUid(true);
  108 + $result = CartModel::addToFav($uid, $productId);
  109 + }
  110 +
  111 + if (empty($result)) {
  112 + echo ' ';
  113 + } else {
  114 + $this->echoJson($result);
  115 + }
  116 + }
  117 +
  118 + /*
  119 + * 获取购物车商品数据
  120 + */
  121 +
  122 + public function goodinfoAction()
  123 + {
  124 + $result = array();
  125 +
  126 + if ($this->isAjax()) {
  127 + $num = $this->get('buy_num', 1);
  128 + $skn = $this->get('id', 1);
  129 + $uid = $this->getUid(true);
  130 + $result = CartModel::cartProductData($uid, $skn, $num); // 测试skn的ID为51172055
  131 + $result['num'] = $num;
  132 + }
  133 +
  134 + if (empty($result)) {
  135 + echo ' ';
  136 + } else {
  137 + $this->echoJson($result);
  138 + }
  139 + }
38 140
39 - if ($this->isAjax()) {  
40 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
41 - $uid = $this->getUid(true); 141 + /*
  142 + * 获取购物车加价购商品数据
  143 + */
42 144
43 - $result = CartModel::getCartData($uid, $shoppingKey);  
44 - } 145 + public function giftinfoAction()
  146 + {
  147 + $result = array();
  148 +
  149 + if ($this->isAjax()) {
  150 + $skn = $this->get('skn', null);
  151 + $promotionId = $this->get('promotionId', null);
  152 + $result = CartModel::giftProductData($skn, $promotionId);
  153 + }
  154 +
  155 + if (empty($result)) {
  156 + echo ' ';
  157 + } else {
  158 + $this->echoJson($result);
  159 + }
  160 + }
45 161
46 - if (empty($result)) {  
47 - echo ' ';  
48 - } else {  
49 - $this->echoJson($result);  
50 - } 162 + /**
  163 + * 修改购物车商品数据
  164 + */
  165 + public function modifyAction()
  166 + {
  167 + $result = array();
  168 +
  169 + if ($this->isAjax()) {
  170 + $shoppingKey = $this->getSession('shoppingKey');
  171 + $uid = $this->getUid(true);
  172 +
  173 + $params = array();
  174 + $params['old_product_sku'] = $this->post('old_product_sku', 0);
  175 + $params['new_product_sku'] = $this->post('new_product_sku', 0);
  176 + $params['buy_number'] = $this->post('buy_number', 0);
  177 + $params['selected'] = $this->post('selected', null);
  178 + $result = CartModel::modifyCartProduct($uid, $params, $shoppingKey);
  179 + }
  180 +
  181 + if (empty($result)) {
  182 + echo ' ';
  183 + } else {
  184 + $this->echoJson($result);
  185 + }
51 } 186 }
52 187
53 - /**  
54 - * 购物车商品选择与取消  
55 - */  
56 - public function selectAction()  
57 - {  
58 - $result = array();  
59 -  
60 - if ($this->isAjax()) {  
61 - $productId = $this->post('id', 0);  
62 - $uid = $this->getUid(true);  
63 - $shoppingKey = $this->getSession('shoppingKey');  
64 - $result = CartModel::selectGoods($uid, $productId, $shoppingKey);  
65 - }  
66 -  
67 - if (empty($result)) {  
68 - echo ' ';  
69 - } else {  
70 - $this->echoJson($result);  
71 - }  
72 - }  
73 -  
74 - /**  
75 - * 移出购物车  
76 - */  
77 - public function delAction()  
78 - {  
79 - $result = array();  
80 -  
81 - if ($this->isAjax()) {  
82 - $productId = $this->post('id', 0);  
83 - $uid = $this->getUid(true);  
84 - $shoppingKey = $this->getSession('shoppingKey');  
85 - $result = CartModel::removeFromCart($uid, $productId, $shoppingKey);  
86 - }  
87 -  
88 - if (empty($result)) {  
89 - echo ' ';  
90 - } else {  
91 - $this->echoJson($result);  
92 - }  
93 - }  
94 -  
95 - /**  
96 - * 移入收藏夹  
97 - */  
98 - public function colAction()  
99 - {  
100 - $result = array();  
101 -  
102 - if ($this->isAjax()) {  
103 - $productId = $this->post('id', 0);  
104 - $uid = $this->getUid(true);  
105 - $result = CartModel::addToFav($uid, $productId);  
106 - }  
107 -  
108 - if (empty($result)) {  
109 - echo ' ';  
110 - } else {  
111 - $this->echoJson($result);  
112 - }  
113 - }  
114 -  
115 - /*  
116 - * 获取购物车商品数据  
117 - */  
118 - public function goodinfoAction()  
119 - {  
120 - $result = array();  
121 -  
122 - if ($this->isAjax()) {  
123 - $num = $this->get('buy_num', 1);  
124 - $skn = $this->get('id', 1);  
125 - $uid = $this->getUid(true);  
126 - $result = CartModel::cartProductData($uid, $skn, $num); // 测试skn的ID为51172055  
127 - $result['num'] = $num;  
128 - }  
129 -  
130 - if (empty($result)) {  
131 - echo ' ';  
132 - } else {  
133 - $this->echoJson($result);  
134 - }  
135 - }  
136 -  
137 - /*  
138 - * 获取购物车加价购商品数据  
139 - */  
140 - public function giftinfoAction()  
141 - {  
142 - $result = array();  
143 -  
144 - if ($this->isAjax()) {  
145 - $skn = $this->get('skn', null);  
146 - $promotionId = $this->get('promotionId', null);  
147 - $result = CartModel::giftProductData($skn, $promotionId);  
148 - }  
149 -  
150 - if (empty($result)) {  
151 - echo ' ';  
152 - } else {  
153 - $this->echoJson($result);  
154 - }  
155 - }  
156 -  
157 - /**  
158 - * 修改购物车商品数据  
159 - */  
160 - public function modifyAction()  
161 - {  
162 - $result = array();  
163 -  
164 - if ($this->isAjax()) {  
165 - $shoppingKey = $this->getSession('shoppingKey');  
166 - $uid = $this->getUid(true);  
167 -  
168 - $params = array();  
169 - $params['old_product_sku']= $this->post('old_product_sku', 0);  
170 - $params['new_product_sku']= $this->post('new_product_sku', 0);  
171 - $params['buy_number']= $this->post('buy_number', 0);  
172 - $params['selected']= $this->post('selected', null);  
173 - $result = CartModel::modifyCartProduct($uid, $params, $shoppingKey);  
174 - }  
175 -  
176 - if (empty($result)) {  
177 - echo ' ';  
178 - } else {  
179 - $this->echoJson($result);  
180 - }  
181 - }  
182 -  
183 - /**  
184 - * 购物车结算请求  
185 - */  
186 - public function orderEnsureAction()  
187 - {  
188 - $this->setTitle('购物车');  
189 - $this->setNavHeader('购物车');  
190 -  
191 - $cartType = $this->post('cartType', 'ordinary');  
192 - $cookieData = $this->getCookie('order-info', null);  
193 - $uid = $this->getUid(true);  
194 - $data = array(  
195 - 'orderEnsurePage' => true,  
196 - 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)  
197 - ); 188 + /**
  189 + * 购物车结算请求
  190 + */
  191 + public function orderEnsureAction()
  192 + {
  193 + $this->setTitle('购物车');
  194 + $this->setNavHeader('购物车');
  195 +
  196 + $cartType = $this->post('cartType', 'ordinary');
  197 + $cookieData = $this->getCookie('order-info', null);
  198 + $uid = $this->getUid(true);
  199 + $data = array(
  200 + 'orderEnsurePage' => true,
  201 + 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
  202 + );
198 // var_dump($data); 203 // var_dump($data);
199 - $this->_view->display('order-ensure', $data);  
200 - }  
201 -  
202 - /**  
203 - * 购物车选择改变字段,重新运算订单数据  
204 - */  
205 - public function orderComputeAction()  
206 - {  
207 - $result = array();  
208 -  
209 - if ($this->isAjax()) {  
210 - $cartType = $this->post('cartType', 'ordinary');  
211 - $deliveryWay = $this->post('deliveryId', 1);  
212 - $paymentType = $this->post('paymentTypeId', 1);  
213 - $couponCode = $this->post('couponCode', null);  
214 - $yohoCoin = $this->post('yohoCoin', null);  
215 - $uid = $this->getUid(true);  
216 - $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);  
217 - }  
218 -  
219 - if (empty($result)) {  
220 - echo ' ';  
221 - } else {  
222 - $this->echoJson($result);  
223 - }  
224 - }  
225 -  
226 - /**  
227 - * 购物车输入优惠券码使用优惠券  
228 - */  
229 - public function couponSearchAction()  
230 - {  
231 - $result = array();  
232 -  
233 - if ($this->isAjax()) {  
234 - $couponCode = $this->get('couponCode', '');  
235 - $uid = $this->getUid(true);  
236 - $result = CartModel::searchCoupon($uid, $couponCode);  
237 - }  
238 -  
239 - if (empty($result)) {  
240 - echo ' ';  
241 - } else {  
242 - $this->echoJson($result);  
243 - }  
244 - }  
245 -  
246 - /**  
247 - * 购物车结算--获取优惠券列表  
248 - */  
249 - public function couponListAction()  
250 - {  
251 - $result = array();  
252 -  
253 - if ($this->isAjax()) {  
254 - $uid = $this->getUid(true);  
255 - $page = $this->get('page', 1);  
256 - $result = CartModel::getCouponList($uid);  
257 - }  
258 -  
259 - if (empty($result)) {  
260 - echo ' ';  
261 - } else {  
262 - $this->echoJson($result);  
263 - }  
264 - } 204 + $this->_view->display('order-ensure', $data);
  205 + }
  206 +
  207 + /**
  208 + * 购物车选择改变字段,重新运算订单数据
  209 + */
  210 + public function orderComputeAction()
  211 + {
  212 + $result = array();
  213 +
  214 + if ($this->isAjax()) {
  215 + $cartType = $this->post('cartType', 'ordinary');
  216 + $deliveryWay = $this->post('deliveryId', 1);
  217 + $paymentType = $this->post('paymentTypeId', 1);
  218 + $couponCode = $this->post('couponCode', null);
  219 + $yohoCoin = $this->post('yohoCoin', null);
  220 + $uid = $this->getUid(true);
  221 + $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
  222 + }
  223 +
  224 + if (empty($result)) {
  225 + echo ' ';
  226 + } else {
  227 + $this->echoJson($result);
  228 + }
  229 + }
  230 +
  231 + /**
  232 + * 购物车输入优惠券码使用优惠券
  233 + */
  234 + public function couponSearchAction()
  235 + {
  236 + $result = array();
  237 +
  238 + if ($this->isAjax()) {
  239 + $couponCode = $this->get('couponCode', '');
  240 + $uid = $this->getUid(true);
  241 + $result = CartModel::searchCoupon($uid, $couponCode);
  242 + }
  243 +
  244 + if (empty($result)) {
  245 + echo ' ';
  246 + } else {
  247 + $this->echoJson($result);
  248 + }
  249 + }
  250 +
  251 + /**
  252 + * 购物车结算--获取优惠券列表
  253 + */
  254 + public function couponListAction()
  255 + {
  256 + $result = array();
  257 +
  258 + if ($this->isAjax()) {
  259 + $uid = $this->getUid(true);
  260 + $page = $this->get('page', 1);
  261 + $result = CartModel::getCouponList($uid);
  262 + }
  263 +
  264 + if (empty($result)) {
  265 + echo ' ';
  266 + } else {
  267 + $this->echoJson($result);
  268 + }
  269 + }
265 270
266 /** 271 /**
267 * 下单流程 选择地址 272 * 下单流程 选择地址
@@ -272,7 +277,7 @@ class ShoppingCartController extends AbstractAction @@ -272,7 +277,7 @@ class ShoppingCartController extends AbstractAction
272 $this->setTitle('选择地址'); 277 $this->setTitle('选择地址');
273 $this->setNavHeader('选择地址', Helpers::url('/shoppingCart/orderEnsure')); 278 $this->setNavHeader('选择地址', Helpers::url('/shoppingCart/orderEnsure'));
274 279
275 - $uid = $this->getUid(true); 280 + $uid = $this->getUid(true);
276 $address = UserModel::getAddressData($uid); 281 $address = UserModel::getAddressData($uid);
277 282
278 $this->_view->display('select-address', array( 283 $this->_view->display('select-address', array(
@@ -296,36 +301,72 @@ class ShoppingCartController extends AbstractAction @@ -296,36 +301,72 @@ class ShoppingCartController extends AbstractAction
296 )); 301 ));
297 } 302 }
298 303
299 - /**  
300 - * 确认结算订单  
301 - */  
302 - public function orderSubAction()  
303 - {  
304 - $result = array();  
305 -  
306 - if ($this->isAjax()) {  
307 - $uid = $this->getUid(true);  
308 - $addressId = $this->post('addressId', null);  
309 - $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车  
310 - $deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送  
311 - $deliveryWay = $this->post('deliveryId', 1); // 默认普通快递  
312 - $invoiceTitle = $this->post('invoiceText', null);  
313 - $invoiceId = $this->post('invoiceType', null);  
314 - $paymentId = $this->post('paymentTypeId', 15);  
315 - $paymentType = $this->post('paymentType', 1); // 默认在线支付  
316 - $remark = $this->post('msg', null);  
317 - $couponCode = $this->post('couponCode', null);  
318 - $yohoCoin = $this->post('yohoCoin', 1);  
319 - $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);  
320 - }  
321 -  
322 - if (empty($result)) {  
323 - echo ' ';  
324 - } else {  
325 - // 提交成功清除Cookie  
326 - $this->setCookie('order-info', null);  
327 -  
328 - $this->echoJson($result);  
329 - }  
330 - } 304 + /**
  305 + * 确认结算订单
  306 + */
  307 + public function orderSubAction()
  308 + {
  309 + $result = array();
  310 +
  311 + if ($this->isAjax()) {
  312 + $uid = $this->getUid(true);
  313 + $addressId = $this->post('addressId', null);
  314 + $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
  315 + $deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送
  316 + $deliveryWay = $this->post('deliveryId', 1); // 默认普通快递
  317 + $invoiceTitle = $this->post('invoiceText', null);
  318 + $invoiceId = $this->post('invoiceType', null);
  319 + $paymentId = $this->post('paymentTypeId', 15);
  320 + $paymentType = $this->post('paymentType', 1); // 默认在线支付
  321 + $remark = $this->post('msg', null);
  322 + $couponCode = $this->post('couponCode', null);
  323 + $yohoCoin = $this->post('yohoCoin', 1);
  324 + $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
  325 + }
  326 +
  327 + if (empty($result)) {
  328 + echo ' ';
  329 + } else {
  330 + // 提交成功清除Cookie
  331 + $this->setCookie('order-info', null);
  332 +
  333 + $this->echoJson($result);
  334 + }
  335 + }
  336 +
  337 + /**
  338 + * 加入购物车
  339 + *
  340 + * @param string productSku 商品的SKU
  341 + * @param int buyNumber 购买数量
  342 + * @param int promotionId 促销ID, 加价购有关
  343 + * @param int goodsType 商品类型,0表示普通商品,1表示加价购商品
  344 + * @param int isEdit 是否是编辑商品SKU,0表示不是编辑
  345 + * @return json
  346 + */
  347 + public function addAction()
  348 + {
  349 + $result = array();
  350 +
  351 + if ($this->isAjax()) {
  352 + $shoppingKey = Helpers::getShoppingKeyByCookie();
  353 + $productSku = $this->post('productSku');
  354 + $buyNumber = $this->post('buyNumber', 1);
  355 + $goodsType = $this->post('goodsType', 0);
  356 + $promotionId = $this->post('promotionId', 0);
  357 + $isEdit = $this->post('isEdit', 0);
  358 + $uid = $this->getUid(true);
  359 +
  360 + // 执行加入购物车操作
  361 + $result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);
  362 +
  363 + // 设置加入购物车凭证到客户端浏览器
  364 + if (isset($result['data']['shopping_key'])) {
  365 + $this->setCookie('_spk', $shoppingKey);
  366 + }
  367 + }
  368 +
  369 + $this->echoJson($result);
  370 + }
  371 +
331 } 372 }
@@ -8,14 +8,13 @@ use Plugin\Helpers; @@ -8,14 +8,13 @@ use Plugin\Helpers;
8 /** 8 /**
9 * 帮助中心相关数据处理 9 * 帮助中心相关数据处理
10 */ 10 */
11 -class HelpModel  
12 -{ 11 +
  12 +class HelpModel {
13 /* 13 /*
14 * 获取帮助中心列表 14 * 获取帮助中心列表
15 */ 15 */
16 16
17 - public static function serviceInfo()  
18 - { 17 + public static function serviceInfo() {
19 //调用接口获取数据 18 //调用接口获取数据
20 $res = json_decode(HelpData::serviceInfo(), TRUE); 19 $res = json_decode(HelpData::serviceInfo(), TRUE);
21 $cateInfo = $res['data']; 20 $cateInfo = $res['data'];
@@ -25,12 +24,23 @@ class HelpModel @@ -25,12 +24,23 @@ class HelpModel
25 foreach ($cateInfo as $key => $value) { 24 foreach ($cateInfo as $key => $value) {
26 $iHelp[$key]['name'] = $value['caption']; 25 $iHelp[$key]['name'] = $value['caption'];
27 $iHelp[$key]['code'] = $value['code']; 26 $iHelp[$key]['code'] = $value['code'];
28 - }  
29 - 27 + $iHelp[$key]['url'] = Helpers::url('/home/helpDetail', array('code' => $value['code'], 'caption' => $value['caption']) );
  28 + }
30 } 29 }
31 return $iHelp; 30 return $iHelp;
32 } 31 }
33 - 32 +
  33 + /*
  34 + * 获取帮助中心详细内容
  35 + */
  36 + public static function serviceDetail($code) {
  37 + $res = HelpData::serviceDetail($code);
  38 + if (!empty($res)) {
  39 + if (false !== ($part = strstr($res,'<div class="deal_main">'))) {
  40 + $res = strstr($part,'</body>',TRUE);
  41 + }
  42 + }
  43 + return $res;
  44 + }
34 45
35 } 46 }
36 -  
@@ -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'];
@@ -586,7 +588,7 @@ class CartModel @@ -586,7 +588,7 @@ class CartModel
586 $result['message'] = '请选择配送方式'; 588 $result['message'] = '请选择配送方式';
587 } else { 589 } else {
588 $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin); 590 $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
589 - if ($orderSubRes && isset($orderSubRes['code'])) { 591 + if ($orderSubRes && isset($orderSubRes['code'])) {
590 $result = $orderSubRes; 592 $result = $orderSubRes;
591 } 593 }
592 } 594 }
@@ -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;
@@ -10,7 +10,7 @@ use Configs\CacheConfig; @@ -10,7 +10,7 @@ use Configs\CacheConfig;
10 10
11 /** 11 /**
12 * 首页相关的模板数据模型 12 * 首页相关的模板数据模型
13 - * 13 + *
14 * @name HomeModel 14 * @name HomeModel
15 * @package models 15 * @package models
16 * @copyright yoho.inc 16 * @copyright yoho.inc
@@ -52,7 +52,7 @@ class HomeModel @@ -52,7 +52,7 @@ class HomeModel
52 52
53 /** 53 /**
54 * 选择频道 54 * 选择频道
55 - * 55 + *
56 * @return void 56 * @return void
57 */ 57 */
58 public static function goSwitchChannel() 58 public static function goSwitchChannel()
@@ -70,7 +70,7 @@ class HomeModel @@ -70,7 +70,7 @@ class HomeModel
70 70
71 /** 71 /**
72 * 设置选择的频道保存到浏览器COOKIE 72 * 设置选择的频道保存到浏览器COOKIE
73 - * 73 + *
74 * @param string $cookie 74 * @param string $cookie
75 * @return void 75 * @return void
76 */ 76 */
@@ -81,7 +81,7 @@ class HomeModel @@ -81,7 +81,7 @@ class HomeModel
81 81
82 /** 82 /**
83 * 获取频道选择页的背景图片 83 * 获取频道选择页的背景图片
84 - * 84 + *
85 * @return string | false 85 * @return string | false
86 */ 86 */
87 public static function getBgImage() 87 public static function getBgImage()
@@ -122,7 +122,7 @@ class HomeModel @@ -122,7 +122,7 @@ class HomeModel
122 122
123 /** 123 /**
124 * 获取男生,女生底部banner 124 * 获取男生,女生底部banner
125 - * 125 + *
126 * @return string | false 126 * @return string | false
127 */ 127 */
128 public static function getBottomBanner($channel) 128 public static function getBottomBanner($channel)
@@ -164,7 +164,7 @@ class HomeModel @@ -164,7 +164,7 @@ class HomeModel
164 } 164 }
165 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 165 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
166 else { 166 else {
167 - Cache::set($cache, $result); 167 + Cache::set($cache, $result);
168 } 168 }
169 } 169 }
170 170
@@ -173,7 +173,7 @@ class HomeModel @@ -173,7 +173,7 @@ class HomeModel
173 173
174 /** 174 /**
175 * 获取男生首页的楼层数据 175 * 获取男生首页的楼层数据
176 - * 176 + *
177 * @return array | false 177 * @return array | false
178 */ 178 */
179 public static function getBoysFloor() 179 public static function getBoysFloor()
@@ -204,13 +204,13 @@ class HomeModel @@ -204,13 +204,13 @@ class HomeModel
204 Cache::set(CacheConfig::KEY_ACTION_BOYS_INDEX, $result); 204 Cache::set(CacheConfig::KEY_ACTION_BOYS_INDEX, $result);
205 } 205 }
206 } 206 }
207 - 207 +
208 return $result; 208 return $result;
209 } 209 }
210 210
211 /** 211 /**
212 * 获取女生首页的楼层数据 212 * 获取女生首页的楼层数据
213 - * 213 + *
214 * @return array | false 214 * @return array | false
215 */ 215 */
216 public static function getGirlsFloor() 216 public static function getGirlsFloor()
@@ -247,7 +247,7 @@ class HomeModel @@ -247,7 +247,7 @@ class HomeModel
247 247
248 /** 248 /**
249 * 获取潮童首页的楼层数据 249 * 获取潮童首页的楼层数据
250 - * 250 + *
251 * @return array | false 251 * @return array | false
252 */ 252 */
253 public static function getKidsFloor() 253 public static function getKidsFloor()
@@ -284,7 +284,7 @@ class HomeModel @@ -284,7 +284,7 @@ class HomeModel
284 284
285 /** 285 /**
286 * 获取创意生活首页的楼层数据 286 * 获取创意生活首页的楼层数据
287 - * 287 + *
288 * @return array | false 288 * @return array | false
289 */ 289 */
290 public static function getLifestyleFloor() 290 public static function getLifestyleFloor()
@@ -319,4 +319,53 @@ class HomeModel @@ -319,4 +319,53 @@ class HomeModel
319 return $result; 319 return $result;
320 } 320 }
321 321
  322 + /**
  323 + * 获取频道选择页数据
  324 + *
  325 + * @return array
  326 + */
  327 + public static function getChannel(){
  328 + $result = array();
  329 + $result['showYohood'] = false;
  330 +
  331 + $data = IndexData::channelData();
  332 +
  333 + $channelList = array();
  334 + if(isset($data['data']['list'])){
  335 + foreach($data['data']['list'] as $key => $value){
  336 + switch ($value['channel_id']) {
  337 + case 5:
  338 + $result['showYohood'] = true;
  339 + $result['yohoodHref'] = '/yohood';
  340 + break;
  341 + case 1:
  342 + $channelList[$key]['href'] = '/boys';
  343 + $channelList[$key]['title'] = '男生';
  344 + $channelList[$key]['entitle'] = 'BOYS';
  345 + break;
  346 + case 2:
  347 + $channelList[$key]['href'] = '/girls';
  348 + $channelList[$key]['title'] = '女生';
  349 + $channelList[$key]['entitle'] = 'GIRLS';
  350 + break;
  351 + case 3:
  352 + $channelList[$key]['href'] = '/kids';
  353 + $channelList[$key]['title'] = '潮童';
  354 + $channelList[$key]['entitle'] = 'KIDS';
  355 + break;
  356 + case 4:
  357 + $channelList[$key]['href'] = '/lifestyle';
  358 + $channelList[$key]['title'] = '创意生活';
  359 + $channelList[$key]['entitle'] = 'LIFESTYLE';
  360 + break;
  361 + default:
  362 + break;
  363 + }
  364 + }
  365 + $result['channelList'] = $channelList;
  366 + }
  367 +
  368 + return $result;
  369 + }
  370 +
322 } 371 }
@@ -160,17 +160,15 @@ class DetailModel @@ -160,17 +160,15 @@ class DetailModel
160 $colorGroup = array(); 160 $colorGroup = array();
161 $sizeList = array(); 161 $sizeList = array();
162 $goodsGroup = array(); 162 $goodsGroup = array();
163 - $coverImage = '';  
164 - $colorStorageNum = 0; // 颜色的库存总数 163 + $thumbImageList = array();
  164 + $colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
  165 + $sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔
  166 + $colorStorageNum = 0;
165 $totalStorageNum = 0; // 总库存数 167 $totalStorageNum = 0; // 总库存数
166 - foreach ($baseInfo['goodsList'] as $i => $value) { 168 + foreach ($baseInfo['goodsList'] as $value) {
167 $sizeList = array(); 169 $sizeList = array();
168 $colorStorageNum = 0; 170 $colorStorageNum = 0;
169 -  
170 - // 获取默认的封面图  
171 - if ($i === 0) {  
172 - $coverImage = Helpers::getImageUrl($value['colorImage'], 60, 60);  
173 - } 171 + $sizeStorageStr = ''; // clear to empty
174 172
175 // 商品分组 173 // 商品分组
176 if (isset($value['goodsImagesList'])) { 174 if (isset($value['goodsImagesList'])) {
@@ -189,10 +187,13 @@ class DetailModel @@ -189,10 +187,13 @@ class DetailModel
189 'id' => $size['id'], 187 'id' => $size['id'],
190 'skuId' => $size['goodsSizeSkuId'], 188 'skuId' => $size['goodsSizeSkuId'],
191 'goodsId' => $size['goodsId'], 189 'goodsId' => $size['goodsId'],
  190 + 'colorId' => $value['colorId'],
192 'name' => $size['sizeName'], 191 'name' => $size['sizeName'],
193 'sizeNum' => $size['goodsSizeStorageNum'], 192 'sizeNum' => $size['goodsSizeStorageNum'],
194 ); 193 );
195 $colorStorageNum += intval($size['goodsSizeStorageNum']); 194 $colorStorageNum += intval($size['goodsSizeStorageNum']);
  195 + $sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
  196 + $colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum'];
196 } 197 }
197 } 198 }
198 199
@@ -202,11 +203,19 @@ class DetailModel @@ -202,11 +203,19 @@ class DetailModel
202 'skcId' => $value['productSkc'], 203 'skcId' => $value['productSkc'],
203 'name' => $value['colorName'], 204 'name' => $value['colorName'],
204 'goodsName' => $value['goodsName'], 205 'goodsName' => $value['goodsName'],
205 - 'shortUrl' => Helpers::getImageUrl($value['colorImage'], 60, 60),  
206 'colorNum' => $colorStorageNum, 206 'colorNum' => $colorStorageNum,
207 - 'sizes' => $sizeList, 207 + 'sizeNumStr' => rtrim($sizeStorageStr, '/'),
208 ); 208 );
209 209
  210 + // 缩略图
  211 + $thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
  212 +
  213 + // 统计每个尺码对应的各个颜色的库存量
  214 + foreach ($sizeList as &$sizeArr) {
  215 + $sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['sizeName'] ]) );
  216 + }
  217 +
  218 + // 商品库存总数
210 $totalStorageNum += $colorStorageNum; 219 $totalStorageNum += $colorStorageNum;
211 } 220 }
212 221
@@ -238,12 +247,13 @@ class DetailModel @@ -238,12 +247,13 @@ class DetailModel
238 if (!$soldOut && !$notForSale) { 247 if (!$soldOut && !$notForSale) {
239 $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); 248 $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
240 $result['cartInfo']['productId'] = $productId; 249 $result['cartInfo']['productId'] = $productId;
241 - $result['cartInfo']['thumb'] = $coverImage; 250 + $result['cartInfo']['thumbs'] = $thumbImageList;
242 $result['cartInfo']['name'] = isset($result['goodsName']) ? $result['goodsName'] : ''; 251 $result['cartInfo']['name'] = isset($result['goodsName']) ? $result['goodsName'] : '';
243 $result['cartInfo']['price'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : ''; 252 $result['cartInfo']['price'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : '';
244 $result['cartInfo']['salePrice'] = isset($result['goodsPrice']['previousPrice']) ? $result['goodsPrice']['previousPrice'] : ''; 253 $result['cartInfo']['salePrice'] = isset($result['goodsPrice']['previousPrice']) ? $result['goodsPrice']['previousPrice'] : '';
245 $result['cartInfo']['totalNum'] = $totalStorageNum; 254 $result['cartInfo']['totalNum'] = $totalStorageNum;
246 $result['cartInfo']['colors'] = $colorGroup; 255 $result['cartInfo']['colors'] = $colorGroup;
  256 + $result['cartInfo']['sizes'] = $sizeList;
247 } 257 }
248 // 非卖品 258 // 非卖品
249 elseif ($notForSale) { 259 elseif ($notForSale) {
@@ -336,7 +346,7 @@ class DetailModel @@ -336,7 +346,7 @@ class DetailModel
336 346
337 $referenceList = array(); 347 $referenceList = array();
338 // 判断是否显示参考尺码 348 // 判断是否显示参考尺码
339 - $showReference = !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']) && ($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']['gender'] == $gender || $sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']['gender'] == 3); 349 + $showReference = !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']);
340 if ($showReference) { 350 if ($showReference) {
341 $referenceList[0] = array('param' => $referenceName); 351 $referenceList[0] = array('param' => $referenceName);
342 } 352 }
@@ -351,7 +361,10 @@ class DetailModel @@ -351,7 +361,10 @@ class DetailModel
351 foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) { 361 foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
352 $item = array(); 362 $item = array();
353 $sizeNameList[] = array('param' => $value['sizeName']); 363 $sizeNameList[] = array('param' => $value['sizeName']);
354 - if (!empty($value['referenceSize']['gender']) && ($value['referenceSize']['gender'] == $gender || $value['referenceSize']['gender'] == 3)) { 364 + if (!empty($value['referenceSize']['gender']) && $boyReference && ($value['referenceSize']['gender'] == 1 || $value['referenceSize']['gender'] == 3)) {
  365 + $referenceList[] = array('param' => empty($value['referenceSize']['referenceName']) ? ' ' : $value['referenceSize']['referenceName']);
  366 + }
  367 + elseif (!empty($value['referenceSize']['gender']) && $girlReference && ($value['referenceSize']['gender'] == 2 || $value['referenceSize']['gender'] == 3)) {
355 $referenceList[] = array('param' => empty($value['referenceSize']['referenceName']) ? ' ' : $value['referenceSize']['referenceName']); 368 $referenceList[] = array('param' => empty($value['referenceSize']['referenceName']) ? ' ' : $value['referenceSize']['referenceName']);
356 } 369 }
357 foreach ($value['sortAttributes'] as $attr) { 370 foreach ($value['sortAttributes'] as $attr) {
@@ -59,7 +59,7 @@ class BindController extends AbstractAction @@ -59,7 +59,7 @@ class BindController extends AbstractAction
59 $phoneNum=$this->get('phoneNum'); 59 $phoneNum=$this->get('phoneNum');
60 60
61 $data = array( 61 $data = array(
62 - 'bindIndex'=>true,//js标识 62 + 'bindCode'=>true,//js标识
63 'backUrl' => '/', // 返回的URL链接 63 'backUrl' => '/', // 返回的URL链接
64 'showHeaderImg' => true, // 控制显示头部图片 64 'showHeaderImg' => true, // 控制显示头部图片
65 'isPassportPage' => true, // 模板中模块标识 65 'isPassportPage' => true, // 模板中模块标识
@@ -87,7 +87,7 @@ class BindController extends AbstractAction @@ -87,7 +87,7 @@ class BindController extends AbstractAction
87 $nickname = $this->get('nickname'); 87 $nickname = $this->get('nickname');
88 $areaCode = $this->get('areaCode', '86'); 88 $areaCode = $this->get('areaCode', '86');
89 $data = array( 89 $data = array(
90 - 'bindIndex'=>true,//js标识 90 + 'bindPwd'=>true,//js标识
91 'backUrl' => '/', // 返回的URL链接 91 'backUrl' => '/', // 返回的URL链接
92 'showHeaderImg' => true, // 控制显示头部图片 92 'showHeaderImg' => true, // 控制显示头部图片
93 'isPassportPage' => true, // 模板中模块标识 93 'isPassportPage' => true, // 模板中模块标识
@@ -138,7 +138,7 @@ class BindController extends AbstractAction @@ -138,7 +138,7 @@ class BindController extends AbstractAction
138 } 138 }
139 else 139 else
140 { 140 {
141 - $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => $res['data']); 141 + $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data'])?$res['data']:'');
142 } 142 }
143 } 143 }
144 while (false); 144 while (false);
@@ -192,15 +192,15 @@ class BindController extends AbstractAction @@ -192,15 +192,15 @@ class BindController extends AbstractAction
192 } 192 }
193 193
194 $phoneNum = $this->post('phoneNum'); 194 $phoneNum = $this->post('phoneNum');
195 - $msgCode = $this->post('msgCode'); 195 + $code = $this->post('code');
196 $areaCode = $this->post('areaCode'); 196 $areaCode = $this->post('areaCode');
197 197
198 - if (!is_numeric($phoneNum) || !$msgCode) 198 + if (!is_numeric($phoneNum) || !$code)
199 { 199 {
200 break; 200 break;
201 } 201 }
202 202
203 - $data = BindData::checkBindCode($areaCode,$phoneNum, $msgCode); 203 + $data = BindData::checkBindCode($areaCode,$phoneNum, $code);
204 if (!isset($data['code'])) 204 if (!isset($data['code']))
205 { 205 {
206 break; 206 break;