Authored by biao

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

Showing 44 changed files with 675 additions and 459 deletions
@@ -823,19 +823,23 @@ @@ -823,19 +823,23 @@
823 { 823 {
824 id: 1, 824 id: 1,
825 chosed: true, 825 chosed: true,
826 - name: '黄色'  
827 - },  
828 - ...  
829 - ], 826 + name: '黄色',
  827 + colorNum:10,
  828 + shortUrl:'',
830 sizes: [ 829 sizes: [
831 { 830 {
832 id: 2, 831 id: 2,
833 chosed: true, 832 chosed: true,
834 - name: 'X' 833 + name: 'X',
  834 + sizeNum: 2
  835 + },
  836 + ...
  837 + ]
835 }, 838 },
836 ... 839 ...
837 ], 840 ],
838 - num: 2 841 +
  842 + totalNum: 20
839 } 843 }
840 844
841 ### 购物车商品 845 ### 购物车商品
@@ -1134,7 +1138,8 @@ @@ -1134,7 +1138,8 @@
1134 'feedbacks' : { 1138 'feedbacks' : {
1135 'commentsNum' : 0, 1139 'commentsNum' : 0,
1136 'consultsNum' : 1, 1140 'consultsNum' : 1,
1137 - 'link' : '', 1141 + 'commentsUrl' : '',
  1142 + 'consultsUrl' : '',
1138 'comments' : [ 1143 'comments' : [
1139 { 1144 {
1140 'userName' : 'Lynnic', 1145 'userName' : 'Lynnic',
@@ -1264,6 +1269,20 @@ @@ -1264,6 +1269,20 @@
1264 'id' : '', 1269 'id' : '',
1265 'preferenceUrl' :'' 1270 'preferenceUrl' :''
1266 } 1271 }
  1272 +### 评价列表页面
  1273 + {
  1274 + 'comments':{
  1275 + 'list' : [
  1276 + {
  1277 + 'userName':'',
  1278 + 'desc':'',
  1279 + 'content':'',
  1280 + 'time':''
  1281 + }
  1282 + ...
  1283 + ]
  1284 + }
  1285 + }
1267 ### 咨询列表页面 1286 ### 咨询列表页面
1268 { 1287 {
1269 'link' : '咨询表单跳转url', 1288 'link' : '咨询表单跳转url',
@@ -1318,3 +1337,29 @@ @@ -1318,3 +1337,29 @@
1318 ] 1337 ]
1319 } 1338 }
1320 1339
  1340 +
  1341 +### 频道选择页
  1342 + {
  1343 + 'background' : 'http://img11.static.yhbimg.com/yhb-img01/2015/12/14/03/0189f7499bcb98cbeb4d18d61275606716.png?imageView/2/w/640/h/800',
  1344 + 'searchUrl' : 'http://search.dev.yohobuy.com',
  1345 + 'channelList' : [
  1346 + {
  1347 + 'href' : '/boys',
  1348 + 'title' : '男生',
  1349 + 'entitle' : 'BOYS',
  1350 + }, {
  1351 + 'href' : '/girls',
  1352 + 'title' : ' 女生',
  1353 + 'entitle' : 'GIRLS',
  1354 + }, {
  1355 + 'href' : '/kids',
  1356 + 'title' : '潮童',
  1357 + 'entitle' : KIDS'',
  1358 + }, {
  1359 + 'href' : '/lifestyle',
  1360 + 'title' : '创意生活',
  1361 + 'entitle' : 'LIFESTYLE',
  1362 + }
  1363 + ],
  1364 + 'showYohood' : true/false
  1365 + }
@@ -23,13 +23,12 @@ class CartData @@ -23,13 +23,12 @@ class CartData
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 $isEdit 是否是编辑商品SKU,0表示不是编辑 26 + * @param int 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 - * @param string $shoppingKey 购物的凭证  
30 * @return array 加入购物车接口返回的数据 29 * @return array 加入购物车接口返回的数据
31 */ 30 */
32 - public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit = 0, $promotionId = null, $uid = null, $shoppingKey = '') 31 + public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit = 0, $promotionId = null, $uid = null)
33 { 32 {
34 $param = Yohobuy::param(); 33 $param = Yohobuy::param();
35 $param['method'] = 'app.Shopping.add'; 34 $param['method'] = 'app.Shopping.add';
@@ -39,9 +38,8 @@ class CartData @@ -39,9 +38,8 @@ class CartData
39 $param['edit_product_sku'] = $isEdit; 38 $param['edit_product_sku'] = $isEdit;
40 $param['selected'] = 'Y'; 39 $param['selected'] = 'Y';
41 $param['promotion_id'] = $promotionId; 40 $param['promotion_id'] = $promotionId;
42 - $param['shopping_key'] = $shoppingKey;  
43 41
44 - if (!empty($uid)) { 42 + if ($uid !== null) {
45 $param['uid'] = $uid; 43 $param['uid'] = $uid;
46 } 44 }
47 $param['client_secret'] = Sign::getSign($param); 45 $param['client_secret'] = Sign::getSign($param);
@@ -203,19 +201,23 @@ class CartData @@ -203,19 +201,23 @@ class CartData
203 * 201 *
204 * @param int $uid 用户ID 202 * @param int $uid 用户ID
205 * @param string $cartType 购物车类型,ordinary表示普通购物车 203 * @param string $cartType 购物车类型,ordinary表示普通购物车
206 - * @param string $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运  
207 - * @param string $paymentType 支付方式,1表示在线支付,2表示货到付款  
208 - * @param string $yohoCoin 使用的YOHO币数量,默认为null表示不适用 204 + * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
  205 + * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
  206 + * @param string $couponCode 优惠券码
  207 + * @param mixed $yohoCoin 使用的YOHO币数量
209 * @return array 接口返回的数据 208 * @return array 接口返回的数据
210 */ 209 */
211 - public static function paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType, $yohoCoin = null) 210 + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
212 { 211 {
213 $param = Yohobuy::param(); 212 $param = Yohobuy::param();
214 $param['method'] = 'app.Shopping.compute'; 213 $param['method'] = 'app.Shopping.compute';
215 $param['cart_type'] = $cartType; 214 $param['cart_type'] = $cartType;
216 $param['delivery_way'] = $deliveryWay; 215 $param['delivery_way'] = $deliveryWay;
217 $param['payment_type'] = $paymentType; 216 $param['payment_type'] = $paymentType;
218 - if ($yohoCoin !== null) { 217 + if (!empty($couponCode)) {
  218 + $param['coupon_code'] = $couponCode;
  219 + }
  220 + if (!empty($yohoCoin)) {
219 $param['use_yoho_coin'] = $yohoCoin; 221 $param['use_yoho_coin'] = $yohoCoin;
220 } 222 }
221 223
@@ -232,7 +234,7 @@ class CartData @@ -232,7 +234,7 @@ class CartData
232 * @param string $couponCode 优惠券代码 234 * @param string $couponCode 优惠券代码
233 * @return array 接口返回的数据 235 * @return array 接口返回的数据
234 */ 236 */
235 - public static function getCoupon($uid, $couponCode) 237 + public static function searchCoupon($uid, $couponCode)
236 { 238 {
237 $param = Yohobuy::param(); 239 $param = Yohobuy::param();
238 $param['method'] = 'app.Shopping.useCoupon'; 240 $param['method'] = 'app.Shopping.useCoupon';
@@ -244,10 +246,38 @@ class CartData @@ -244,10 +246,38 @@ class CartData
244 } 246 }
245 247
246 /** 248 /**
  249 + * 购物车结算--获取优惠券列表
  250 + *
  251 + * @param int $uid 用户ID
  252 + * @return array 接口返回的数据
  253 + */
  254 + public static function getCouponList($uid)
  255 + {
  256 + $param = Yohobuy::param();
  257 + $param['method'] = 'app.coupons.lists';
  258 + $param['type'] = 'notuse';
  259 + $param['page'] = 1;
  260 + $param['limit'] = 1000;
  261 + $param['uid'] = $uid;
  262 + $param['client_secret'] = Sign::getSign($param);
  263 +
  264 + return Yohobuy::get(Yohobuy::API_URL, $param);
  265 + }
  266 +
  267 + /**
247 * 购物车结算--提交结算信息 268 * 购物车结算--提交结算信息
248 * 269 *
249 * @param int $uid 用户ID 270 * @param int $uid 用户ID
250 - * @param string $couponCode 优惠券代码 271 + * @param int $addressId 地址ID
  272 + * @param int $cartType 购物车类型ID
  273 + * @param int $deliveryTime 寄送时间ID
  274 + * @param int $deliveryWay 寄送方式ID
  275 + * @param string $invoiceTitle 发票说明
  276 + * @param int $invoiceId 发票类型ID
  277 + * @param int $paymentId 支付方式ID
  278 + * @param int $paymentType 支付类型ID
  279 + * @param string $remark 留言
  280 + * @param mixed $yohoCoin 使用的YOHO币数量或为空
251 * @return array 接口返回的数据 281 * @return array 接口返回的数据
252 */ 282 */
253 public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin) 283 public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin)
@@ -258,12 +288,19 @@ class CartData @@ -258,12 +288,19 @@ class CartData
258 $param['cart_type'] = $cartType; 288 $param['cart_type'] = $cartType;
259 $param['delivery_time'] = $deliveryTime; 289 $param['delivery_time'] = $deliveryTime;
260 $param['delivery_way'] = $deliveryWay; 290 $param['delivery_way'] = $deliveryWay;
  291 + if (!empty($invoiceTitle)) {
261 $param['invoices_title'] = $invoiceTitle; 292 $param['invoices_title'] = $invoiceTitle;
  293 + }
  294 + if (!empty($invoiceId)) {
262 $param['invoices_type_id'] = $invoiceId; 295 $param['invoices_type_id'] = $invoiceId;
  296 + }
  297 +
263 $param['payment_id'] = $paymentId; 298 $param['payment_id'] = $paymentId;
264 $param['payment_type'] = $paymentType; 299 $param['payment_type'] = $paymentType;
265 $param['remark'] = $remark; 300 $param['remark'] = $remark;
  301 + if (!empty($yohoCoin)) {
266 $param['use_yoho_coin'] = $yohoCoin; 302 $param['use_yoho_coin'] = $yohoCoin;
  303 + }
267 $param['uid'] = $uid; 304 $param['uid'] = $uid;
268 $param['client_secret'] = Sign::getSign($param); 305 $param['client_secret'] = Sign::getSign($param);
269 306
@@ -4,7 +4,7 @@ namespace LibModels\Wap\Home; @@ -4,7 +4,7 @@ namespace LibModels\Wap\Home;
4 4
5 use Api\Yohobuy; 5 use Api\Yohobuy;
6 use Api\Sign; 6 use Api\Sign;
7 -/* 7 +/**
8 * 帮助中心数据模型 8 * 帮助中心数据模型
9 * 9 *
10 */ 10 */
@@ -12,7 +12,8 @@ class HelpData @@ -12,7 +12,8 @@ class HelpData
12 { 12 {
13 13
14 /* 14 /*
15 - * 获取帮助中心列表 15 + * 获取帮助列表(分类),缓存1h
  16 + * clientType客户端
16 */ 17 */
17 public static function serviceInfo() 18 public static function serviceInfo()
18 { 19 {
@@ -25,20 +26,6 @@ class HelpData @@ -25,20 +26,6 @@ class HelpData
25 } 26 }
26 27
27 28
28 - /*  
29 - * 获取帮助中心列表  
30 - */  
31 - public static function serviceDetail($code)  
32 - {  
33 - //构建必传参数  
34 - $param = Yohobuy::param();  
35 - $param['method'] = 'app.help.detail';  
36 - $param['code'] = $code;  
37 - $param['return_type'] = 'html';  
38 - $param['client_secret'] = Sign::getSign($param);  
39 - return Yohobuy::post(Yohobuy::API_URL, $param,$param );  
40 - }  
41 -  
42 29
43 } 30 }
44 31
@@ -73,7 +73,6 @@ class DetailData @@ -73,7 +73,6 @@ class DetailData
73 $param['limit'] = $pageSize; 73 $param['limit'] = $pageSize;
74 $param['client_secret'] = Sign::getSign($param); 74 $param['client_secret'] = Sign::getSign($param);
75 75
76 -  
77 return Yohobuy::get(Yohobuy::API_URL, $param); 76 return Yohobuy::get(Yohobuy::API_URL, $param);
78 } 77 }
79 78
@@ -94,7 +93,6 @@ class DetailData @@ -94,7 +93,6 @@ class DetailData
94 $param['limit'] = $pageSize; 93 $param['limit'] = $pageSize;
95 $param['client_secret'] = Sign::getSign($param); 94 $param['client_secret'] = Sign::getSign($param);
96 95
97 -  
98 return Yohobuy::get(Yohobuy::API_URL, $param); 96 return Yohobuy::get(Yohobuy::API_URL, $param);
99 } 97 }
100 98
@@ -158,6 +158,21 @@ function reMarginFooter(fixedElement) { @@ -158,6 +158,21 @@ function reMarginFooter(fixedElement) {
158 $footer.removeClass('hide'); 158 $footer.removeClass('hide');
159 }()); 159 }());
160 160
  161 +(function(w, d, s, j, f) {
  162 + var a = d.createElement(s);
  163 + var m = d.getElementsByTagName(s)[0];
  164 +
  165 + w.YohoAcquisitionObject = f;
  166 +
  167 + w[f] = function() {
  168 + w[f].p = arguments;
  169 + };
  170 +
  171 + a.async = 1;
  172 + a.src = j;
  173 + m.parentNode.insertBefore(a, m);
  174 +})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas-debug.js', '_yas');
  175 +
161 (function() { 176 (function() {
162 var uid = getUid(); 177 var uid = getUid();
163 178
@@ -166,7 +181,7 @@ function reMarginFooter(fixedElement) { @@ -166,7 +181,7 @@ function reMarginFooter(fixedElement) {
166 window._ozuid = uid;//暴露ozuid 181 window._ozuid = uid;//暴露ozuid
167 182
168 if (window._yas) { 183 if (window._yas) {
169 - window._yas(1 * new Date(), '1.0.13.2', 'yohobuy_m', uid, ''); 184 + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', uid, '', '');
170 } 185 }
171 }()); 186 }());
172 187
@@ -182,8 +197,8 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() { @@ -182,8 +197,8 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() {
182 $(this).addClass('highlight'); 197 $(this).addClass('highlight');
183 }).on('touchend touchcancel', '.tap-hightlight', function() { 198 }).on('touchend touchcancel', '.tap-hightlight', function() {
184 $(this).removeClass('highlight'); 199 $(this).removeClass('highlight');
185 -  
186 }); 200 });
  201 +
187 $('.nav-home').on('touchstart', function() { 202 $('.nav-home').on('touchstart', function() {
188 $('.homebuttom').toggleClass('none'); 203 $('.homebuttom').toggleClass('none');
189 }); 204 });
@@ -231,6 +246,23 @@ $('.nav-home').on('touchstart', function() { @@ -231,6 +246,23 @@ $('.nav-home').on('touchstart', function() {
231 window.cancelAnimationFrame = cancelAnimationFrame; 246 window.cancelAnimationFrame = cancelAnimationFrame;
232 }()); 247 }());
233 248
  249 +// 给jQuery 扩展 queryString函数
  250 +$.extend({
  251 + queryString: function() {
  252 + var vars = [],
  253 + hash,
  254 + i;
  255 + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  256 +
  257 + for (i = 0; i < hashes.length; i++) {
  258 + hash = hashes[i].split('=');
  259 + vars.push(hash[0]);
  260 + vars[hash[0]] = hash[1];
  261 + }
  262 + return vars;
  263 + }
  264 +});
  265 +
234 //暴露公共接口 266 //暴露公共接口
235 window.cookie = cookie; 267 window.cookie = cookie;
236 268
@@ -20,7 +20,8 @@ var $addressForm = $('.edit-address'), @@ -20,7 +20,8 @@ var $addressForm = $('.edit-address'),
20 $area = $('.area'), 20 $area = $('.area'),
21 isSubmiting, 21 isSubmiting,
22 currentPage = 'edit', 22 currentPage = 'edit',
23 - newArea = []; 23 + newArea = [],
  24 + queryString = $.queryString();
24 25
25 $($editAddressPage, $addressListPage).css('min-height', function() { 26 $($editAddressPage, $addressListPage).css('min-height', function() {
26 return $(window).height() - $('#yoho-header').height(); 27 return $(window).height() - $('#yoho-header').height();
@@ -91,8 +92,12 @@ $addressForm.on('submit', function() { @@ -91,8 +92,12 @@ $addressForm.on('submit', function() {
91 isSubmiting = false; 92 isSubmiting = false;
92 loading.hideLoadingMask(); 93 loading.hideLoadingMask();
93 } else { 94 } else {
  95 + if (queryString.refer === 'shopping') {
  96 + window.location.href = '/shoppingCart/selectAddress';
  97 + } else {
94 window.location.href = '/home/address'; 98 window.location.href = '/home/address';
95 } 99 }
  100 + }
96 }).fail(function() { 101 }).fail(function() {
97 tip.show('网络出了点问题~'); 102 tip.show('网络出了点问题~');
98 isSubmiting = false; 103 isSubmiting = false;
@@ -69,4 +69,5 @@ $addAddress.on('touchend', function() { @@ -69,4 +69,5 @@ $addAddress.on('touchend', function() {
69 $action.on('touchend', '.del', function() { 69 $action.on('touchend', '.del', function() {
70 deleteId = $(this).data('id'); 70 deleteId = $(this).data('id');
71 $confim.fadeIn(); 71 $confim.fadeIn();
  72 + return false;
72 }); 73 });
@@ -9,10 +9,7 @@ var $ = require('jquery'), @@ -9,10 +9,7 @@ var $ = require('jquery'),
9 9
10 var commentsNum,consultsNum; 10 var commentsNum,consultsNum;
11 11
12 -var consultFooterEle = $('.consult-content-footer')[0],  
13 - consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle),  
14 -  
15 - navtabEle = document.getElementById('nav-tab'), 12 +var navtabEle = document.getElementById('nav-tab'),
16 navtabHammer = navtabEle && new Hammer(navtabEle), 13 navtabHammer = navtabEle && new Hammer(navtabEle),
17 14
18 gotoConsultEle = document.getElementById('goto-consult'), 15 gotoConsultEle = document.getElementById('goto-consult'),
@@ -66,12 +63,6 @@ if (navtabHammer) { @@ -66,12 +63,6 @@ if (navtabHammer) {
66 }); 63 });
67 } 64 }
68 65
69 -if (consultFooterHammer) {  
70 - consultFooterHammer.on('tap', function() {  
71 - location.href = $(consultFooterEle).data('href');  
72 - });  
73 -}  
74 -  
75 if (gotoConsultHammer) { 66 if (gotoConsultHammer) {
76 gotoConsultHammer.on('tap', function() { 67 gotoConsultHammer.on('tap', function() {
77 location.href = $(gotoConsultEle).data('href'); 68 location.href = $(gotoConsultEle).data('href');
@@ -30,6 +30,7 @@ if (likeHammer) { @@ -30,6 +30,7 @@ if (likeHammer) {
30 opt = 'ok'; 30 opt = 'ok';
31 favorite = 1; 31 favorite = 1;
32 } 32 }
  33 +
33 $.ajax({ 34 $.ajax({
34 type: 'POST', 35 type: 'POST',
35 url: '/product/opt/favoriteProduct', 36 url: '/product/opt/favoriteProduct',
@@ -51,19 +52,19 @@ if (likeHammer) { @@ -51,19 +52,19 @@ if (likeHammer) {
51 } else { 52 } else {
52 tip.show(data.message); 53 tip.show(data.message);
53 } 54 }
  55 + },
  56 + error: function() {
  57 + tip.show('网络断开连接了~');
  58 + }
  59 + });
54 60
55 // 统计代码:用于统计用户加入或取消商品收藏的动作 61 // 统计代码:用于统计用户加入或取消商品收藏的动作
56 if (window._yas) { 62 if (window._yas) {
57 window._yas.sendCustomInfo({ 63 window._yas.sendCustomInfo({
58 pd: productId, 64 pd: productId,
59 fa: favorite 65 fa: favorite
60 - }); 66 + }, true);
61 } 67 }
62 - },  
63 - error: function() {  
64 - tip.show('网络断开连接了~');  
65 - }  
66 - });  
67 }); 68 });
68 } 69 }
69 70
@@ -75,7 +76,7 @@ if (addToCartHammer) { @@ -75,7 +76,7 @@ if (addToCartHammer) {
75 window._yas.sendCustomInfo({ 76 window._yas.sendCustomInfo({
76 pd: productId, 77 pd: productId,
77 by: 1 78 by: 1
78 - }); 79 + }, false);
79 } 80 }
80 }); 81 });
81 } 82 }
@@ -8,6 +8,7 @@ var $ = require('jquery'), @@ -8,6 +8,7 @@ var $ = require('jquery'),
8 Hammer = require('yoho.hammer'), 8 Hammer = require('yoho.hammer'),
9 lazyLoad = require('yoho.lazyload'); 9 lazyLoad = require('yoho.lazyload');
10 10
  11 +
11 //品牌页参数 12 //品牌页参数
12 var $brandHeader = $('#brand-header'), 13 var $brandHeader = $('#brand-header'),
13 $introBox = $('#intro-box'); 14 $introBox = $('#intro-box');
@@ -231,6 +232,25 @@ function search(opt) { @@ -231,6 +232,25 @@ function search(opt) {
231 loading.hideLoadingMask(); 232 loading.hideLoadingMask();
232 233
233 window.rePosFooter(); 234 window.rePosFooter();
  235 +
  236 +
  237 + // 用于统计点击了商品列表的第几个商品,序号从1开始计算。
  238 + if (window._yas) {
  239 + switch (navType) {
  240 + case 'newest':
  241 + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
  242 + '', '.new-goods .good-info .good-detail-img .good-thumb');
  243 + break;
  244 + case 'price':
  245 + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
  246 + '', '.new-goods .good-info .good-detail-img .good-thumb');
  247 + break;
  248 + case 'discount':
  249 + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
  250 + '', '.new-goods .good-info .good-detail-img .good-thumb');
  251 + break;
  252 + }
  253 + }
234 } 254 }
235 }); 255 });
236 256
@@ -455,8 +475,3 @@ $listNav.on('touchstart', 'li', function() { @@ -455,8 +475,3 @@ $listNav.on('touchstart', 'li', function() {
455 $listNav.find('li').removeClass('bytouch'); 475 $listNav.find('li').removeClass('bytouch');
456 }); 476 });
457 477
458 -// 用于统计点击了商品列表的第几个商品,序号从1开始计算。  
459 -if (window._yas) {  
460 - window._yas(1 * new Date(), '1.0.13.2', 'yohobuy_m', window._ozuid,  
461 - '', '#goods-container >div >div .good-thumb >img');  
462 -}  
@@ -7,3 +7,5 @@ @@ -7,3 +7,5 @@
7 require('./cart'); 7 require('./cart');
8 require('./gift-advance'); 8 require('./gift-advance');
9 require('./order-ensure'); 9 require('./order-ensure');
  10 +require('./select-coupon');
  11 +require('./select-address');
@@ -6,9 +6,12 @@ @@ -6,9 +6,12 @@
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 lazyLoad = require('yoho.lazyload'), 8 lazyLoad = require('yoho.lazyload'),
9 - Hammer = require('yoho.hammer'); 9 + Hammer = require('yoho.hammer'),
  10 + orderInfo = require('./order-info').orderInfo;
10 11
11 -var dispatchModeHammer, dispatchTimeHammer; 12 +var dispatchModeHammer,
  13 + dispatchTimeHammer,
  14 + $invoice = $('.invoice');
12 15
13 lazyLoad(); 16 lazyLoad();
14 17
@@ -51,3 +54,42 @@ $('.invoice').on('touchend', '.checkbox', function() { @@ -51,3 +54,42 @@ $('.invoice').on('touchend', '.checkbox', function() {
51 $('.invoice').removeClass('focus'); 54 $('.invoice').removeClass('focus');
52 } 55 }
53 }); 56 });
  57 +
  58 +// 界面点击,状态存 cookie
  59 +$('.dispatch-mode').on('touchend', 'li', function() {
  60 + orderInfo('deliveryId', $(this).data('id'));
  61 +});
  62 +
  63 +$('.dispatch-time').on('touchend', 'li', function() {
  64 + orderInfo('deliveryTimeId', $(this).data('id'));
  65 +});
  66 +
  67 +$('.coin').on('touchend', function() {
  68 + var $this = $(this);
  69 +
  70 + if ($this.find('.checkbox').hasClass('icon-cb-checked')) {
  71 + orderInfo('yohoCoin', $this.data('yoho-coin'));
  72 + } else {
  73 + orderInfo('yohoCoin', 0);
  74 + }
  75 +});
  76 +
  77 +$invoice.on('touchend', function() {
  78 + var $this = $(this);
  79 +
  80 + orderInfo('invoice', $this.find('.checkbox').hasClass('icon-cb-checked'));
  81 +});
  82 +
  83 +$invoice.find('[name="invoice-title"]').on('blur', function() {
  84 + orderInfo('invoiceText', $(this).val());
  85 +}).end().find('.invoice-type').on('change', function() {
  86 + orderInfo('invoiceType', $(this).val());
  87 +});
  88 +
  89 +$('#msg').find('input').on('blur', function() {
  90 + orderInfo('msg', $(this).val());
  91 +});
  92 +
  93 +$('.pay-mode').on('click', 'li', function() {
  94 + orderInfo('paymentTypeId', $(this).data('pay-id'));
  95 +});
  1 +/**
  2 + * 订单信息读取
  3 + * @author: bikai<kai.bi@yoho.cn>
  4 + * @date: 2015/12/14
  5 + */
  6 +var info = window.cookie('order-info');
  7 +
  8 +// info 必须是 JSON 字符串
  9 +try {
  10 + info = JSON.parse(info);
  11 +} catch (e) {
  12 + info = {};
  13 +}
  14 +
  15 +exports.orderInfo = function(key, value) {
  16 + if (value === undefined) {
  17 + return info[key];
  18 + }
  19 + info[key] = value;
  20 + window.setCookie('order-info', JSON.stringify(info));
  21 +};
  1 +/**
  2 + * 购物车 地址选择
  3 + * @author: bikai<kai.bi@yoho.cn>
  4 + * @date: 2015/12/14
  5 + */
  6 +
  7 +var $ = require('jquery'),
  8 + orderInfo = require('./order-info').orderInfo;
  9 +
  10 +$('.address-item').on('touchend', function() {
  11 + orderInfo('addressId', $(this).data('address-id'));
  12 +}).on('touchend', '.edit', function() {
  13 + window.location.href = $(this).data('href');
  14 + return false;
  15 +});
  1 +/**
  2 + * 优惠券选择
  3 + * @author: bikai<kai.bi@yoho.cn>
  4 + * @date: 2015/12/10
  5 + */
  6 +
1 var $ = require('jquery'), 7 var $ = require('jquery'),
2 Handlebars = require('yoho.handlebars'), 8 Handlebars = require('yoho.handlebars'),
3 ellipsis = require('mlellipsis'), 9 ellipsis = require('mlellipsis'),
4 loading = require('../plugin/loading'), 10 loading = require('../plugin/loading'),
5 - tip = require('../plugin/tip'); 11 + tip = require('../plugin/tip'),
  12 + orderInfo = require('./order-info').orderInfo;
6 13
7 var page = 1, 14 var page = 1,
8 canGetCoupon = true, 15 canGetCoupon = true,
9 isGetData; 16 isGetData;
10 17
11 var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), 18 var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
12 - conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()); 19 + conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()),
  20 + $newCoupon = $('#new-coupon');
13 21
14 ellipsis.init(); 22 ellipsis.init();
15 23
16 -$('#search-coupon').on('submit', function() { 24 +$newCoupon.on('submit', function() {
17 $.ajax({ 25 $.ajax({
18 method: 'POST', 26 method: 'POST',
19 - url: '', 27 + url: '/shoppingCart/couponSearch',
20 data: $(this).serialize() 28 data: $(this).serialize()
21 }).then(function(res) { 29 }).then(function(res) {
22 - if (res.avaliable) {  
23 - $('#coupon-list').html(conponTmpl({  
24 - coupons: res.coupons  
25 - }));  
26 - $('#coupon-list-not').html(''); 30 + if (res.code === 200) {
  31 + tip.show('优惠券可用');
  32 + orderInfo('couponCode', res.data.coupon_code);
  33 + window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code;
27 } else { 34 } else {
28 - tip.show(res.msg); 35 + tip.show(res.message);
29 } 36 }
  37 + }).fail(function() {
  38 + tip.show('网络错误');
30 }); 39 });
31 return false; 40 return false;
32 }); 41 });
33 42
  43 +$('#coupon-list').on('touchend', '.employ-main', function() {
  44 + var $this = $(this);
  45 +
  46 + orderInfo('couponCode', $this.data('coupon-code'));
  47 + orderInfo('couponValue', $this.data('coupon-value'));
  48 +});
  49 +
  50 +$newCoupon.find('input').on('input', function() {
  51 + if ($(this).val() !== '') {
  52 + $newCoupon.find('.submit').css('background', '#444');
  53 + } else {
  54 + $newCoupon.find('.submit').css('background', '#b0b0b0');
  55 + }
  56 +});
  57 +
34 function getCouponHandle(coupons) { 58 function getCouponHandle(coupons) {
35 var notAvailableCoupons = []; 59 var notAvailableCoupons = [];
36 60
37 // 后端需要返回一个 coupons 列表,如下 61 // 后端需要返回一个 coupons 列表,如下
38 // notAvailable 表示不可用的优惠券 62 // notAvailable 表示不可用的优惠券
39 - coupons = [{  
40 - money: '99',  
41 - coupon_name: '满XX-减去吴悠右腿有益于有2222',  
42 - couponValidity: '20150129-20150430',  
43 - coupon_id: '22222'  
44 - }, {  
45 - money: '99',  
46 - coupon_name: '满XX-减去吴悠右腿有益于有2222',  
47 - couponValidity: '20150129-20150430',  
48 - coupon_id: '2222233'  
49 - }, {  
50 - money: '99',  
51 - coupon_name: 'NONO满XX-减去吴悠右腿有益于有2222',  
52 - couponValidity: '20150129-20150430',  
53 - coupon_id: '2222233',  
54 - notAvailable: 1  
55 - }]; 63 + // coupons = [{
  64 + // money: '99',
  65 + // coupon_name: '满XX-减去吴悠右腿有益于有2222',
  66 + // couponValidity: '20150129-20150430',
  67 + // coupon_id: '22222'
  68 + // }, {
  69 + // money: '99',
  70 + // coupon_name: '满XX-减去吴悠右腿有益于有2222',
  71 + // couponValidity: '20150129-20150430',
  72 + // coupon_id: '2222233'
  73 + // }, {
  74 + // money: '99',
  75 + // coupon_name: 'NONO满XX-减去吴悠右腿有益于有2222',
  76 + // couponValidity: '20150129-20150430',
  77 + // coupon_id: '2222233',
  78 + // notAvailable: 1
  79 + // }];
56 80
57 // coupons 是个列表,如果不是列表,可能是服务器错误,这次翻页加载不算 81 // coupons 是个列表,如果不是列表,可能是服务器错误,这次翻页加载不算
58 if (!$.isArray(coupons)) { 82 if (!$.isArray(coupons)) {
@@ -105,10 +129,9 @@ function getCouponDate() { @@ -105,10 +129,9 @@ function getCouponDate() {
105 129
106 $.ajax({ 130 $.ajax({
107 type: 'POST', 131 type: 'POST',
108 - url: '/home/couponData',  
109 - dataType: 'html', 132 + url: '/shoppingCart/couponList',
  133 + dataType: 'json',
110 data: { 134 data: {
111 - statuss: status,  
112 page: page 135 page: page
113 } 136 }
114 }).then(getCouponHandle).fail(function() { 137 }).then(getCouponHandle).fail(function() {
@@ -143,7 +143,7 @@ @@ -143,7 +143,7 @@
143 font-size: 16px; 143 font-size: 16px;
144 line-height: 52px; 144 line-height: 52px;
145 color: #fff; 145 color: #fff;
146 - background: #000; 146 + background-color: #000;
147 border: 4px solid #fff; 147 border: 4px solid #fff;
148 font-weight: bold; 148 font-weight: bold;
149 &:last-child { 149 &:last-child {
@@ -168,9 +168,6 @@ @@ -168,9 +168,6 @@
168 &.focus { 168 &.focus {
169 color: #000; 169 color: #000;
170 } 170 }
171 - .comments-num {  
172 - display: none;  
173 - }  
174 } 171 }
175 .comment-nav { 172 .comment-nav {
176 border-right: 1px solid #ccc; 173 border-right: 1px solid #ccc;
@@ -286,19 +283,18 @@ @@ -286,19 +283,18 @@
286 283
287 .comment-content-footer, 284 .comment-content-footer,
288 .consult-content-footer { 285 .consult-content-footer {
  286 + display: block;
289 min-height: pxToRem(88px); 287 min-height: pxToRem(88px);
290 text-align: center; 288 text-align: center;
291 background-color: #fff; 289 background-color: #fff;
292 border-bottom: 1px solid $borderC; 290 border-bottom: 1px solid $borderC;
293 line-height: pxToRem(88px); 291 line-height: pxToRem(88px);
294 font-size: pxToRem(28px); 292 font-size: pxToRem(28px);
295 - a {  
296 color: #b0b0b0; 293 color: #b0b0b0;
297 .iconfont { 294 .iconfont {
298 font-size: inherit; 295 font-size: inherit;
299 } 296 }
300 } 297 }
301 - }  
302 298
303 .content.hide { 299 .content.hide {
304 display: none; 300 display: none;
@@ -250,8 +250,15 @@ $basicBtnC:#eb0313; @@ -250,8 +250,15 @@ $basicBtnC:#eb0313;
250 padding-right: pxToRem(28px); 250 padding-right: pxToRem(28px);
251 border-bottom: 1px solid $borderC; 251 border-bottom: 1px solid $borderC;
252 background-color: $pageBgC; 252 background-color: $pageBgC;
253 - display: flex;  
254 - align-items: center; 253 + @include flexbox((
  254 + box-flex: 1.0,
  255 + display: box,
  256 + box-align: center
  257 + ), $version: 1);
  258 + @include flexbox((
  259 + display: flex,
  260 + align-items: center
  261 + ));
255 span{ 262 span{
256 // display: table-cell; 263 // display: table-cell;
257 display: -webkit-box; 264 display: -webkit-box;
1 -@import "good", "chose-panel", "gift-advance-good", "order-ensure", "select-coupon"; 1 +@import "good", "chose-panel", "gift-advance-good", "order-ensure", "select-coupon", "select-address";
2 2
3 3
4 .icon-checkbox:before { content: "\e61c"; } 4 .icon-checkbox:before { content: "\e61c"; }
@@ -163,6 +163,20 @@ @@ -163,6 +163,20 @@
163 } 163 }
164 } 164 }
165 165
  166 + #msg {
  167 + padding-top: pxToRem(20px);
  168 + input {
  169 + padding: pxToRem(10px);
  170 + width: pxToRem(580px);
  171 + height: pxToRem(50px);
  172 + outline: 0;
  173 + border: 0;
  174 + border: 1px solid #f7f7f7;
  175 + border-radius: pxToRem(4px);
  176 + }
  177 +
  178 + }
  179 +
166 .total { 180 .total {
167 font-size: 22rem / $pxConvertRem; 181 font-size: 22rem / $pxConvertRem;
168 margin-top: 20rem / $pxConvertRem; 182 margin-top: 20rem / $pxConvertRem;
  1 +.select-address-page {
  2 + padding-bottom: pxToRem(20px);
  3 +
  4 + .add-address {
  5 + margin-bottom: 0;
  6 + }
  7 +
  8 +}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 margin-top: pxToRem(30px); 2 margin-top: pxToRem(30px);
3 margin-bottom: pxToRem(30px); 3 margin-bottom: pxToRem(30px);
4 4
5 - #search-coupon { 5 + #new-coupon {
6 margin-bottom: pxToRem(30px); 6 margin-bottom: pxToRem(30px);
7 padding-left: pxToRem(30px); 7 padding-left: pxToRem(30px);
8 padding-right: pxToRem(30px); 8 padding-right: pxToRem(30px);
@@ -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>{{ caption}}</span><i class="iconfont num">&#xe604;</i></a></li> 5 + <li><a href="/home/helpDetail?code={{ code}}"><span>{{ name}}</span><i class="iconfont num">&#xe604;</i></a></li>
6 {{/ iHelp}} 6 {{/ iHelp}}
7 </ul> 7 </ul>
8 </div> 8 </div>
@@ -19,10 +19,12 @@ @@ -19,10 +19,12 @@
19 <div class="index-channel"> 19 <div class="index-channel">
20 <img class="img" src="{{background}}"> 20 <img class="img" src="{{background}}">
21 <div class="index-channel-list"> 21 <div class="index-channel-list">
22 - <a href="/boys" class="list-item">男生 <span class="lighter">BOYS</span> <span class="iconfont right-icon">&#xe614;</span></a>  
23 - <a href="/girls" class="list-item">女生 <span class="lighter">GIRLS</span> <span class="iconfont right-icon">&#xe614;</span></a>  
24 - <a href="/kids" class="list-item">潮童 <span class="lighter">KIDS</span> <span class="iconfont right-icon">&#xe614;</span></a>  
25 - <a href="/lifestyle" class="list-item">创意生活 <span class="lighter">LIFESTYLE</span> <span class="iconfont right-icon">&#xe614;</span></a> 22 + {{#channelList}}
  23 + <a href="{{href}}" class="list-item">{{title}} <span class="lighter">{{entitle}}</span> <span class="iconfont right-icon">&#xe614;</span></a>
  24 + {{/channelList}}
  25 + {{#showYohood}}
  26 + <a href="/yohood" id="yohood" class="list-item"> <span class="iconfont right-icon">&#xe614;</span></a>
  27 + {{/showYohood}}
26 </div> 28 </div>
27 </div> 29 </div>
28 </div> 30 </div>
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
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>
8 - <span class="address">{{address}}</span> 8 + <span class="address">{{area}} {{address}}</span>
9 </p> 9 </p>
10 <span class="iconfont">&#xe614;</span> 10 <span class="iconfont">&#xe614;</span>
11 </a> 11 </a>
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <h3 class="title">配送方式</h3> 15 <h3 class="title">配送方式</h3>
16 <ul class="dispatch-mode clearfix"> 16 <ul class="dispatch-mode clearfix">
17 {{#each dispatchMode}} 17 {{#each dispatchMode}}
18 - <li {{#if @first}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li> 18 + <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li>
19 {{/each}} 19 {{/each}}
20 </ul> 20 </ul>
21 </div> 21 </div>
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <h3 class="title">送货时间</h3> 24 <h3 class="title">送货时间</h3>
25 <ul class="dispatch-time clearfix"> 25 <ul class="dispatch-time clearfix">
26 {{#each dispatchTime}} 26 {{#each dispatchTime}}
27 - <li {{#if @first}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li> 27 + <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li>
28 {{/each}} 28 {{/each}}
29 </ul> 29 </ul>
30 </div> 30 </div>
@@ -52,14 +52,14 @@ @@ -52,14 +52,14 @@
52 </span> 52 </span>
53 {{/if}} 53 {{/if}}
54 54
55 - {{#if notUsed}}  
56 - <span class="not-used coupon-use">  
57 - 未使用 55 + {{#if value}}
  56 + <span class="used coupon-use">
  57 + {{value}}
58 <i class="iconfont">&#xe614;</i> 58 <i class="iconfont">&#xe614;</i>
59 </span> 59 </span>
60 {{^}} 60 {{^}}
61 - <span class="used coupon-use">  
62 - {{value}} 61 + <span class="not-used coupon-use">
  62 + 未使用
63 <i class="iconfont">&#xe614;</i> 63 <i class="iconfont">&#xe614;</i>
64 </span> 64 </span>
65 {{/if}} 65 {{/if}}
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
68 {{/ coupon}} 68 {{/ coupon}}
69 69
70 {{# yohoCoin}} 70 {{# yohoCoin}}
71 - <li class="coin"> 71 + <li class="coin" data-yoho-coin="{{.}}">
72 <span class="title">YOHO币</span> 72 <span class="title">YOHO币</span>
73 <span class="desc">可抵用¥{{.}}</span> 73 <span class="desc">可抵用¥{{.}}</span>
74 <span class="coin-check"> 74 <span class="coin-check">
@@ -97,6 +97,12 @@ @@ -97,6 +97,12 @@
97 {{/if}} 97 {{/if}}
98 </ul> 98 </ul>
99 99
  100 + <form id="msg" action="" method="post">
  101 + <input type="text" name="msg" value="" placeholder="留言">
  102 + </form>
  103 + </section>
  104 +
  105 + <section class="block">
100 <ul class="total"> 106 <ul class="total">
101 <li> 107 <li>
102 <span>总价</span> 108 <span>总价</span>
@@ -2,12 +2,36 @@ @@ -2,12 +2,36 @@
2 <div class="my-address-page select-address-page yoho-page"> 2 <div class="my-address-page select-address-page yoho-page">
3 <div class="page-wrap"> 3 <div class="page-wrap">
4 {{# address}} 4 {{# address}}
5 - <a class="address-item" href="/shoppingCart/orderEnsure?address_id={{address_id}}"> 5 + <a class="address-item" data-address-id="{{address_id}}" href="/shoppingCart/orderEnsure">
6 <span class="name">{{consignee}}</span> 6 <span class="name">{{consignee}}</span>
7 <span class="tel">{{mobile}}</span> 7 <span class="tel">{{mobile}}</span>
8 <p class="address-info">{{area}} {{address}}</p> 8 <p class="address-info">{{area}} {{address}}</p>
  9 + <div class="action iconfont">
  10 + <span class="edit" data-href="/home/addressAct?id={{address_id}}&refer=shopping">&#xe61e;</span>
  11 + <span class="del" data-id="{{address_id}}">&#xe621;</span>
  12 + </div>
9 </a> 13 </a>
10 {{/ address}} 14 {{/ address}}
  15 +
  16 + <a class="add-address" data-href="/home/addressAct?refer=shopping">
  17 + 添加新地址
  18 + </a>
  19 +
  20 + <div class="confim-mask hide">
  21 + <div class="confim-box">
  22 + <div class="content">
  23 + 您确定要删除地址?
  24 + </div>
  25 + <div class="action">
  26 + <span class="cancel">
  27 + 取消
  28 + </span>
  29 + <span class="confim">
  30 + 确认
  31 + </span>
  32 + </div>
  33 + </div>
  34 + </div>
11 </div> 35 </div>
12 </div> 36 </div>
13 {{> layout/footer}} 37 {{> layout/footer}}
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="yoho-page select-coupon-page my-coupon-page"> 2 <div class="yoho-page select-coupon-page my-coupon-page">
3 - <form id="search-coupon" method="POST" action="">  
4 - <input type="text" name="coupon-code" value="" placeholder="输入优惠券码"> 3 + <form id="new-coupon" method="POST" action="">
  4 + <input type="text" name="couponCode" value="" placeholder="输入优惠券码">
5 <button type="submit" class="submit">确定</button> 5 <button type="submit" class="submit">确定</button>
6 </form> 6 </form>
7 <div id="coupon-list" class="coupon-list"></div> 7 <div id="coupon-list" class="coupon-list"></div>
@@ -11,9 +11,9 @@ @@ -11,9 +11,9 @@
11 <script id="tmpl-coupon" type="text/tmpl"> 11 <script id="tmpl-coupon" type="text/tmpl">
12 \{{#coupons}} 12 \{{#coupons}}
13 \{{^ notAvailable}} 13 \{{^ notAvailable}}
14 - <a class="employ-main" href="/shoppingCart/orderEnsure?coupon_id={{ coupon_id}}">  
15 - <span>\{{ money}}</span>  
16 - <p class="coupon-name">\{{ coupon_name}}</p> 14 + <a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-value="\{{ couponValue}}" href="/shoppingCart/orderEnsure">
  15 + <span>\{{ couponValue}}</span>
  16 + <p class="coupon-name">\{{ couponDetailInfomation}}</p>
17 <p>有效期:\{{ couponValidity}}</p> 17 <p>有效期:\{{ couponValidity}}</p>
18 </a> 18 </a>
19 \{{/ notAvailable}} 19 \{{/ notAvailable}}
@@ -22,8 +22,8 @@ @@ -22,8 +22,8 @@
22 <script id="tmpl-coupon-not-avaliable" type="text/tmpl"> 22 <script id="tmpl-coupon-not-avaliable" type="text/tmpl">
23 \{{# notAvailableCoupons}} 23 \{{# notAvailableCoupons}}
24 <div class="employ-main not-avaliable"> 24 <div class="employ-main not-avaliable">
25 - <span>\{{ money}}</span>  
26 - <p class="coupon-name">\{{ coupon_name}}</p> 25 + <span>\{{ couponValue}}</span>
  26 + <p class="coupon-name">\{{ couponDetailInfomation}}</p>
27 <p>有效期:\{{ couponValidity}}</p> 27 <p>有效期:\{{ couponValidity}}</p>
28 </div> 28 </div>
29 \{{/ notAvailableCoupons}} 29 \{{/ notAvailableCoupons}}
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 {{userName}} 8 {{userName}}
9 </span> 9 </span>
10 <span class="goods-spec"> 10 <span class="goods-spec">
11 - {{desc}} 11 + &nbsp;购买了&nbsp;&nbsp;{{desc}}
12 </span> 12 </span>
13 <p class="detail-content"> 13 <p class="detail-content">
14 {{content}} 14 {{content}}
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 (function() { 13 (function() {
14 var hm = document.createElement("script"); 14 var hm = document.createElement("script");
15 hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311"; 15 hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
  16 + hm.async = 1;
16 var s = document.getElementsByTagName("script")[0]; 17 var s = document.getElementsByTagName("script")[0];
17 s.parentNode.insertBefore(hm, s); 18 s.parentNode.insertBefore(hm, s);
18 })(); 19 })();
@@ -22,6 +23,7 @@ @@ -22,6 +23,7 @@
22 (function() { 23 (function() {
23 var hm = document.createElement("script"); 24 var hm = document.createElement("script");
24 hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; 25 hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
  26 + hm.async = 1;
25 var s = document.getElementsByTagName("script")[0]; 27 var s = document.getElementsByTagName("script")[0];
26 s.parentNode.insertBefore(hm, s); 28 s.parentNode.insertBefore(hm, s);
27 })(); 29 })();
@@ -19,18 +19,7 @@ @@ -19,18 +19,7 @@
19 <script src="http://localhost:8000/static/js/sea.js?nowrap"></script> 19 <script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
20 <script>seajs.config({base: 'http://localhost:8000/'});</script> 20 <script>seajs.config({base: 'http://localhost:8000/'});</script>
21 {{/if}} 21 {{/if}}
22 -<script type="text/javascript">  
23 - (function(w,d,s,j,f){  
24 - w['YohoAcquisitionObject']=f;  
25 - w[f]=function(){w[f].p=arguments;};  
26 - var a=d.createElement(s);  
27 - var m=d.getElementsByTagName(s)[0];  
28 - a.async=1;  
29 - a.src=j;  
30 - m.parentNode.insertBefore(a,m);  
31 - })(window,document,'script','http://cdn.yoho.cn/yas-jssdk/{{yas_version}}/yas.js','_yas');  
32 -</script>  
33 -{{> layout/use}} 22 + {{> layout/use}}
34 {{> layout/analysis}} 23 {{> layout/analysis}}
35 </body> 24 </body>
36 </html> 25 </html>
@@ -234,6 +234,12 @@ @@ -234,6 +234,12 @@
234 seajs.use('js/shopping-cart/order-ensure'); 234 seajs.use('js/shopping-cart/order-ensure');
235 </script> 235 </script>
236 {{/if}} 236 {{/if}}
  237 +{{#if selectAddressPage}}
  238 +<script>
  239 + seajs.use('js/me/address');
  240 + seajs.use('js/shopping-cart/select-address');
  241 +</script>
  242 +{{/if}}
237 {{#if selectCouponPage}} 243 {{#if selectCouponPage}}
238 <script> 244 <script>
239 seajs.use('js/shopping-cart/select-coupon'); 245 seajs.use('js/shopping-cart/select-coupon');
1 <ul id="nav-tab" class="nav-tab clearfix"> 1 <ul id="nav-tab" class="nav-tab clearfix">
2 - <li class="comment-nav tap-hightlight">商品评价<span class="comments-num">{{commentsNum}}</span></li> 2 + <li class="comment-nav tap-hightlight">商品评价(<span class="comments-num">{{commentsNum}}</span>)</li>
3 <li class="consult-nav tap-hightlight">购买咨询(<span class="consults-num">{{consultsNum}}</span>)</li> 3 <li class="consult-nav tap-hightlight">购买咨询(<span class="consults-num">{{consultsNum}}</span>)</li>
4 </ul> 4 </ul>
5 <div id="feedback-content" > 5 <div id="feedback-content" >
@@ -21,6 +21,10 @@ @@ -21,6 +21,10 @@
21 </span> 21 </span>
22 {{/ comments}} 22 {{/ comments}}
23 </div> 23 </div>
  24 + <a class="comment-content-footer tap-hightlight" href="{{commentsUrl}}">
  25 + 查看更多
  26 + <span class="iconfont">&#xe604;</span>
  27 + </a>
24 {{^}} 28 {{^}}
25 <div class="comment-content-main content-main no-item"> 29 <div class="comment-content-main content-main no-item">
26 <span class="iconfont">&#xe63d;</span>暂无评论 30 <span class="iconfont">&#xe63d;</span>暂无评论
@@ -46,17 +50,16 @@ @@ -46,17 +50,16 @@
46 </div> 50 </div>
47 {{/ consults}} 51 {{/ consults}}
48 </div> 52 </div>
49 - <div class="consult-content-footer tap-hightlight" data-href="{{link}}">  
50 - <a href="javascript:;"> 53 + <a class="consult-content-footer tap-hightlight" href="{{consultsUrl}}">
51 查看更多 54 查看更多
52 - <span class="iconfont">&#xe604;</span></a>  
53 - </div> 55 + <span class="iconfont">&#xe604;</span>
  56 + </a>
54 {{else}} 57 {{else}}
55 <div class="consult-content-main content-main no-item"> 58 <div class="consult-content-main content-main no-item">
56 <span class="iconfont">&#xe63f;</span>暂无咨询 59 <span class="iconfont">&#xe63f;</span>暂无咨询
57 </div> 60 </div>
58 61
59 - <div class="consult-content-footer tap-hightlight" data-href="{{link}}"> 62 + <div class="consult-content-footer tap-hightlight" data-href="{{commentsLink}}">
60 <a href="javascript:;"> 63 <a href="javascript:;">
61 我要咨询 64 我要咨询
62 <span class="iconfont">&#xe604;</span></a> 65 <span class="iconfont">&#xe604;</span></a>
@@ -48,7 +48,7 @@ class HomeController extends AbstractAction @@ -48,7 +48,7 @@ class HomeController extends AbstractAction
48 'showDownloadApp' => true, 48 'showDownloadApp' => true,
49 'pageFooter' => true, 49 'pageFooter' => true,
50 'cartUrl' => Helpers::url('/cart/index/index', null), 50 'cartUrl' => Helpers::url('/cart/index/index', null),
51 - 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home')) ), 51 + 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))),
52 ); 52 );
53 $uid = $this->getUid(false); 53 $uid = $this->getUid(false);
54 if ($uid) { 54 if ($uid) {
@@ -832,69 +832,49 @@ class HomeController extends AbstractAction @@ -832,69 +832,49 @@ class HomeController extends AbstractAction
832 */ 832 */
833 public function orderDetailAction() 833 public function orderDetailAction()
834 { 834 {
835 - $data = array(  
836 - 'name' => '毛毛莉Lydia',  
837 - 'phoneNum' => '18600001133',  
838 - 'address' => '南京市建邺区嘉陵江东街18号国家广告产业园5栋17楼',  
839 - 'orderStatus' => '订单取消',  
840 - 'orderNum' => '418358063',  
841 - 'orderTime' => '2014-03-10 17:25:10',  
842 - 'orderCancel' => true,  
843 - 'goods' => array(  
844 - array(  
845 - 'id' => 1,  
846 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
847 - 'name' => 'Adidas Originals ZX FLUXM22508',  
848 - 'color' => '黄',  
849 - 'size' => '43',  
850 - 'price' => '699.00',  
851 - 'count' => '2'  
852 - ),  
853 - array(  
854 - 'id' => 1,  
855 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
856 - 'name' => 'B.Duck浴室玩伴mini浮水鸭',  
857 - 'gift' => true,  
858 - 'color' => '黄',  
859 - 'size' => '43',  
860 - 'price' => '0.00',  
861 - 'count' => '1'  
862 - )  
863 - ),  
864 - 'sumPrice' => 799,  
865 - 'salePrice' => 80,  
866 - 'freight' => 5,  
867 - 'coupon' => 0,  
868 - 'yohoCoin' => 5,  
869 - 'price' => 719  
870 - );  
871 - $this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true)); 835 + // 审判跳转登录页
  836 + $this->auditJumpLogin();
  837 +
  838 + $orderCode = $this->get('order_code');
  839 + if (empty($orderCode)) {
  840 + $this->error();
  841 + }
  842 +
  843 + $this->setTitle('订单详情');
  844 + $this->setNavHeader('订单详情');
  845 +
  846 + $this->_view->display('order-detail', array(
  847 + 'orderDetailPage' => true,
  848 + 'orderDetail' => OrderModel::orderDetail($orderCode, $this->_uid, $this->_session),
  849 + ));
872 } 850 }
873 851
874 /** 852 /**
875 - * 帮助中心列表页 853 + * 帮助列表页
876 */ 854 */
877 public function helpAction() 855 public function helpAction()
878 { 856 {
879 - $service = Home\HelpModel::serviceInfo();  
880 $this->setTitle('帮助中心'); 857 $this->setTitle('帮助中心');
881 $this->setNavHeader('帮助中心'); 858 $this->setNavHeader('帮助中心');
882 $data = array( 859 $data = array(
883 - 'iHelp' =>$service, 860 + 'iHelp' => Home\HelpModel::serviceInfo(),
884 ); 861 );
885 $this->_view->display('i-help', $data); 862 $this->_view->display('i-help', $data);
886 } 863 }
887 864
888 /** 865 /**
889 - * 帮助中心列表详细信息 866 + * 帮助列表页
890 */ 867 */
891 public function helpDetailAction() 868 public function helpDetailAction()
892 { 869 {
893 - $code = $this->get('code', 0);  
894 - $service = Home\HelpModel::serviceDetail($code); 870 + $this->setTitle('帮助中心');
  871 + $this->setNavHeader('帮助中心');
895 $data = array( 872 $data = array(
896 - 'iHelp' => $service, 873 + 'iHelp' => array(
  874 + array('name' => '新用户注册'),
  875 + )
897 ); 876 );
898 $this->_view->display('helpDetail', $data); 877 $this->_view->display('helpDetail', $data);
899 } 878 }
  879 +
900 } 880 }
@@ -32,41 +32,6 @@ class ShoppingCartController extends AbstractAction @@ -32,41 +32,6 @@ class ShoppingCartController extends AbstractAction
32 } 32 }
33 33
34 /** 34 /**
35 - * 加入购物车  
36 - *  
37 - * @param string productSku 商品的SKU  
38 - * @param int buyNumber 购买数量  
39 - * @param int promotionId 促销ID, 加价购有关  
40 - * @param int goodsType 商品类型,0表示普通商品,1表示加价购商品  
41 - * @param int isEdit 是否是编辑商品SKU,0表示不是编辑  
42 - * @return json  
43 - */  
44 - public function addAction()  
45 - {  
46 - $result = array();  
47 -  
48 - if ($this->isAjax()) {  
49 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
50 - $productSku = $this->post('productSku');  
51 - $buyNumber = $this->post('buyNumber', 1);  
52 - $goodsType = $this->post('goodsType', 0);  
53 - $promotionId = $this->post('promotionId', 0);  
54 - $isEdit = $this->post('isEdit', 0);  
55 - $uid = $this->getUid(true);  
56 -  
57 - // 执行加入购物车操作  
58 - $result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);  
59 -  
60 - // 设置加入购物车凭证到客户端浏览器  
61 - if (isset($result['data']['shopping_key'])) {  
62 - $this->setCookie('_spk', $shoppingKey);  
63 - }  
64 - }  
65 -  
66 - $this->echoJson($result);  
67 - }  
68 -  
69 - /**  
70 * 移出购物车 35 * 移出购物车
71 */ 36 */
72 public function delAction() 37 public function delAction()
@@ -76,7 +41,7 @@ class ShoppingCartController extends AbstractAction @@ -76,7 +41,7 @@ class ShoppingCartController extends AbstractAction
76 if ($this->isAjax()) { 41 if ($this->isAjax()) {
77 $productId = $this->post('id', 0); 42 $productId = $this->post('id', 0);
78 $uid = $this->getUid(true); 43 $uid = $this->getUid(true);
79 - $shoppingKey = Helpers::getShoppingKeyByCookie(); 44 + $shoppingKey = $this->getSession('shoppingKey');
80 $result = CartModel::removeFromCart($uid, $productId, $shoppingKey); 45 $result = CartModel::removeFromCart($uid, $productId, $shoppingKey);
81 } 46 }
82 47
@@ -110,7 +75,6 @@ class ShoppingCartController extends AbstractAction @@ -110,7 +75,6 @@ class ShoppingCartController extends AbstractAction
110 /* 75 /*
111 * 获取购物车商品数据 76 * 获取购物车商品数据
112 */ 77 */
113 -  
114 public function goodinfoAction() 78 public function goodinfoAction()
115 { 79 {
116 $result = array(); 80 $result = array();
@@ -133,7 +97,6 @@ class ShoppingCartController extends AbstractAction @@ -133,7 +97,6 @@ class ShoppingCartController extends AbstractAction
133 /* 97 /*
134 * 获取购物车加价购商品数据 98 * 获取购物车加价购商品数据
135 */ 99 */
136 -  
137 public function giftinfoAction() 100 public function giftinfoAction()
138 { 101 {
139 $result = array(); 102 $result = array();
@@ -159,14 +122,14 @@ class ShoppingCartController extends AbstractAction @@ -159,14 +122,14 @@ class ShoppingCartController extends AbstractAction
159 $result = array(); 122 $result = array();
160 123
161 if ($this->isAjax()) { 124 if ($this->isAjax()) {
162 - $shoppingKey = Helpers::getShoppingKeyByCookie(); 125 + $shoppingKey = $this->getSession('shoppingKey');
163 $uid = $this->getUid(true); 126 $uid = $this->getUid(true);
164 127
165 $params = array(); 128 $params = array();
166 - $params['old_product_sku'] = $this->post('old_product_sku', 0);  
167 - $params['new_product_sku'] = $this->post('new_product_sku', 0);  
168 - $params['buy_number'] = $this->post('buy_number', 0);  
169 - $params['selected'] = $this->post('selected', null); 129 + $params['old_product_sku']= $this->post('old_product_sku', 0);
  130 + $params['new_product_sku']= $this->post('new_product_sku', 0);
  131 + $params['buy_number']= $this->post('buy_number', 0);
  132 + $params['selected']= $this->post('selected', null);
170 $result = CartModel::modifyCartProduct($uid, $params, $shoppingKey); 133 $result = CartModel::modifyCartProduct($uid, $params, $shoppingKey);
171 } 134 }
172 135
@@ -180,25 +143,27 @@ class ShoppingCartController extends AbstractAction @@ -180,25 +143,27 @@ class ShoppingCartController extends AbstractAction
180 /** 143 /**
181 * 购物车结算请求 144 * 购物车结算请求
182 */ 145 */
183 - public function payAction() 146 + public function orderEnsureAction()
184 { 147 {
185 $this->setTitle('购物车'); 148 $this->setTitle('购物车');
186 $this->setNavHeader('购物车'); 149 $this->setNavHeader('购物车');
187 150
188 $cartType = $this->post('cartType', 'ordinary'); 151 $cartType = $this->post('cartType', 'ordinary');
  152 + $cookieData = $this->getCookie('order-info', null);
189 $uid = $this->getUid(true); 153 $uid = $this->getUid(true);
190 $data = array( 154 $data = array(
191 'orderEnsurePage' => true, 155 'orderEnsurePage' => true,
192 - 'orderEnsure' => CartModel::cartPay($uid, $cartType) 156 + 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
193 ); 157 );
194 158
  159 +
195 $this->_view->display('order-ensure', $data); 160 $this->_view->display('order-ensure', $data);
196 } 161 }
197 162
198 /** 163 /**
199 - * 购物车选择支付方式和配送方式接口 164 + * 购物车选择改变字段,重新运算订单数据
200 */ 165 */
201 - public function payAndDeliveryAction() 166 + public function orderComputeAction()
202 { 167 {
203 $result = array(); 168 $result = array();
204 169
@@ -206,8 +171,10 @@ class ShoppingCartController extends AbstractAction @@ -206,8 +171,10 @@ class ShoppingCartController extends AbstractAction
206 $cartType = $this->post('cartType', 'ordinary'); 171 $cartType = $this->post('cartType', 'ordinary');
207 $deliveryWay = $this->post('deliveryWay', 1); 172 $deliveryWay = $this->post('deliveryWay', 1);
208 $paymentType = $this->post('paymentType', 1); 173 $paymentType = $this->post('paymentType', 1);
  174 + $couponCode = $this->post('paymentType', null);
  175 + $yohoCoin = $this->post('paymentType', null);
209 $uid = $this->getUid(true); 176 $uid = $this->getUid(true);
210 - $result = CartModel::paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType); 177 + $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
211 } 178 }
212 179
213 if (empty($result)) { 180 if (empty($result)) {
@@ -220,14 +187,14 @@ class ShoppingCartController extends AbstractAction @@ -220,14 +187,14 @@ class ShoppingCartController extends AbstractAction
220 /** 187 /**
221 * 购物车输入优惠券码使用优惠券 188 * 购物车输入优惠券码使用优惠券
222 */ 189 */
223 - public function couponAction() 190 + public function couponSearchAction()
224 { 191 {
225 $result = array(); 192 $result = array();
226 193
227 if ($this->isAjax()) { 194 if ($this->isAjax()) {
228 - $couponCode = $this->post('couponCode', ''); 195 + $couponCode = $this->get('couponCode', '');
229 $uid = $this->getUid(true); 196 $uid = $this->getUid(true);
230 - $result = CartModel::getCoupon($uid, $couponCode); 197 + $result = CartModel::searchCoupon($uid, $couponCode);
231 } 198 }
232 199
233 if (empty($result)) { 200 if (empty($result)) {
@@ -238,18 +205,16 @@ class ShoppingCartController extends AbstractAction @@ -238,18 +205,16 @@ class ShoppingCartController extends AbstractAction
238 } 205 }
239 206
240 /** 207 /**
241 - * 购物车使用YOHO币 208 + * 购物车结算--获取优惠券列表
242 */ 209 */
243 - public function yohoCoinAction() 210 + public function couponListAction()
244 { 211 {
245 $result = array(); 212 $result = array();
246 213
247 if ($this->isAjax()) { 214 if ($this->isAjax()) {
248 - $cartType = $this->post('cartType', 'ordinary');  
249 - $deliveryWay = $this->post('deliveryWay', 1);  
250 - $paymentType = $this->post('paymentType', 1);  
251 - $yohoCoin = $this->post('yohoCoin', 1);  
252 - $result = CartModel::paymentTypeAndDelivery($this->_uid, $cartType, $deliveryWay, $paymentType, $yohoCoin); 215 + $uid = $this->getUid(true);
  216 + $page = $this->get('page', 1);
  217 + $result = CartModel::getCouponList($uid);
253 } 218 }
254 219
255 if (empty($result)) { 220 if (empty($result)) {
@@ -259,124 +224,6 @@ class ShoppingCartController extends AbstractAction @@ -259,124 +224,6 @@ class ShoppingCartController extends AbstractAction
259 } 224 }
260 } 225 }
261 226
262 - public function giftAdvanceAction()  
263 - {  
264 - $data = array(  
265 - 'advance' => array(  
266 - array(  
267 - 'title' => '【izzue】加¥19购袜子',  
268 - 'goods' => array(  
269 - 'id' => 1,  
270 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',  
271 - 'name' => 'Life.After.Life纯棉短袜',  
272 - 'salePrice' => 19,  
273 - 'price' => 99,  
274 - 'count' => 1  
275 - )  
276 - ),  
277 - array(  
278 - 'title' => '【银鳞堂】加¥9购手绳',  
279 - 'goods' => array(  
280 - 'id' => 1,  
281 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/03/10/01bc1878f9154e77ac4f7a6003c954f1b8.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
282 - 'name' => '银鳞堂民族风牛皮手绳',  
283 - 'salePrice' => 9,  
284 - 'price' => 19,  
285 - 'count' => 1  
286 - )  
287 - )  
288 - )  
289 - );  
290 -  
291 - $data = array(  
292 - 'gift' => array(  
293 - 'id' => 1,  
294 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',  
295 - 'name' => 'Life.After.Life纯棉短袜',  
296 - 'color' => '黄色',  
297 - 'size' => 'L',  
298 - 'price' => 0,  
299 - 'count' => 1  
300 - )  
301 - );  
302 -  
303 - $this->_view->display('gift-advance', array('giftAdvancePage' => true, 'pageHeader' => array(  
304 - 'navBack' => true, 'navTitle' => '加价购'), 'shoppingCart' => $data));  
305 - }  
306 -  
307 - /*  
308 - * 确认订单  
309 - */  
310 -  
311 - public function orderEnsureAction()  
312 - {  
313 - $data = array(  
314 - 'orderEnsurePage' => true,  
315 - 'orderEnsure' => array(  
316 - 'name' => '申建军',  
317 - 'phoneNum' => '12345678',  
318 - 'address' => '江苏省南京市建邺区',  
319 - 'dispatchMode' => array(  
320 - array(  
321 - 'id' => 1,  
322 - 'name' => '普通快递¥10'  
323 - ),  
324 - array(  
325 - 'id' => 2,  
326 - 'name' => '顺丰速运¥15(仅支持顺丰克配送的地区)'  
327 - )  
328 - ),  
329 - 'dispatchTime' => array(  
330 - array(  
331 - 'id' => 1,  
332 - 'name' => '工作日、双休日、节假日均可送货'  
333 - ),  
334 - array(  
335 - 'id' => 2,  
336 - 'name' => '只工作日送货'  
337 - ),  
338 - array(  
339 - 'id' => 3,  
340 - 'name' => '只双休日、节假日送货'  
341 - )  
342 - ),  
343 - 'goods' => array(  
344 - array(  
345 - 'id' => 1,  
346 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
347 - 'name' => 'Adidas Originals ZX FLUXM22508',  
348 - 'color' => '黄',  
349 - 'size' => '43',  
350 - 'price' => '699.00',  
351 - 'count' => '2'  
352 - ),  
353 - array(  
354 - 'id' => 1,  
355 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
356 - 'name' => 'B.Duck浴室玩伴mini浮水鸭',  
357 - 'gift' => true,  
358 - 'color' => '黄',  
359 - 'size' => '43',  
360 - 'price' => '0.00',  
361 - 'count' => '1'  
362 - )  
363 - ),  
364 - 'coupon' => array(  
365 - 'count' => 1,  
366 - 'notUsed' => true  
367 - ),  
368 - 'yohoCoin' => '0',  
369 - 'invoice' => true,  
370 - 'sumPrice' => 900,  
371 - 'salePrice' => 90,  
372 - 'freight' => 0,  
373 - 'price' => 810  
374 - )  
375 - );  
376 -  
377 - $this->_view->display('order-ensure', $data);  
378 - }  
379 -  
380 /** 227 /**
381 * 下单流程 选择地址 228 * 下单流程 选择地址
382 */ 229 */
@@ -386,7 +233,7 @@ class ShoppingCartController extends AbstractAction @@ -386,7 +233,7 @@ class ShoppingCartController extends AbstractAction
386 $this->setTitle('选择地址'); 233 $this->setTitle('选择地址');
387 $this->setNavHeader('选择地址', Helpers::url('/shoppingCart/orderEnsure')); 234 $this->setNavHeader('选择地址', Helpers::url('/shoppingCart/orderEnsure'));
388 235
389 - $uid = $this->_uid; 236 + $uid = $this->getUid(true);
390 $address = UserModel::getAddressData($uid); 237 $address = UserModel::getAddressData($uid);
391 238
392 $this->_view->display('select-address', array( 239 $this->_view->display('select-address', array(
@@ -404,15 +251,41 @@ class ShoppingCartController extends AbstractAction @@ -404,15 +251,41 @@ class ShoppingCartController extends AbstractAction
404 // 设置网站标题 251 // 设置网站标题
405 $this->setTitle('选择优惠券'); 252 $this->setTitle('选择优惠券');
406 $this->setNavHeader('选择优惠券', Helpers::url('/shoppingCart/orderEnsure')); 253 $this->setNavHeader('选择优惠券', Helpers::url('/shoppingCart/orderEnsure'));
407 -  
408 - $uid = $this->_uid;  
409 - $address = UserModel::getAddressData($uid);  
410 -  
411 $this->_view->display('select-coupon', array( 254 $this->_view->display('select-coupon', array(
412 'selectCouponPage' => true, 255 'selectCouponPage' => true,
413 - 'pageFooter' => true,  
414 - 'address' => $address 256 + 'pageFooter' => true
415 )); 257 ));
416 } 258 }
417 259
  260 + /**
  261 + * 确认结算订单
  262 + */
  263 + public function orderSubAction()
  264 + {
  265 + $result = array();
  266 +
  267 + if ($this->isAjax()) {
  268 + $uid = $this->getUid(true);
  269 + $addressId = $this->post('addressId', null);
  270 + $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
  271 + $deliveryTime = $this->post('deliveryTime', 1); // 默认只工作日配送
  272 + $deliveryWay = $this->post('deliveryWay', 1); // 默认普通快递
  273 + $invoiceTitle = $this->post('invoiceTitle', null);
  274 + $invoiceId = $this->post('invoiceId', null);
  275 + $paymentId = $this->post('paymentId', 15);
  276 + $paymentType = $this->post('paymentType', 1); // 默认在线支付
  277 + $remark = $this->post('remark', null); // 默认在线支付
  278 + $yohoCoin = $this->post('yohoCoin', 1);
  279 + $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
  280 + }
  281 +
  282 + if (empty($result)) {
  283 + echo ' ';
  284 + } else {
  285 + // 提交成功清除Cookie
  286 + $this->setCookie('orderInfo', null);
  287 +
  288 + $this->echoJson($result);
  289 + }
  290 + }
418 } 291 }
@@ -5,13 +5,13 @@ namespace Home; @@ -5,13 +5,13 @@ namespace Home;
5 use LibModels\Wap\Home\HelpData; 5 use LibModels\Wap\Home\HelpData;
6 use Plugin\Helpers; 6 use Plugin\Helpers;
7 7
8 -/* 8 +/**
9 * 帮助中心相关数据处理 9 * 帮助中心相关数据处理
10 */ 10 */
11 class HelpModel 11 class HelpModel
12 { 12 {
13 /* 13 /*
14 - * 获取帮助列表 14 + * 获取帮助中心列表
15 */ 15 */
16 16
17 public static function serviceInfo() 17 public static function serviceInfo()
@@ -20,9 +20,10 @@ class HelpModel @@ -20,9 +20,10 @@ class HelpModel
20 $res = json_decode(HelpData::serviceInfo(), TRUE); 20 $res = json_decode(HelpData::serviceInfo(), TRUE);
21 $cateInfo = $res['data']; 21 $cateInfo = $res['data'];
22 $iHelp = array(); 22 $iHelp = array();
  23 + $list = array();
23 if ($cateInfo) { 24 if ($cateInfo) {
24 foreach ($cateInfo as $key => $value) { 25 foreach ($cateInfo as $key => $value) {
25 - $iHelp[$key]['caption'] = $value['caption']; 26 + $iHelp[$key]['name'] = $value['caption'];
26 $iHelp[$key]['code'] = $value['code']; 27 $iHelp[$key]['code'] = $value['code'];
27 } 28 }
28 29
@@ -30,17 +31,6 @@ class HelpModel @@ -30,17 +31,6 @@ class HelpModel
30 return $iHelp; 31 return $iHelp;
31 } 32 }
32 33
33 - /*  
34 - * 获取帮助中心详细内容  
35 - */  
36 -  
37 - public static function serviceDetail($code)  
38 - {  
39 -  
40 - $res = HelpData::serviceDetail($code);  
41 - return $res;  
42 - }  
43 -  
44 34
45 } 35 }
46 36
@@ -80,7 +80,7 @@ class OrderModel @@ -80,7 +80,7 @@ class OrderModel
80 $result[$key]['sumCost'] = $vo['amount']; 80 $result[$key]['sumCost'] = $vo['amount'];
81 //类内调用格式化订单商品数据方法 81 //类内调用格式化订单商品数据方法
82 $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count); 82 $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count);
83 - $result[$key]['detailUrl'] = Helpers::url('/home/orders/detail', array('order_code' => $vo['order_code'], 't' => time())); 83 + $result[$key]['detailUrl'] = Helpers::url('/home/orderDetail', array('order_code' => $vo['order_code']));
84 $result[$key]['count'] = $count; 84 $result[$key]['count'] = $count;
85 } 85 }
86 } 86 }
@@ -28,11 +28,11 @@ class CartModel @@ -28,11 +28,11 @@ class CartModel
28 * @param null|int $uid 用户UID,可以不传 28 * @param null|int $uid 用户UID,可以不传
29 * @return array 加入购物车接口返回的数据 29 * @return array 加入购物车接口返回的数据
30 */ 30 */
31 - public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey) 31 + public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid)
32 { 32 {
33 $result = array('code' => 400, 'message' => '出错啦~~'); 33 $result = array('code' => 400, 'message' => '出错啦~~');
34 34
35 - $addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey); 35 + $addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid);
36 if ($addCart && isset($addCart['code'])) { 36 if ($addCart && isset($addCart['code'])) {
37 $result = $addCart; 37 $result = $addCart;
38 } 38 }
@@ -62,16 +62,17 @@ class CartModel @@ -62,16 +62,17 @@ class CartModel
62 $cart = $cartData['data']; 62 $cart = $cartData['data'];
63 63
64 /* 普通购物车 */ 64 /* 普通购物车 */
65 - if (isset($cart['ordinary_cart_data'])) { 65 + if(isset($cart['ordinary_cart_data'])) {
66 $result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']); 66 $result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']);
67 $result['commonCart'] = self::procCartData($cart['ordinary_cart_data']); 67 $result['commonCart'] = self::procCartData($cart['ordinary_cart_data']);
68 } 68 }
69 69
70 /* 预售购物车 */ 70 /* 预售购物车 */
71 - if (isset($cart['advance_cart_data'])) { 71 + if(isset($cart['advance_cart_data'])) {
72 $result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']); 72 $result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']);
73 $result['preSellCart'] = self::procCartData($cart['advance_cart_data']); 73 $result['preSellCart'] = self::procCartData($cart['advance_cart_data']);
74 } 74 }
  75 +
75 } 76 }
76 77
77 return $result; 78 return $result;
@@ -287,9 +288,10 @@ class CartModel @@ -287,9 +288,10 @@ class CartModel
287 * 288 *
288 * @param int $uid 用户ID 289 * @param int $uid 用户ID
289 * @param string $cartType 购物车类型,ordinary表示普通购物车 290 * @param string $cartType 购物车类型,ordinary表示普通购物车
  291 + * @param null|string $cookieData cookie中记录的一些订单有关数据
290 * @return array 接口返回的数据 292 * @return array 接口返回的数据
291 */ 293 */
292 - public static function cartPay($uid, $cartType) 294 + public static function cartPay($uid, $cartType, $cookieData)
293 { 295 {
294 $result = array(); 296 $result = array();
295 297
@@ -297,13 +299,29 @@ class CartModel @@ -297,13 +299,29 @@ class CartModel
297 299
298 if ($pay && isset($pay['code']) && $pay['code'] === 200) { 300 if ($pay && isset($pay['code']) && $pay['code'] === 200) {
299 $payReturn = $pay['data']; 301 $payReturn = $pay['data'];
300 - $result = array(); 302 + $orderInfo = array();
  303 + $address = array();
  304 + $orderCompute = array();
  305 +
  306 + // cookie保存的数据
  307 + if (!empty($cookieData)) {
  308 + $orderInfo = json_decode($cookieData, true);
  309 + $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
  310 + }
  311 +
  312 + // 根据地址id查询地址信息
  313 + if (isset($orderInfo['addressId'])) {
  314 + $address = UserModel::getAddressDataById($uid, $orderInfo['addressId']);
  315 + }
301 316
302 // 收货人有关信息 317 // 收货人有关信息
303 if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_address'])) { 318 if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_address'])) {
304 - $result['name'] = $payReturn['delivery_address']['consignee'];  
305 - $result['phoneNum'] = $payReturn['delivery_address']['mobile'] ? : $payReturn['delivery_address']['phone'];  
306 - $result['address'] = $payReturn['delivery_address']['address']; 319 + $result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id'];
  320 + $result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee'];
  321 + $result['phoneNum'] = isset($address['mobile']) ? $address['mobile'] : $payReturn['delivery_address']['mobile'];
  322 + $result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area'];
  323 + $result['address'] = isset($address['address']) ? $address['address'] : $payReturn['delivery_address']['address'];
  324 + $result['isSupport'] = ($payReturn['delivery_address']['is_support'] === 'Y');
307 } 325 }
308 326
309 // 配送方式 327 // 配送方式
@@ -313,7 +331,10 @@ class CartModel @@ -313,7 +331,10 @@ class CartModel
313 $oneDeliv = array(); 331 $oneDeliv = array();
314 $oneDeliv['id'] = $val['delivery_way_id']; 332 $oneDeliv['id'] = $val['delivery_way_id'];
315 $oneDeliv['name'] = $val['delivery_way_name']; 333 $oneDeliv['name'] = $val['delivery_way_name'];
316 - $oneDeliv['default'] = ($val['default'] === 'Y'); 334 +
  335 + isset($orderInfo['deliveryId']) && $orderInfo['deliveryId'] === $oneDeliv['id'] && $oneDeliv['isSelected'] = true;
  336 +
  337 + !isset($oneDeliv['isSelected']) && $oneDeliv['isSelected'] = ($val['default'] === 'Y');
317 338
318 $result['dispatchMode'][] = $oneDeliv; 339 $result['dispatchMode'][] = $oneDeliv;
319 } 340 }
@@ -327,6 +348,7 @@ class CartModel @@ -327,6 +348,7 @@ class CartModel
327 $oneDelivTime['id'] = $one['delivery_time_id']; 348 $oneDelivTime['id'] = $one['delivery_time_id'];
328 $oneDelivTime['name'] = $one['delivery_time_string']; 349 $oneDelivTime['name'] = $one['delivery_time_string'];
329 $oneDelivTime['default'] = ($one['default'] === 'Y'); 350 $oneDelivTime['default'] = ($one['default'] === 'Y');
  351 + isset($orderInfo['deliveryTimeId']) && $orderInfo['deliveryTimeId'] === $oneDelivTime['id'] && $oneDeliv['isSelected'] = true;
330 352
331 $result['dispatchTime'][] = $oneDelivTime; 353 $result['dispatchTime'][] = $oneDelivTime;
332 } 354 }
@@ -364,14 +386,18 @@ class CartModel @@ -364,14 +386,18 @@ class CartModel
364 } 386 }
365 387
366 // 有货币 388 // 有货币
367 - $result['yohoCoin'] = $payReturn['yoho_coin']; 389 + $result['yohoCoin'] = isset($orderCompute['use_yoho_coin']) ? isset($orderCompute['use_yoho_coin']) : $payReturn['yoho_coin'];
368 390
369 // 订单数据 391 // 订单数据
370 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { 392 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
371 - $result['sumPrice'] = Helpers::transPrice($payReturn['shopping_cart_data']['order_amount']);  
372 - $result['salePrice'] = Helpers::transPrice($payReturn['shopping_cart_data']['discount_amount']);  
373 - $result['price'] = Helpers::transPrice($payReturn['shopping_cart_data']['last_order_amount']);  
374 - $result['freight'] = Helpers::transPrice($payReturn['shopping_cart_data']['shipping_cost']); 393 + $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
  394 + $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount'];
  395 + $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
  396 + $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list']['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'];
  397 + $result['sumPrice'] = Helpers::transPrice($sumPrice);
  398 + $result['salePrice'] = Helpers::transPrice($salePrice);
  399 + $result['price'] = Helpers::transPrice($price);
  400 + $result['freight'] = strtr($freight, array('¥'=>'','¥'=>'')) . '.00';
375 } 401 }
376 402
377 // 发票有关数据 403 // 发票有关数据
@@ -388,7 +414,8 @@ class CartModel @@ -388,7 +414,8 @@ class CartModel
388 414
389 // 优惠券数据 415 // 优惠券数据
390 $coupons = array('notUsed' => true); 416 $coupons = array('notUsed' => true);
391 - $coupons += UserModel::getCouponData($uid, 0, 1, true); 417 + !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
  418 + $coupons += self::getCouponList($uid, 0, 1, true);
392 $result['coupon'] = $coupons; 419 $result['coupon'] = $coupons;
393 } 420 }
394 421
@@ -400,17 +427,19 @@ class CartModel @@ -400,17 +427,19 @@ class CartModel
400 * 427 *
401 * @param int $uid 用户ID 428 * @param int $uid 用户ID
402 * @param string $cartType 购物车类型,ordinary表示普通购物车 429 * @param string $cartType 购物车类型,ordinary表示普通购物车
403 - * @param string $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运  
404 - * @param string $paymentType 支付方式,1表示在线支付,2表示货到付款 430 + * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
  431 + * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
  432 + * @param string $couponCode 优惠券码
  433 + * @param mixed $yohoCoin 使用的YOHO币数量
405 * @return array 接口返回的数据 434 * @return array 接口返回的数据
406 */ 435 */
407 - public static function paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType) 436 + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
408 { 437 {
409 $result = array(); 438 $result = array();
410 439
411 - $pay = CartData::paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType);  
412 - if ($pay && isset($pay['code']) && $pay['code'] === 200) {  
413 - $result = $pay['data']; 440 + $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
  441 + if ($compute && isset($compute['code']) && $compute['code'] === 200) {
  442 + $result = $compute['data'];
414 } 443 }
415 444
416 return $result; 445 return $result;
@@ -423,20 +452,85 @@ class CartModel @@ -423,20 +452,85 @@ class CartModel
423 * @param string $couponCode 优惠券代码 452 * @param string $couponCode 优惠券代码
424 * @return array 接口返回的数据 453 * @return array 接口返回的数据
425 */ 454 */
426 - public static function getCoupon($uid, $couponCode) 455 + public static function searchCoupon($uid, $couponCode)
427 { 456 {
428 $result = array('code' => 400, 'message' => '出错啦~'); 457 $result = array('code' => 400, 'message' => '出错啦~');
429 458
430 - $coupon = CartData::getCoupon($uid, $couponCode);  
431 - if ($coupon && isset($coupon['code']) && $coupon['code'] === 200) {  
432 - $result['code'] = $coupon['code'];  
433 - $result['message'] = $coupon['message']; 459 + $coupon = CartData::searchCoupon($uid, $couponCode);
  460 + if ($coupon && isset($coupon['code'])) {
  461 + $result = $coupon;
434 } 462 }
435 463
436 return $result; 464 return $result;
437 } 465 }
438 466
439 /** 467 /**
  468 + * 处理优惠券列表数据
  469 + *
  470 + * @param int $uid 用户ID
  471 + * @param boolean $onlyTotal 只返回总数
  472 + * @return array|mixed 处理之后的优惠券数据
  473 + */
  474 + public static function getCouponList($uid, $onlyTotal = false)
  475 + {
  476 + $result = array();
  477 +
  478 + // 调用接口获取优惠券数据
  479 + $coupons = CartData::getCouponList($uid);
  480 +
  481 + // 处理优惠券数据
  482 + if (isset($coupons['data'])) {
  483 +
  484 + if ($onlyTotal) {
  485 + $result['count'] = $coupons['data']['total'];
  486 + } else {
  487 + $couponArr = array();
  488 + isset($coupons['data']['couponList']) && $couponArr = $coupons['data']['couponList'];
  489 +
  490 + foreach ($couponArr as &$val) {
  491 + $notAvailableRes = self::searchCoupon($uid, $val['couponCode']);
  492 + // 处理可用的优惠券
  493 + if (isset($notAvailableRes['code']) && $notAvailableRes['code'] !== 200) {
  494 + $val['notAvailable'] = true;
  495 + }
  496 + }
  497 + !empty($couponArr) && $result = $couponArr;
  498 + }
  499 + }
  500 +
  501 + return $result;
  502 + }
  503 +
  504 + /**
  505 + * 购物车结算--提交结算信息
  506 + *
  507 + * @param int $uid 用户ID
  508 + * @param int $addressId 地址ID
  509 + * @param int $cartType 购物车类型ID
  510 + * @param int $deliveryTime 寄送时间ID
  511 + * @param int $deliveryWay 寄送方式ID
  512 + * @param string $invoiceTitle 发票说明
  513 + * @param int $invoiceId 发票类型ID
  514 + * @param int $paymentId 支付方式ID
  515 + * @param int $paymentType 支付类型ID
  516 + * @param string $remark 留言
  517 + * @param mixed $yohoCoin 使用的YOHO币数量或为空
  518 + * @return array 接口返回的数据
  519 + */
  520 + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin)
  521 + {
  522 + $result = array();
  523 +
  524 + $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
  525 + if ($orderSubRes && isset($orderSubRes['code']) && $orderSubRes['code'] === 200) {
  526 + $result = $orderSubRes;
  527 + }
  528 +
  529 + return $result;
  530 + }
  531 +
  532 +
  533 + /**
440 * 处理不同类型的购物车数据 534 * 处理不同类型的购物车数据
441 * 535 *
442 * @param array $data 不同类型购物车数据 536 * @param array $data 不同类型购物车数据
@@ -374,10 +374,9 @@ class UserModel @@ -374,10 +374,9 @@ class UserModel
374 * @param int $uid 用户ID 374 * @param int $uid 用户ID
375 * @param int $status 优惠券状态,0表示未使用,1表示已使用 375 * @param int $status 优惠券状态,0表示未使用,1表示已使用
376 * @param int $page 第几页 376 * @param int $page 第几页
377 - * @param boolean $onlyTotal 只返回总数  
378 * @return array|mixed 处理之后的优惠券数据 377 * @return array|mixed 处理之后的优惠券数据
379 */ 378 */
380 - public static function getCouponData($uid, $status, $page, $onlyTotal = false) 379 + public static function getCouponData($uid, $status, $page)
381 { 380 {
382 $result = array(); 381 $result = array();
383 382
@@ -386,7 +385,6 @@ class UserModel @@ -386,7 +385,6 @@ class UserModel
386 385
387 // 没有获取到优惠券时 386 // 没有获取到优惠券时
388 if (!$coupons) { 387 if (!$coupons) {
389 - $result['topURL'] = '/product/new';  
390 $result['noRecord'] = true; 388 $result['noRecord'] = true;
391 389
392 return $result; 390 return $result;
@@ -395,15 +393,8 @@ class UserModel @@ -395,15 +393,8 @@ class UserModel
395 // 处理优惠券数据 393 // 处理优惠券数据
396 if (isset($coupons['data'])) { 394 if (isset($coupons['data'])) {
397 395
398 - if ($onlyTotal) {  
399 - $result['count'] = $coupons['data']['total'];  
400 -  
401 - return $result;  
402 - }  
403 -  
404 // 不能再查到结果了 396 // 不能再查到结果了
405 if ($page == 1 && $coupons['data']['total'] === 0) { 397 if ($page == 1 && $coupons['data']['total'] === 0) {
406 - $result['walkwayUrl'] = '/product/new';  
407 $result['noRecord'] = true; 398 $result['noRecord'] = true;
408 } else { 399 } else {
409 $couponArr = array(); 400 $couponArr = array();
@@ -157,39 +157,57 @@ class DetailModel @@ -157,39 +157,57 @@ class DetailModel
157 157
158 // 商品信息 158 // 商品信息
159 if (!empty($baseInfo['goodsList'])) { 159 if (!empty($baseInfo['goodsList'])) {
160 -// $colorGroup = array();  
161 -// $sizeGroup = array();  
162 - $goodsList = array(); 160 + $colorGroup = array();
  161 + $sizeList = array();
163 $goodsGroup = array(); 162 $goodsGroup = array();
164 - $colorId = 0;  
165 - foreach ($baseInfo['goodsList'] as $value) {  
166 - $colorId = intval($value['colorId']);  
167 - // 商品按颜色进行分类分组 163 + $coverImage = '';
  164 + $colorStorageNum = 0; // 颜色的库存总数
  165 + $totalStorageNum = 0; // 总库存数
  166 + foreach ($baseInfo['goodsList'] as $i => $value) {
  167 + $sizeList = array();
  168 + $colorStorageNum = 0;
  169 +
  170 + // 获取默认的封面图
  171 + if ($i === 0) {
  172 + $coverImage = Helpers::getImageUrl($value['colorImage'], 60, 60);
  173 + }
  174 +
  175 + // 商品分组
168 if (isset($value['goodsImagesList'])) { 176 if (isset($value['goodsImagesList'])) {
169 foreach ($value['goodsImagesList'] as $goods) { 177 foreach ($value['goodsImagesList'] as $goods) {
170 - $goodsList[$goods['goodsId']] = $colorId;  
171 $goodsGroup[] = array( 178 $goodsGroup[] = array(
172 'goodsId' => $goods['goodsId'], 179 'goodsId' => $goods['goodsId'],
173 'img' => $goods['imageUrl'], 180 'img' => $goods['imageUrl'],
174 ); 181 );
175 -// $colorGroup[$colorId] = array(  
176 -// 'colorId' => $colorId,  
177 -// 'colorName' => $value['colorName'],  
178 -// 'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60),  
179 -// );  
180 } 182 }
181 } 183 }
182 184
183 -// // 商品的尺码列表  
184 -// if (isset($value['goodsSizeBoList'])) {  
185 -// foreach ($value['goodsSizeBoList'] as $size) {  
186 -// $sizeGroup[$colorId] = array(  
187 -// 'sizeName' => $size['sizeName'],  
188 -// 'sizeSku' => $size['goodsSizeSkuId'],  
189 -// 'sizeStorage' => $size['goodsSizeStorageNum'],  
190 -// );  
191 -// }  
192 -// } 185 + // 商品的尺码列表
  186 + if (isset($value['goodsSizeBoList'])) {
  187 + foreach ($value['goodsSizeBoList'] as $size) {
  188 + $sizeList[] = array(
  189 + 'id' => $size['id'],
  190 + 'skuId' => $size['goodsSizeSkuId'],
  191 + 'goodsId' => $size['goodsId'],
  192 + 'name' => $size['sizeName'],
  193 + 'sizeNum' => $size['goodsSizeStorageNum'],
  194 + );
  195 + $colorStorageNum += intval($size['goodsSizeStorageNum']);
  196 + }
  197 + }
  198 +
  199 + // 颜色分组
  200 + $colorGroup[] = array(
  201 + 'id' => $value['colorId'],
  202 + 'skcId' => $value['productSkc'],
  203 + 'name' => $value['colorName'],
  204 + 'goodsName' => $value['goodsName'],
  205 + 'shortUrl' => Helpers::getImageUrl($value['colorImage'], 60, 60),
  206 + 'colorNum' => $colorStorageNum,
  207 + 'sizes' => $sizeList,
  208 + );
  209 +
  210 + $totalStorageNum += $colorStorageNum;
193 } 211 }
194 212
195 // 商品图: 多个 213 // 商品图: 多个
@@ -214,11 +232,18 @@ class DetailModel @@ -214,11 +232,18 @@ class DetailModel
214 'numInCart' => 0, 232 'numInCart' => 0,
215 'goodsInstore' => $baseInfo['storage'], // 库存量 233 'goodsInstore' => $baseInfo['storage'], // 库存量
216 ); 234 );
217 - $soldOut = $baseInfo['storage'] == 0; 235 + $soldOut = $totalStorageNum === 0;
218 $notForSale = $baseInfo['attribute'] == 2; 236 $notForSale = $baseInfo['attribute'] == 2;
219 // 显示加入购物车链接 237 // 显示加入购物车链接
220 if (!$soldOut && !$notForSale) { 238 if (!$soldOut && !$notForSale) {
221 - $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); // 239 + $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
  240 + $result['cartInfo']['productId'] = $productId;
  241 + $result['cartInfo']['thumb'] = $coverImage;
  242 + $result['cartInfo']['name'] = isset($result['goodsName']) ? $result['goodsName'] : '';
  243 + $result['cartInfo']['price'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : '';
  244 + $result['cartInfo']['salePrice'] = isset($result['goodsPrice']['previousPrice']) ? $result['goodsPrice']['previousPrice'] : '';
  245 + $result['cartInfo']['totalNum'] = $totalStorageNum;
  246 + $result['cartInfo']['colors'] = $colorGroup;
222 } 247 }
223 // 非卖品 248 // 非卖品
224 elseif ($notForSale) { 249 elseif ($notForSale) {
@@ -345,7 +370,6 @@ class DetailModel @@ -345,7 +370,6 @@ class DetailModel
345 } else { 370 } else {
346 $result['sizeInfo']['detail']['list'][0]['params'] = array(0 => array('param' => '')); 371 $result['sizeInfo']['detail']['list'][0]['params'] = array(0 => array('param' => ''));
347 } 372 }
348 -  
349 } 373 }
350 374
351 // 测量方式 375 // 测量方式
@@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets" @@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 application.version = "1.2.1" 53 application.version = "1.2.1"
54 -; JS统计代码的版本号  
55 -application.yas.version = "1.0.13.2"  
56 54
57 ; 网站SEO信息 55 ; 网站SEO信息
58 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
@@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets" @@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 application.version = "1.2.1" 53 application.version = "1.2.1"
54 -; JS统计代码的版本号  
55 -application.yas.version = "1.0.13.2"  
56 54
57 ; 网站SEO信息 55 ; 网站SEO信息
58 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
@@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets" @@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 application.version = "1.2.1" 53 application.version = "1.2.1"
54 -; JS统计代码的版本号  
55 -application.yas.version = "1.0.13.2"  
56 54
57 ; 网站SEO信息 55 ; 网站SEO信息
58 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
@@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets" @@ -51,8 +51,6 @@ application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 application.version = "1.2.1" 53 application.version = "1.2.1"
54 -; JS统计代码的版本号  
55 -application.yas.version = "1.0.13.2"  
56 54
57 ; 网站SEO信息 55 ; 网站SEO信息
58 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"