Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into feature/bindMobile
Showing
44 changed files
with
1549 additions
and
1333 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 | - ], | ||
830 | - sizes: [ | ||
831 | - { | ||
832 | - id: 2, | ||
833 | - chosed: true, | ||
834 | - name: 'X' | 826 | + name: '黄色', |
827 | + colorNum:10, | ||
828 | + shortUrl:'', | ||
829 | + sizes: [ | ||
830 | + { | ||
831 | + id: 2, | ||
832 | + chosed: true, | ||
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 | + } |
@@ -17,257 +17,294 @@ use Api\Yohobuy; | @@ -17,257 +17,294 @@ use Api\Yohobuy; | ||
17 | class CartData | 17 | class CartData |
18 | { | 18 | { |
19 | 19 | ||
20 | - /** | ||
21 | - * 加入购物车接口 | ||
22 | - * | ||
23 | - * @param int $productSku 商品SKU | ||
24 | - * @param int $buyNumber 购买数量 | ||
25 | - * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 | ||
26 | - * @param int $isEdit 是否是编辑商品SKU,0表示不是编辑 | ||
27 | - * @param null|int $promotionId 促销id,默认null(加价购有关) | ||
28 | - * @param null|int $uid 用户UID,可以不传 | ||
29 | - * @param string $shoppingKey 购物的凭证 | ||
30 | - * @return array 加入购物车接口返回的数据 | ||
31 | - */ | ||
32 | - public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit = 0, $promotionId = null, $uid = null, $shoppingKey = '') | ||
33 | - { | ||
34 | - $param = Yohobuy::param(); | ||
35 | - $param['method'] = 'app.Shopping.add'; | ||
36 | - $param['product_sku'] = $productSku; | ||
37 | - $param['buy_number'] = $buyNumber; | ||
38 | - $param['goods_type'] = $goodsType; | ||
39 | - $param['edit_product_sku'] = $isEdit; | ||
40 | - $param['selected'] = 'Y'; | ||
41 | - $param['promotion_id'] = $promotionId; | ||
42 | - $param['shopping_key'] = $shoppingKey; | ||
43 | - | ||
44 | - if (!empty($uid)) { | ||
45 | - $param['uid'] = $uid; | ||
46 | - } | ||
47 | - $param['client_secret'] = Sign::getSign($param); | ||
48 | - | ||
49 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
50 | - } | ||
51 | - | ||
52 | - /** | ||
53 | - * 购物车数据 | ||
54 | - * | ||
55 | - * @param int $uid 用户ID | ||
56 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
57 | - * @return array 购物车接口返回的数据 | ||
58 | - */ | ||
59 | - public static function cartData($uid, $shoppingKey) | ||
60 | - { | ||
61 | - $param = Yohobuy::param(); | ||
62 | - $param['method'] = 'app.Shopping.cart'; | ||
63 | - | ||
64 | - if (!empty($uid)) { | ||
65 | - $param['uid'] = $uid; | ||
66 | - } | ||
67 | - if (!empty($shoppingKey)) { | ||
68 | - $param['shopping_key'] = $shoppingKey; | ||
69 | - } | ||
70 | - | ||
71 | - $param['client_secret'] = Sign::getSign($param); | ||
72 | - | ||
73 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
74 | - } | ||
75 | - | ||
76 | - /** | ||
77 | - * 移出购物车 | ||
78 | - * | ||
79 | - * @param int $uid 用户ID | ||
80 | - * @param string $sku 商品sku列表 | ||
81 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
82 | - * @return array 接口返回的数据 | ||
83 | - */ | ||
84 | - public static function removeFromCart($uid, $sku, $shoppingKey) | ||
85 | - { | ||
86 | - $param = Yohobuy::param(); | ||
87 | - $param['method'] = 'app.Shopping.remove'; | ||
88 | - $param['product_sku_list'] = $sku; | ||
89 | - | ||
90 | - if (!empty($uid)) { | ||
91 | - $param['uid'] = $uid; | ||
92 | - } | ||
93 | - if (!empty($shoppingKey)) { | ||
94 | - $param['shopping_key'] = $shoppingKey; | ||
95 | - } | ||
96 | - | ||
97 | - $param['client_secret'] = Sign::getSign($param); | ||
98 | - | ||
99 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
100 | - } | ||
101 | - | ||
102 | - /** | ||
103 | - * 移入收藏夹 | ||
104 | - * | ||
105 | - * @param int $uid 用户ID | ||
106 | - * @param string $sku 商品sku列表 | ||
107 | - * @return array 接口返回的数据 | ||
108 | - */ | ||
109 | - public static function addToFav($uid, $sku) | ||
110 | - { | ||
111 | - $param = Yohobuy::param(); | ||
112 | - $param['method'] = 'app.Shopping.addfavorite'; | ||
113 | - $param['product_sku_list'] = $sku; | ||
114 | - $param['uid'] = $uid; | ||
115 | - $param['client_secret'] = Sign::getSign($param); | ||
116 | - | ||
117 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
118 | - } | ||
119 | - | ||
120 | - /** | ||
121 | - * 获取购物车商品数据 | ||
122 | - * | ||
123 | - * @param int $uid 用户ID | ||
124 | - * @param int $skn 商品skn | ||
125 | - * @return array 接口返回的数据 | ||
126 | - */ | ||
127 | - public static function cartProductData($uid, $skn) | ||
128 | - { | ||
129 | - $param = Yohobuy::param(); | ||
130 | - $param['method'] = 'app.product.data'; | ||
131 | - $param['product_skn'] = $skn; | ||
132 | - $param['showcomment'] = 'N'; | ||
133 | - $param['uid'] = $uid; | ||
134 | - $param['client_secret'] = Sign::getSign($param); | ||
135 | - | ||
136 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
137 | - } | ||
138 | - | ||
139 | - /** | ||
140 | - * 获取加价购商品数据 | ||
141 | - * | ||
142 | - * @param int $skn 商品skn | ||
143 | - * @param int $promotionId 加价购商品促销ID | ||
144 | - * @return array 接口返回的数据 | ||
145 | - */ | ||
146 | - public static function giftProductData($skn, $promotionId) | ||
147 | - { | ||
148 | - $param = Yohobuy::param(); | ||
149 | - $param['method'] = 'app.product.gift'; | ||
150 | - $param['product_skn'] = $skn; | ||
151 | - $param['promotion_id'] = $promotionId; | ||
152 | - $param['client_secret'] = Sign::getSign($param); | ||
153 | - | ||
154 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
155 | - } | ||
156 | - | ||
157 | - /** | ||
158 | - * 修改购物车商品数据 | ||
159 | - * | ||
160 | - * @param int $uid 用户ID | ||
161 | - * @param string $swapData 商品数据 | ||
162 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
163 | - * @return array 接口返回的数据 | ||
164 | - */ | ||
165 | - public static function modifyCartProduct($uid, $swapData, $shoppingKey) | ||
166 | - { | ||
167 | - $param = Yohobuy::param(); | ||
168 | - $param['method'] = 'app.Shopping.swap'; | ||
169 | - $param['swap_data'] = $swapData; | ||
170 | - | ||
171 | - if (!empty($uid)) { | ||
172 | - $param['uid'] = $uid; | ||
173 | - } | ||
174 | - if ($shoppingKey !== null) { | ||
175 | - $param['shopping_key'] = $shoppingKey; | ||
176 | - } | ||
177 | - | ||
178 | - $param['client_secret'] = Sign::getSign($param); | ||
179 | - | ||
180 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
181 | - } | ||
182 | - | ||
183 | - /** | ||
184 | - * 购物车结算 | ||
185 | - * | ||
186 | - * @param int $uid 用户ID | ||
187 | - * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
188 | - * @return array 接口返回的数据 | ||
189 | - */ | ||
190 | - public static function cartPay($uid, $cartType) | ||
191 | - { | ||
192 | - $param = Yohobuy::param(); | ||
193 | - $param['method'] = 'app.Shopping.payment'; | ||
194 | - $param['cart_type'] = $cartType; | ||
195 | - $param['uid'] = $uid; | ||
196 | - $param['client_secret'] = Sign::getSign($param); | ||
197 | - | ||
198 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
199 | - } | ||
200 | - | ||
201 | - /** | ||
202 | - * 购物车结算--支付方式和配送方式选择 | ||
203 | - * | ||
204 | - * @param int $uid 用户ID | ||
205 | - * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
206 | - * @param string $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | ||
207 | - * @param string $paymentType 支付方式,1表示在线支付,2表示货到付款 | ||
208 | - * @param string $yohoCoin 使用的YOHO币数量,默认为null表示不适用 | ||
209 | - * @return array 接口返回的数据 | ||
210 | - */ | ||
211 | - public static function paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType, $yohoCoin = null) | ||
212 | - { | ||
213 | - $param = Yohobuy::param(); | ||
214 | - $param['method'] = 'app.Shopping.compute'; | ||
215 | - $param['cart_type'] = $cartType; | ||
216 | - $param['delivery_way'] = $deliveryWay; | ||
217 | - $param['payment_type'] = $paymentType; | ||
218 | - if ($yohoCoin !== null) { | ||
219 | - $param['use_yoho_coin'] = $yohoCoin; | ||
220 | - } | ||
221 | - | ||
222 | - $param['uid'] = $uid; | ||
223 | - $param['client_secret'] = Sign::getSign($param); | ||
224 | - | ||
225 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
226 | - } | ||
227 | - | ||
228 | - /** | ||
229 | - * 购物车结算--使用优惠券 | ||
230 | - * | ||
231 | - * @param int $uid 用户ID | ||
232 | - * @param string $couponCode 优惠券代码 | ||
233 | - * @return array 接口返回的数据 | ||
234 | - */ | ||
235 | - public static function getCoupon($uid, $couponCode) | ||
236 | - { | ||
237 | - $param = Yohobuy::param(); | ||
238 | - $param['method'] = 'app.Shopping.useCoupon'; | ||
239 | - $param['coupon_code'] = $couponCode; | ||
240 | - $param['uid'] = $uid; | ||
241 | - $param['client_secret'] = Sign::getSign($param); | ||
242 | - | ||
243 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
244 | - } | ||
245 | - | ||
246 | - /** | ||
247 | - * 购物车结算--提交结算信息 | ||
248 | - * | ||
249 | - * @param int $uid 用户ID | ||
250 | - * @param string $couponCode 优惠券代码 | ||
251 | - * @return array 接口返回的数据 | ||
252 | - */ | ||
253 | - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin) | ||
254 | - { | ||
255 | - $param = Yohobuy::param(); | ||
256 | - $param['method'] = 'app.Shopping.submit'; | ||
257 | - $param['addressId'] = $addressId; | ||
258 | - $param['cart_type'] = $cartType; | ||
259 | - $param['delivery_time'] = $deliveryTime; | ||
260 | - $param['delivery_way'] = $deliveryWay; | ||
261 | - $param['invoices_title'] = $invoiceTitle; | ||
262 | - $param['invoices_type_id'] = $invoiceId; | ||
263 | - $param['payment_id'] = $paymentId; | ||
264 | - $param['payment_type'] = $paymentType; | ||
265 | - $param['remark'] = $remark; | ||
266 | - $param['use_yoho_coin'] = $yohoCoin; | ||
267 | - $param['uid'] = $uid; | ||
268 | - $param['client_secret'] = Sign::getSign($param); | ||
269 | - | ||
270 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
271 | - } | 20 | + /** |
21 | + * 加入购物车接口 | ||
22 | + * | ||
23 | + * @param int $productSku 商品SKU | ||
24 | + * @param int $buyNumber 购买数量 | ||
25 | + * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 | ||
26 | + * @param int int $isEdit 是否是编辑商品SKU,0表示不是编辑 | ||
27 | + * @param null|int $promotionId 促销id,默认null(加价购有关) | ||
28 | + * @param null|int $uid 用户UID,可以不传 | ||
29 | + * @return array 加入购物车接口返回的数据 | ||
30 | + */ | ||
31 | + public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit = 0, $promotionId = null, $uid = null) | ||
32 | + { | ||
33 | + $param = Yohobuy::param(); | ||
34 | + $param['method'] = 'app.Shopping.add'; | ||
35 | + $param['product_sku'] = $productSku; | ||
36 | + $param['buy_number'] = $buyNumber; | ||
37 | + $param['goods_type'] = $goodsType; | ||
38 | + $param['edit_product_sku'] = $isEdit; | ||
39 | + $param['selected'] = 'Y'; | ||
40 | + $param['promotion_id'] = $promotionId; | ||
41 | + | ||
42 | + if ($uid !== null) { | ||
43 | + $param['uid'] = $uid; | ||
44 | + } | ||
45 | + $param['client_secret'] = Sign::getSign($param); | ||
46 | + | ||
47 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 购物车数据 | ||
52 | + * | ||
53 | + * @param int $uid 用户ID | ||
54 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
55 | + * @return array 购物车接口返回的数据 | ||
56 | + */ | ||
57 | + public static function cartData($uid, $shoppingKey) | ||
58 | + { | ||
59 | + $param = Yohobuy::param(); | ||
60 | + $param['method'] = 'app.Shopping.cart'; | ||
61 | + | ||
62 | + if (!empty($uid)) { | ||
63 | + $param['uid'] = $uid; | ||
64 | + } | ||
65 | + if (!empty($shoppingKey)) { | ||
66 | + $param['shopping_key'] = $shoppingKey; | ||
67 | + } | ||
68 | + | ||
69 | + $param['client_secret'] = Sign::getSign($param); | ||
70 | + | ||
71 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * 移出购物车 | ||
76 | + * | ||
77 | + * @param int $uid 用户ID | ||
78 | + * @param string $sku 商品sku列表 | ||
79 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
80 | + * @return array 接口返回的数据 | ||
81 | + */ | ||
82 | + public static function removeFromCart($uid, $sku, $shoppingKey) | ||
83 | + { | ||
84 | + $param = Yohobuy::param(); | ||
85 | + $param['method'] = 'app.Shopping.remove'; | ||
86 | + $param['product_sku_list'] = $sku; | ||
87 | + | ||
88 | + if (!empty($uid)) { | ||
89 | + $param['uid'] = $uid; | ||
90 | + } | ||
91 | + if (!empty($shoppingKey)) { | ||
92 | + $param['shopping_key'] = $shoppingKey; | ||
93 | + } | ||
94 | + | ||
95 | + $param['client_secret'] = Sign::getSign($param); | ||
96 | + | ||
97 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
98 | + } | ||
99 | + | ||
100 | + /** | ||
101 | + * 移入收藏夹 | ||
102 | + * | ||
103 | + * @param int $uid 用户ID | ||
104 | + * @param string $sku 商品sku列表 | ||
105 | + * @return array 接口返回的数据 | ||
106 | + */ | ||
107 | + public static function addToFav($uid, $sku) | ||
108 | + { | ||
109 | + $param = Yohobuy::param(); | ||
110 | + $param['method'] = 'app.Shopping.addfavorite'; | ||
111 | + $param['product_sku_list'] = $sku; | ||
112 | + $param['uid'] = $uid; | ||
113 | + $param['client_secret'] = Sign::getSign($param); | ||
114 | + | ||
115 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * 获取购物车商品数据 | ||
120 | + * | ||
121 | + * @param int $uid 用户ID | ||
122 | + * @param int $skn 商品skn | ||
123 | + * @return array 接口返回的数据 | ||
124 | + */ | ||
125 | + public static function cartProductData($uid, $skn) | ||
126 | + { | ||
127 | + $param = Yohobuy::param(); | ||
128 | + $param['method'] = 'app.product.data'; | ||
129 | + $param['product_skn'] = $skn; | ||
130 | + $param['showcomment'] = 'N'; | ||
131 | + $param['uid'] = $uid; | ||
132 | + $param['client_secret'] = Sign::getSign($param); | ||
133 | + | ||
134 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
135 | + } | ||
136 | + | ||
137 | + /** | ||
138 | + * 获取加价购商品数据 | ||
139 | + * | ||
140 | + * @param int $skn 商品skn | ||
141 | + * @param int $promotionId 加价购商品促销ID | ||
142 | + * @return array 接口返回的数据 | ||
143 | + */ | ||
144 | + public static function giftProductData($skn, $promotionId) | ||
145 | + { | ||
146 | + $param = Yohobuy::param(); | ||
147 | + $param['method'] = 'app.product.gift'; | ||
148 | + $param['product_skn'] = $skn; | ||
149 | + $param['promotion_id'] = $promotionId; | ||
150 | + $param['client_secret'] = Sign::getSign($param); | ||
151 | + | ||
152 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
153 | + } | ||
154 | + | ||
155 | + /** | ||
156 | + * 修改购物车商品数据 | ||
157 | + * | ||
158 | + * @param int $uid 用户ID | ||
159 | + * @param string $swapData 商品数据 | ||
160 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
161 | + * @return array 接口返回的数据 | ||
162 | + */ | ||
163 | + public static function modifyCartProduct($uid, $swapData, $shoppingKey) | ||
164 | + { | ||
165 | + $param = Yohobuy::param(); | ||
166 | + $param['method'] = 'app.Shopping.swap'; | ||
167 | + $param['swap_data'] = $swapData; | ||
168 | + | ||
169 | + if (!empty($uid)) { | ||
170 | + $param['uid'] = $uid; | ||
171 | + } | ||
172 | + if ($shoppingKey !== null) { | ||
173 | + $param['shopping_key'] = $shoppingKey; | ||
174 | + } | ||
175 | + | ||
176 | + $param['client_secret'] = Sign::getSign($param); | ||
177 | + | ||
178 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
182 | + * 购物车结算 | ||
183 | + * | ||
184 | + * @param int $uid 用户ID | ||
185 | + * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
186 | + * @return array 接口返回的数据 | ||
187 | + */ | ||
188 | + public static function cartPay($uid, $cartType) | ||
189 | + { | ||
190 | + $param = Yohobuy::param(); | ||
191 | + $param['method'] = 'app.Shopping.payment'; | ||
192 | + $param['cart_type'] = $cartType; | ||
193 | + $param['uid'] = $uid; | ||
194 | + $param['client_secret'] = Sign::getSign($param); | ||
195 | + | ||
196 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
197 | + } | ||
198 | + | ||
199 | + /** | ||
200 | + * 购物车结算--支付方式和配送方式选择 | ||
201 | + * | ||
202 | + * @param int $uid 用户ID | ||
203 | + * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
204 | + * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | ||
205 | + * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | ||
206 | + * @param string $couponCode 优惠券码 | ||
207 | + * @param mixed $yohoCoin 使用的YOHO币数量 | ||
208 | + * @return array 接口返回的数据 | ||
209 | + */ | ||
210 | + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin) | ||
211 | + { | ||
212 | + $param = Yohobuy::param(); | ||
213 | + $param['method'] = 'app.Shopping.compute'; | ||
214 | + $param['cart_type'] = $cartType; | ||
215 | + $param['delivery_way'] = $deliveryWay; | ||
216 | + $param['payment_type'] = $paymentType; | ||
217 | + if (!empty($couponCode)) { | ||
218 | + $param['coupon_code'] = $couponCode; | ||
219 | + } | ||
220 | + if (!empty($yohoCoin)) { | ||
221 | + $param['use_yoho_coin'] = $yohoCoin; | ||
222 | + } | ||
223 | + | ||
224 | + $param['uid'] = $uid; | ||
225 | + $param['client_secret'] = Sign::getSign($param); | ||
226 | + | ||
227 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
228 | + } | ||
229 | + | ||
230 | + /** | ||
231 | + * 购物车结算--使用优惠券 | ||
232 | + * | ||
233 | + * @param int $uid 用户ID | ||
234 | + * @param string $couponCode 优惠券代码 | ||
235 | + * @return array 接口返回的数据 | ||
236 | + */ | ||
237 | + public static function searchCoupon($uid, $couponCode) | ||
238 | + { | ||
239 | + $param = Yohobuy::param(); | ||
240 | + $param['method'] = 'app.Shopping.useCoupon'; | ||
241 | + $param['coupon_code'] = $couponCode; | ||
242 | + $param['uid'] = $uid; | ||
243 | + $param['client_secret'] = Sign::getSign($param); | ||
244 | + | ||
245 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
246 | + } | ||
247 | + | ||
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 | + /** | ||
268 | + * 购物车结算--提交结算信息 | ||
269 | + * | ||
270 | + * @param int $uid 用户ID | ||
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币数量或为空 | ||
281 | + * @return array 接口返回的数据 | ||
282 | + */ | ||
283 | + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin) | ||
284 | + { | ||
285 | + $param = Yohobuy::param(); | ||
286 | + $param['method'] = 'app.Shopping.submit'; | ||
287 | + $param['addressId'] = $addressId; | ||
288 | + $param['cart_type'] = $cartType; | ||
289 | + $param['delivery_time'] = $deliveryTime; | ||
290 | + $param['delivery_way'] = $deliveryWay; | ||
291 | + if (!empty($invoiceTitle)) { | ||
292 | + $param['invoices_title'] = $invoiceTitle; | ||
293 | + } | ||
294 | + if (!empty($invoiceId)) { | ||
295 | + $param['invoices_type_id'] = $invoiceId; | ||
296 | + } | ||
297 | + | ||
298 | + $param['payment_id'] = $paymentId; | ||
299 | + $param['payment_type'] = $paymentType; | ||
300 | + $param['remark'] = $remark; | ||
301 | + if (!empty($yohoCoin)) { | ||
302 | + $param['use_yoho_coin'] = $yohoCoin; | ||
303 | + } | ||
304 | + $param['uid'] = $uid; | ||
305 | + $param['client_secret'] = Sign::getSign($param); | ||
306 | + | ||
307 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
308 | + } | ||
272 | 309 | ||
273 | } | 310 | } |
@@ -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 | { |
@@ -23,21 +24,7 @@ class HelpData | @@ -23,21 +24,7 @@ class HelpData | ||
23 | 24 | ||
24 | return Yohobuy::post(Yohobuy::API_URL, $param, $param); | 25 | return Yohobuy::post(Yohobuy::API_URL, $param, $param); |
25 | } | 26 | } |
26 | - | ||
27 | - | ||
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 | - } | 27 | + |
41 | 28 | ||
42 | 29 | ||
43 | } | 30 | } |
@@ -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 |
static/img/yohood.png
0 → 100755
4.05 KB
@@ -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'); |
200 | +}); | ||
185 | 201 | ||
186 | -}); | ||
187 | $('.nav-home').on('touchstart', function() { | 202 | $('.nav-home').on('touchstart', function() { |
188 | $('.homebuttom').toggleClass('none'); | 203 | $('.homebuttom').toggleClass('none'); |
189 | }); | 204 | }); |
@@ -215,8 +230,8 @@ $('.nav-home').on('touchstart', function() { | @@ -215,8 +230,8 @@ $('.nav-home').on('touchstart', function() { | ||
215 | //为了使setTimteout的尽可能的接近每秒60帧的效果 | 230 | //为了使setTimteout的尽可能的接近每秒60帧的效果 |
216 | var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | 231 | var timeToCall = Math.max(0, 16 - (currTime - lastTime)); |
217 | var id = window.setTimeout(function() { | 232 | var id = window.setTimeout(function() { |
218 | - callback(currTime + timeToCall); | ||
219 | - }, timeToCall); | 233 | + callback(currTime + timeToCall); |
234 | + }, timeToCall); | ||
220 | 235 | ||
221 | lastTime = currTime + timeToCall; | 236 | lastTime = currTime + timeToCall; |
222 | return id; | 237 | return id; |
@@ -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,7 +92,11 @@ $addressForm.on('submit', function() { | @@ -91,7 +92,11 @@ $addressForm.on('submit', function() { | ||
91 | isSubmiting = false; | 92 | isSubmiting = false; |
92 | loading.hideLoadingMask(); | 93 | loading.hideLoadingMask(); |
93 | } else { | 94 | } else { |
94 | - window.location.href = '/home/address'; | 95 | + if (queryString.refer === 'shopping') { |
96 | + window.location.href = '/shoppingCart/selectAddress'; | ||
97 | + } else { | ||
98 | + window.location.href = '/home/address'; | ||
99 | + } | ||
95 | } | 100 | } |
96 | }).fail(function() { | 101 | }).fail(function() { |
97 | tip.show('网络出了点问题~'); | 102 | tip.show('网络出了点问题~'); |
@@ -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 | } |
54 | - | ||
55 | - // 统计代码:用于统计用户加入或取消商品收藏的动作 | ||
56 | - if (window._yas) { | ||
57 | - window._yas.sendCustomInfo({ | ||
58 | - pd: productId, | ||
59 | - fa: favorite | ||
60 | - }); | ||
61 | - } | ||
62 | }, | 55 | }, |
63 | error: function() { | 56 | error: function() { |
64 | tip.show('网络断开连接了~'); | 57 | tip.show('网络断开连接了~'); |
65 | } | 58 | } |
66 | }); | 59 | }); |
60 | + | ||
61 | + // 统计代码:用于统计用户加入或取消商品收藏的动作 | ||
62 | + if (window._yas) { | ||
63 | + window._yas.sendCustomInfo({ | ||
64 | + pd: productId, | ||
65 | + fa: favorite | ||
66 | + }, true); | ||
67 | + } | ||
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 | -} |
@@ -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 | +}); |
static/js/shopping-cart/order-info.js
0 → 100644
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 | +}; |
static/js/shopping-cart/select-address.js
0 → 100644
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() { |
@@ -117,7 +117,7 @@ | @@ -117,7 +117,7 @@ | ||
117 | overflow: hidden; | 117 | overflow: hidden; |
118 | padding: 0 10rem / $pxConvertRem;; | 118 | padding: 0 10rem / $pxConvertRem;; |
119 | 119 | ||
120 | - | 120 | + |
121 | } | 121 | } |
122 | 122 | ||
123 | .index-channel { | 123 | .index-channel { |
@@ -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 { |
@@ -162,11 +162,11 @@ | @@ -162,11 +162,11 @@ | ||
162 | .homestyle { | 162 | .homestyle { |
163 | margin-bottom: 50rem / $pxConvertRem; | 163 | margin-bottom: 50rem / $pxConvertRem; |
164 | width: 287.3rem / $pxConvertRem; | 164 | width: 287.3rem / $pxConvertRem; |
165 | - } | 165 | + } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | } | 168 | } |
169 | - | 169 | + |
170 | } | 170 | } |
171 | 171 | ||
172 | @import "search","footer", "error"; | 172 | @import "search","footer", "error"; |
@@ -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,17 +283,16 @@ | @@ -286,17 +283,16 @@ | ||
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; | ||
297 | - .iconfont { | ||
298 | - font-size: inherit; | ||
299 | - } | 293 | + color: #b0b0b0; |
294 | + .iconfont { | ||
295 | + font-size: inherit; | ||
300 | } | 296 | } |
301 | } | 297 | } |
302 | 298 |
@@ -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; |
@@ -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; |
@@ -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"></i></a></li> | 5 | + <li><a href="/home/helpDetail?code={{ code}}"><span>{{ name}}</span><i class="iconfont num"></i></a></li> |
6 | {{/ iHelp}} | 6 | {{/ iHelp}} |
7 | </ul> | 7 | </ul> |
8 | </div> | 8 | </div> |
@@ -19,12 +19,14 @@ | @@ -19,12 +19,14 @@ | ||
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"></span></a> | ||
23 | - <a href="/girls" class="list-item">女生 <span class="lighter">GIRLS</span> <span class="iconfont right-icon"></span></a> | ||
24 | - <a href="/kids" class="list-item">潮童 <span class="lighter">KIDS</span> <span class="iconfont right-icon"></span></a> | ||
25 | - <a href="/lifestyle" class="list-item">创意生活 <span class="lighter">LIFESTYLE</span> <span class="iconfont right-icon"></span></a> | ||
26 | - </div> | 22 | + {{#channelList}} |
23 | + <a href="{{href}}" class="list-item">{{title}} <span class="lighter">{{entitle}}</span> <span class="iconfont right-icon"></span></a> | ||
24 | + {{/channelList}} | ||
25 | + {{#showYohood}} | ||
26 | + <a href="/yohood" id="yohood" class="list-item"> <span class="iconfont right-icon"></span></a> | ||
27 | + {{/showYohood}} | ||
28 | + </div> | ||
27 | </div> | 29 | </div> |
28 | </div> | 30 | </div> |
29 | </div> | 31 | </div> |
30 | -{{> layout/footer}} | ||
32 | +{{> layout/footer}} |
@@ -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"></span> | 10 | <span class="iconfont"></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"></i> | 58 | <i class="iconfont"></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"></i> | 63 | <i class="iconfont"></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"></span> | ||
11 | + <span class="del" data-id="{{address_id}}"></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 | + 购买了 {{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"></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"></span>暂无评论 | 30 | <span class="iconfont"></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:;"> | ||
51 | - 查看更多 | ||
52 | - <span class="iconfont"></span></a> | ||
53 | - </div> | 53 | + <a class="consult-content-footer tap-hightlight" href="{{consultsUrl}}"> |
54 | + 查看更多 | ||
55 | + <span class="iconfont"></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"></span>暂无咨询 | 59 | <span class="iconfont"></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"></span></a> | 65 | <span class="iconfont"></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 | - /** | ||
875 | - * 帮助中心列表页 | ||
876 | - */ | 852 | + /** |
853 | + * 帮助列表页 | ||
854 | + */ | ||
877 | public function helpAction() | 855 | public function helpAction() |
878 | - { | ||
879 | - $service = Home\HelpModel::serviceInfo(); | 856 | + { |
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 | - * 帮助中心列表详细信息 | ||
890 | - */ | ||
891 | - public function helpDetailAction() | ||
892 | - { | ||
893 | - $code = $this->get('code', 0); | ||
894 | - $service = Home\HelpModel::serviceDetail($code); | ||
895 | - $data = array( | ||
896 | - 'iHelp' => $service, | ||
897 | - ); | ||
898 | - $this->_view->display('helpDetail', $data); | ||
899 | - } | 866 | + * 帮助列表页 |
867 | + */ | ||
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); | ||
878 | + } | ||
879 | + | ||
900 | } | 880 | } |
@@ -31,351 +31,198 @@ class ShoppingCartController extends AbstractAction | @@ -31,351 +31,198 @@ class ShoppingCartController extends AbstractAction | ||
31 | $this->_view->display('index', $data); | 31 | $this->_view->display('index', $data); |
32 | } | 32 | } |
33 | 33 | ||
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 | - * 移出购物车 | ||
71 | - */ | ||
72 | - public function delAction() | ||
73 | - { | ||
74 | - $result = array(); | ||
75 | - | ||
76 | - if ($this->isAjax()) { | ||
77 | - $productId = $this->post('id', 0); | ||
78 | - $uid = $this->getUid(true); | ||
79 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
80 | - $result = CartModel::removeFromCart($uid, $productId, $shoppingKey); | ||
81 | - } | ||
82 | - | ||
83 | - if (empty($result)) { | ||
84 | - echo ' '; | ||
85 | - } else { | ||
86 | - $this->echoJson($result); | ||
87 | - } | ||
88 | - } | ||
89 | - | ||
90 | - /** | ||
91 | - * 移入收藏夹 | ||
92 | - */ | ||
93 | - public function colAction() | ||
94 | - { | ||
95 | - $result = array(); | ||
96 | - | ||
97 | - if ($this->isAjax()) { | ||
98 | - $productId = $this->post('id', 0); | ||
99 | - $uid = $this->getUid(true); | ||
100 | - $result = CartModel::addToFav($uid, $productId); | ||
101 | - } | ||
102 | - | ||
103 | - if (empty($result)) { | ||
104 | - echo ' '; | ||
105 | - } else { | ||
106 | - $this->echoJson($result); | ||
107 | - } | ||
108 | - } | ||
109 | - | ||
110 | - /* | ||
111 | - * 获取购物车商品数据 | ||
112 | - */ | ||
113 | - | ||
114 | - public function goodinfoAction() | ||
115 | - { | ||
116 | - $result = array(); | ||
117 | - | ||
118 | - if ($this->isAjax()) { | ||
119 | - $num = $this->get('buy_num', 1); | ||
120 | - $skn = $this->get('id', 1); | ||
121 | - $uid = $this->getUid(true); | ||
122 | - $result = CartModel::cartProductData($uid, $skn, $num); // 测试skn的ID为51172055 | ||
123 | - $result['num'] = $num; | ||
124 | - } | ||
125 | - | ||
126 | - if (empty($result)) { | ||
127 | - echo ' '; | ||
128 | - } else { | ||
129 | - $this->echoJson($result); | ||
130 | - } | ||
131 | - } | ||
132 | - | ||
133 | - /* | ||
134 | - * 获取购物车加价购商品数据 | ||
135 | - */ | ||
136 | - | ||
137 | - public function giftinfoAction() | ||
138 | - { | ||
139 | - $result = array(); | ||
140 | - | ||
141 | - if ($this->isAjax()) { | ||
142 | - $skn = $this->get('skn', null); | ||
143 | - $promotionId = $this->get('promotionId', null); | ||
144 | - $result = CartModel::giftProductData($skn, $promotionId); | ||
145 | - } | ||
146 | - | ||
147 | - if (empty($result)) { | ||
148 | - echo ' '; | ||
149 | - } else { | ||
150 | - $this->echoJson($result); | ||
151 | - } | ||
152 | - } | ||
153 | - | ||
154 | - /** | ||
155 | - * 修改购物车商品数据 | ||
156 | - */ | ||
157 | - public function modifyAction() | ||
158 | - { | ||
159 | - $result = array(); | ||
160 | - | ||
161 | - if ($this->isAjax()) { | ||
162 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
163 | - $uid = $this->getUid(true); | ||
164 | - | ||
165 | - $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); | ||
170 | - $result = CartModel::modifyCartProduct($uid, $params, $shoppingKey); | ||
171 | - } | ||
172 | - | ||
173 | - if (empty($result)) { | ||
174 | - echo ' '; | ||
175 | - } else { | ||
176 | - $this->echoJson($result); | ||
177 | - } | ||
178 | - } | ||
179 | - | ||
180 | - /** | ||
181 | - * 购物车结算请求 | ||
182 | - */ | ||
183 | - public function payAction() | ||
184 | - { | ||
185 | - $this->setTitle('购物车'); | ||
186 | - $this->setNavHeader('购物车'); | ||
187 | - | ||
188 | - $cartType = $this->post('cartType', 'ordinary'); | ||
189 | - $uid = $this->getUid(true); | ||
190 | - $data = array( | ||
191 | - 'orderEnsurePage' => true, | ||
192 | - 'orderEnsure' => CartModel::cartPay($uid, $cartType) | ||
193 | - ); | ||
194 | - | ||
195 | - $this->_view->display('order-ensure', $data); | ||
196 | - } | ||
197 | - | ||
198 | - /** | ||
199 | - * 购物车选择支付方式和配送方式接口 | ||
200 | - */ | ||
201 | - public function payAndDeliveryAction() | ||
202 | - { | ||
203 | - $result = array(); | ||
204 | - | ||
205 | - if ($this->isAjax()) { | ||
206 | - $cartType = $this->post('cartType', 'ordinary'); | ||
207 | - $deliveryWay = $this->post('deliveryWay', 1); | ||
208 | - $paymentType = $this->post('paymentType', 1); | ||
209 | - $uid = $this->getUid(true); | ||
210 | - $result = CartModel::paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType); | ||
211 | - } | ||
212 | - | ||
213 | - if (empty($result)) { | ||
214 | - echo ' '; | ||
215 | - } else { | ||
216 | - $this->echoJson($result); | ||
217 | - } | ||
218 | - } | ||
219 | - | ||
220 | - /** | ||
221 | - * 购物车输入优惠券码使用优惠券 | ||
222 | - */ | ||
223 | - public function couponAction() | ||
224 | - { | ||
225 | - $result = array(); | ||
226 | - | ||
227 | - if ($this->isAjax()) { | ||
228 | - $couponCode = $this->post('couponCode', ''); | ||
229 | - $uid = $this->getUid(true); | ||
230 | - $result = CartModel::getCoupon($uid, $couponCode); | ||
231 | - } | ||
232 | - | ||
233 | - if (empty($result)) { | ||
234 | - echo ' '; | ||
235 | - } else { | ||
236 | - $this->echoJson($result); | ||
237 | - } | ||
238 | - } | ||
239 | - | ||
240 | - /** | ||
241 | - * 购物车使用YOHO币 | ||
242 | - */ | ||
243 | - public function yohoCoinAction() | ||
244 | - { | ||
245 | - $result = array(); | ||
246 | - | ||
247 | - 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); | ||
253 | - } | ||
254 | - | ||
255 | - if (empty($result)) { | ||
256 | - echo ' '; | ||
257 | - } else { | ||
258 | - $this->echoJson($result); | ||
259 | - } | ||
260 | - } | ||
261 | - | ||
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 | - } | 34 | + /** |
35 | + * 移出购物车 | ||
36 | + */ | ||
37 | + public function delAction() | ||
38 | + { | ||
39 | + $result = array(); | ||
40 | + | ||
41 | + if ($this->isAjax()) { | ||
42 | + $productId = $this->post('id', 0); | ||
43 | + $uid = $this->getUid(true); | ||
44 | + $shoppingKey = $this->getSession('shoppingKey'); | ||
45 | + $result = CartModel::removeFromCart($uid, $productId, $shoppingKey); | ||
46 | + } | ||
47 | + | ||
48 | + if (empty($result)) { | ||
49 | + echo ' '; | ||
50 | + } else { | ||
51 | + $this->echoJson($result); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * 移入收藏夹 | ||
57 | + */ | ||
58 | + public function colAction() | ||
59 | + { | ||
60 | + $result = array(); | ||
61 | + | ||
62 | + if ($this->isAjax()) { | ||
63 | + $productId = $this->post('id', 0); | ||
64 | + $uid = $this->getUid(true); | ||
65 | + $result = CartModel::addToFav($uid, $productId); | ||
66 | + } | ||
67 | + | ||
68 | + if (empty($result)) { | ||
69 | + echo ' '; | ||
70 | + } else { | ||
71 | + $this->echoJson($result); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + /* | ||
76 | + * 获取购物车商品数据 | ||
77 | + */ | ||
78 | + public function goodinfoAction() | ||
79 | + { | ||
80 | + $result = array(); | ||
81 | + | ||
82 | + if ($this->isAjax()) { | ||
83 | + $num = $this->get('buy_num', 1); | ||
84 | + $skn = $this->get('id', 1); | ||
85 | + $uid = $this->getUid(true); | ||
86 | + $result = CartModel::cartProductData($uid, $skn, $num); // 测试skn的ID为51172055 | ||
87 | + $result['num'] = $num; | ||
88 | + } | ||
89 | + | ||
90 | + if (empty($result)) { | ||
91 | + echo ' '; | ||
92 | + } else { | ||
93 | + $this->echoJson($result); | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + /* | ||
98 | + * 获取购物车加价购商品数据 | ||
99 | + */ | ||
100 | + public function giftinfoAction() | ||
101 | + { | ||
102 | + $result = array(); | ||
103 | + | ||
104 | + if ($this->isAjax()) { | ||
105 | + $skn = $this->get('skn', null); | ||
106 | + $promotionId = $this->get('promotionId', null); | ||
107 | + $result = CartModel::giftProductData($skn, $promotionId); | ||
108 | + } | ||
109 | + | ||
110 | + if (empty($result)) { | ||
111 | + echo ' '; | ||
112 | + } else { | ||
113 | + $this->echoJson($result); | ||
114 | + } | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 修改购物车商品数据 | ||
119 | + */ | ||
120 | + public function modifyAction() | ||
121 | + { | ||
122 | + $result = array(); | ||
123 | + | ||
124 | + if ($this->isAjax()) { | ||
125 | + $shoppingKey = $this->getSession('shoppingKey'); | ||
126 | + $uid = $this->getUid(true); | ||
127 | + | ||
128 | + $params = array(); | ||
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); | ||
133 | + $result = CartModel::modifyCartProduct($uid, $params, $shoppingKey); | ||
134 | + } | ||
135 | + | ||
136 | + if (empty($result)) { | ||
137 | + echo ' '; | ||
138 | + } else { | ||
139 | + $this->echoJson($result); | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
143 | + /** | ||
144 | + * 购物车结算请求 | ||
145 | + */ | ||
146 | + public function orderEnsureAction() | ||
147 | + { | ||
148 | + $this->setTitle('购物车'); | ||
149 | + $this->setNavHeader('购物车'); | ||
150 | + | ||
151 | + $cartType = $this->post('cartType', 'ordinary'); | ||
152 | + $cookieData = $this->getCookie('order-info', null); | ||
153 | + $uid = $this->getUid(true); | ||
154 | + $data = array( | ||
155 | + 'orderEnsurePage' => true, | ||
156 | + 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData) | ||
157 | + ); | ||
158 | + | ||
159 | + | ||
160 | + $this->_view->display('order-ensure', $data); | ||
161 | + } | ||
162 | + | ||
163 | + /** | ||
164 | + * 购物车选择改变字段,重新运算订单数据 | ||
165 | + */ | ||
166 | + public function orderComputeAction() | ||
167 | + { | ||
168 | + $result = array(); | ||
169 | + | ||
170 | + if ($this->isAjax()) { | ||
171 | + $cartType = $this->post('cartType', 'ordinary'); | ||
172 | + $deliveryWay = $this->post('deliveryWay', 1); | ||
173 | + $paymentType = $this->post('paymentType', 1); | ||
174 | + $couponCode = $this->post('paymentType', null); | ||
175 | + $yohoCoin = $this->post('paymentType', null); | ||
176 | + $uid = $this->getUid(true); | ||
177 | + $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin); | ||
178 | + } | ||
179 | + | ||
180 | + if (empty($result)) { | ||
181 | + echo ' '; | ||
182 | + } else { | ||
183 | + $this->echoJson($result); | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
188 | + * 购物车输入优惠券码使用优惠券 | ||
189 | + */ | ||
190 | + public function couponSearchAction() | ||
191 | + { | ||
192 | + $result = array(); | ||
193 | + | ||
194 | + if ($this->isAjax()) { | ||
195 | + $couponCode = $this->get('couponCode', ''); | ||
196 | + $uid = $this->getUid(true); | ||
197 | + $result = CartModel::searchCoupon($uid, $couponCode); | ||
198 | + } | ||
199 | + | ||
200 | + if (empty($result)) { | ||
201 | + echo ' '; | ||
202 | + } else { | ||
203 | + $this->echoJson($result); | ||
204 | + } | ||
205 | + } | ||
206 | + | ||
207 | + /** | ||
208 | + * 购物车结算--获取优惠券列表 | ||
209 | + */ | ||
210 | + public function couponListAction() | ||
211 | + { | ||
212 | + $result = array(); | ||
213 | + | ||
214 | + if ($this->isAjax()) { | ||
215 | + $uid = $this->getUid(true); | ||
216 | + $page = $this->get('page', 1); | ||
217 | + $result = CartModel::getCouponList($uid); | ||
218 | + } | ||
219 | + | ||
220 | + if (empty($result)) { | ||
221 | + echo ' '; | ||
222 | + } else { | ||
223 | + $this->echoJson($result); | ||
224 | + } | ||
225 | + } | ||
379 | 226 | ||
380 | /** | 227 | /** |
381 | * 下单流程 选择地址 | 228 | * 下单流程 选择地址 |
@@ -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,26 +20,16 @@ class HelpModel | @@ -20,26 +20,16 @@ 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 | ||
29 | } | 30 | } |
30 | return $iHelp; | 31 | return $iHelp; |
31 | } | 32 | } |
32 | - | ||
33 | - /* | ||
34 | - * 获取帮助中心详细内容 | ||
35 | - */ | ||
36 | - | ||
37 | - public static function serviceDetail($code) | ||
38 | - { | ||
39 | - | ||
40 | - $res = HelpData::serviceDetail($code); | ||
41 | - return $res; | ||
42 | - } | ||
43 | 33 | ||
44 | 34 | ||
45 | } | 35 | } |
@@ -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 | } |
@@ -17,463 +17,557 @@ use Plugin\Images; | @@ -17,463 +17,557 @@ use Plugin\Images; | ||
17 | class CartModel | 17 | class CartModel |
18 | { | 18 | { |
19 | 19 | ||
20 | - /** | ||
21 | - * 加入购物车 | ||
22 | - * | ||
23 | - * @param int $productSku 商品SKU | ||
24 | - * @param int $buyNumber 购买数量 | ||
25 | - * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 | ||
26 | - * @param int int $isEdit 是否是编辑商品SKU,0表示不是编辑 | ||
27 | - * @param null|int $promotionId 促销id,默认null(加价购有关) | ||
28 | - * @param null|int $uid 用户UID,可以不传 | ||
29 | - * @return array 加入购物车接口返回的数据 | ||
30 | - */ | ||
31 | - public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey) | ||
32 | - { | ||
33 | - $result = array('code' => 400, 'message' => '出错啦~~'); | ||
34 | - | ||
35 | - $addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey); | ||
36 | - if ($addCart && isset($addCart['code'])) { | ||
37 | - $result = $addCart; | ||
38 | - } | ||
39 | - | ||
40 | - return $result; | ||
41 | - } | ||
42 | - | ||
43 | - /** | ||
44 | - * @param integer $uid 用户ID | ||
45 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
46 | - * @return array|mixed 处理之后的购物车数据 | ||
47 | - */ | ||
48 | - public static function getCartData($uid, $shoppingKey) | ||
49 | - { | ||
50 | - $result = array('cartNav' => true); | ||
51 | - | ||
52 | - // 用户是否登录 | ||
53 | - if (empty($uid)) { | ||
54 | - $result['showLoginInfo'] = true; | ||
55 | - } | ||
56 | - | ||
57 | - // 调用接口获取购物车的数据 | ||
58 | - $cartData = CartData::cartData($uid, $shoppingKey); | ||
59 | - | ||
60 | - // 处理普通购物车和预售购物车的数据 | ||
61 | - if (isset($cartData['data']) && !empty($cartData['data'])) { | ||
62 | - $cart = $cartData['data']; | ||
63 | - | ||
64 | - /* 普通购物车 */ | ||
65 | - if (isset($cart['ordinary_cart_data'])) { | ||
66 | - $result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']); | ||
67 | - $result['commonCart'] = self::procCartData($cart['ordinary_cart_data']); | ||
68 | - } | ||
69 | - | ||
70 | - /* 预售购物车 */ | ||
71 | - if (isset($cart['advance_cart_data'])) { | ||
72 | - $result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']); | ||
73 | - $result['preSellCart'] = self::procCartData($cart['advance_cart_data']); | ||
74 | - } | ||
75 | - } | ||
76 | - | ||
77 | - return $result; | ||
78 | - } | ||
79 | - | ||
80 | - /** | ||
81 | - * 移出购物车 | ||
82 | - * | ||
83 | - * @param int $uid 用户ID | ||
84 | - * @param string $sku 商品sku列表 | ||
85 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
86 | - * @return array 接口返回的数据 | ||
87 | - */ | ||
88 | - public static function removeFromCart($uid, $sku, $shoppingKey) | ||
89 | - { | ||
90 | - $result = array('code' => 400, 'message' => '出错啦~'); | ||
91 | - | ||
92 | - // 处理sku | ||
93 | - $sku_list = json_encode(array($sku => 1)); | ||
94 | - | ||
95 | - $remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey); | ||
96 | - if ($remove && isset($remove['code'])) { | ||
97 | - $result['code'] = $remove['code']; | ||
98 | - $result['message'] = $remove['message']; | ||
99 | - } | ||
100 | - | ||
101 | - return $result; | ||
102 | - } | ||
103 | - | ||
104 | - /** | ||
105 | - * 移入收藏夹 | ||
106 | - * | ||
107 | - * @param int $uid 用户ID | ||
108 | - * @param string $sku 商品sku列表 | ||
109 | - * @return array 接口返回的数据 | ||
110 | - */ | ||
111 | - public static function addToFav($uid, $sku) | ||
112 | - { | ||
113 | - $result = array('code' => 400, 'message' => '出错啦~'); | ||
114 | - | ||
115 | - if (empty($uid)) { | ||
116 | - $result['code'] = 300; | ||
117 | - $reult['message'] = '请先登录'; | ||
118 | - $result['data'] = '/signin.html'; | ||
119 | - | ||
120 | - return $result; | ||
121 | - } | ||
122 | - | ||
123 | - // 处理sku | ||
124 | - $sku_list = json_encode(array($sku => 1)); | ||
125 | - | ||
126 | - $add = CartData::addToFav($uid, $sku_list); | ||
127 | - if ($add && isset($add['code'])) { | ||
128 | - $result['code'] = $add['code']; | ||
129 | - $result['message'] = $add['message']; | ||
130 | - } | ||
131 | - | ||
132 | - return $result; | ||
133 | - } | ||
134 | - | ||
135 | - /** | ||
136 | - * 处理购物车商品数据 | ||
137 | - * | ||
138 | - * @param int $uid 用户ID | ||
139 | - * @param int $skn 商品skn | ||
140 | - * @param int $num 购买数目 | ||
141 | - * @return array 接口返回的数据 | ||
142 | - */ | ||
143 | - public static function cartProductData($uid, $skn, $num) | ||
144 | - { | ||
145 | - $result = array('code' => 400, 'message' => '出错啦~'); | ||
146 | - | ||
147 | - $product = CartData::cartProductData($uid, $skn); | ||
148 | - if (isset($product['code']) && $product['code'] === 200) { | ||
149 | - $result['code'] = 200; | ||
150 | - $data = array(); | ||
151 | - $productData = $product['data']; | ||
152 | - | ||
153 | - // 品牌信息 | ||
154 | - if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
155 | - $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
156 | - } | ||
157 | - | ||
158 | - $data['name'] = $productData['product_name']; | ||
159 | - $data['price'] = $productData['market_price']; | ||
160 | - $data['salePrice'] = $productData['sales_price']; | ||
161 | - $data['storage'] = $productData['storage_sum']; | ||
162 | - $data['num'] = $num; | ||
163 | - | ||
164 | - // 商品选择 | ||
165 | - if (isset($productData['goods_list'])) { | ||
166 | - $goodsList = $productData['goods_list']; | ||
167 | - | ||
168 | - $colors = array(); | ||
169 | - $oneColor = array(); | ||
170 | - $sizes = array(); | ||
171 | - $oneSize = array(); | ||
172 | - foreach ($goodsList as $val) { | ||
173 | - // 颜色 | ||
174 | - $oneColor = array(); | ||
175 | - $oneColor['id'] = $val['color_id']; | ||
176 | - $oneColor['name'] = $val['color_name']; | ||
177 | - | ||
178 | - // 尺码 | ||
179 | - foreach ($val['size_list'] as $one) { | ||
180 | - $oneSize = array(); | ||
181 | - $oneSize['id'] = $one['size_id']; | ||
182 | - $oneSize['name'] = $one['size_name']; | ||
183 | - } | ||
184 | - $sizes[] = $oneSize; | ||
185 | - | ||
186 | - $oneColor['sizes'] = $sizes; | ||
187 | - $colors[] = $oneColor; | ||
188 | - } | ||
189 | - | ||
190 | - $data['colors'] = $colors; | ||
191 | - } | ||
192 | - | ||
193 | - $result['data'] = $data; | ||
194 | - } | ||
195 | - | ||
196 | - return $result; | ||
197 | - } | ||
198 | - | ||
199 | - /** | ||
200 | - * 处理加价购商品数据 | ||
201 | - * | ||
202 | - * @param int $skn 商品skn | ||
203 | - * @param int $promotionId 加价购商品促销ID | ||
204 | - * @return array | ||
205 | - */ | ||
206 | - public static function giftProductData($skn, $promotionId) | ||
207 | - { | ||
208 | - $result = array(); | ||
209 | - | ||
210 | - $product = CartData::giftProductData($skn, $promotionId); | ||
211 | - if (isset($product['code']) && $product['code'] === 200) { | ||
212 | - $result['code'] = 200; | ||
213 | - $data = array(); | ||
214 | - $productData = $product['data']; | ||
215 | - | ||
216 | - // 品牌信息 | ||
217 | - if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
218 | - $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
219 | - } | ||
220 | - | ||
221 | - $data['name'] = $productData['product_name']; | ||
222 | - $data['price'] = $productData['market_price']; | ||
223 | - $data['salePrice'] = $productData['sales_price']; | ||
224 | - $data['storage'] = $productData['storage_sum']; | ||
225 | - | ||
226 | - // 商品选择 | ||
227 | - if (isset($productData['goods_list'])) { | ||
228 | - $goodsList = $productData['goods_list']; | ||
229 | - | ||
230 | - $colors = array(); | ||
231 | - $oneColor = array(); | ||
232 | - $sizes = array(); | ||
233 | - $oneSize = array(); | ||
234 | - foreach ($goodsList as $val) { | ||
235 | - // 颜色 | ||
236 | - $oneColor = array(); | ||
237 | - $oneColor['id'] = $val['color_id']; | ||
238 | - $oneColor['name'] = $val['color_name']; | ||
239 | - | ||
240 | - // 尺码 | ||
241 | - foreach ($val['size_list'] as $one) { | ||
242 | - $oneSize = array(); | ||
243 | - $oneSize['id'] = $one['size_id']; | ||
244 | - $oneSize['name'] = $one['size_name']; | ||
245 | - } | ||
246 | - $sizes[] = $oneSize; | ||
247 | - | ||
248 | - $oneColor['sizes'] = $sizes; | ||
249 | - $colors[] = $oneColor; | ||
250 | - } | ||
251 | - | ||
252 | - $data['colors'] = $colors; | ||
253 | - } | ||
254 | - | ||
255 | - $result['data'] = $data; | ||
256 | - } | ||
257 | - | ||
258 | - return $result; | ||
259 | - } | ||
260 | - | ||
261 | - /** | ||
262 | - * 修改购物车商品数据 | ||
263 | - * | ||
264 | - * @param int $uid 用户ID | ||
265 | - * @param string $param 要更改的数据 | ||
266 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
267 | - * @return array 接口返回的数据 | ||
268 | - */ | ||
269 | - public static function modifyCartProduct($uid, $param, $shoppingKey) | ||
270 | - { | ||
271 | - $result = array('code' => 400, 'message' => '出错啦~'); | ||
272 | - | ||
273 | - // 处理要更改的数据 | ||
274 | - $swapData = json_encode(array($param)); | ||
275 | - | ||
276 | - $modify = CartData::modifyCartProduct($uid, $swapData, $shoppingKey); | ||
277 | - if ($modify && isset($modify['code'])) { | ||
278 | - $result['code'] = $modify['code']; | ||
279 | - $result['message'] = $modify['message']; | ||
280 | - } | ||
281 | - | ||
282 | - return $result; | ||
283 | - } | ||
284 | - | ||
285 | - /** | ||
286 | - * 调用购物车结算接口返回的数据处理 | ||
287 | - * | ||
288 | - * @param int $uid 用户ID | ||
289 | - * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
290 | - * @return array 接口返回的数据 | ||
291 | - */ | ||
292 | - public static function cartPay($uid, $cartType) | ||
293 | - { | ||
294 | - $result = array(); | ||
295 | - | ||
296 | - $pay = CartData::cartPay($uid, $cartType); | ||
297 | - | ||
298 | - if ($pay && isset($pay['code']) && $pay['code'] === 200) { | ||
299 | - $payReturn = $pay['data']; | ||
300 | - $result = array(); | ||
301 | - | ||
302 | - // 收货人有关信息 | ||
303 | - 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']; | ||
307 | - } | ||
308 | - | ||
309 | - // 配送方式 | ||
310 | - if (isset($payReturn['delivery_way'])) { | ||
311 | - $oneDeliv = array(); | ||
312 | - foreach ($payReturn['delivery_way'] as $val) { | ||
313 | - $oneDeliv = array(); | ||
314 | - $oneDeliv['id'] = $val['delivery_way_id']; | ||
315 | - $oneDeliv['name'] = $val['delivery_way_name']; | ||
316 | - $oneDeliv['default'] = ($val['default'] === 'Y'); | ||
317 | - | ||
318 | - $result['dispatchMode'][] = $oneDeliv; | ||
319 | - } | ||
320 | - } | ||
321 | - | ||
322 | - // 配送时间 | ||
323 | - if (isset($payReturn['delivery_time'])) { | ||
324 | - $oneDelivTime = array(); | ||
325 | - foreach ($payReturn['delivery_time'] as $one) { | ||
326 | - $oneDelivTime = array(); | ||
327 | - $oneDelivTime['id'] = $one['delivery_time_id']; | ||
328 | - $oneDelivTime['name'] = $one['delivery_time_string']; | ||
329 | - $oneDelivTime['default'] = ($one['default'] === 'Y'); | ||
330 | - | ||
331 | - $result['dispatchTime'][] = $oneDelivTime; | ||
332 | - } | ||
333 | - } | ||
334 | - | ||
335 | - // 订单商品 | ||
336 | - if (isset($payReturn['goods_list'])) { | ||
337 | - $oneGoods = array(); | ||
338 | - foreach ($payReturn['goods_list'] as $single) { | ||
339 | - $oneGoods = array(); | ||
340 | - $oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个 | ||
341 | - $oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 120); | ||
342 | - $oneGoods['name'] = $single['product_name']; | ||
343 | - $oneGoods['color'] = $single['color_name']; | ||
344 | - $oneGoods['size'] = $single['size_name']; | ||
345 | - $oneGoods['price'] = Helpers::transPrice($single['real_price']); // last_price有些带.00,有些不带,real_price都不带.00 | ||
346 | - $oneGoods['count'] = $single['buy_number']; | ||
347 | - | ||
348 | - $result['goods'][] = $oneGoods; | ||
349 | - } | ||
350 | - } | ||
351 | - | ||
352 | - // 支付方式 | ||
353 | - if (isset($payReturn['payment_way'])) { | ||
354 | - $onePay = array(); | ||
355 | - foreach ($payReturn['payment_way'] as $pay) { | ||
356 | - $onePay = array(); | ||
357 | - $onePay['id'] = $pay['payment_id']; | ||
358 | - $onePay['paymentType'] = $pay['payment_type']; | ||
359 | - $onePay['name'] = $pay['payment_type_name']; | ||
360 | - $onePay['default'] = ($pay['default'] === 'Y'); | ||
361 | - | ||
362 | - $result['paymentWay'][] = $onePay; | ||
363 | - } | ||
364 | - } | ||
365 | - | ||
366 | - // 有货币 | ||
367 | - $result['yohoCoin'] = $payReturn['yoho_coin']; | ||
368 | - | ||
369 | - // 订单数据 | ||
370 | - 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']); | ||
375 | - } | ||
376 | - | ||
377 | - // 发票有关数据 | ||
378 | - if (isset($payReturn['invoices']) && !empty($payReturn['invoices'])) { | ||
379 | - $one = array(); | ||
380 | - foreach ($payReturn['invoices']['invoices_type_list'] as $inv) { | ||
381 | - $one = array(); | ||
382 | - $one['id'] = $inv['invoices_type_id']; | ||
383 | - $one['name'] = $inv['invoices_type_name']; | ||
384 | - | ||
385 | - $result['invoice'][] = $one; | ||
386 | - } | ||
387 | - } | ||
388 | - | ||
389 | - // 优惠券数据 | ||
390 | - $coupons = array('notUsed' => true); | ||
391 | - $coupons += UserModel::getCouponData($uid, 0, 1, true); | ||
392 | - $result['coupon'] = $coupons; | ||
393 | - } | ||
394 | - | ||
395 | - return $result; | ||
396 | - } | ||
397 | - | ||
398 | - /** | ||
399 | - * 购物车结算--支付方式和配送方式选择以及是否使用YOHO币接口返回的数据处理 | ||
400 | - * | ||
401 | - * @param int $uid 用户ID | ||
402 | - * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
403 | - * @param string $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | ||
404 | - * @param string $paymentType 支付方式,1表示在线支付,2表示货到付款 | ||
405 | - * @return array 接口返回的数据 | ||
406 | - */ | ||
407 | - public static function paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType) | ||
408 | - { | ||
409 | - $result = array(); | ||
410 | - | ||
411 | - $pay = CartData::paymentTypeAndDelivery($uid, $cartType, $deliveryWay, $paymentType); | ||
412 | - if ($pay && isset($pay['code']) && $pay['code'] === 200) { | ||
413 | - $result = $pay['data']; | ||
414 | - } | ||
415 | - | ||
416 | - return $result; | ||
417 | - } | ||
418 | - | ||
419 | - /** | ||
420 | - * 购物车结算--输入优惠券代码返回的结果处理 | ||
421 | - * | ||
422 | - * @param int $uid 用户ID | ||
423 | - * @param string $couponCode 优惠券代码 | ||
424 | - * @return array 接口返回的数据 | ||
425 | - */ | ||
426 | - public static function getCoupon($uid, $couponCode) | ||
427 | - { | ||
428 | - $result = array('code' => 400, 'message' => '出错啦~'); | ||
429 | - | ||
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']; | ||
434 | - } | ||
435 | - | ||
436 | - return $result; | ||
437 | - } | ||
438 | - | ||
439 | - /** | ||
440 | - * 处理不同类型的购物车数据 | ||
441 | - * | ||
442 | - * @param array $data 不同类型购物车数据 | ||
443 | - * @return array $result 处理之后的不同类型购物车数据 | ||
444 | - */ | ||
445 | - private static function procCartData($data) | ||
446 | - { | ||
447 | - $result = array(); | ||
448 | - | ||
449 | - $oneGoods = array(); | ||
450 | - // 购买的商品列表 | ||
451 | - foreach ($data['goods_list'] as $value) { | ||
452 | - $oneGoods['id'] = $value['product_sku']; | ||
453 | - $oneGoods['skn'] = $value['product_skn']; | ||
454 | - $oneGoods['name'] = $value['product_name']; | ||
455 | - $oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120); | ||
456 | - $oneGoods['color'] = $value['color_name']; | ||
457 | - $oneGoods['size'] = $value['size_name']; | ||
458 | - $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据 | ||
459 | - $oneGoods['price'] = $value['real_price']; | ||
460 | - $oneGoods['count'] = $value['buy_number']; | ||
461 | - $oneGoods['lowStocks'] = true; | ||
462 | - | ||
463 | - $result['goods'][] = $oneGoods; | ||
464 | - } | ||
465 | - // 赠品 | ||
466 | - count($data['gift_list']) && $result['freebieOrAdvanceBuy'] = true; | ||
467 | - $result['freebie'] = $data['gift_list']; | ||
468 | - // 加价购 | ||
469 | - $result['advanceBuy'] = $data['price_gift']; | ||
470 | - // 结算数据 | ||
471 | - $result['price'] = $data['shopping_cart_data']['order_amount']; | ||
472 | - $result['activityPrice'] = $data['shopping_cart_data']['discount_amount']; | ||
473 | - $result['count'] = $data['shopping_cart_data']['goods_count']; | ||
474 | - $result['sumPrice'] = $data['shopping_cart_data']['order_amount']; | ||
475 | - | ||
476 | - return $result; | ||
477 | - } | 20 | + /** |
21 | + * 加入购物车 | ||
22 | + * | ||
23 | + * @param int $productSku 商品SKU | ||
24 | + * @param int $buyNumber 购买数量 | ||
25 | + * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 | ||
26 | + * @param int int $isEdit 是否是编辑商品SKU,0表示不是编辑 | ||
27 | + * @param null|int $promotionId 促销id,默认null(加价购有关) | ||
28 | + * @param null|int $uid 用户UID,可以不传 | ||
29 | + * @return array 加入购物车接口返回的数据 | ||
30 | + */ | ||
31 | + public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid) | ||
32 | + { | ||
33 | + $result = array('code' => 400, 'message' => '出错啦~~'); | ||
34 | + | ||
35 | + $addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid); | ||
36 | + if ($addCart && isset($addCart['code'])) { | ||
37 | + $result = $addCart; | ||
38 | + } | ||
39 | + | ||
40 | + return $result; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * @param integer $uid 用户ID | ||
45 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
46 | + * @return array|mixed 处理之后的购物车数据 | ||
47 | + */ | ||
48 | + public static function getCartData($uid, $shoppingKey) | ||
49 | + { | ||
50 | + $result = array('cartNav' => true); | ||
51 | + | ||
52 | + // 用户是否登录 | ||
53 | + if (empty($uid)) { | ||
54 | + $result['showLoginInfo'] = true; | ||
55 | + } | ||
56 | + | ||
57 | + // 调用接口获取购物车的数据 | ||
58 | + $cartData = CartData::cartData($uid, $shoppingKey); | ||
59 | + | ||
60 | + // 处理普通购物车和预售购物车的数据 | ||
61 | + if (isset($cartData['data']) && !empty($cartData['data'])) { | ||
62 | + $cart = $cartData['data']; | ||
63 | + | ||
64 | + /* 普通购物车 */ | ||
65 | + if(isset($cart['ordinary_cart_data'])) { | ||
66 | + $result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']); | ||
67 | + $result['commonCart'] = self::procCartData($cart['ordinary_cart_data']); | ||
68 | + } | ||
69 | + | ||
70 | + /* 预售购物车 */ | ||
71 | + if(isset($cart['advance_cart_data'])) { | ||
72 | + $result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']); | ||
73 | + $result['preSellCart'] = self::procCartData($cart['advance_cart_data']); | ||
74 | + } | ||
75 | + | ||
76 | + } | ||
77 | + | ||
78 | + return $result; | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * 移出购物车 | ||
83 | + * | ||
84 | + * @param int $uid 用户ID | ||
85 | + * @param string $sku 商品sku列表 | ||
86 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
87 | + * @return array 接口返回的数据 | ||
88 | + */ | ||
89 | + public static function removeFromCart($uid, $sku, $shoppingKey) | ||
90 | + { | ||
91 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
92 | + | ||
93 | + // 处理sku | ||
94 | + $sku_list = json_encode(array($sku => 1)); | ||
95 | + | ||
96 | + $remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey); | ||
97 | + if ($remove && isset($remove['code'])) { | ||
98 | + $result['code'] = $remove['code']; | ||
99 | + $result['message'] = $remove['message']; | ||
100 | + } | ||
101 | + | ||
102 | + return $result; | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * 移入收藏夹 | ||
107 | + * | ||
108 | + * @param int $uid 用户ID | ||
109 | + * @param string $sku 商品sku列表 | ||
110 | + * @return array 接口返回的数据 | ||
111 | + */ | ||
112 | + public static function addToFav($uid, $sku) | ||
113 | + { | ||
114 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
115 | + | ||
116 | + if (empty($uid)) { | ||
117 | + $result['code'] = 300; | ||
118 | + $reult['message'] = '请先登录'; | ||
119 | + $result['data'] = '/signin.html'; | ||
120 | + | ||
121 | + return $result; | ||
122 | + } | ||
123 | + | ||
124 | + // 处理sku | ||
125 | + $sku_list = json_encode(array($sku => 1)); | ||
126 | + | ||
127 | + $add = CartData::addToFav($uid, $sku_list); | ||
128 | + if ($add && isset($add['code'])) { | ||
129 | + $result['code'] = $add['code']; | ||
130 | + $result['message'] = $add['message']; | ||
131 | + } | ||
132 | + | ||
133 | + return $result; | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * 处理购物车商品数据 | ||
138 | + * | ||
139 | + * @param int $uid 用户ID | ||
140 | + * @param int $skn 商品skn | ||
141 | + * @param int $num 购买数目 | ||
142 | + * @return array 接口返回的数据 | ||
143 | + */ | ||
144 | + public static function cartProductData($uid, $skn, $num) | ||
145 | + { | ||
146 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
147 | + | ||
148 | + $product = CartData::cartProductData($uid, $skn); | ||
149 | + if (isset($product['code']) && $product['code'] === 200) { | ||
150 | + $result['code'] = 200; | ||
151 | + $data = array(); | ||
152 | + $productData = $product['data']; | ||
153 | + | ||
154 | + // 品牌信息 | ||
155 | + if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
156 | + $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
157 | + } | ||
158 | + | ||
159 | + $data['name'] = $productData['product_name']; | ||
160 | + $data['price'] = $productData['market_price']; | ||
161 | + $data['salePrice'] = $productData['sales_price']; | ||
162 | + $data['storage'] = $productData['storage_sum']; | ||
163 | + $data['num'] = $num; | ||
164 | + | ||
165 | + // 商品选择 | ||
166 | + if (isset($productData['goods_list'])) { | ||
167 | + $goodsList = $productData['goods_list']; | ||
168 | + | ||
169 | + $colors = array(); | ||
170 | + $oneColor = array(); | ||
171 | + $sizes = array(); | ||
172 | + $oneSize = array(); | ||
173 | + foreach ($goodsList as $val) { | ||
174 | + // 颜色 | ||
175 | + $oneColor = array(); | ||
176 | + $oneColor['id'] = $val['color_id']; | ||
177 | + $oneColor['name'] = $val['color_name']; | ||
178 | + | ||
179 | + // 尺码 | ||
180 | + foreach ($val['size_list'] as $one) { | ||
181 | + $oneSize = array(); | ||
182 | + $oneSize['id'] = $one['size_id']; | ||
183 | + $oneSize['name'] = $one['size_name']; | ||
184 | + } | ||
185 | + $sizes[] = $oneSize; | ||
186 | + | ||
187 | + $oneColor['sizes'] = $sizes; | ||
188 | + $colors[] = $oneColor; | ||
189 | + } | ||
190 | + | ||
191 | + $data['colors'] = $colors; | ||
192 | + } | ||
193 | + | ||
194 | + $result['data'] = $data; | ||
195 | + } | ||
196 | + | ||
197 | + return $result; | ||
198 | + } | ||
199 | + | ||
200 | + /** | ||
201 | + * 处理加价购商品数据 | ||
202 | + * | ||
203 | + * @param int $skn 商品skn | ||
204 | + * @param int $promotionId 加价购商品促销ID | ||
205 | + * @return array | ||
206 | + */ | ||
207 | + public static function giftProductData($skn, $promotionId) | ||
208 | + { | ||
209 | + $result = array(); | ||
210 | + | ||
211 | + $product = CartData::giftProductData($skn, $promotionId); | ||
212 | + if (isset($product['code']) && $product['code'] === 200) { | ||
213 | + $result['code'] = 200; | ||
214 | + $data = array(); | ||
215 | + $productData = $product['data']; | ||
216 | + | ||
217 | + // 品牌信息 | ||
218 | + if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
219 | + $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
220 | + } | ||
221 | + | ||
222 | + $data['name'] = $productData['product_name']; | ||
223 | + $data['price'] = $productData['market_price']; | ||
224 | + $data['salePrice'] = $productData['sales_price']; | ||
225 | + $data['storage'] = $productData['storage_sum']; | ||
226 | + | ||
227 | + // 商品选择 | ||
228 | + if (isset($productData['goods_list'])) { | ||
229 | + $goodsList = $productData['goods_list']; | ||
230 | + | ||
231 | + $colors = array(); | ||
232 | + $oneColor = array(); | ||
233 | + $sizes = array(); | ||
234 | + $oneSize = array(); | ||
235 | + foreach ($goodsList as $val) { | ||
236 | + // 颜色 | ||
237 | + $oneColor = array(); | ||
238 | + $oneColor['id'] = $val['color_id']; | ||
239 | + $oneColor['name'] = $val['color_name']; | ||
240 | + | ||
241 | + // 尺码 | ||
242 | + foreach ($val['size_list'] as $one) { | ||
243 | + $oneSize = array(); | ||
244 | + $oneSize['id'] = $one['size_id']; | ||
245 | + $oneSize['name'] = $one['size_name']; | ||
246 | + } | ||
247 | + $sizes[] = $oneSize; | ||
248 | + | ||
249 | + $oneColor['sizes'] = $sizes; | ||
250 | + $colors[] = $oneColor; | ||
251 | + } | ||
252 | + | ||
253 | + $data['colors'] = $colors; | ||
254 | + } | ||
255 | + | ||
256 | + $result['data'] = $data; | ||
257 | + } | ||
258 | + | ||
259 | + return $result; | ||
260 | + } | ||
261 | + | ||
262 | + /** | ||
263 | + * 修改购物车商品数据 | ||
264 | + * | ||
265 | + * @param int $uid 用户ID | ||
266 | + * @param string $param 要更改的数据 | ||
267 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
268 | + * @return array 接口返回的数据 | ||
269 | + */ | ||
270 | + public static function modifyCartProduct($uid, $param, $shoppingKey) | ||
271 | + { | ||
272 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
273 | + | ||
274 | + // 处理要更改的数据 | ||
275 | + $swapData = json_encode(array($param)); | ||
276 | + | ||
277 | + $modify = CartData::modifyCartProduct($uid, $swapData, $shoppingKey); | ||
278 | + if ($modify && isset($modify['code'])) { | ||
279 | + $result['code'] = $modify['code']; | ||
280 | + $result['message'] = $modify['message']; | ||
281 | + } | ||
282 | + | ||
283 | + return $result; | ||
284 | + } | ||
285 | + | ||
286 | + /** | ||
287 | + * 调用购物车结算接口返回的数据处理 | ||
288 | + * | ||
289 | + * @param int $uid 用户ID | ||
290 | + * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
291 | + * @param null|string $cookieData cookie中记录的一些订单有关数据 | ||
292 | + * @return array 接口返回的数据 | ||
293 | + */ | ||
294 | + public static function cartPay($uid, $cartType, $cookieData) | ||
295 | + { | ||
296 | + $result = array(); | ||
297 | + | ||
298 | + $pay = CartData::cartPay($uid, $cartType); | ||
299 | + | ||
300 | + if ($pay && isset($pay['code']) && $pay['code'] === 200) { | ||
301 | + $payReturn = $pay['data']; | ||
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 | + } | ||
316 | + | ||
317 | + // 收货人有关信息 | ||
318 | + if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_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'); | ||
325 | + } | ||
326 | + | ||
327 | + // 配送方式 | ||
328 | + if (isset($payReturn['delivery_way'])) { | ||
329 | + $oneDeliv = array(); | ||
330 | + foreach ($payReturn['delivery_way'] as $val) { | ||
331 | + $oneDeliv = array(); | ||
332 | + $oneDeliv['id'] = $val['delivery_way_id']; | ||
333 | + $oneDeliv['name'] = $val['delivery_way_name']; | ||
334 | + | ||
335 | + isset($orderInfo['deliveryId']) && $orderInfo['deliveryId'] === $oneDeliv['id'] && $oneDeliv['isSelected'] = true; | ||
336 | + | ||
337 | + !isset($oneDeliv['isSelected']) && $oneDeliv['isSelected'] = ($val['default'] === 'Y'); | ||
338 | + | ||
339 | + $result['dispatchMode'][] = $oneDeliv; | ||
340 | + } | ||
341 | + } | ||
342 | + | ||
343 | + // 配送时间 | ||
344 | + if (isset($payReturn['delivery_time'])) { | ||
345 | + $oneDelivTime = array(); | ||
346 | + foreach ($payReturn['delivery_time'] as $one) { | ||
347 | + $oneDelivTime = array(); | ||
348 | + $oneDelivTime['id'] = $one['delivery_time_id']; | ||
349 | + $oneDelivTime['name'] = $one['delivery_time_string']; | ||
350 | + $oneDelivTime['default'] = ($one['default'] === 'Y'); | ||
351 | + isset($orderInfo['deliveryTimeId']) && $orderInfo['deliveryTimeId'] === $oneDelivTime['id'] && $oneDeliv['isSelected'] = true; | ||
352 | + | ||
353 | + $result['dispatchTime'][] = $oneDelivTime; | ||
354 | + } | ||
355 | + } | ||
356 | + | ||
357 | + // 订单商品 | ||
358 | + if (isset($payReturn['goods_list'])) { | ||
359 | + $oneGoods = array(); | ||
360 | + foreach ($payReturn['goods_list'] as $single) { | ||
361 | + $oneGoods = array(); | ||
362 | + $oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个 | ||
363 | + $oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 120); | ||
364 | + $oneGoods['name'] = $single['product_name']; | ||
365 | + $oneGoods['color'] = $single['color_name']; | ||
366 | + $oneGoods['size'] = $single['size_name']; | ||
367 | + $oneGoods['price'] = Helpers::transPrice($single['real_price']); // last_price有些带.00,有些不带,real_price都不带.00 | ||
368 | + $oneGoods['count'] = $single['buy_number']; | ||
369 | + | ||
370 | + $result['goods'][] = $oneGoods; | ||
371 | + } | ||
372 | + } | ||
373 | + | ||
374 | + // 支付方式 | ||
375 | + if (isset($payReturn['payment_way'])) { | ||
376 | + $onePay = array(); | ||
377 | + foreach ($payReturn['payment_way'] as $pay) { | ||
378 | + $onePay = array(); | ||
379 | + $onePay['id'] = $pay['payment_id']; | ||
380 | + $onePay['paymentType'] = $pay['payment_type']; | ||
381 | + $onePay['name'] = $pay['payment_type_name']; | ||
382 | + $onePay['default'] = ($pay['default'] === 'Y'); | ||
383 | + | ||
384 | + $result['paymentWay'][] = $onePay; | ||
385 | + } | ||
386 | + } | ||
387 | + | ||
388 | + // 有货币 | ||
389 | + $result['yohoCoin'] = isset($orderCompute['use_yoho_coin']) ? isset($orderCompute['use_yoho_coin']) : $payReturn['yoho_coin']; | ||
390 | + | ||
391 | + // 订单数据 | ||
392 | + if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { | ||
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'; | ||
401 | + } | ||
402 | + | ||
403 | + // 发票有关数据 | ||
404 | + if (isset($payReturn['invoices']) && !empty($payReturn['invoices'])) { | ||
405 | + $one = array(); | ||
406 | + foreach ($payReturn['invoices']['invoices_type_list'] as $inv) { | ||
407 | + $one = array(); | ||
408 | + $one['id'] = $inv['invoices_type_id']; | ||
409 | + $one['name'] = $inv['invoices_type_name']; | ||
410 | + | ||
411 | + $result['invoice'][] = $one; | ||
412 | + } | ||
413 | + } | ||
414 | + | ||
415 | + // 优惠券数据 | ||
416 | + $coupons = array('notUsed' => true); | ||
417 | + !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue']; | ||
418 | + $coupons += self::getCouponList($uid, 0, 1, true); | ||
419 | + $result['coupon'] = $coupons; | ||
420 | + } | ||
421 | + | ||
422 | + return $result; | ||
423 | + } | ||
424 | + | ||
425 | + /** | ||
426 | + * 购物车结算--支付方式和配送方式选择以及是否使用YOHO币接口返回的数据处理 | ||
427 | + * | ||
428 | + * @param int $uid 用户ID | ||
429 | + * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
430 | + * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | ||
431 | + * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | ||
432 | + * @param string $couponCode 优惠券码 | ||
433 | + * @param mixed $yohoCoin 使用的YOHO币数量 | ||
434 | + * @return array 接口返回的数据 | ||
435 | + */ | ||
436 | + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin) | ||
437 | + { | ||
438 | + $result = array(); | ||
439 | + | ||
440 | + $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin); | ||
441 | + if ($compute && isset($compute['code']) && $compute['code'] === 200) { | ||
442 | + $result = $compute['data']; | ||
443 | + } | ||
444 | + | ||
445 | + return $result; | ||
446 | + } | ||
447 | + | ||
448 | + /** | ||
449 | + * 购物车结算--输入优惠券代码返回的结果处理 | ||
450 | + * | ||
451 | + * @param int $uid 用户ID | ||
452 | + * @param string $couponCode 优惠券代码 | ||
453 | + * @return array 接口返回的数据 | ||
454 | + */ | ||
455 | + public static function searchCoupon($uid, $couponCode) | ||
456 | + { | ||
457 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
458 | + | ||
459 | + $coupon = CartData::searchCoupon($uid, $couponCode); | ||
460 | + if ($coupon && isset($coupon['code'])) { | ||
461 | + $result = $coupon; | ||
462 | + } | ||
463 | + | ||
464 | + return $result; | ||
465 | + } | ||
466 | + | ||
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 | + /** | ||
534 | + * 处理不同类型的购物车数据 | ||
535 | + * | ||
536 | + * @param array $data 不同类型购物车数据 | ||
537 | + * @return array $result 处理之后的不同类型购物车数据 | ||
538 | + */ | ||
539 | + private static function procCartData($data) | ||
540 | + { | ||
541 | + $result = array(); | ||
542 | + | ||
543 | + $oneGoods = array(); | ||
544 | + // 购买的商品列表 | ||
545 | + foreach ($data['goods_list'] as $value) { | ||
546 | + $oneGoods['id'] = $value['product_sku']; | ||
547 | + $oneGoods['skn'] = $value['product_skn']; | ||
548 | + $oneGoods['name'] = $value['product_name']; | ||
549 | + $oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120); | ||
550 | + $oneGoods['color'] = $value['color_name']; | ||
551 | + $oneGoods['size'] = $value['size_name']; | ||
552 | + $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据 | ||
553 | + $oneGoods['price'] = $value['real_price']; | ||
554 | + $oneGoods['count'] = $value['buy_number']; | ||
555 | + $oneGoods['lowStocks'] = true; | ||
556 | + | ||
557 | + $result['goods'][] = $oneGoods; | ||
558 | + } | ||
559 | + // 赠品 | ||
560 | + count($data['gift_list']) && $result['freebieOrAdvanceBuy'] = true; | ||
561 | + $result['freebie'] = $data['gift_list']; | ||
562 | + // 加价购 | ||
563 | + $result['advanceBuy'] = $data['price_gift']; | ||
564 | + // 结算数据 | ||
565 | + $result['price'] = $data['shopping_cart_data']['order_amount']; | ||
566 | + $result['activityPrice'] = $data['shopping_cart_data']['discount_amount']; | ||
567 | + $result['count'] = $data['shopping_cart_data']['goods_count']; | ||
568 | + $result['sumPrice'] = $data['shopping_cart_data']['order_amount']; | ||
569 | + | ||
570 | + return $result; | ||
571 | + } | ||
478 | 572 | ||
479 | } | 573 | } |
@@ -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(); |
@@ -142,7 +142,7 @@ class DetailModel | @@ -142,7 +142,7 @@ class DetailModel | ||
142 | $result['feedbacks']['comments'][] = $build; | 142 | $result['feedbacks']['comments'][] = $build; |
143 | } | 143 | } |
144 | $result['feedbacks']['commentsUrl'] = Helpers::url('/product/detail/comments', array('product_id' => $productId, 'total' => $result['feedbacks']['commentsNum'])); | 144 | $result['feedbacks']['commentsUrl'] = Helpers::url('/product/detail/comments', array('product_id' => $productId, 'total' => $result['feedbacks']['commentsNum'])); |
145 | - } | 145 | + } |
146 | 146 | ||
147 | // 品牌信息 | 147 | // 品牌信息 |
148 | if (!empty($baseInfo['brand'])) { | 148 | if (!empty($baseInfo['brand'])) { |
@@ -157,41 +157,59 @@ class DetailModel | @@ -157,41 +157,59 @@ 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 | // 商品图: 多个 |
196 | if (isset($goodsGroup[1])) { | 214 | if (isset($goodsGroup[1])) { |
197 | foreach ($goodsGroup as $value) { | 215 | foreach ($goodsGroup as $value) { |
@@ -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) { |
@@ -251,11 +276,11 @@ class DetailModel | @@ -251,11 +276,11 @@ class DetailModel | ||
251 | */ | 276 | */ |
252 | public static function getSizeInfo($productSkn) | 277 | public static function getSizeInfo($productSkn) |
253 | { | 278 | { |
254 | - $result = array(); | 279 | + $result = array(); |
255 | 280 | ||
256 | if (is_numeric($productSkn)) { | 281 | if (is_numeric($productSkn)) { |
257 | // 调用服务 | 282 | // 调用服务 |
258 | - $sizeInfo = DetailData::sizeInfo($productSkn); | 283 | + $sizeInfo = DetailData::sizeInfo($productSkn); |
259 | 284 | ||
260 | // 商品信息 | 285 | // 商品信息 |
261 | if (isset($sizeInfo['productDescBo']['erpProductId'])) { | 286 | if (isset($sizeInfo['productDescBo']['erpProductId'])) { |
@@ -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有货 | 潮流购物逛不停" |
-
Please register or login to post a comment