Showing
61 changed files
with
2179 additions
and
1089 deletions
Too many changes to show.
To preserve performance only 61 of 61+ files are displayed.
@@ -22,21 +22,20 @@ class Yohobuy | @@ -22,21 +22,20 @@ class Yohobuy | ||
22 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 22 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
23 | 23 | ||
24 | //java API | 24 | //java API |
25 | - const API_URL = 'http://api.yoho.yohoops.org/';// | ||
26 | - const API_URL2 = 'http://api.yoho.yohoops.org/';// | ||
27 | - const SERVICE_URL = 'http://service.yoho.yohoops.org/'; | 25 | + // const API_URL = 'http://api.yoho.yohoops.org/';// |
26 | + // const API_URL2 = 'http://api.yoho.yohoops.org/';// | ||
27 | + // const SERVICE_URL = 'http://service.yoho.yohoops.org/'; | ||
28 | + // const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
29 | + // const API_OLD = 'http://api2.open.yohobuy.com/'; | ||
30 | + // const SERVICE_NOTIFY = 'http://service.yoho.cn/';// 支付回调地址 | ||
31 | + | ||
32 | + // 测试环境 | ||
33 | + const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/' | ||
34 | + const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | ||
28 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 35 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
29 | - const API_OLD = 'http://api2.open.yohobuy.com/'; | ||
30 | -//// 支付回调地址 | ||
31 | - const SERVICE_NOTIFY = 'http://service.yoho.cn/'; | ||
32 | - | ||
33 | - // 测试环境 */ | ||
34 | -// const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/' | ||
35 | -// const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | ||
36 | -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
37 | -// const API_OLD = 'http://test2.open.yohobuy.com/'; | ||
38 | -//// 支付回调地址 | ||
39 | -// const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/'; | 36 | + const API_OLD = 'http://test2.open.yohobuy.com/'; |
37 | + // 支付回调地址 | ||
38 | + const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/'; | ||
40 | 39 | ||
41 | /* 预览环境 */ | 40 | /* 预览环境 */ |
42 | // const API_URL = 'http://preapi.yoho.cn/'; | 41 | // const API_URL = 'http://preapi.yoho.cn/'; |
@@ -503,5 +503,13 @@ class ChannelConfig | @@ -503,5 +503,13 @@ class ChannelConfig | ||
503 | public static $completeType = 5; //已完成订单 | 503 | public static $completeType = 5; //已完成订单 |
504 | public static $cancelType = 7; //取消订单 | 504 | public static $cancelType = 7; //取消订单 |
505 | public static $historyType = 8; //历史订单 | 505 | public static $historyType = 8; //历史订单 |
506 | + | ||
507 | + //order标签 | ||
508 | + public static $orderTagArr = array( | ||
509 | + 'gift' => array('name' => '赠品','classname' => 'freebie-tag'), | ||
510 | + 'price_gift' => array('name' => '加价购','classname' => 'advance-buy-tag'), | ||
511 | + 'advance' => array('name' => '预售','classname' => 'presall-tag'), | ||
512 | + 'ticket' => array('name' => '虚拟商品','classname' => 'virtual-good-tag') | ||
513 | + ); | ||
506 | 514 | ||
507 | } | 515 | } |
@@ -129,4 +129,22 @@ class ListData | @@ -129,4 +129,22 @@ class ListData | ||
129 | return $result; | 129 | return $result; |
130 | } | 130 | } |
131 | 131 | ||
132 | + /** | ||
133 | + * 通过品牌获取相关文章 | ||
134 | + * @param type $brandId 品牌id | ||
135 | + * @param type $limit 取推荐内容的数量 | ||
136 | + * @param type $udid | ||
137 | + * @return type [] | ||
138 | + */ | ||
139 | + public static function getArticleByBrand($brandId, $limit, $udid = '') | ||
140 | + { | ||
141 | + $param = Yohobuy::param(); | ||
142 | + $param['brand_id'] = $brandId; | ||
143 | + $param['udid'] = $udid; | ||
144 | + $param['limit'] = $limit; | ||
145 | + $param['private_key'] = Yohobuy::$privateKeyList['web']; | ||
146 | + $param['client_secret'] = Sign::getSign($param); | ||
147 | + | ||
148 | + return Yohobuy::get(Yohobuy::SERVICE_URL . 'guang/service/v2/article/getArticleByBrand', $param); | ||
149 | + } | ||
132 | } | 150 | } |
@@ -266,11 +266,12 @@ class CartData | @@ -266,11 +266,12 @@ class CartData | ||
266 | * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | 266 | * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 |
267 | * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | 267 | * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 |
268 | * @param string $couponCode 优惠券码 | 268 | * @param string $couponCode 优惠券码 |
269 | + * @param string $promotionCode 优惠码 | ||
269 | * @param mixed $yohoCoin 使用的YOHO币数量 | 270 | * @param mixed $yohoCoin 使用的YOHO币数量 |
270 | * @param int $redEnvelopes 红包 | 271 | * @param int $redEnvelopes 红包 |
271 | * @return array 接口返回的数据 | 272 | * @return array 接口返回的数据 |
272 | */ | 273 | */ |
273 | - public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes) | 274 | + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes) |
274 | { | 275 | { |
275 | $param = Yohobuy::param(); | 276 | $param = Yohobuy::param(); |
276 | $param['method'] = 'app.Shopping.compute'; | 277 | $param['method'] = 'app.Shopping.compute'; |
@@ -280,6 +281,9 @@ class CartData | @@ -280,6 +281,9 @@ class CartData | ||
280 | if (!empty($couponCode)) { | 281 | if (!empty($couponCode)) { |
281 | $param['coupon_code'] = $couponCode; | 282 | $param['coupon_code'] = $couponCode; |
282 | } | 283 | } |
284 | + if (!empty($promotionCode)) { | ||
285 | + $param['promotion_code'] = $promotionCode; | ||
286 | + } | ||
283 | if (!empty($yohoCoin)) { | 287 | if (!empty($yohoCoin)) { |
284 | $param['use_yoho_coin'] = $yohoCoin; | 288 | $param['use_yoho_coin'] = $yohoCoin; |
285 | } | 289 | } |
@@ -361,6 +365,7 @@ class CartData | @@ -361,6 +365,7 @@ class CartData | ||
361 | * @param int $paymentType 支付类型ID | 365 | * @param int $paymentType 支付类型ID |
362 | * @param string $remark 留言 | 366 | * @param string $remark 留言 |
363 | * @param string $couponCode 优惠券码 | 367 | * @param string $couponCode 优惠券码 |
368 | + * @param string $promotionCode 优惠码 | ||
364 | * @param mixed $yohoCoin 使用的YOHO币数量或为空 | 369 | * @param mixed $yohoCoin 使用的YOHO币数量或为空 |
365 | * @param int $isPreContact 送货前是否联系 | 370 | * @param int $isPreContact 送货前是否联系 |
366 | * @param int $isPrintPrice 是否打印价格 | 371 | * @param int $isPrintPrice 是否打印价格 |
@@ -370,7 +375,7 @@ class CartData | @@ -370,7 +375,7 @@ class CartData | ||
370 | * @return array 接口返回的数据 | 375 | * @return array 接口返回的数据 |
371 | */ | 376 | */ |
372 | public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, | 377 | public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, |
373 | - $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $isPreContact, $isPrintPrice, $unionKey,$userAgent, $redEnvelopes) | 378 | + $paymentId, $paymentType, $remark,$couponCode,$promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $unionKey,$userAgent, $redEnvelopes) |
374 | { | 379 | { |
375 | $param = Yohobuy::param(); | 380 | $param = Yohobuy::param(); |
376 | $param['debug'] = 'Y'; | 381 | $param['debug'] = 'Y'; |
@@ -393,9 +398,13 @@ class CartData | @@ -393,9 +398,13 @@ class CartData | ||
393 | } | 398 | } |
394 | $param['payment_id'] = $paymentId; | 399 | $param['payment_id'] = $paymentId; |
395 | $param['payment_type'] = $paymentType; | 400 | $param['payment_type'] = $paymentType; |
401 | + | ||
396 | if (!empty($couponCode)) { | 402 | if (!empty($couponCode)) { |
397 | $param['coupon_code'] = $couponCode; | 403 | $param['coupon_code'] = $couponCode; |
398 | } | 404 | } |
405 | + if (!empty($promotionCode)) { | ||
406 | + $param['promotion_code'] = $promotionCode; | ||
407 | + } | ||
399 | if (!empty($yohoCoin)) { | 408 | if (!empty($yohoCoin)) { |
400 | $param['use_yoho_coin'] = $yohoCoin; | 409 | $param['use_yoho_coin'] = $yohoCoin; |
401 | } | 410 | } |
@@ -114,19 +114,24 @@ class FavoriteData | @@ -114,19 +114,24 @@ class FavoriteData | ||
114 | } | 114 | } |
115 | 115 | ||
116 | /** | 116 | /** |
117 | - * 取消商品或品牌收藏 | ||
118 | - * @param type $uid 用户uid | ||
119 | - * @param type $productId 商品id或品牌id | ||
120 | - * @param type $bool 商品或品牌 | 117 | + * 取消商品或品牌或店铺收藏 |
118 | + * @param type $uid 用户uid | ||
119 | + * @param type $productId 商品id或品牌id或店铺id | ||
120 | + * @param type $isBrand 商品或品牌 | ||
121 | + * @param type $isShop 是否是店铺 | ||
121 | * @return type | 122 | * @return type |
122 | */ | 123 | */ |
123 | - public static function cancelProductFav($uid, $productId, $isBrand = false) | 124 | + public static function cancelProductFav($uid, $productId, $isBrand = false, $isShop = false) |
124 | { | 125 | { |
125 | $param = Yohobuy::param(); | 126 | $param = Yohobuy::param(); |
126 | $param['method'] = 'web.favorite.cancel'; | 127 | $param['method'] = 'web.favorite.cancel'; |
127 | $param['favIds'] = $productId; | 128 | $param['favIds'] = $productId; |
128 | $param['uid'] = $uid; | 129 | $param['uid'] = $uid; |
129 | - $param['type'] = $isBrand ? 'brand' : 'product'; | 130 | + if ($isShop) { |
131 | + $param['type'] = 'shop'; | ||
132 | + } else { | ||
133 | + $param['type'] = $isBrand ? 'brand' : 'product'; | ||
134 | + } | ||
130 | $param['client_secret'] = Sign::getSign($param); | 135 | $param['client_secret'] = Sign::getSign($param); |
131 | 136 | ||
132 | return Yohobuy::get(Yohobuy::API_URL, $param); | 137 | return Yohobuy::get(Yohobuy::API_URL, $param); |
@@ -77,52 +77,60 @@ class SearchData | @@ -77,52 +77,60 @@ class SearchData | ||
77 | elseif ($type == 'brand') { | 77 | elseif ($type == 'brand') { |
78 | return 'http://192.168.10.64:8080/yohosearch/brand/list.json'; | 78 | return 'http://192.168.10.64:8080/yohosearch/brand/list.json'; |
79 | } | 79 | } |
80 | - return 'http://192.168.10.64:8080/yohosearch/search.json'; | 80 | + return 'http://192.168.102.216:8080/yohosearch/search.json'; |
81 | case 'testing': | 81 | case 'testing': |
82 | + if ($type == 'sort') { | ||
83 | + return 'http://testing.yohoops.org/yohosearch/sortgroup.json'; | ||
84 | + } | ||
85 | + elseif ($type == 'discount') { | ||
86 | + return 'http://testing.yohoops.org/yohosearch/discount.json'; | ||
87 | + } | ||
88 | + elseif ($type == 'recent') { | ||
89 | + return 'http://testing.yohoops.org/yohosearch/recent.json'; | ||
90 | + } | ||
91 | + elseif ($type == 'suggest') { | ||
92 | + return 'http://testing.yohoops.org/yohosearch/suggest.json'; | ||
93 | + } | ||
94 | + else if($type == 'new-shelve') { | ||
95 | + return 'http://testing.yohoops.org/yohosearch/new-shelve.json'; | ||
96 | + } | ||
97 | + elseif ($type == 'shop') { | ||
98 | + return 'http://testing.yohoops.org/yohosearch/shops.json'; | ||
99 | + } | ||
100 | + elseif ($type == 'search') { | ||
101 | + return 'http://testing.yohoops.org/yohosearch/search.json'; | ||
102 | + } | ||
103 | + elseif ($type == 'brand') { | ||
104 | + return 'http://testing.yohoops.org/yohosearch/brand/list.json'; | ||
105 | + } | ||
106 | + return 'http://testing.yohoops.org/yohosearch/search.json'; | ||
82 | case 'developer': | 107 | case 'developer': |
83 | default: | 108 | default: |
84 | if ($type == 'sort') { | 109 | if ($type == 'sort') { |
85 | - return 'http://101.200.31.165/yohosearch/sortgroup.json'; | ||
86 | -// return 'http://101.200.31.165/yohosearch/sortgroup.json'; | ||
87 | -// return 'http://182.92.99.119:8080/yohosearch/sortgroup.json'; | 110 | + return 'http://192.168.102.216:8080/yohosearch/sortgroup.json'; |
88 | } | 111 | } |
89 | elseif ($type == 'discount') { | 112 | elseif ($type == 'discount') { |
90 | - return 'http://101.200.31.165/yohosearch/discount.json'; | ||
91 | -// return 'http://101.200.31.165/yohosearch/discount.json'; | ||
92 | -// return 'http://182.92.99.119:8080/yohosearch/discount.json'; | 113 | + return 'http://192.168.102.216:8080/yohosearch/discount.json'; |
93 | } | 114 | } |
94 | elseif ($type == 'recent') { | 115 | elseif ($type == 'recent') { |
95 | - return 'http://101.200.31.165/yohosearch/recent.json'; | ||
96 | -// return 'http://101.200.31.165/yohosearch/recent.json'; | ||
97 | -// return 'http://182.92.99.119:8080/yohosearch/recent.json'; | 116 | + return 'http://192.168.102.216:8080/yohosearch/recent.json'; |
98 | } | 117 | } |
99 | elseif ($type == 'suggest') { | 118 | elseif ($type == 'suggest') { |
100 | - return 'http://101.200.31.165/yohosearch/suggest.json'; | ||
101 | -// return 'http://101.200.31.165/yohosearch/suggest.json'; | ||
102 | -// return 'http://182.92.99.119:8080/yohosearch/suggest.json'; | 119 | + return 'http://192.168.102.216:8080/yohosearch/suggest.json'; |
103 | } | 120 | } |
104 | else if($type == 'new-shelve') { | 121 | else if($type == 'new-shelve') { |
105 | - return 'http://101.200.31.165/yohosearch/new-shelve.json';//'http://182.92.99.119:8080/yohosearch/new-shelve.json'; | ||
106 | -// return 'http://182.92.99.119:8080/yohosearch/new-shelve.json';//'http://182.92.99.119:8080/yohosearch/new-shelve.json'; | 122 | + return 'http://192.168.102.216:8080/yohosearch/new-shelve.json'; |
107 | } | 123 | } |
108 | elseif ($type == 'shop') { | 124 | elseif ($type == 'shop') { |
109 | - return 'http://101.200.31.165/yohosearch/shops.json'; | ||
110 | -// return 'http://101.200.31.165/yohosearch/shops.json'; | ||
111 | -// return 'http://182.92.99.119:8080/yohosearch/shops.json'; | 125 | + return 'http://192.168.102.216:8080/yohosearch/shops.json'; |
112 | } | 126 | } |
113 | elseif ($type == 'search') { | 127 | elseif ($type == 'search') { |
114 | - return 'http://182.92.99.119:8080/yohosearch/search-once.json'; | 128 | + return 'http://192.168.102.216:8080/yohosearch/search.json'; |
115 | } | 129 | } |
116 | elseif ($type == 'brand') { | 130 | elseif ($type == 'brand') { |
117 | - return 'http://101.200.31.165/yohosearch/brand/list.json'; | ||
118 | -// return 'http://101.200.31.165/yohosearch/brand/list.json'; | ||
119 | -// return 'http://182.92.99.119:8080/yohosearch/brand/list.json'; | 131 | + return 'http://192.168.102.216:8080/yohosearch/brand/list.json'; |
120 | } | 132 | } |
121 | - return 'http://192.168.102.216:8087/yohosearch/search.json'; | ||
122 | -// return 'http://192.168.10.64:8080/yohosearch/search.json'; | ||
123 | -// return 'http://101.200.31.165/yohosearch/search.json'; | ||
124 | - //return 'http://101.200.31.165/yohosearch/search.json'; | ||
125 | -// return 'http://182.92.99.119:8080/yohosearch/search.json'; | 133 | + return 'http://192.168.102.216:8080/yohosearch/search.json'; |
126 | } | 134 | } |
127 | } | 135 | } |
128 | 136 | ||
@@ -586,4 +594,18 @@ class SearchData | @@ -586,4 +594,18 @@ class SearchData | ||
586 | { | 594 | { |
587 | return Yohobuy::get(self::getUrl(), $param); | 595 | return Yohobuy::get(self::getUrl(), $param); |
588 | } | 596 | } |
597 | + /** | ||
598 | + * 根据品牌id查询店铺列表接口 | ||
599 | + * @param type array $param | ||
600 | + * @return type [] | ||
601 | + */ | ||
602 | + public static function getQueryShopsByBrandId($brandId) | ||
603 | + { | ||
604 | + $param = Yohobuy::param(); | ||
605 | + $param['method'] = 'app.shop.queryShopsByBrandId'; | ||
606 | + $param['brand_id'] = $brandId; | ||
607 | + $param['client_secret'] = Sign::getSign($param); | ||
608 | + | ||
609 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
610 | + } | ||
589 | } | 611 | } |
library/LibModels/Web/Product/ShopData.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace LibModels\Web\Product; | ||
4 | + | ||
5 | +use Api\Yohobuy; | ||
6 | +use Api\Sign; | ||
7 | +/** | ||
8 | + * 品牌店铺的接口 | ||
9 | + * @info http://git.dev.yoho.cn/yoho-documents/api-interfaces/blob/master/%E5%95%86%E5%93%81%E5%88%97%E8%A1%A8/brandShops.md | ||
10 | + * @copyright yoho.inc | ||
11 | + * @author xiaoxiao.hao <xiaoxiao.hao@yoho.cn> | ||
12 | + */ | ||
13 | +class ShopData | ||
14 | +{ | ||
15 | + /** | ||
16 | + * 获取店铺装修的所有资源接口 | ||
17 | + * @param type int $shopId 店铺id | ||
18 | + * @return type [] | ||
19 | + */ | ||
20 | + public static function shopsDecoratorList($shopId) | ||
21 | + { | ||
22 | + $param = Yohobuy::param(); | ||
23 | + $param['method'] = 'app.shopsdecorator.getList'; | ||
24 | + $param['shop_id'] = intval($shopId); | ||
25 | + $param['client_secret'] = Sign::getSign($param); | ||
26 | + | ||
27 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
28 | + } | ||
29 | + /** | ||
30 | + * 查询店铺介绍接口 | ||
31 | + * @param type int $shopId 店铺id | ||
32 | + * @return type [] | ||
33 | + */ | ||
34 | + public static function getIntro($shopId, $uid = '') | ||
35 | + { | ||
36 | + $param = Yohobuy::param(); | ||
37 | + $param['method'] = 'app.shops.getIntro'; | ||
38 | + $param['shop_id'] = intval($shopId); | ||
39 | + $param['uid'] = $uid; | ||
40 | + $param['client_secret'] = Sign::getSign($param); | ||
41 | + | ||
42 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 查询店铺下面的所有品牌 | ||
47 | + * @param type int $shopId 店铺id | ||
48 | + * @return type [] | ||
49 | + */ | ||
50 | + public static function getShopsBrands($shopId) | ||
51 | + { | ||
52 | + $param = Yohobuy::param(); | ||
53 | + $param['method'] = 'app.shops.getShopsBrands'; | ||
54 | + $param['shop_id'] = intval($shopId); | ||
55 | + $param['client_secret'] = Sign::getSign($param); | ||
56 | + | ||
57 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * 搜索店铺内商品 || 查询该店铺下全部商品 | ||
62 | + * @param type int $shopId 店铺id | ||
63 | + * @return type [] | ||
64 | + */ | ||
65 | + public static function getSearch($shopId) | ||
66 | + { | ||
67 | + $param = Yohobuy::param(); | ||
68 | + $param['method'] = 'app.search.li'; | ||
69 | + $param['shop'] = intval($shopId); | ||
70 | + $param['client_secret'] = Sign::getSign($param); | ||
71 | + | ||
72 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * 查询该店铺下所有二级品类 | ||
77 | + * @param type int $shopId 店铺id | ||
78 | + * @param type string $yhChannel 频道 | ||
79 | + * @param type string $gender 性别 | ||
80 | + * @return type [] | ||
81 | + */ | ||
82 | + public static function getSortInfo($shopId, $yhChannel = '', $gender = '') | ||
83 | + { | ||
84 | + $param = Yohobuy::param(); | ||
85 | + $param['method'] = 'app.shop.getSortInfo'; | ||
86 | + $param['shop_id'] = intval($shopId); | ||
87 | + $param['yh_channel'] = $yhChannel; | ||
88 | + $param['gender'] = $gender; | ||
89 | + $param['client_secret'] = Sign::getSign($param); | ||
90 | + | ||
91 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * 收藏|取消 店铺接口 | ||
96 | + * @param type int $shopId 店铺id | ||
97 | + * @param type Boolean $isfavorite true:收藏,false:取消 | ||
98 | + * @param type string $type 收藏的类型,brand、product、shop | ||
99 | + * @return type [] | ||
100 | + */ | ||
101 | + public static function setFavorite($shopId, $isfavorite, $uid, $type = 'shop') | ||
102 | + { | ||
103 | + $param = Yohobuy::param(); | ||
104 | + $param['method'] = $isfavorite ? 'app.favorite.add' : 'app.favorite.cancel'; | ||
105 | + $param['id'] = intval($shopId); | ||
106 | + $param['fav_id'] = intval($shopId); | ||
107 | + $param['uid'] = $uid; | ||
108 | + $param['type'] = $type; | ||
109 | + $param['client_secret'] = Sign::getSign($param); | ||
110 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
111 | + } | ||
112 | + /** | ||
113 | + * 根据domain查找shop_id | ||
114 | + * @param type string $domain 品牌域名 | ||
115 | + * @return type [] | ||
116 | + */ | ||
117 | + public static function byDomain($domain) | ||
118 | + { | ||
119 | + $param = Yohobuy::param(); | ||
120 | + $param['method'] = 'web.brand.byDomain'; | ||
121 | + $param['domain'] = $domain; | ||
122 | + $param['client_secret'] = Sign::getSign($param); | ||
123 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
124 | + } | ||
125 | +} |
@@ -177,8 +177,15 @@ class HelperSearch | @@ -177,8 +177,15 @@ class HelperSearch | ||
177 | self::setSearchNav($data['product']['total']); | 177 | self::setSearchNav($data['product']['total']); |
178 | } | 178 | } |
179 | //品牌店铺信息 | 179 | //品牌店铺信息 |
180 | - if (isset($data['shop']) && !empty($data['shop']) && isset($data['shopSort'])) { | ||
181 | - $result['shopEntry'] = self::shop($data['shop'], $data['shopSort']); | 180 | + if (isset($data['shopData']) && !empty($data['shopData'])) { |
181 | + $result['shopEntry'] = array(); | ||
182 | + foreach ($data['shopData'] as $val) { | ||
183 | + $shopSort = self::shop($val['shop'], $val['shopSort']); | ||
184 | + if (empty($shopSort)) { | ||
185 | + continue; | ||
186 | + } | ||
187 | + $result['shopEntry'][] = $shopSort; | ||
188 | + } | ||
182 | } | 189 | } |
183 | //分页 | 190 | //分页 |
184 | if (isset($result['totalCount'])) { | 191 | if (isset($result['totalCount'])) { |
@@ -261,7 +268,7 @@ class HelperSearch | @@ -261,7 +268,7 @@ class HelperSearch | ||
261 | if (!$defaultGood) { | 268 | if (!$defaultGood) { |
262 | $defaultGood = $v['goods_id']; | 269 | $defaultGood = $v['goods_id']; |
263 | } | 270 | } |
264 | - if (!$val['default_images']) { | 271 | + if (isset($val['default_images']) || empty($val['default_images'])) { |
265 | $val['default_images'] = $v['images_url']; | 272 | $val['default_images'] = $v['images_url']; |
266 | } | 273 | } |
267 | } | 274 | } |
@@ -307,6 +314,11 @@ class HelperSearch | @@ -307,6 +314,11 @@ class HelperSearch | ||
307 | $isNew = false; | 314 | $isNew = false; |
308 | $isSale = false; | 315 | $isSale = false; |
309 | } | 316 | } |
317 | + | ||
318 | + if (isset($options['isNew']) && $options['isNew']) { | ||
319 | + $isNew = true; | ||
320 | + } | ||
321 | + | ||
310 | //SALE、NEW标签不共存 | 322 | //SALE、NEW标签不共存 |
311 | if ($isNew) { | 323 | if ($isNew) { |
312 | $isSale = false; | 324 | $isSale = false; |
@@ -323,7 +335,7 @@ class HelperSearch | @@ -323,7 +335,7 @@ class HelperSearch | ||
323 | 'name' => $val['product_name'], | 335 | 'name' => $val['product_name'], |
324 | 'salePrice' => $val['sales_price'], | 336 | 'salePrice' => $val['sales_price'], |
325 | 'brand' => array( | 337 | 'brand' => array( |
326 | - 'url' => Helpers::url('', '', $val['brand_domain']), | 338 | + 'url' => Helpers::url('', '', isset($val['brand_domain']) ? $val['brand_domain'] : ''), |
327 | 'name' => $val['brand_name'] | 339 | 'name' => $val['brand_name'] |
328 | ), | 340 | ), |
329 | 'isFew' => $isFew, | 341 | 'isFew' => $isFew, |
@@ -584,7 +596,7 @@ class HelperSearch | @@ -584,7 +596,7 @@ class HelperSearch | ||
584 | //已选中品牌标签名 | 596 | //已选中品牌标签名 |
585 | $existName = array(); | 597 | $existName = array(); |
586 | foreach ($brand as $key => $v) { | 598 | foreach ($brand as $key => $v) { |
587 | - if (!$v['brand_alif']) { | 599 | + if (empty($v['brand_alif'])) { |
588 | $v['brand_alif'] = substr($v['brand_name_en'], 0, 1); | 600 | $v['brand_alif'] = substr($v['brand_name_en'], 0, 1); |
589 | if (!$v['brand_alif']) { | 601 | if (!$v['brand_alif']) { |
590 | $pinyin = self::pinYin($v['brand_name']); | 602 | $pinyin = self::pinYin($v['brand_name']); |
@@ -734,10 +746,10 @@ class HelperSearch | @@ -734,10 +746,10 @@ class HelperSearch | ||
734 | unset($params['color']); | 746 | unset($params['color']); |
735 | } | 747 | } |
736 | $result = array(); | 748 | $result = array(); |
737 | - $color = $filter['color']; | ||
738 | - if (!isset($color) && empty($color)) { | 749 | + if (!isset($filter['color']) && empty($filter['color'])) { |
739 | return $result; | 750 | return $result; |
740 | } | 751 | } |
752 | + $color = $filter['color']; | ||
741 | if (isset($color['color_id'])) { | 753 | if (isset($color['color_id'])) { |
742 | $checked = isset(self::$params['color']) && self::$params['color'] ==$color['color_id'] ? true : false; | 754 | $checked = isset(self::$params['color']) && self::$params['color'] ==$color['color_id'] ? true : false; |
743 | $result[] = array( | 755 | $result[] = array( |
@@ -869,7 +881,7 @@ class HelperSearch | @@ -869,7 +881,7 @@ class HelperSearch | ||
869 | unset($params['style']); | 881 | unset($params['style']); |
870 | } | 882 | } |
871 | $result = array(); | 883 | $result = array(); |
872 | - $style = $filter['style']; | 884 | + $style = empty($filter['style']) ? array() : $filter['style']; |
873 | $styleNum = 0; | 885 | $styleNum = 0; |
874 | $styleName = ''; | 886 | $styleName = ''; |
875 | foreach ($style as $v) { | 887 | foreach ($style as $v) { |
@@ -1175,6 +1187,10 @@ class HelperSearch | @@ -1175,6 +1187,10 @@ class HelperSearch | ||
1175 | } | 1187 | } |
1176 | $queryPath = explode('?', $_SERVER['REQUEST_URI']); | 1188 | $queryPath = explode('?', $_SERVER['REQUEST_URI']); |
1177 | $params_arr = array(); | 1189 | $params_arr = array(); |
1190 | + //店铺装修,添加额外参数 | ||
1191 | + if (empty($params['shopId']) && isset($_REQUEST['shopId'])) { | ||
1192 | + $params['shopId'] = $_REQUEST['shopId']; | ||
1193 | + } | ||
1178 | foreach ($params as $key => $val) { | 1194 | foreach ($params as $key => $val) { |
1179 | if (is_array($val) || $val === '') { | 1195 | if (is_array($val) || $val === '') { |
1180 | continue; | 1196 | continue; |
@@ -1310,6 +1326,10 @@ class HelperSearch | @@ -1310,6 +1326,10 @@ class HelperSearch | ||
1310 | if (!empty(self::$specialsaleParam)) { | 1326 | if (!empty(self::$specialsaleParam)) { |
1311 | $url[0] .= '?' . http_build_query(self::$specialsaleParam); | 1327 | $url[0] .= '?' . http_build_query(self::$specialsaleParam); |
1312 | } | 1328 | } |
1329 | + //店铺装修,添加额外参数 | ||
1330 | + if (empty($urlParam['shopId']) && isset($_REQUEST['shopId'])) { | ||
1331 | + $urlParam['shopId'] = $_REQUEST['shopId']; | ||
1332 | + } | ||
1313 | if (isset(self::$params['query'])) { | 1333 | if (isset(self::$params['query'])) { |
1314 | $urlParam['query'] = self::$params['query']; | 1334 | $urlParam['query'] = self::$params['query']; |
1315 | } | 1335 | } |
@@ -1429,7 +1449,14 @@ class HelperSearch | @@ -1429,7 +1449,14 @@ class HelperSearch | ||
1429 | if (self::$total == 0) { | 1449 | if (self::$total == 0) { |
1430 | return $shopEntry; | 1450 | return $shopEntry; |
1431 | } | 1451 | } |
1432 | - $url = Helpers::url('', '', $shop['brand_domain']); | 1452 | + |
1453 | + if (empty($shopSort)) { | ||
1454 | + $shopSort = array(); | ||
1455 | + } | ||
1456 | + | ||
1457 | + $shop['shop_id'] = empty($shop['shop_id']) ? '' : $shop['shop_id']; | ||
1458 | + | ||
1459 | + $url = Helpers::url('', array('shopId' => $shop['shop_id']), $shop['brand_domain']); | ||
1433 | $sort = array(); | 1460 | $sort = array(); |
1434 | $sortInfo = array(); | 1461 | $sortInfo = array(); |
1435 | foreach ($shopSort as $msort) { | 1462 | foreach ($shopSort as $msort) { |
@@ -1441,11 +1468,12 @@ class HelperSearch | @@ -1441,11 +1468,12 @@ class HelperSearch | ||
1441 | break 2; | 1468 | break 2; |
1442 | } | 1469 | } |
1443 | $sortInfo = array(); | 1470 | $sortInfo = array(); |
1444 | - $sortInfo['href'] = $url . '/?msort=' . $msort['sort_id'] . '&misort=' . $misort['sort_id']; | 1471 | + $sortInfo['href'] = "{$url}&msort={$msort['sort_id']}&misort={$misort['sort_id']}"; |
1445 | $sortInfo['name'] = $misort['sort_name']; | 1472 | $sortInfo['name'] = $misort['sort_name']; |
1446 | $sort[] = $sortInfo; | 1473 | $sort[] = $sortInfo; |
1447 | } | 1474 | } |
1448 | } | 1475 | } |
1476 | + $shop['brand_ico'] = strstr($shop['brand_ico'], '?', true); | ||
1449 | $shopEntry['home'] = $url; | 1477 | $shopEntry['home'] = $url; |
1450 | $shopEntry['logo'] = Images::getImageUrl($shop['brand_ico'], 80, 50, 1, 'brandLogo'); | 1478 | $shopEntry['logo'] = Images::getImageUrl($shop['brand_ico'], 80, 50, 1, 'brandLogo'); |
1451 | $shopEntry['shopName'] = $shop['brand_name']; | 1479 | $shopEntry['shopName'] = $shop['brand_name']; |
@@ -1050,4 +1050,44 @@ class Helpers | @@ -1050,4 +1050,44 @@ class Helpers | ||
1050 | return true; | 1050 | return true; |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | + /** | ||
1054 | + * 格式化产品url | ||
1055 | + * @param type int $productId 产品id | ||
1056 | + * @param type $productSkn 产品编号 | ||
1057 | + * @param type $productName 产品名称 | ||
1058 | + * @param type $cnAlphaBet | ||
1059 | + * @return type url | ||
1060 | + */ | ||
1061 | + public static function getProductUrl($productId, $productSkn, $productName = '', $cnAlphaBet = '') | ||
1062 | + { | ||
1063 | + $cnAlphaBet = empty($cnAlphaBet) ? $cnAlphaBet : md5($productName); | ||
1064 | + | ||
1065 | + return self::url( | ||
1066 | + '/product/pro_' . $productId . '_' . | ||
1067 | + $productSkn . '/' . $cnAlphaBet . '.html', | ||
1068 | + null, | ||
1069 | + 'item' | ||
1070 | + ); | ||
1071 | + } | ||
1072 | + | ||
1073 | + /** | ||
1074 | + * 截取字符串长度,超过用省略号表示 | ||
1075 | + * @param type string $str 字符串 | ||
1076 | + * @param type int $len 要截取的长度 | ||
1077 | + * @return type string | ||
1078 | + */ | ||
1079 | + public static function substrEllipsis($str, $len) | ||
1080 | + { | ||
1081 | + return mb_substr($str, 0, $len, 'utf-8') . ($len >= mb_strlen($str,'utf-8') ? '' : '...'); | ||
1082 | + } | ||
1083 | + | ||
1084 | + /** | ||
1085 | + * 判断字符串是否包含中文 | ||
1086 | + * @param type string $str 字符串 | ||
1087 | + * @return type boolean | ||
1088 | + */ | ||
1089 | + public static function isChinese($str) | ||
1090 | + { | ||
1091 | + return preg_match("/[\x7f-\xff]/", $str); | ||
1092 | + } | ||
1053 | } | 1093 | } |
@@ -108,7 +108,7 @@ | @@ -108,7 +108,7 @@ | ||
108 | </div> | 108 | </div> |
109 | </td> | 109 | </td> |
110 | <td class="productPrice">¥{{productPrice}}</td> | 110 | <td class="productPrice">¥{{productPrice}}</td> |
111 | - <td>{{yohoIcon}}</td> | 111 | + <td>{{yohoIcon}}个</td> |
112 | <td class="adjust-cart-num"> | 112 | <td class="adjust-cart-num"> |
113 | {{#if isGift}} | 113 | {{#if isGift}} |
114 | <div>{{productNum}}</div> | 114 | <div>{{productNum}}</div> |
@@ -163,7 +163,7 @@ | @@ -163,7 +163,7 @@ | ||
163 | <span class="vipPrice">(VIP)</span> | 163 | <span class="vipPrice">(VIP)</span> |
164 | {{/isVipPrice}} | 164 | {{/isVipPrice}} |
165 | </td> | 165 | </td> |
166 | - <td>{{yohoIcon}}</td> | 166 | + <td>{{yohoIcon}}个</td> |
167 | <td class="adjust-cart-num"> | 167 | <td class="adjust-cart-num"> |
168 | {{#if isGift}} | 168 | {{#if isGift}} |
169 | <div>{{productNum}}</div> | 169 | <div>{{productNum}}</div> |
@@ -259,7 +259,7 @@ | @@ -259,7 +259,7 @@ | ||
259 | <del class="wapper-price" style="margin-right: 5px;">¥{{marketPrice}}</del> | 259 | <del class="wapper-price" style="margin-right: 5px;">¥{{marketPrice}}</del> |
260 | <span class="subjoin-price">¥{{subjoinPrice}}</span> | 260 | <span class="subjoin-price">¥{{subjoinPrice}}</span> |
261 | </td> | 261 | </td> |
262 | - <td style="width:7%;">{{yohoIcon}}</td> | 262 | + <td style="width:7%;">{{yohoIcon}}个</td> |
263 | <td style="width:10%;">1</td> | 263 | <td style="width:10%;">1</td> |
264 | <td style="width:10%;">¥{{subjoinPrice}}</td> | 264 | <td style="width:10%;">¥{{subjoinPrice}}</td> |
265 | <td style="width:20%; border-right: none;"> | 265 | <td style="width:20%; border-right: none;"> |
@@ -318,7 +318,11 @@ | @@ -318,7 +318,11 @@ | ||
318 | {{/unless}} | 318 | {{/unless}} |
319 | <div class="right"> | 319 | <div class="right"> |
320 | <p class="sum">商品总价(¥{{cartEnsure.productAmmount}})- 活动(¥{{cartEnsure.activeSale}})= 商品金额总计(¥{{cartEnsure.productAllA}})</p> | 320 | <p class="sum">商品总价(¥{{cartEnsure.productAmmount}})- 活动(¥{{cartEnsure.activeSale}})= 商品金额总计(¥{{cartEnsure.productAllA}})</p> |
321 | - <p>获赠YOHO币:{{cartEnsure.getYoho}}个 商品总价(不含运费):<strong>¥{{cartEnsure.productAllA}}</strong> 元</p> | 321 | + <p> |
322 | + <a href="/help/?category_id=87" class="yoho-coin" target="_blank"></a> | ||
323 | + 共返YOHO币:{{cartEnsure.getYoho}}个 商品总价(不含运费): | ||
324 | + <strong>¥{{cartEnsure.productAllA}}</strong> 元 | ||
325 | + </p> | ||
322 | </div> | 326 | </div> |
323 | </div> | 327 | </div> |
324 | <div class="cartnew-submit" id="payDiv"> | 328 | <div class="cartnew-submit" id="payDiv"> |
1 | -{{> layout/header}} | 1 | +{{> layout/header}} |
2 | <div class="order-ensure-page yoho-page clearfix"> | 2 | <div class="order-ensure-page yoho-page clearfix"> |
3 | {{# orderEnsure}} | 3 | {{# orderEnsure}} |
4 | <div class="order-edit"> | 4 | <div class="order-edit"> |
@@ -123,13 +123,19 @@ | @@ -123,13 +123,19 @@ | ||
123 | </ul> | 123 | </ul> |
124 | </div> | 124 | </div> |
125 | </li> | 125 | </li> |
126 | - | 126 | + |
127 | <li> | 127 | <li> |
128 | {{#if supportDeliveryPay}} | 128 | {{#if supportDeliveryPay}} |
129 | <input value="2" {{#if deliveryPay.checked}}checked{{/if}} class="radio {{#if deliveryPay.checked}}checked{{/if}}" name="pay-type" type="radio" id="" data-pay="{{deliveryPay.paymentId}}"/> | 129 | <input value="2" {{#if deliveryPay.checked}}checked{{/if}} class="radio {{#if deliveryPay.checked}}checked{{/if}}" name="pay-type" type="radio" id="" data-pay="{{deliveryPay.paymentId}}"/> |
130 | {{/if}} | 130 | {{/if}} |
131 | <label for="">货到付款</label> | 131 | <label for="">货到付款</label> |
132 | - <span class="pay-type-tips">注:订单中有限量商品、预售商品、化妆品或者订单金额超过5000元不可以选择货到付款。</span> | 132 | + <span class="pay-type-tips"> |
133 | + {{#if packages}} | ||
134 | + 注:您订单中的商品暂不支持货到付款,请您选择在线支付。 | ||
135 | + {{^}} | ||
136 | + 注:{{paymentInCashInfo}} | ||
137 | + {{/if}} | ||
138 | + </span> | ||
133 | </li> | 139 | </li> |
134 | </ul> | 140 | </ul> |
135 | 141 | ||
@@ -141,7 +147,7 @@ | @@ -141,7 +147,7 @@ | ||
141 | <label for="">{{desc}}</label> | 147 | <label for="">{{desc}}</label> |
142 | </li> | 148 | </li> |
143 | {{/each}} | 149 | {{/each}} |
144 | - | 150 | + |
145 | <li class="pay-dashed-hr pay-type-tips">声明:我们会努力按照您指定的时间配送,但因为天气、交通等各类因素影响,您的订单有可能会有延误现象,敬请谅解!</li> | 151 | <li class="pay-dashed-hr pay-type-tips">声明:我们会努力按照您指定的时间配送,但因为天气、交通等各类因素影响,您的订单有可能会有延误现象,敬请谅解!</li> |
146 | 152 | ||
147 | <li> | 153 | <li> |
@@ -173,6 +179,48 @@ | @@ -173,6 +179,48 @@ | ||
173 | </div> | 179 | </div> |
174 | </div> | 180 | </div> |
175 | </div> | 181 | </div> |
182 | + <!-- 订单提示--> | ||
183 | + | ||
184 | + {{#if packages}} | ||
185 | + <div id="differentOrder" class="differentOrder"> | ||
186 | + <p class="warn"> | ||
187 | + 温馨提示:您购买的商品<span class="red">分属不同的仓库</span>,需要调拨,将被拆分为多个包裹送达 | ||
188 | + <span class="why"> | ||
189 | + </span> | ||
190 | + </p> | ||
191 | + <div id="differentBag" class="differentBag"> | ||
192 | + {{#each packages}} | ||
193 | + <div class="bag"> | ||
194 | + <h3> | ||
195 | + {{title}} | ||
196 | + </h3> | ||
197 | + <p class="pre"> | ||
198 | + </p> | ||
199 | + <div class="bagDetil"> | ||
200 | + <ul> | ||
201 | + {{#each goodlist}} | ||
202 | + <li > | ||
203 | + <img src={{src}}/> | ||
204 | + {{#if goodsType}} | ||
205 | + <p class="{{classname}}" >{{goodsType}}</p> | ||
206 | + {{/if}} | ||
207 | + </li> | ||
208 | + {{/each}} | ||
209 | + </ul> | ||
210 | + </div> | ||
211 | + <p class="next"> | ||
212 | + </p> | ||
213 | + {{#if fee}} | ||
214 | + <p class="express-fee">运费:¥{{fee}}元(原价{{orign}}元,优惠{{count}}元)</p> | ||
215 | + {{else}} | ||
216 | + <p class="express-fee">运费:¥0.00元</p> | ||
217 | + {{/if}} | ||
218 | + </div> | ||
219 | + {{/each}} | ||
220 | + | ||
221 | + </div> | ||
222 | + </div> | ||
223 | + {{/if}} | ||
176 | <div class="order-pay"> | 224 | <div class="order-pay"> |
177 | <div class="pay-wapper"> | 225 | <div class="pay-wapper"> |
178 | <table> | 226 | <table> |
@@ -214,7 +262,7 @@ | @@ -214,7 +262,7 @@ | ||
214 | <span class="vipPrice">(VIP)</span> | 262 | <span class="vipPrice">(VIP)</span> |
215 | {{/isVipPrice}} | 263 | {{/isVipPrice}} |
216 | </td> | 264 | </td> |
217 | - <td>{{yohoIcon}}</td> | 265 | + <td>{{yohoIcon}}个</td> |
218 | <td>{{productNum}}</td> | 266 | <td>{{productNum}}</td> |
219 | <td class="cart-sub-total {{#xForOne}}xforone{{/xForOne}}"> | 267 | <td class="cart-sub-total {{#xForOne}}xforone{{/xForOne}}"> |
220 | {{#if xForOne}} | 268 | {{#if xForOne}} |
@@ -259,13 +307,16 @@ | @@ -259,13 +307,16 @@ | ||
259 | <label for="isPPY">是</label> | 307 | <label for="isPPY">是</label> |
260 | <input name="isPP" id="isPPN" type="radio" value="N"> | 308 | <input name="isPP" id="isPPN" type="radio" value="N"> |
261 | <label for="isPPN">否</label> | 309 | <label for="isPPN">否</label> |
262 | - (如:送朋友的商品可不打印价格哦!) | 310 | + (如:送朋友的商品可不打印价格哦!) |
263 | </p> | 311 | </p> |
264 | </div> | 312 | </div> |
265 | </dd> | 313 | </dd> |
266 | </dl> | 314 | </dl> |
267 | </div> | 315 | </div> |
268 | <div class="play-right"> | 316 | <div class="play-right"> |
317 | + <div class="back-coin"> | ||
318 | + <a href="/help/?category_id=87" class="yoho-coin" target="_blank"></a>共返YOHO币:{{totalYoho}}个 | ||
319 | + </div> | ||
269 | <ul class="play-total"> | 320 | <ul class="play-total"> |
270 | {{#each promotionFormulaList}} | 321 | {{#each promotionFormulaList}} |
271 | <li class="{{#if isExpress}}total-express-w{{/if}}"> | 322 | <li class="{{#if isExpress}}total-express-w{{/if}}"> |
@@ -330,9 +381,9 @@ | @@ -330,9 +381,9 @@ | ||
330 | </div> | 381 | </div> |
331 | {{/if}} | 382 | {{/if}} |
332 | </div> | 383 | </div> |
333 | - </div> | ||
334 | </div> | 384 | </div> |
335 | - | 385 | + </div> |
386 | + | ||
336 | <div class="to-play"> | 387 | <div class="to-play"> |
337 | <p>您需要实际支付金额:<em>{{lastOrderAmount}}</em>元</p> | 388 | <p>您需要实际支付金额:<em>{{lastOrderAmount}}</em>元</p> |
338 | <div class="btn-group clearfix"> | 389 | <div class="btn-group clearfix"> |
@@ -343,4 +394,4 @@ | @@ -343,4 +394,4 @@ | ||
343 | {{/ orderEnsure}} | 394 | {{/ orderEnsure}} |
344 | <div class="loading"><span></span>请稍后...</div> | 395 | <div class="loading"><span></span>请稍后...</div> |
345 | </div> | 396 | </div> |
346 | -{{> layout/footer}} | ||
397 | +{{> layout/footer}} |
1 | -{{> layout/header}} | ||
2 | -<div class="order-detail-page me-page yoho-page clearfix"> | ||
3 | - {{# meOrderDetail}} | ||
4 | - {{> home/path}} | ||
5 | - | ||
6 | - {{> home/navigation}} | ||
7 | - | ||
8 | - <div class="me-main"> | ||
9 | - <div class="order-detail block" data-id="{{orderNum}}"> | ||
10 | - <h2 class="title"></h2> | ||
11 | - | ||
12 | - <div class="status"> | ||
13 | - <p> | ||
14 | - 订单编号: | ||
15 | - <em>{{orderNum}}</em> | ||
16 | - </p> | ||
17 | - <p class="cur-status"> | ||
18 | - 当前状态:{{curStatus}} | ||
19 | - </p> | ||
20 | - {{#if complete}} | ||
21 | - <p class="complete-tip">订单已经完成,感谢你在YOHO商城购物,欢迎您对本次交易及所购商品进行评价。</p> | ||
22 | - {{/if}} | ||
23 | - | ||
24 | - {{#if operation.goPay}} | ||
25 | - <a class="go-pay oo-btn" href="{{operation.goPay}}">立即付款</a> | ||
26 | - {{/if}} | ||
27 | - </div> | ||
28 | - | ||
29 | - <div class="detail-info{{#if virtualGoods}} virtual-detail{{/unless}}"> | ||
30 | - {{# progress}} | ||
31 | - <div class="order-progress"> | ||
32 | - <div class="progress-box"> | ||
33 | - <div class="outter-progress"> | ||
34 | - <div class="inner-progress" style="width: {{percent}};"></div> | ||
35 | - </div> | ||
36 | - <ul class="clearfix"> | ||
37 | - {{#each middleStatus}} | ||
38 | - <li class="pg-{{@index}}{{#if cur}} cur{{/if}}"> | ||
39 | - {{name}} | ||
40 | - {{#if date}} | ||
41 | - <span class="date">{{date}}</span> | ||
42 | - {{/if}} | ||
43 | - </li> | ||
44 | - {{/each}} | ||
45 | - </ul> | ||
46 | - </div> | ||
47 | - </div> | ||
48 | - {{/ progress}} | ||
49 | - | ||
50 | - {{# traceOrder}} | ||
51 | - <div class="trace-order"> | ||
52 | - <p class="sub-title"> | ||
53 | - <span class="icon"></span> | ||
54 | - 订单追踪 | ||
55 | - </p> | ||
56 | - <div class="content"> | ||
57 | - <p>下单时间:{{orderDate}}</p> | ||
58 | - {{#if logisticsCompany}} | ||
59 | - <p>物流公司:{{logisticsCompany}}</p> | ||
60 | - {{/if}} | ||
61 | - {{#if courierNumbe}} | ||
62 | - <p>快递单号:{{courierNumbe}}</p> | ||
63 | - {{/if}} | ||
64 | - <table> | ||
65 | - <thead> | ||
66 | - <th class="handle-time">处理时间</th> | ||
67 | - <th class="recive-place">接收地点</th> | ||
68 | - <th class="logistics-info">物流信息</th> | ||
69 | - </thead> | ||
70 | - <tbody> | ||
71 | - {{# logistics}} | ||
72 | - <tr> | ||
73 | - {{#each .}} | ||
74 | - <td> | ||
75 | - {{.}} | ||
76 | - </td> | ||
77 | - {{/each}} | ||
78 | - </tr> | ||
79 | - {{/ logistics}} | ||
80 | - </tbody> | ||
81 | - </table> | ||
82 | - </div> | ||
83 | - </div> | ||
84 | - {{/ traceOrder}} | ||
85 | - | ||
86 | - {{# orderInfo}} | ||
87 | - <div class="order-info"> | ||
88 | - <p class="sub-title"> | ||
89 | - <span class="icon"></span> | ||
90 | - 订单信息 | ||
91 | - </p> | ||
92 | - <div class="content"> | ||
93 | - <p>收货人:{{receiver}}</p> | ||
94 | - <p>收货地址:{{address}}</p> | ||
95 | - <p>联系电话:{{phone}}</p> | ||
96 | - </div> | ||
97 | - </div> | ||
98 | - {{/ orderInfo}} | ||
99 | - | ||
100 | - <div class="order-remark"> | ||
101 | - <p class="sub-title"> | ||
102 | - <span class="icon"></span> | ||
103 | - 备注 | ||
104 | - </p> | ||
105 | - <p class="content"> | ||
106 | - {{remark}} | ||
107 | - </p> | ||
108 | - </div> | ||
109 | - | ||
110 | - {{# noramlPayMode}} | ||
111 | - <div class="pay-mode"> | ||
112 | - <p class="sub-title"> | ||
113 | - <span class="icon"></span> | ||
114 | - 支付及配送方式 | ||
115 | - </p> | ||
116 | - <div class="content"> | ||
117 | - <p>支付类型:{{payMode}}</p> | ||
118 | - {{#if payWay}} | ||
119 | - <p>支付方式:{{payWay}}</p> | ||
120 | - {{/if}} | ||
121 | - <p>送货上门时间:{{deliverTime}}</p> | ||
122 | - </div> | ||
123 | - </div> | ||
124 | - {{/ noramlPayMode}} | ||
125 | - | ||
126 | - {{# virtualPayMode}} | ||
127 | - <div class="pay-mode virtual-pay-mode"> | ||
128 | - <p class="sub-title"> | ||
129 | - <span class="icon"></span> | ||
130 | - 付款方式 | ||
131 | - </p> | ||
132 | - <div class="content"> | ||
133 | - <span>付款方式:{{payMode}}</span> | ||
134 | - <span>电话号码:{{phone}}</span> | ||
135 | - </div> | ||
136 | - </div> | ||
137 | - {{/ virtualPayMode}} | ||
138 | - | ||
139 | - <div class="good-list"> | ||
140 | - <p class="sub-title"> | ||
141 | - <span class="icon"></span> | ||
142 | - 商品清单 | ||
143 | - </p> | ||
144 | - <div class="content"> | ||
145 | - <table> | ||
146 | - <thead> | ||
147 | - <th class="product-info">商品信息</th> | ||
148 | - <th class="good-price">单价(元)</th> | ||
149 | - <th class="yoho-coin"> | ||
150 | - 返YOHO币 | ||
151 | - <a target="_blank" href="{{yohoCoinUrl}}"></a> | ||
152 | - </th> | ||
153 | - <th class="num">数量</th> | ||
154 | - <th class="sum">小计(元)</th> | ||
155 | - </thead> | ||
156 | - <tbody> | ||
157 | - {{# goods}} | ||
158 | - <tr> | ||
159 | - <td> | ||
160 | - <a class="thumb-link" href="{{url}}" target="_blank"> | ||
161 | - <img class="thumb" src="{{img}}"> | ||
162 | - {{> home/order-goods-tags}} | ||
163 | - </a> | ||
164 | - <p class="name-color-size"> | ||
165 | - <a class="name" href="{{url}}" target="_blank">{{name}}</a> | ||
166 | - {{#if color}} | ||
167 | - 颜色:{{color}} | ||
168 | - {{/if}} | ||
169 | - | ||
170 | - {{#if size}} | ||
171 | - 尺码:{{size}} | ||
172 | - {{/if}} | ||
173 | - | ||
174 | - {{#if date}} | ||
175 | - 日期:{{date}} | ||
176 | - {{/if}} | ||
177 | - </p> | ||
178 | - </td> | ||
179 | - <td>{{price}}</td> | ||
180 | - <td>{{coin}}</td> | ||
181 | - <td>{{num}}</td> | ||
182 | - <td>{{sum}}</td> | ||
183 | - </tr> | ||
184 | - {{/ goods}} | ||
185 | - </tbody> | ||
186 | - </table> | ||
187 | - <div class="order-balance"> | ||
188 | - {{#each orderBalance}} | ||
189 | - <p> | ||
190 | - {{promotion}}: | ||
191 | - {{#if @first}} | ||
192 | - <em>{{account}}</em> | ||
193 | - {{^}} | ||
194 | - {{#if @last}} | ||
195 | - <em class="payment">{{account}}</em> | ||
196 | - {{^}} | ||
197 | - {{account}} | ||
198 | - {{/if}} | ||
199 | - {{/if}} | ||
200 | - 元 | ||
201 | - </p> | ||
202 | - {{/each}} | ||
203 | - </div> | ||
204 | - </div> | ||
205 | - </div> | ||
206 | - | ||
207 | - {{# operation}} | ||
208 | - <div class="order-operation clearfix"> | ||
209 | - {{#if paid}} | ||
210 | - <p> | ||
211 | - <span class="success-icon oo-icon"></span> | ||
212 | - 订单已支付 | ||
213 | - </p> | ||
214 | - {{/if}} | ||
215 | - | ||
216 | - {{#if goPay}} | ||
217 | - <a class="go-pay oo-btn" href="{{goPay}}" target="_blank" >立即付款</a> | ||
218 | - {{/if}} | ||
219 | - | ||
220 | - {{#if cancelOrder}} | ||
221 | - <span class="cancel-order oo-btn">取消订单</span> | ||
222 | - {{/if}} | ||
223 | - | ||
224 | - {{#if shipped}} | ||
225 | - <span id="receive-confirm" class="confirm-received oo-btn">确认收货</span> | ||
226 | - {{/if}} | ||
227 | - | ||
228 | - {{#if cancel}} | ||
229 | - <p> | ||
230 | - <span class="cancel-icon oo-icon"></span> | ||
231 | - 订单已取消 | ||
232 | - </p> | ||
233 | - {{/if}} | ||
234 | - | ||
235 | - {{#if checkQrCode}} | ||
236 | - <a class="check-qrcode oo-btn" href="{{checkQrCode}}" target="_blank">查看二维码</a> | ||
237 | - {{/if}} | ||
238 | - </div> | ||
239 | - {{/ operation}} | ||
240 | - </div> | ||
241 | - </div> | ||
242 | - </div> | ||
243 | - {{/ meOrderDetail}} | ||
244 | - {{> home/order-cancel-tpl}} | ||
245 | -</div> | 1 | +{{> layout/header}} |
2 | +<div class="order-detail-page me-page yoho-page clearfix"> | ||
3 | + {{# meOrderDetail}} | ||
4 | + {{> home/path}} | ||
5 | + | ||
6 | + {{> home/navigation}} | ||
7 | + | ||
8 | + <div class="me-main"> | ||
9 | + <div class="order-detail block" data-id="{{orderNum}}"> | ||
10 | + <h2 class="title"></h2> | ||
11 | + | ||
12 | + <div class="status"> | ||
13 | + <p> | ||
14 | + 订单编号: | ||
15 | + <em>{{orderNum}}</em> | ||
16 | + </p> | ||
17 | + <p class="cur-status"> | ||
18 | + 当前状态:{{curStatus}} | ||
19 | + </p> | ||
20 | + {{#if complete}} | ||
21 | + <p class="complete-tip">订单已经完成,感谢你在YOHO商城购物,欢迎您对本次交易及所购商品进行评价。</p> | ||
22 | + {{/if}} | ||
23 | + | ||
24 | + {{#if operation.goPay}} | ||
25 | + <a class="go-pay oo-btn" href="{{operation.goPay}}">立即付款</a> | ||
26 | + {{/if}} | ||
27 | + </div> | ||
28 | + | ||
29 | + <div class="detail-info{{#if virtualGoods}} virtual-detail{{/unless}}"> | ||
30 | + {{# progress}} | ||
31 | + <div class="order-progress"> | ||
32 | + <div class="progress-box"> | ||
33 | + <div class="outter-progress"> | ||
34 | + <div class="inner-progress" style="width: {{percent}};"></div> | ||
35 | + </div> | ||
36 | + <ul class="clearfix"> | ||
37 | + {{#each middleStatus}} | ||
38 | + <li class="pg-{{@index}}{{#if cur}} cur{{/if}}"> | ||
39 | + {{name}} | ||
40 | + {{#if date}} | ||
41 | + <span class="date">{{date}}</span> | ||
42 | + {{/if}} | ||
43 | + </li> | ||
44 | + {{/each}} | ||
45 | + </ul> | ||
46 | + </div> | ||
47 | + </div> | ||
48 | + {{/ progress}} | ||
49 | + | ||
50 | + {{# traceOrder}} | ||
51 | + <div class="trace-order"> | ||
52 | + <p class="sub-title"> | ||
53 | + <span class="icon"></span> | ||
54 | + 订单追踪 | ||
55 | + </p> | ||
56 | + <div class="content"> | ||
57 | + <p>下单时间:{{orderDate}}</p> | ||
58 | + {{#if logisticsCompany}} | ||
59 | + <p>物流公司:{{logisticsCompany}}</p> | ||
60 | + {{/if}} | ||
61 | + {{#if courierNumbe}} | ||
62 | + <p>快递单号:{{courierNumbe}}</p> | ||
63 | + {{/if}} | ||
64 | + <table> | ||
65 | + <thead> | ||
66 | + <th class="handle-time">处理时间</th> | ||
67 | + <th class="recive-place">接收地点</th> | ||
68 | + <th class="logistics-info">物流信息</th> | ||
69 | + </thead> | ||
70 | + <tbody> | ||
71 | + {{# logistics}} | ||
72 | + <tr> | ||
73 | + {{#each .}} | ||
74 | + <td> | ||
75 | + {{.}} | ||
76 | + </td> | ||
77 | + {{/each}} | ||
78 | + </tr> | ||
79 | + {{/ logistics}} | ||
80 | + </tbody> | ||
81 | + </table> | ||
82 | + </div> | ||
83 | + </div> | ||
84 | + {{/ traceOrder}} | ||
85 | + | ||
86 | + {{# orderInfo}} | ||
87 | + <div class="order-info"> | ||
88 | + <p class="sub-title"> | ||
89 | + <span class="icon"></span> | ||
90 | + 订单信息 | ||
91 | + </p> | ||
92 | + <div class="content"> | ||
93 | + <p>收货人:{{receiver}}</p> | ||
94 | + <p>收货地址:{{address}}</p> | ||
95 | + <p>联系电话:{{phone}}</p> | ||
96 | + </div> | ||
97 | + </div> | ||
98 | + {{/ orderInfo}} | ||
99 | + | ||
100 | + <div class="order-remark"> | ||
101 | + <p class="sub-title"> | ||
102 | + <span class="icon"></span> | ||
103 | + 备注 | ||
104 | + </p> | ||
105 | + <p class="content"> | ||
106 | + {{remark}} | ||
107 | + </p> | ||
108 | + </div> | ||
109 | + | ||
110 | + {{# noramlPayMode}} | ||
111 | + <div class="pay-mode"> | ||
112 | + <p class="sub-title"> | ||
113 | + <span class="icon"></span> | ||
114 | + 支付及配送方式 | ||
115 | + </p> | ||
116 | + <div class="content"> | ||
117 | + <p>支付类型:{{payMode}}</p> | ||
118 | + {{#if payWay}} | ||
119 | + <p>支付方式:{{payWay}}</p> | ||
120 | + {{/if}} | ||
121 | + <p>送货上门时间:{{deliverTime}}</p> | ||
122 | + </div> | ||
123 | + </div> | ||
124 | + {{/ noramlPayMode}} | ||
125 | + | ||
126 | + {{# virtualPayMode}} | ||
127 | + <div class="pay-mode virtual-pay-mode"> | ||
128 | + <p class="sub-title"> | ||
129 | + <span class="icon"></span> | ||
130 | + 付款方式 | ||
131 | + </p> | ||
132 | + <div class="content"> | ||
133 | + <span>付款方式:{{payMode}}</span> | ||
134 | + <span>电话号码:{{phone}}</span> | ||
135 | + </div> | ||
136 | + </div> | ||
137 | + {{/ virtualPayMode}} | ||
138 | + <div class="good-list"> | ||
139 | + <p class="sub-title"> | ||
140 | + <span class="icon"></span> | ||
141 | + 商品清单 | ||
142 | + </p> | ||
143 | + <!--订单不同包裹提示--> | ||
144 | + {{#if packages}} | ||
145 | + <div id="differentOrder" class="differentOrder"> | ||
146 | + <p class="warn"> | ||
147 | + 温馨提示:您购买的商品<span class="red">分属不同的仓库</span>,需要调拨,将被拆分为多个包裹送达 | ||
148 | + <span class="why"> | ||
149 | + </span> | ||
150 | + </p> | ||
151 | + <div id="differentBag" class="differentBag"> | ||
152 | + {{#each packages}} | ||
153 | + <div class="bag"> | ||
154 | + <h3> | ||
155 | + {{title}} | ||
156 | + </h3> | ||
157 | + <p class="pre"> | ||
158 | + </p> | ||
159 | + <div class="bagDetil"> | ||
160 | + <ul> | ||
161 | + {{#each goodlist}} | ||
162 | + <li> | ||
163 | + <a href={{link}}> | ||
164 | + <img src={{src}}/> | ||
165 | + | ||
166 | + </a> | ||
167 | + {{#if goodsType}} | ||
168 | + <p class="{{classname}}" >{{goodsType}}</p> | ||
169 | + {{/if}} | ||
170 | + </li> | ||
171 | + {{/each}} | ||
172 | + </ul> | ||
173 | + </div> | ||
174 | + <p class="next"> | ||
175 | + </p> | ||
176 | + {{#if fee}} | ||
177 | + <p>运费:¥{{fee}}元(原价{{orign}}元,优惠{{count}}元)</p> | ||
178 | + {{else}} | ||
179 | + <p>运费:¥0.00元</p> | ||
180 | + {{/if}} | ||
181 | + </div> | ||
182 | + {{/each}} | ||
183 | + </div> | ||
184 | + </div> | ||
185 | + {{/if}} | ||
186 | + <div class="content"> | ||
187 | + <table> | ||
188 | + <thead> | ||
189 | + <th class="product-info">商品信息</th> | ||
190 | + <th class="good-price">单价(元)</th> | ||
191 | + <th class="yoho-coin"> | ||
192 | + 返YOHO币 | ||
193 | + <a target="_blank" href="{{yohoCoinUrl}}"></a> | ||
194 | + </th> | ||
195 | + <th class="num">数量</th> | ||
196 | + <th class="sum">小计(元)</th> | ||
197 | + </thead> | ||
198 | + <tbody> | ||
199 | + {{# goods}} | ||
200 | + <tr> | ||
201 | + <td> | ||
202 | + <a class="thumb-link" href="{{url}}" target="_blank"> | ||
203 | + <img class="thumb" src="{{img}}"> | ||
204 | + {{> home/order-goods-tags}} | ||
205 | + </a> | ||
206 | + <p class="name-color-size"> | ||
207 | + <a class="name" href="{{url}}" target="_blank">{{name}}</a> | ||
208 | + {{#if color}} | ||
209 | + 颜色:{{color}} | ||
210 | + {{/if}} | ||
211 | + | ||
212 | + {{#if size}} | ||
213 | + 尺码:{{size}} | ||
214 | + {{/if}} | ||
215 | + | ||
216 | + {{#if date}} | ||
217 | + 日期:{{date}} | ||
218 | + {{/if}} | ||
219 | + </p> | ||
220 | + </td> | ||
221 | + <td>{{price}}</td> | ||
222 | + <td>{{coin}}个</td> | ||
223 | + <td>{{num}}</td> | ||
224 | + <td>{{sum}}</td> | ||
225 | + </tr> | ||
226 | + {{/ goods}} | ||
227 | + </tbody> | ||
228 | + </table> | ||
229 | + <div class="order-balance"> | ||
230 | + <p class="back-coin"> | ||
231 | + <a href="/help/?category_id=87" class="yoho-coin" target="_blank"></a>共返YOHO币:{{totalYoho}}个 | ||
232 | + </p> | ||
233 | + {{#each orderBalance}} | ||
234 | + <p> | ||
235 | + {{promotion}}: | ||
236 | + {{#if @first}} | ||
237 | + <em>{{account}}</em> | ||
238 | + {{^}} | ||
239 | + {{#if @last}} | ||
240 | + <em class="payment">{{account}}</em> | ||
241 | + {{^}} | ||
242 | + {{account}} | ||
243 | + {{/if}} | ||
244 | + {{/if}} | ||
245 | + 元 | ||
246 | + </p> | ||
247 | + {{/each}} | ||
248 | + </div> | ||
249 | + </div> | ||
250 | + </div> | ||
251 | + | ||
252 | + {{# operation}} | ||
253 | + <div class="order-operation clearfix"> | ||
254 | + {{#if paid}} | ||
255 | + <p> | ||
256 | + <span class="success-icon oo-icon"></span> | ||
257 | + 订单已支付 | ||
258 | + </p> | ||
259 | + {{/if}} | ||
260 | + | ||
261 | + {{#if goPay}} | ||
262 | + <a class="go-pay oo-btn" href="{{goPay}}" target="_blank" >立即付款</a> | ||
263 | + {{/if}} | ||
264 | + | ||
265 | + {{#if cancelOrder}} | ||
266 | + <span class="cancel-order oo-btn">取消订单</span> | ||
267 | + {{/if}} | ||
268 | + | ||
269 | + {{#if shipped}} | ||
270 | + <span id="receive-confirm" class="confirm-received oo-btn">确认收货</span> | ||
271 | + {{/if}} | ||
272 | + | ||
273 | + {{#if cancel}} | ||
274 | + <p> | ||
275 | + <span class="cancel-icon oo-icon"></span> | ||
276 | + 订单已取消 | ||
277 | + </p> | ||
278 | + {{/if}} | ||
279 | + | ||
280 | + {{#if checkQrCode}} | ||
281 | + <a class="check-qrcode oo-btn" href="{{checkQrCode}}" target="_blank">查看二维码</a> | ||
282 | + {{/if}} | ||
283 | + </div> | ||
284 | + {{/ operation}} | ||
285 | + </div> | ||
286 | + </div> | ||
287 | + </div> | ||
288 | + {{/ meOrderDetail}} | ||
289 | + {{> home/order-cancel-tpl}} | ||
290 | +</div> | ||
246 | {{> layout/footer}} | 291 | {{> layout/footer}} |
1 | +{{> product/goods-list}} |
1 | +{{> layout/header}} | ||
2 | +<div class="shop-index-page product-list-page product-page yoho-page center-content home-page"> | ||
3 | + <div class="center-content clearfix"> | ||
4 | + {{> layout/path-nav}} | ||
5 | + | ||
6 | + {{> product/shop-header}} | ||
7 | + | ||
8 | + <div class="list-left pull-left"> | ||
9 | + {{> product/left-content}} | ||
10 | + | ||
11 | + {{> product/shop-sidebar}} | ||
12 | + </div> | ||
13 | + <div class="list-right pull-right"> | ||
14 | + {{#if coupon}} | ||
15 | + <div class="coupon clearfix"> | ||
16 | + <div class="coupon-title"> | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + {{/if}} | ||
20 | + {{#if largeSlideImg}} | ||
21 | + <div class="slider-wrap clearfix"> | ||
22 | + <div class="slider-left pull-left"> | ||
23 | + <div class="slide-wrapper"> | ||
24 | + <ul> | ||
25 | + {{#largeSlideImg}} | ||
26 | + <li> | ||
27 | + <a href="{{url}}"><img src="{{img}}"></a> | ||
28 | + </li> | ||
29 | + {{/largeSlideImg}} | ||
30 | + </ul> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="slider-right pull-right"> | ||
34 | + {{#oneRowTwoColImages}} | ||
35 | + <a class="slider-item" href="{{url}}"><img src="{{img}}"></a> | ||
36 | + {{/oneRowTwoColImages}} | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + {{/if}} | ||
40 | + {{#newArrivel}} | ||
41 | + <div class="new-arrivel clearfix"> | ||
42 | + {{> index/floor-header}} | ||
43 | + {{> product/shop-single-list}} | ||
44 | + </div> | ||
45 | + {{/newArrivel}} | ||
46 | + {{#hotSingle}} | ||
47 | + <div class="hot-single clearfix"> | ||
48 | + {{> index/floor-header}} | ||
49 | + {{> product/shop-single-list}} | ||
50 | + </div> | ||
51 | + {{/hotSingle}} | ||
52 | + {{#allGoods}} | ||
53 | + <div class="all-goods clearfix"> | ||
54 | + {{> index/floor-header}} | ||
55 | + | ||
56 | + <div class="goods-wrap"> | ||
57 | + {{> product/goods-list}} | ||
58 | + </div> | ||
59 | + | ||
60 | + <div class="loading"> | ||
61 | + <a href="{{href}}" target= "_blank">查看更多</a> | ||
62 | + </div> | ||
63 | + </div> | ||
64 | + {{/allGoods}} | ||
65 | + {{#trendInfo}} | ||
66 | + <div class="trend-info clearfix"> | ||
67 | + {{> index/floor-header}} | ||
68 | + | ||
69 | + <ul class="trend-list"> | ||
70 | + {{#each trendList}} | ||
71 | + <li> | ||
72 | + <a href="{{href}}"> | ||
73 | + <img src="{{src}}" /> | ||
74 | + <div class="main-title">{{mainTitle}}</div> | ||
75 | + <div class="sub-title">{{Subtitle}}</div> | ||
76 | + </a> | ||
77 | + </li> | ||
78 | + {{/each}} | ||
79 | + </ul> | ||
80 | + </div> | ||
81 | + {{/trendInfo}} | ||
82 | + </div> | ||
83 | + </div> | ||
84 | +</div> | ||
85 | +{{> layout/footer}} |
1 | +{{> layout/header}} | ||
2 | +<div class="shop-index-page product-list-page product-page yoho-page center-content"> | ||
3 | + <div class="center-content clearfix"> | ||
4 | + {{> layout/path-nav}} | ||
5 | + | ||
6 | + {{> product/shop-header}} | ||
7 | + | ||
8 | + <div class="list-left pull-left"> | ||
9 | + {{> product/left-content}} | ||
10 | + | ||
11 | + {{> product/shop-sidebar}} | ||
12 | + </div> | ||
13 | + <div class="list-right pull-right"> | ||
14 | + {{> product/shop-entry}} | ||
15 | + | ||
16 | + {{> product/standard-content}} | ||
17 | + | ||
18 | + {{> product/latest-walk}} | ||
19 | + </div> | ||
20 | + </div> | ||
21 | +</div> | ||
22 | +{{> layout/footer}} |
@@ -15,7 +15,10 @@ | @@ -15,7 +15,10 @@ | ||
15 | <div class="li-1">订单号</div> | 15 | <div class="li-1">订单号</div> |
16 | <div class="li-2">实际支付金额</div> | 16 | <div class="li-2">实际支付金额</div> |
17 | <div class="li-3">支付方式</div> | 17 | <div class="li-3">支付方式</div> |
18 | - <div class="li-4">获得YOHO币</div> | 18 | + <div class="li-4"> |
19 | + <a href="/help/?category_id=87" class="yoho-coin" target="_blank"></a> | ||
20 | + 共返YOHO币 | ||
21 | + </div> | ||
19 | <div class="li-5">获得VIP累计金额</div> | 22 | <div class="li-5">获得VIP累计金额</div> |
20 | </div> | 23 | </div> |
21 | <div class="list"> | 24 | <div class="list"> |
@@ -29,7 +32,7 @@ | @@ -29,7 +32,7 @@ | ||
29 | </div> | 32 | </div> |
30 | <div class="li-3 pay-mode">货到付款</div> | 33 | <div class="li-3 pay-mode">货到付款</div> |
31 | <div class="li-4"> | 34 | <div class="li-4"> |
32 | - <strong class="f-rz">{{yohoCoin}}</strong> | 35 | + <strong class="f-rz">{{yohoCoin}}</strong>个 |
33 | <a href="{{yohoCoinUrl}}" class="f-e" target="_blank">YOHO币能做什么</a> | 36 | <a href="{{yohoCoinUrl}}" class="f-e" target="_blank">YOHO币能做什么</a> |
34 | </div> | 37 | </div> |
35 | <div class="li-5"> | 38 | <div class="li-5"> |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | {{^}} | 14 | {{^}} |
15 | <ul> | 15 | <ul> |
16 | {{# brands}} | 16 | {{# brands}} |
17 | - <li class="fav-brand fav-row" data-id="{{id}}"> | 17 | + <li class="fav-brand fav-row" data-id="{{id}}" data-shopid="{{shop_id}}" data-brandOrShopType="{{brandOrShopType}}"> |
18 | <div class="checkbox"> | 18 | <div class="checkbox"> |
19 | <input type="checkbox"> | 19 | <input type="checkbox"> |
20 | </div> | 20 | </div> |
@@ -304,5 +304,10 @@ | @@ -304,5 +304,10 @@ | ||
304 | seajs.use('js/coupon/coupon'); | 304 | seajs.use('js/coupon/coupon'); |
305 | </script> | 305 | </script> |
306 | {{/if}} | 306 | {{/if}} |
307 | - | 307 | +{{!-- 店铺首页 --}} |
308 | +{{#if shopIndexPage}} | ||
309 | + <script> | ||
310 | + seajs.use('js/product/shop-index'); | ||
311 | + </script> | ||
312 | +{{/if}} | ||
308 | 313 |
1 | +<div class="fixed-area"> | ||
2 | +{{# goodsMenu}} | ||
3 | + <div class="all-goods-menu"> | ||
4 | + <span class="menu-tag">所有商品</span> | ||
5 | + <ul class="menu-list"> | ||
6 | + {{#each menuList}} | ||
7 | + <li class="{{#if curMenu}} on {{/if}}"><a class="pjax" href="{{href}}">{{name}}</a></li> | ||
8 | + {{/each}} | ||
9 | + </ul> | ||
10 | + <a href="{{url}}" class="more">MORE</a> | ||
11 | + </div> | ||
12 | +{{/goodsMenu}} | ||
13 | + | ||
14 | +{{# opts}} | ||
15 | + <div class="sort-pager"> | ||
16 | + {{# sortType}} | ||
17 | + <a class="sort-type{{#if active}} active{{/if}} pjax" href="{{href}}"> | ||
18 | + {{name}} | ||
19 | + {{#if hasSortOrient}} | ||
20 | + {{#if active}} | ||
21 | + {{#if desc}} | ||
22 | + <span class="active-icon iconfont"></span> | ||
23 | + {{^}} | ||
24 | + <span class="active-icon iconfont"></span> | ||
25 | + {{/if}} | ||
26 | + {{^}} | ||
27 | + <span class="iconfont"></span> | ||
28 | + {{/if}} | ||
29 | + {{^}} | ||
30 | + <span class="iconfont"></span> | ||
31 | + {{/if}} | ||
32 | + </a> | ||
33 | + {{/ sortType}} | ||
34 | + | ||
35 | + {{#if list}} | ||
36 | + {{#if oldPage}} | ||
37 | + <div class="pager-wrap"> | ||
38 | + <p class="page-orient"> | ||
39 | + {{#if preHref}} | ||
40 | + <a class="pjax" href="{{preHref}}"> | ||
41 | + <span class="iconfont"></span> | ||
42 | + </a> | ||
43 | + {{^}} | ||
44 | + <span class="dis-icon iconfont"></span> | ||
45 | + {{/if}} | ||
46 | + | ||
47 | + <span> | ||
48 | + <i>{{curPage}}</i>/{{pageCount}} | ||
49 | + </span> | ||
50 | + | ||
51 | + {{#if nextHref}} | ||
52 | + <a class="pjax" href="{{nextHref}}"> | ||
53 | + <span class="iconfont"></span> | ||
54 | + </a> | ||
55 | + {{^}} | ||
56 | + <span class="dis-icon iconfont"></span> | ||
57 | + {{/if}} | ||
58 | + </p> | ||
59 | + </div> | ||
60 | + {{^}} | ||
61 | + <div class="page-nav"> | ||
62 | + {{#if preHref}} | ||
63 | + <a class="pjax" href="{{preHref}}"> | ||
64 | + <span class="page-prev"><i class="arrow-left"></i></span> | ||
65 | + </a> | ||
66 | + {{^}} | ||
67 | + <span class="page-prev"><i class="arrow-left"></i></span> | ||
68 | + {{/if}} | ||
69 | + | ||
70 | + {{#if nextHref}} | ||
71 | + <a class="pjax" href="{{nextHref}}"> | ||
72 | + <span class="page-next"> | ||
73 | + 下一页 | ||
74 | + <i class="arrow-right"></i> | ||
75 | + <i class="pages">{{curPage}}</i>/{{pageCount}} | ||
76 | + </span> | ||
77 | + </a> | ||
78 | + {{^}} | ||
79 | + <span class="page-next"> | ||
80 | + 下一页 | ||
81 | + <i class="arrow-right"></i> | ||
82 | + <i class="pages">{{curPage}}</i>/{{pageCount}} | ||
83 | + </span> | ||
84 | + {{/if}} | ||
85 | + </div> | ||
86 | + {{/if}} | ||
87 | + {{/if}} | ||
88 | + </div> | ||
89 | +{{/ opts}} | ||
90 | +</div> | ||
91 | + | ||
92 | +<div class="goods-container clearfix"> | ||
93 | + {{# list}} | ||
94 | + {{> product/good}} | ||
95 | + {{/list}} | ||
96 | + <div class="good-item-wrapper"> | ||
97 | + <div class="good-info-main"></div> | ||
98 | + <div class="good-select-color"></div> | ||
99 | + </div> | ||
100 | +</div> |
@@ -114,3 +114,17 @@ | @@ -114,3 +114,17 @@ | ||
114 | {{#if node}} | 114 | {{#if node}} |
115 | <div id="brand-card" class="brand-card" data-node="{{node}}"></div> | 115 | <div id="brand-card" class="brand-card" data-node="{{node}}"></div> |
116 | {{/if}} | 116 | {{/if}} |
117 | + | ||
118 | +{{!-- 水牌广告-基础模板 --}} | ||
119 | +{{#signboard}} | ||
120 | + <div class="sell-signboard left-modular"> | ||
121 | + <h2 class="title">{{title}}</h2> | ||
122 | + <ul class="left-list"> | ||
123 | + {{#each list}} | ||
124 | + <li> | ||
125 | + <a target="_blank" href="{{url}}"><img src="{{img}}" alt="{{title}}" /></a> | ||
126 | + </li> | ||
127 | + {{/each}} | ||
128 | + </ul> | ||
129 | + </div> | ||
130 | +{{/signboard}} |
1 | -{{# shopEntry}} | ||
2 | - <div class="shop-entry clearfix"> | ||
3 | - <a class="pull-left" href="{{home}}"> | ||
4 | - <img class="logo" src="{{logo}}"> | ||
5 | - </a> | 1 | +<div class="shop-entry-area"> |
2 | + {{# shopEntry}} | ||
3 | + <div class="shop-entry clearfix"> | ||
4 | + <a class="pull-left" href="{{home}}"> | ||
5 | + <img class="logo" src="{{logo}}"> | ||
6 | + </a> | ||
6 | 7 | ||
7 | - <div class="name pull-left"> | ||
8 | - <a class="shop-name" href="{{home}}">{{shopName}}</a> | ||
9 | - <p class="sorts"> | ||
10 | - {{#each sort}} | ||
11 | - <a href="{{href}}">{{name}}</a> | 8 | + <div class="name pull-left"> |
9 | + <a class="shop-name" href="{{home}}">{{shopName}}</a> | ||
10 | + <p class="sorts"> | ||
11 | + {{#each sort}} | ||
12 | + <a href="{{href}}">{{name}}</a> | ||
12 | 13 | ||
13 | - {{#unless @last}} | ||
14 | - / | ||
15 | - {{/unless}} | ||
16 | - {{/each}} | ||
17 | - </p> | ||
18 | - </div> | 14 | + {{#unless @last}} |
15 | + / | ||
16 | + {{/unless}} | ||
17 | + {{/each}} | ||
18 | + </p> | ||
19 | + </div> | ||
19 | 20 | ||
20 | - <a class="entry-btn pull-right" href="{{home}}"> | ||
21 | - 进入品牌店铺 | ||
22 | - <span class="iconfont"></span> | ||
23 | - </a> | ||
24 | - </div> | ||
25 | -{{/ shopEntry}} | 21 | + <a class="entry-btn pull-right" href="{{home}}"> |
22 | + 进入品牌店铺 | ||
23 | + <span class="iconfont"></span> | ||
24 | + </a> | ||
25 | + </div> | ||
26 | + {{/ shopEntry}} | ||
27 | +</div> |
1 | +{{# shopTopBanner}} | ||
2 | + <div class="shop-banner"> | ||
3 | + <div class="banner-img" style="height: {{bannerHeight}}px;background: url({{banner}})"></div> | ||
4 | + {{#if isShowShopName}} | ||
5 | + <div class="shop-name"> | ||
6 | + {{brandIntro.brandName}} | ||
7 | + </div> | ||
8 | + {{/if}} | ||
9 | + <div class="opt-wrap"> | ||
10 | + <div class="shop-intro"> | ||
11 | + <i class="shop-intro-ico"></i> | ||
12 | + 店铺介绍 | ||
13 | + </div> | ||
14 | + <div class="shop-collect" data-id="{{brandIntro.shopId}}"> | ||
15 | + <i class="shop-collect-ico {{#if brandIntro.isFavorite}}on{{/if}}"></i> | ||
16 | + <span class="shop-collect-text"> | ||
17 | + {{#if brandIntro.isFavorite}} | ||
18 | + 已收藏 | ||
19 | + {{else}} | ||
20 | + 收藏 | ||
21 | + {{/if}} | ||
22 | + </span> | ||
23 | + </div> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + {{#brandIntro}} | ||
27 | + <div class="pop-shop-intro"> | ||
28 | + <div class="shop-intro-bg"></div> | ||
29 | + <div class="shop-intro-area"> | ||
30 | + <i class="close-btn"></i> | ||
31 | + <div class="brand-cont"> | ||
32 | + <div class="intro-title"> | ||
33 | + <h2>{{brandName}}</h2> | ||
34 | + <p>品牌介绍</p> | ||
35 | + </div> | ||
36 | + <div class="intro-cont"> | ||
37 | + {{{brandCont}}} | ||
38 | + </div> | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + </div> | ||
42 | + {{/brandIntro}} | ||
43 | + <div class="mask"></div> | ||
44 | +{{/ shopTopBanner}} | ||
45 | + | ||
46 | +{{#if navigationBar}} | ||
47 | + <ul class="shop-nav clearfix"> | ||
48 | + {{#navigationBar}} | ||
49 | + <li class="nav-item {{#if @first}}first{{/if}} {{#if current}}current{{/if}}"> | ||
50 | + <a href="{{url}}"> | ||
51 | + {{name}} | ||
52 | + {{#if arrow}} | ||
53 | + <span class="iconfont"></span> | ||
54 | + {{/if}} | ||
55 | + </a> | ||
56 | + </li> | ||
57 | + {{/navigationBar}} | ||
58 | + </ul> | ||
59 | +{{/if}} |
1 | +{{#brandBrowse}} | ||
2 | + <div class="brand-collect left-modular"> | ||
3 | + <h2 class="title">{{title}}</h2> | ||
4 | + <ul class="left-list"> | ||
5 | + {{#each list}} | ||
6 | + <li class="{{#if cur}} on {{/if}}"><a href="{{url}}">{{brandName}}</a></li> | ||
7 | + {{/each}} | ||
8 | + </ul> | ||
9 | + </div> | ||
10 | +{{/brandBrowse}} | ||
11 | + | ||
12 | +{{#recommend}} | ||
13 | + <div class="classic-recommend left-modular"> | ||
14 | + <h2 class="title">{{title}}</h2> | ||
15 | + <ul class="left-list"> | ||
16 | + {{#each list}} | ||
17 | + <li> | ||
18 | + <a href="{{url}}"> | ||
19 | + <div class="classic-name"> | ||
20 | + {{#name}} | ||
21 | + <p class="name">{{.}}</p> | ||
22 | + {{/name}} | ||
23 | + {{#enName}} | ||
24 | + <p class="en-name">{{.}}</p> | ||
25 | + {{/enName}} | ||
26 | + </div> | ||
27 | + <img src="{{img}}" /> | ||
28 | + </a> | ||
29 | + </li> | ||
30 | + {{/each}} | ||
31 | + </ul> | ||
32 | + </div> | ||
33 | +{{/recommend}} | ||
34 | + | ||
35 | +{{#hotRecommend}} | ||
36 | + <div class="sell-recommend left-modular"> | ||
37 | + <h2 class="title">{{title}}</h2> | ||
38 | + <ul class="left-list"> | ||
39 | + {{#each list}} | ||
40 | + <li> | ||
41 | + <a target="_blank" href="{{url}}"><img src="{{img}}" alt="{{title}}" /></a> | ||
42 | + </li> | ||
43 | + {{/each}} | ||
44 | + </ul> | ||
45 | + </div> | ||
46 | +{{/hotRecommend}} |
1 | +<ul> | ||
2 | + {{#each list}} | ||
3 | + <li> | ||
4 | + <a class="item item-{{@index}}" href="{{url}}" target= "_blank"> | ||
5 | + <img class="lazy" data-original="{{img}}"/> | ||
6 | + <p class="title"> | ||
7 | + {{title}} | ||
8 | + </p> | ||
9 | + <p class="price"> | ||
10 | + {{price}} | ||
11 | + </p> | ||
12 | + {{#if index}} | ||
13 | + <span class="hat">{{index}}</span> | ||
14 | + {{/if}} | ||
15 | + </a> | ||
16 | + </li> | ||
17 | + {{/each}} | ||
18 | +</ul> |
This diff could not be displayed because it is too large.
web-static/dist/yohobuy/0.0.25/index.css
0 → 100644
This diff could not be displayed because it is too large.
web-static/dist/yohobuy/0.0.25/index.js
0 → 100644
This diff could not be displayed because it is too large.
web-static/dist/yohobuy/0.0.25/lib.js
0 → 100644
This diff could not be displayed because it is too large.

508 Bytes

573 Bytes

646 Bytes

141 Bytes

132 Bytes

12.6 KB

14.8 KB

1.17 KB

1.28 KB

253 Bytes

1.19 KB

13.8 KB
web-static/img/order/next.png
0 → 100644

508 Bytes
web-static/img/order/pre.png
0 → 100644

573 Bytes
web-static/img/order/why.png
0 → 100644

646 Bytes
web-static/img/product/arrow-left.png
0 → 100644

141 Bytes
web-static/img/product/arrow-right.png
0 → 100644

132 Bytes
web-static/img/product/coupon-title.png
0 → 100644

12.6 KB
web-static/img/product/hat.png
0 → 100644

14.8 KB

1.17 KB
web-static/img/product/shop-collection.png
0 → 100644

1.28 KB
web-static/img/product/shop-instro-close.png
0 → 100644

253 Bytes
web-static/img/product/shop-instro.png
0 → 100644

1.19 KB
web-static/img/sprite.product.png
0 → 100644

759 Bytes
@@ -392,7 +392,9 @@ $('#me-checkall').click(function() { | @@ -392,7 +392,9 @@ $('#me-checkall').click(function() { | ||
392 | 392 | ||
393 | //删除收藏 | 393 | //删除收藏 |
394 | $('.del-favorite').click(function(e) { | 394 | $('.del-favorite').click(function(e) { |
395 | - var id = $(this).closest('.fav-row').data('id'); | 395 | + var id = $(this).closest('.fav-row').data('id'), |
396 | + shopid = $(this).closest('.fav-row').data('shopid'), | ||
397 | + brandorshoptype = $(this).closest('.fav-row').data('brandorshoptype'); | ||
396 | 398 | ||
397 | e.preventDefault(); | 399 | e.preventDefault(); |
398 | 400 | ||
@@ -401,6 +403,8 @@ $('.del-favorite').click(function(e) { | @@ -401,6 +403,8 @@ $('.del-favorite').click(function(e) { | ||
401 | url: '/home/favorite/cancel', | 403 | url: '/home/favorite/cancel', |
402 | data: { | 404 | data: { |
403 | id: id, | 405 | id: id, |
406 | + shopid: shopid, | ||
407 | + brandorshoptype: brandorshoptype, | ||
404 | type: favType | 408 | type: favType |
405 | } | 409 | } |
406 | }).then(function(data) { | 410 | }).then(function(data) { |
@@ -3,5 +3,91 @@ | @@ -3,5 +3,91 @@ | ||
3 | * @author: xuqi<qi.xu@yoho.cn> | 3 | * @author: xuqi<qi.xu@yoho.cn> |
4 | * @date: 2016/2/17 | 4 | * @date: 2016/2/17 |
5 | */ | 5 | */ |
6 | +var $ = require('yoho.jquery'); | ||
6 | 7 | ||
7 | -require('./order-block'); | ||
8 | + | ||
9 | +require('./order-block'); | ||
10 | + | ||
11 | +//不同订单包裹提示 | ||
12 | + | ||
13 | +$('.why').click(function() { | ||
14 | + $('#differentBag').show(); | ||
15 | + return false; | ||
16 | + | ||
17 | +}); | ||
18 | +$('#differentBag').click(function() { | ||
19 | + return false; | ||
20 | +}); | ||
21 | +$(document).click(function() { | ||
22 | + $('#differentBag').hide(); | ||
23 | +}); | ||
24 | + | ||
25 | + | ||
26 | +//订单包裹左右切换 | ||
27 | +function lunBo($pre, $next, $ul, $iWidth) { | ||
28 | + var i = 1, | ||
29 | + j = 1; | ||
30 | + | ||
31 | + var iSpeed = 0, | ||
32 | + isMoving = false; | ||
33 | + | ||
34 | + $pre.click(function() { | ||
35 | + if (isMoving) { | ||
36 | + return; | ||
37 | + } | ||
38 | + | ||
39 | + if ($ul.css('left') === '0px') { | ||
40 | + iSpeed = 0; | ||
41 | + | ||
42 | + } else { | ||
43 | + iSpeed += j * $iWidth; | ||
44 | + isMoving = true; | ||
45 | + } | ||
46 | + $ul.stop().animate({ | ||
47 | + left: iSpeed | ||
48 | + }, 300, function() { | ||
49 | + isMoving = false; | ||
50 | + }); | ||
51 | + }); | ||
52 | + $next.click(function() { | ||
53 | + var $largeLeft = $ul.parent().width() - $ul.width() + 'px'; | ||
54 | + | ||
55 | + if (isMoving) { | ||
56 | + return; | ||
57 | + } | ||
58 | + | ||
59 | + if ($ul.css('left') === $largeLeft) { | ||
60 | + $ul.css('left', $largeLeft); | ||
61 | + } else { | ||
62 | + iSpeed += -i * $iWidth; | ||
63 | + isMoving = true; | ||
64 | + } | ||
65 | + | ||
66 | + $ul.stop().animate({ | ||
67 | + left: iSpeed | ||
68 | + }, 300, function() { | ||
69 | + isMoving = false; | ||
70 | + }); | ||
71 | + }); | ||
72 | +} | ||
73 | + | ||
74 | +//订单分类 | ||
75 | +$('.bag').find('ul').each(function() { | ||
76 | + var $pre = $(this).parent().parent().find('.pre'); | ||
77 | + var $next = $(this).parent().parent().find('.next'); | ||
78 | + | ||
79 | + var $iWidth = $(this).find('li').eq(0).width(); | ||
80 | + var $length = $(this).find('li').size(); | ||
81 | + var $ulWidth = $iWidth * $length; | ||
82 | + | ||
83 | + $(this).css('width', $ulWidth); | ||
84 | + if ($length > 5) { | ||
85 | + $pre.show(); | ||
86 | + $next.show(); | ||
87 | + lunBo($pre, $next, $(this), $iWidth); | ||
88 | + } else { | ||
89 | + $pre.hide(); | ||
90 | + $next.hide(); | ||
91 | + } | ||
92 | + | ||
93 | +}); |
@@ -720,7 +720,7 @@ function getYohoBiList() { | @@ -720,7 +720,7 @@ function getYohoBiList() { | ||
720 | type: 'GET', | 720 | type: 'GET', |
721 | dataType: 'json', | 721 | dataType: 'json', |
722 | url: '/cart/index/getCouponList' | 722 | url: '/cart/index/getCouponList' |
723 | - }).then(function(d) { | 723 | + }).then(function(d) { |
724 | 724 | ||
725 | if (d.code === 200) { | 725 | if (d.code === 200) { |
726 | data = d.data; | 726 | data = d.data; |
@@ -728,9 +728,9 @@ function getYohoBiList() { | @@ -728,9 +728,9 @@ function getYohoBiList() { | ||
728 | 728 | ||
729 | for (i = 0; i < dLen; i++) { | 729 | for (i = 0; i < dLen; i++) { |
730 | juanStr += '<li>' + | 730 | juanStr += '<li>' + |
731 | - '<input name="juangroup" type="radio" value="' + | ||
732 | - data[i].code + '" ' + (data[i].valid ? '' : 'disabled="disabled"') + '>' + | ||
733 | - '<label>' + data[i].desc + '</label>' + | 731 | + '<input name="juangroup" type="radio" value="' + |
732 | + data[i].code + '" ' + (data[i].valid ? '' : 'disabled="disabled"') + '>' + | ||
733 | + '<label>' + data[i].desc + '</label>' + | ||
734 | '</li>'; | 734 | '</li>'; |
735 | } | 735 | } |
736 | 736 | ||
@@ -772,6 +772,7 @@ $('.to-play input.submit').click(function() { | @@ -772,6 +772,7 @@ $('.to-play input.submit').click(function() { | ||
772 | redEnvelopes = $('.use-envelopes input:checked').attr('data-use'), | 772 | redEnvelopes = $('.use-envelopes input:checked').attr('data-use'), |
773 | $juangroupInput = $('.play-juan.is-select input[name="juangroup"]:checked'), | 773 | $juangroupInput = $('.play-juan.is-select input[name="juangroup"]:checked'), |
774 | codeVal = $juangroupInput.val(), | 774 | codeVal = $juangroupInput.val(), |
775 | + promotionVal = $juangroupInput.closest('li').find('#juancode').val(); | ||
775 | juanCode = !!codeVal ? codeVal : $juangroupInput.closest('li').find('#juancode').val(); | 776 | juanCode = !!codeVal ? codeVal : $juangroupInput.closest('li').find('#juancode').val(); |
776 | 777 | ||
777 | $loading.show(); | 778 | $loading.show(); |
@@ -797,6 +798,7 @@ $('.to-play input.submit').click(function() { | @@ -797,6 +798,7 @@ $('.to-play input.submit').click(function() { | ||
797 | paymentType: paymentType, | 798 | paymentType: paymentType, |
798 | remark: remark, | 799 | remark: remark, |
799 | couponCode: juanCode, | 800 | couponCode: juanCode, |
801 | + promotionCode: promotionVal, | ||
800 | yohoCoin: yohoCoin, | 802 | yohoCoin: yohoCoin, |
801 | isPreContact: ytoTrue(isPreContact), | 803 | isPreContact: ytoTrue(isPreContact), |
802 | isPrintPrice: ytoTrue(isPrintPrice), | 804 | isPrintPrice: ytoTrue(isPrintPrice), |
@@ -814,4 +816,4 @@ $('.to-play input.submit').click(function() { | @@ -814,4 +816,4 @@ $('.to-play input.submit').click(function() { | ||
814 | }).always(function() { | 816 | }).always(function() { |
815 | $this.removeAttr('disabled'); | 817 | $this.removeAttr('disabled'); |
816 | }); | 818 | }); |
817 | -}); | 819 | +}); |
1 | -/** | ||
2 | - * @description: 订单保存 | ||
3 | - * @time: 2015/12/21 | ||
4 | - */ | ||
5 | - | ||
6 | -var $ = require('yoho.jquery'); | ||
7 | - | ||
8 | -var address = require('./address'); | ||
9 | - | ||
10 | -var dialog = require('../common/dialog'); | ||
11 | - | ||
12 | -var Order = { | ||
13 | - /*业务数据(人民币)*/ | ||
14 | - Data: { | ||
15 | - product: 0,//商品价格 | ||
16 | - activity: 0,//活动 | ||
17 | - carriage: 0,//邮费 | ||
18 | - juan: 0,//优惠卷 | ||
19 | - yohocoin: 0//YOHO币 | ||
20 | - }, | ||
21 | - /*view 交互*/ | ||
22 | - UI: { | ||
23 | - e: { | ||
24 | - $pan: $('.pan'), | ||
25 | - $jc: $('#juancode'), | ||
26 | - $bp: $('#biprice'), | ||
27 | - $statistics: $('li', '.play-total'), | ||
28 | - $tobi: $('p em', '.play-bi-pan .play-pan'), | ||
29 | - $cancel: $('.cancel', '.btn-group'), | ||
30 | - $total: $('em', '.to-play'), | ||
31 | - $tbody: $('table tbody', '.pay-wapper'), | ||
32 | - | ||
33 | - //请填写并核对一下信息 | ||
34 | - $orderSelectionSave: $('.address-list h2 span'), | ||
35 | - $addAddress: $('.add-address'), | ||
36 | - $addressManage: $('.address-manage'), | ||
37 | - $spanPayTypeLegend: $('span.pay-type-legend'), | ||
38 | - $supportType: $('.support-type'), | ||
39 | - $existAddressListWrap: $('.exist-address-list'), | ||
40 | - $existAddressList: $('.exist-address-list').find('li'), | ||
41 | - $existAddress: $('.exist-address-list').find('input[name="exist-address"]'), | ||
42 | - $payTimeModify: $('.pay-time-modify'), | ||
43 | - $switchPayModify: $('.switch-pay-modify'), | ||
44 | - $modityPayInfo: $('.modity-pay-info'), | ||
45 | - $payTotal: $('.play-total'), | ||
46 | - $toPay: $('.to-play em'), | ||
47 | - | ||
48 | - $redEnvelopes: $('.red-envelopes'), | ||
49 | - $useEnvelopes: $('.use-envelopes'), | ||
50 | - $hasEnvelopes: $('.has-envelopes span'), | ||
51 | - $useEnvelopesInput: $('.use-envelopes').find('input') | ||
52 | - }, | ||
53 | - init: function() { | ||
54 | - var e = this.e, | ||
55 | - d = Order.Data, | ||
56 | - c = Order.Common; | ||
57 | - | ||
58 | - //初始化产品价格(表格中的价格) | ||
59 | - e.$tbody.find('tr').each(function(index) { | ||
60 | - | ||
61 | - var td = $(this).find('td'); | ||
62 | - var len = e.$tbody.find('tr').length; | ||
63 | - var subtotal = parseFloat(td.eq(1).html()) * parseInt(td.eq(3).html()); | ||
64 | - | ||
65 | - td.eq(1).html('¥' + td.eq(1).html()); | ||
66 | - | ||
67 | - if (td.hasClass('xforone')) { | ||
68 | - td.eq(4).find('del').html('¥' + c.strFixed(subtotal)); | ||
69 | - subtotal = 0; | ||
70 | - } else { | ||
71 | - td.eq(4).html('¥' + c.strFixed(subtotal)); | ||
72 | - } | ||
73 | - d.product += subtotal; | ||
74 | - if (!index) { | ||
75 | - td.last().attr('rowspan', len); | ||
76 | - } else { | ||
77 | - td.last().remove(); | ||
78 | - } | ||
79 | - if (index === len - 1) { | ||
80 | - e.$tbody.find('tr').eq(0).find('td').last().html('<strong>¥' + c.strFixed(d.product) + '</strong>'); | ||
81 | - } | ||
82 | - }); | ||
83 | - | ||
84 | - // 使用优惠券、使用yoho币点击展开 | ||
85 | - e.$pan.find('dt').click(function() { | ||
86 | - | ||
87 | - var pan = $(this).parent('dl.pan'); | ||
88 | - | ||
89 | - if (pan.find('dd').is(':hidden')) { | ||
90 | - c.winShow(pan); | ||
91 | - | ||
92 | - $(this).addClass('active'); | ||
93 | - } else { | ||
94 | - c.winHide(pan); | ||
95 | - | ||
96 | - $(this).removeClass('active'); | ||
97 | - } | ||
98 | - | ||
99 | - }); | ||
100 | - | ||
101 | - //请填写并核对一下信息 | ||
102 | - e.$orderSelectionSave.click(function() { | ||
103 | - var i = 0, | ||
104 | - $addressLi = $('.exist-address-list li'), | ||
105 | - liLen = $addressLi.length, | ||
106 | - notSelect = 0; | ||
107 | - | ||
108 | - if (!$(this).attr('expand')) { | ||
109 | - | ||
110 | - $(this).attr('expand', 'expand').text('[不保存并关闭]'); | ||
111 | - | ||
112 | - $('.exist-address-list li').removeClass('hide'); | ||
113 | - | ||
114 | - $('.save-btn').removeClass('hide'); | ||
115 | - | ||
116 | - e.$existAddressListWrap.addClass('address-expand'); | ||
117 | - | ||
118 | - if (liLen === 1) { | ||
119 | - e.$addressManage.removeClass('hide'); | ||
120 | - } | ||
121 | - | ||
122 | - } else { | ||
123 | - | ||
124 | - for (i = 0; i < liLen; i++) { | ||
125 | - | ||
126 | - if ($addressLi.eq(i).hasClass('address_select')) { | ||
127 | - notSelect++; | ||
128 | - } | ||
129 | - | ||
130 | - if (!$addressLi.eq(i).hasClass('address_select')) { | ||
131 | - $addressLi.eq(i).addClass('hide'); | ||
132 | - } | ||
133 | - } | ||
134 | - | ||
135 | - if (notSelect === 0) { | ||
136 | - $('.exist-address-list li:not(".use-new-address")').removeClass('hide'); | ||
137 | - | ||
138 | - $('.use-new-address input').removeAttr('checked'); | ||
139 | - } | ||
140 | - | ||
141 | - $('.address-list-inner li.address_select input').attr('checked', 'checked'); | ||
142 | - $('.address-list-inner li').removeClass('active'); | ||
143 | - $('.address-list-inner li.address_select').addClass('active'); | ||
144 | - | ||
145 | - $(this).removeAttr('expand').text('[修改]'); | ||
146 | - | ||
147 | - $('.save-btn').addClass('hide'); | ||
148 | - | ||
149 | - e.$existAddressListWrap.removeClass('address-expand'); | ||
150 | - | ||
151 | - e.$addressManage.addClass('hide'); | ||
152 | - } | ||
153 | - | ||
154 | - }); | ||
155 | - | ||
156 | - | ||
157 | - //支付及送货时间 | ||
158 | - e.$switchPayModify.click(function() { | ||
159 | - | ||
160 | - if (e.$payTimeModify.hasClass('hide')) { | ||
161 | - e.$payTimeModify.removeClass('hide'); | ||
162 | - e.$modityPayInfo.addClass('hide'); | ||
163 | - $(this).text('[不保存并关闭]'); | ||
164 | - } else { | ||
165 | - e.$payTimeModify.addClass('hide'); | ||
166 | - e.$modityPayInfo.removeClass('hide'); | ||
167 | - $(this).text('[修改]'); | ||
168 | - | ||
169 | - e.$payTimeModify.find('input[name="pay-type"]').filter('.checked').attr('checked', 'checked'); | ||
170 | - e.$payTimeModify.find('input[name="pay-time-radio"]').filter('.checked').attr('checked', 'checked'); | ||
171 | - e.$payTimeModify.find('input[name="call-me"]').filter('.checked').attr('checked', 'checked'); | ||
172 | - } | ||
173 | - }); | ||
174 | - | ||
175 | - e.$spanPayTypeLegend.click(function() { | ||
176 | - $(this).toggleClass('active'); | ||
177 | - | ||
178 | - e.$supportType.toggleClass('hide'); | ||
179 | - }); | ||
180 | - | ||
181 | - $(document).on('click', '.exist-address-list li', function() { | ||
182 | - | ||
183 | - $('.exist-address-list li').removeClass('active'); | ||
184 | - | ||
185 | - $(this).addClass('active'); | ||
186 | - | ||
187 | - $(this).find('input').attr('checked', 'checked'); | ||
188 | - | ||
189 | - if ($(this).hasClass('use-new-address')) { | ||
190 | - e.$addressManage.removeClass('hide'); | ||
191 | - | ||
192 | - $('.address-manage input').val(''); | ||
193 | - | ||
194 | - $('.save-btn').removeAttr('data-id'); | ||
195 | - | ||
196 | - // 0表示获取所有省的列表,'000000'表示无匹配的区域码 | ||
197 | - address.newAddress(0, '000000'); | ||
198 | - } | ||
199 | - }); | ||
200 | - }, | ||
201 | - | ||
202 | - //渲染价格明细 | ||
203 | - render: function(data, tips) { | ||
204 | - | ||
205 | - // 下面这段是在服务端算价格 | ||
206 | - var e = this.e, | ||
207 | - i, | ||
208 | - dArr = data.promotion_formula_list, | ||
209 | - str = '', | ||
210 | - isExpress = ''; | ||
211 | - | ||
212 | - var tipsStr; | ||
213 | - | ||
214 | - var envelopesVal; | ||
215 | - | ||
216 | - if (!!tips) { | ||
217 | - tipsStr = tips; | ||
218 | - } else { | ||
219 | - tipsStr = ''; | ||
220 | - } | ||
221 | - | ||
222 | - for (i = 0; i < dArr.length; i++) { | ||
223 | - | ||
224 | - if (dArr[i].promotion === '优惠券:') { | ||
225 | - dArr[i].promotion = (tipsStr ? tipsStr : '优惠券') + '<span class="juan-modify">[修改]</span>:'; | ||
226 | - } | ||
227 | - | ||
228 | - if (dArr[i].promotion === 'YOHO币:') { | ||
229 | - dArr[i].promotion = 'YOHO币<span class="bi-modify">[修改]</span>:'; | ||
230 | - } | ||
231 | - | ||
232 | - if (dArr[i].isExpress) { | ||
233 | - isExpress = 'total-express-w'; | ||
234 | - } else { | ||
235 | - isExpress = ''; | ||
236 | - } | ||
237 | - | ||
238 | - str += '<li class="' + isExpress + '">' + | ||
239 | - '<label>' + dArr[i].promotion + '</label>' + | ||
240 | - '<em>' + dArr[i].promotion_amount + '</em>' + | ||
241 | - '</li>'; | ||
242 | - } | ||
243 | - | ||
244 | - e.$payTotal.html(str); | ||
245 | - e.$toPay.html((data.last_order_amount).toFixed(2)); | ||
246 | - | ||
247 | - //有货币清零状态更新 | ||
248 | - $('#biprice').val(100 * data.use_yoho_coin); | ||
249 | - if (~~data.use_yoho_coin === 0) { | ||
250 | - $('.errbitip').text(''); | ||
251 | - } else { | ||
252 | - $('.errbitip').text('抵扣' + data.use_yoho_coin.toFixed(2) + '元'); | ||
253 | - } | ||
254 | - | ||
255 | - envelopesVal = e.$useEnvelopesInput.data('all') - data.use_red_envelopes; | ||
256 | - | ||
257 | - if (~~data.use_red_envelopes > 0) { | ||
258 | - e.$useEnvelopes.find('span').html('-¥' + data.use_red_envelopes.toFixed(2)); | ||
259 | - e.$useEnvelopes.find('input').attr('data-use', data.use_red_envelopes); | ||
260 | - } else { | ||
261 | - e.$useEnvelopes.find('span').html('-¥0.00'); | ||
262 | - e.$hasEnvelopes.html('¥' + (e.$useEnvelopesInput.attr('data-all') * 1).toFixed(2)); | ||
263 | - e.$redEnvelopes.removeClass('active'); | ||
264 | - e.$useEnvelopesInput.prop('checked', false); | ||
265 | - } | ||
266 | - e.$hasEnvelopes.html('¥' + envelopesVal.toFixed(2)); | ||
267 | - } | ||
268 | - }, | ||
269 | - /*公共方法*/ | ||
270 | - Common: { | ||
271 | - enterNUM: function(str1, str2) { | ||
272 | - str1 = str1.replace(/[^\d]/g, ''); | ||
273 | - if (str1 && str2) { | ||
274 | - str1 = parseInt(str1); | ||
275 | - str2 = parseInt(str2); | ||
276 | - if (str1 > str2) { | ||
277 | - str1 = str2; | ||
278 | - } | ||
279 | - } | ||
280 | - return str1; | ||
281 | - }, | ||
282 | - calucate: function() { | ||
283 | - var p = Order.Data; | ||
284 | - | ||
285 | - $.each(Order.Data, function(key, index) { | ||
286 | - p[key] = parseFloat(Order.Data[key]); | ||
287 | - }); | ||
288 | - return p.product - p.activity + p.carriage - p.juan - p.yohocoin; | ||
289 | - }, | ||
290 | - winShow: function(pan) { | ||
291 | - pan.find('dt').show(); | ||
292 | - pan.find('dd').show(); | ||
293 | - if (pan.attr('class').match(/(-bi-)|(-juan-)/g)) { | ||
294 | - pan.find('dt').hide(); | ||
295 | - } | ||
296 | - }, | ||
297 | - winHide: function(pan) { | ||
298 | - pan.find('dt').show(); | ||
299 | - pan.find('dd').hide(); | ||
300 | - | ||
301 | - /*if (pan.hasClass('play-juan-pan') && $('.juan-modify').length > 0) { | ||
302 | - pan.find('dt').hide(); | ||
303 | - } | ||
304 | - | ||
305 | - if (pan.hasClass('play-bi-pan') && $('.bi-modify').length > 0) { | ||
306 | - pan.find('dt').hide(); | ||
307 | - }*/ | ||
308 | - }, | ||
309 | - strFixed: function(str) { | ||
310 | - return parseFloat(str).toFixed(2); | ||
311 | - } | ||
312 | - }, | ||
313 | - /*业务逻辑*/ | ||
314 | - Bll: { | ||
315 | - e: { | ||
316 | - $juanok: $('#juansubmit'), | ||
317 | - $juantip: $('.errtip', '.play-juan-pan'), | ||
318 | - $biok: $('#bisubmit'), | ||
319 | - $carriageGroup: $('input[name="carriagegroup"]'), | ||
320 | - $selectExpress: $('.express-list input'), | ||
321 | - $bp: $('#biprice'), | ||
322 | - $errorTip: $('.errbitip'), | ||
323 | - $useEnvelopes: $('.use-envelopes'), | ||
324 | - $hasEnvelopes: $('.has-envelopes span'), | ||
325 | - $useEnvelopesInput: $('.use-envelopes').find('input'), | ||
326 | - $redEnvelopes: $('.red-envelopes'), | ||
327 | - $loading: $('.loading') | ||
328 | - }, | ||
329 | - init: function() { | ||
330 | - var e = this.e, | ||
331 | - u = Order.UI, | ||
332 | - options, | ||
333 | - c = Order.Common, | ||
334 | - envelopesVal; | ||
335 | - | ||
336 | - function getSelectData(callback) { | ||
337 | - | ||
338 | - var $juangroupInput = $('.play-juan.is-select input[name="juangroup"]:checked'); | ||
339 | - var expressVal = $('.express-list input[name="carriagegroup"]').val(); | ||
340 | - var biVal = $('#biprice.is-select').val(); | ||
341 | - var codeVal = $juangroupInput.val(); | ||
342 | - var cartType = $('.address-manage').attr('cart-type'); | ||
343 | - var redEnvelopes = $('.use-envelopes input:checked').attr('data-use'); | ||
344 | - var resultData; | ||
345 | - | ||
346 | - codeVal = !!codeVal ? codeVal : $juangroupInput.closest('li').find('#juancode').val(); | ||
347 | - | ||
348 | - resultData = { | ||
349 | - cartType: cartType, | ||
350 | - deliveryWay: expressVal, | ||
351 | - couponCode: codeVal, | ||
352 | - yohoCoin: biVal | ||
353 | - | ||
354 | - //redEnvelopes: e.$useEnvelopesInput.length > 0 ? ~~e.$hasEnvelopes.text().substring(1) : '0' | ||
355 | - }; | ||
356 | - | ||
357 | - if (!!redEnvelopes) { | ||
358 | - resultData.redEnvelopes = redEnvelopes; | ||
359 | - } | ||
360 | - | ||
361 | - callback(resultData); | ||
362 | - | ||
363 | - } | ||
364 | - | ||
365 | - // 选择快递 | ||
366 | - e.$selectExpress.click(function() { | ||
367 | - | ||
368 | - var expressId = $(this).val(); | ||
369 | - | ||
370 | - e.$loading.show(); | ||
371 | - | ||
372 | - getSelectData(function(d) { | ||
373 | - | ||
374 | - d.deliveryWay = expressId; | ||
375 | - | ||
376 | - options = { | ||
377 | - type: 'POST', | ||
378 | - url: '/cart/index/orderCompute', | ||
379 | - data: d, | ||
380 | - success: function(data) { | ||
381 | - e.$loading.hide(); | ||
382 | - | ||
383 | - if (data.code === 200) { | ||
384 | - u.render(data.data); | ||
385 | - | ||
386 | - if (expressId === '1') { | ||
387 | - | ||
388 | - $('.express-list.sf').addClass('hide'); | ||
389 | - } else if (expressId === '2') { | ||
390 | - $('.express-list.sf').removeClass('hide'); | ||
391 | - } | ||
392 | - } else { | ||
393 | - new dialog.Alert(data.message).show(); | ||
394 | - } | ||
395 | - } | ||
396 | - }; | ||
397 | - | ||
398 | - $.ajax(options); | ||
399 | - }); | ||
400 | - }); | ||
401 | - | ||
402 | - //点击 优惠卷支付 确认按钮 | ||
403 | - e.$juanok.click(function() { | ||
404 | - | ||
405 | - var pan = $(this).parents('dl.pan'); | ||
406 | - | ||
407 | - var juanText = ''; | ||
408 | - | ||
409 | - $('.play-juan').addClass('is-select'); | ||
410 | - | ||
411 | - getSelectData(function(d) { | ||
412 | - | ||
413 | - var code = d.couponCode; | ||
414 | - | ||
415 | - if (!code) { | ||
416 | - | ||
417 | - e.$juantip.html('请选择或填写一个优惠券'); | ||
418 | - $('.play-juan').removeClass('is-select'); | ||
419 | - | ||
420 | - } else { | ||
421 | - | ||
422 | - e.$loading.show(); | ||
423 | - | ||
424 | - options = { | ||
425 | - type: 'POST', | ||
426 | - url: '/cart/index/orderCompute', | ||
427 | - data: d, | ||
428 | - success: function(data) { | ||
429 | - | ||
430 | - e.$loading.hide(); | ||
431 | - | ||
432 | - if (data.code === 200) { | ||
433 | - | ||
434 | - juanText = $('.play-juan input[value="' + code + '"]').next().text(); | ||
435 | - u.render(data.data, juanText); | ||
436 | - | ||
437 | - //$('#juancode').val(code); | ||
438 | - | ||
439 | - c.winHide(pan); | ||
440 | - e.$juantip.html(''); | ||
441 | - | ||
442 | - //$('.play-juan-pan dt').hide(); | ||
443 | - | ||
444 | - } else { | ||
445 | - e.$juantip.html(data.message); | ||
446 | - $('.play-juan').removeClass('is-select'); | ||
447 | - } | ||
448 | - } | ||
449 | - }; | ||
450 | - | ||
451 | - $.ajax(options); | ||
452 | - } | ||
453 | - }); | ||
454 | - | ||
455 | - }); | ||
456 | - | ||
457 | - // 优惠券修改 | ||
458 | - $(document).on('click', '.juan-modify', function() { | ||
459 | - | ||
460 | - | ||
461 | - var $pan = $('.play-juan-pan'); | ||
462 | - | ||
463 | - c.winShow($pan); | ||
464 | - }); | ||
465 | - | ||
466 | - e.$biok.click(function() { | ||
467 | - | ||
468 | - var pan = $(this).parents('dl.pan'); | ||
469 | - var juanText; | ||
470 | - | ||
471 | - $('#biprice').addClass('is-select'); | ||
472 | - | ||
473 | - getSelectData(function(d) { | ||
474 | - | ||
475 | - if (!!d.couponCode) { | ||
476 | - juanText = $('.play-juan input[value="' + d.couponCode + '"]').next().text(); | ||
477 | - } | ||
478 | - | ||
479 | - //if (d.yohoCoin * 1 === 0) { | ||
480 | - if (!/^\d+$/.test(d.yohoCoin + '') || d.yohoCoin * 1 === 0) { | ||
481 | - $('.errbitip').html('请输入一个正整数'); | ||
482 | - $('#biprice').removeClass('is-select'); | ||
483 | - | ||
484 | - } else if (d.yohoCoin * 1 > $('.play-pan em').text() * 1) { | ||
485 | - | ||
486 | - $('.errbitip').html('您的YOHO币不足'); | ||
487 | - $('#biprice').removeClass('is-select'); | ||
488 | - | ||
489 | - } else { | ||
490 | - e.$loading.show(); | ||
491 | - | ||
492 | - options = { | ||
493 | - type: 'POST', | ||
494 | - url: '/cart/index/orderCompute', | ||
495 | - data: d, | ||
496 | - success: function(data) { | ||
497 | - | ||
498 | - e.$loading.hide(); | ||
499 | - | ||
500 | - if (data.code === 200) { | ||
501 | - | ||
502 | - u.render(data.data, juanText); | ||
503 | - c.winHide(pan); | ||
504 | - | ||
505 | - //$('.play-bi-pan dt').hide(); | ||
506 | - | ||
507 | - } else { | ||
508 | - $('.errbitip').html(data.message); | ||
509 | - $('#biprice').removeClass('is-select'); | ||
510 | - } | ||
511 | - } | ||
512 | - }; | ||
513 | - | ||
514 | - $.ajax(options); | ||
515 | - } | ||
516 | - | ||
517 | - }); | ||
518 | - }); | ||
519 | - | ||
520 | - // 修改yoho币 | ||
521 | - $(document).on('click', '.bi-modify', function() { | ||
522 | - | ||
523 | - | ||
524 | - var $pan = $('.play-bi-pan'); | ||
525 | - | ||
526 | - c.winShow($pan); | ||
527 | - }); | ||
528 | - | ||
529 | - e.$bp.keyup(function() { | ||
530 | - | ||
531 | - var val = $(this).val(); | ||
532 | - | ||
533 | - //if (val * 1 < 0 || val.indexOf('.') > 0) { | ||
534 | - if (!/^\d+$/.test(val + '')) { | ||
535 | - e.$errorTip.html('请输入一个正整数'); | ||
536 | - } else if (val * 1 > $(this).data('bi') * 1) { | ||
537 | - e.$errorTip.html('您的YOHO币不足'); | ||
538 | - } else { | ||
539 | - e.$errorTip.html('抵扣' + (val / 100).toFixed(2) + '元'); | ||
540 | - } | ||
541 | - }); | ||
542 | - | ||
543 | - // 取消yoho 币 | ||
544 | - $('.cancel-bi').click(function() { | ||
545 | - | ||
546 | - | ||
547 | - var $pan = $('.play-bi-pan'); | ||
548 | - var juanText; | ||
549 | - | ||
550 | - $('.errbitip').html(''); | ||
551 | - | ||
552 | - if ($('#biprice').hasClass('is-select')) { | ||
553 | - | ||
554 | - e.$loading.show(); | ||
555 | - | ||
556 | - getSelectData(function(d) { | ||
557 | - | ||
558 | - d.yohoCoin = 0; | ||
559 | - | ||
560 | - if (!!d.couponCode) { | ||
561 | - juanText = $('.play-juan input[value="' + d.couponCode + '"]').next().text(); | ||
562 | - } | ||
563 | - | ||
564 | - options = { | ||
565 | - type: 'POST', | ||
566 | - url: '/cart/index/orderCompute', | ||
567 | - data: d, | ||
568 | - success: function(data) { | ||
569 | - | ||
570 | - e.$loading.hide(); | ||
571 | - | ||
572 | - if (data.code === 200) { | ||
573 | - u.render(data.data, juanText); | ||
574 | - c.winHide($pan); | ||
575 | - | ||
576 | - $('#biprice').val('0'); | ||
577 | - | ||
578 | - //$('.play-bi-pan dt').hide(); | ||
579 | - $('#biprice').removeClass('is-select'); | ||
580 | - | ||
581 | - $('.errbitip').html(''); | ||
582 | - | ||
583 | - // $('.use-envelopes input').attr('checked', 'checked'); | ||
584 | - // $('.red-envelopes').addClass('active'); | ||
585 | - | ||
586 | - } else { | ||
587 | - $('.errbitip').html(data.message); | ||
588 | - } | ||
589 | - } | ||
590 | - }; | ||
591 | - | ||
592 | - $.ajax(options); | ||
593 | - }); | ||
594 | - | ||
595 | - } else { | ||
596 | - c.winHide($pan); | ||
597 | - $('#biprice').val('0'); | ||
598 | - } | ||
599 | - | ||
600 | - }); | ||
601 | - | ||
602 | - // 取消优惠券 | ||
603 | - $('.cancel-code').click(function() { | ||
604 | - | ||
605 | - var $pan = $('.play-juan-pan'); | ||
606 | - | ||
607 | - if ($('.play-juan').hasClass('is-select')) { | ||
608 | - | ||
609 | - e.$loading.show(); | ||
610 | - | ||
611 | - getSelectData(function(d) { | ||
612 | - | ||
613 | - d.couponCode = ''; | ||
614 | - | ||
615 | - options = { | ||
616 | - type: 'POST', | ||
617 | - url: '/cart/index/orderCompute', | ||
618 | - data: d, | ||
619 | - success: function(data) { | ||
620 | - | ||
621 | - e.$loading.hide(); | ||
622 | - | ||
623 | - if (data.code === 200) { | ||
624 | - u.render(data.data); | ||
625 | - | ||
626 | - c.winHide($pan); | ||
627 | - $('.play-juan').removeClass('is-select'); | ||
628 | - | ||
629 | - $('#juancode').val('') | ||
630 | - .siblings('input[name="juangroup"]').attr('checked', 'checked'); | ||
631 | - | ||
632 | - // $('.use-envelopes input').attr('checked', 'checked'); | ||
633 | - // $('.red-envelopes').addClass('active'); | ||
634 | - | ||
635 | - } else { | ||
636 | - e.$juantip.html(data.message); | ||
637 | - } | ||
638 | - } | ||
639 | - }; | ||
640 | - | ||
641 | - $.ajax(options); | ||
642 | - }); | ||
643 | - } else { | ||
644 | - c.winHide($pan); | ||
645 | - } | ||
646 | - }); | ||
647 | - | ||
648 | - | ||
649 | - // 红包 | ||
650 | - envelopesVal = e.$useEnvelopesInput.data('all') - e.$useEnvelopesInput.data('use'); // 剩余的红包 | ||
651 | - e.$hasEnvelopes.text('¥' + envelopesVal.toFixed(2)); | ||
652 | - e.$useEnvelopes.find('input').click(function() { | ||
653 | - | ||
654 | - var $this = $(this), | ||
655 | - juanText; | ||
656 | - | ||
657 | - e.$loading.show(); | ||
658 | - | ||
659 | - $this.attr('disabled', 'disabled'); | ||
660 | - | ||
661 | - getSelectData(function(d) { | ||
662 | - | ||
663 | - if (!!$this.attr('checked')) { | ||
664 | - | ||
665 | - //d.redEnvelopes = $this.val(); | ||
666 | - d.redEnvelopes = $this.data('use'); | ||
667 | - | ||
668 | - } else { | ||
669 | - | ||
670 | - d.redEnvelopes = 0; | ||
671 | - } | ||
672 | - | ||
673 | - juanText = $('.play-juan input[value="' + d.couponCode + '"]').next().text(); | ||
674 | - | ||
675 | - options = { | ||
676 | - type: 'POST', | ||
677 | - url: '/cart/index/orderCompute', | ||
678 | - data: d, | ||
679 | - success: function(data) { | ||
680 | - e.$loading.hide(); | ||
681 | - | ||
682 | - if (data.code === 200) { | ||
683 | - u.render(data.data, juanText); | ||
684 | - | ||
685 | - $this.removeAttr('disabled'); | ||
686 | - | ||
687 | - if (!!$this.attr('checked')) { | ||
688 | - e.$redEnvelopes.addClass('active'); | ||
689 | - } else { | ||
690 | - e.$useEnvelopes.find('span').html('-¥0.00'); | ||
691 | - e.$hasEnvelopes.html('¥' + ($this.attr('data-all') * 1).toFixed(2)); | ||
692 | - e.$redEnvelopes.removeClass('active'); | ||
693 | - } | ||
694 | - } else { | ||
695 | - | ||
696 | - new dialog.Alert(data.message).show(); | ||
697 | - } | ||
698 | - } | ||
699 | - }; | ||
700 | - | ||
701 | - $.ajax(options); | ||
702 | - }); | ||
703 | - | ||
704 | - }); | ||
705 | - | ||
706 | - | ||
707 | - //发票抬头和备注字数限制 | ||
708 | - function limitStrLen($obj, len) { | ||
709 | - | ||
710 | - var $this = $obj; | ||
711 | - | ||
712 | - $this.keyup(function() { | ||
713 | - | ||
714 | - if ($this.val().length > len) { | ||
715 | - | ||
716 | - $this.val($this.val().substr(0, len)); | ||
717 | - } | ||
718 | - }); | ||
719 | - } | ||
720 | - | ||
721 | - limitStrLen($('#piaodesc'), 30); | ||
722 | - limitStrLen($('#notedesc'), 100); | ||
723 | - } | ||
724 | - } | ||
725 | -}; | ||
726 | - | ||
727 | -Order.Data.activity = 0; | ||
728 | -Order.Data.carriage = 0; | ||
729 | - | ||
730 | -Order.UI.init(); | ||
731 | -Order.Bll.init(); | ||
732 | - | ||
733 | - | ||
734 | -address.getUserAddressList(); | ||
735 | - | ||
736 | -// 0表示获取所有省的列表,'000000'表示无匹配的区域码 | ||
737 | -address.newAddress(0, '000000'); | ||
738 | -address.modifyAddress(); | ||
739 | -address.saveAddress(); | 1 | +/** |
2 | + * @description: 订单保存 | ||
3 | + * @time: 2015/12/21 | ||
4 | + */ | ||
5 | + | ||
6 | +var $ = require('yoho.jquery'); | ||
7 | + | ||
8 | +var address = require('./address'); | ||
9 | + | ||
10 | +var dialog = require('../common/dialog'); | ||
11 | + | ||
12 | +var accMul = function(arg1, arg2) { | ||
13 | + var m = 0, | ||
14 | + s1 = arg1.toString(), | ||
15 | + s2 = arg2.toString(); | ||
16 | + | ||
17 | + try { | ||
18 | + m += s1.split('.')[1].length; | ||
19 | + } catch (e) { | ||
20 | + } | ||
21 | + try { | ||
22 | + m += s2.split('.')[1].length; | ||
23 | + } catch (e) { | ||
24 | + } | ||
25 | + return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m); | ||
26 | +}; | ||
27 | + | ||
28 | +var Order = { | ||
29 | + /*业务数据(人民币)*/ | ||
30 | + Data: { | ||
31 | + product: 0, //商品价格 | ||
32 | + activity: 0, //活动 | ||
33 | + carriage: 0, //邮费 | ||
34 | + juan: 0, //优惠卷 | ||
35 | + yohocoin: 0 //YOHO币 | ||
36 | + }, | ||
37 | + /*view 交互*/ | ||
38 | + UI: { | ||
39 | + e: { | ||
40 | + $pan: $('.pan'), | ||
41 | + $jc: $('#juancode'), | ||
42 | + $bp: $('#biprice'), | ||
43 | + $statistics: $('li', '.play-total'), | ||
44 | + $tobi: $('p em', '.play-bi-pan .play-pan'), | ||
45 | + $cancel: $('.cancel', '.btn-group'), | ||
46 | + $total: $('em', '.to-play'), | ||
47 | + $tbody: $('table tbody', '.pay-wapper'), | ||
48 | + | ||
49 | + //请填写并核对一下信息 | ||
50 | + $orderSelectionSave: $('.address-list h2 span'), | ||
51 | + $addAddress: $('.add-address'), | ||
52 | + $addressManage: $('.address-manage'), | ||
53 | + $spanPayTypeLegend: $('span.pay-type-legend'), | ||
54 | + $supportType: $('.support-type'), | ||
55 | + $existAddressListWrap: $('.exist-address-list'), | ||
56 | + $existAddressList: $('.exist-address-list').find('li'), | ||
57 | + $existAddress: $('.exist-address-list').find('input[name="exist-address"]'), | ||
58 | + $payTimeModify: $('.pay-time-modify'), | ||
59 | + $switchPayModify: $('.switch-pay-modify'), | ||
60 | + $modityPayInfo: $('.modity-pay-info'), | ||
61 | + $payTotal: $('.play-total'), | ||
62 | + $toPay: $('.to-play em'), | ||
63 | + $redEnvelopes: $('.red-envelopes'), | ||
64 | + $useEnvelopes: $('.use-envelopes'), | ||
65 | + $hasEnvelopes: $('.has-envelopes span'), | ||
66 | + $useEnvelopesInput: $('.use-envelopes').find('input'), | ||
67 | + $expressFee: $('.express-fee') | ||
68 | + }, | ||
69 | + init: function() { | ||
70 | + var e = this.e, | ||
71 | + d = Order.Data, | ||
72 | + c = Order.Common; | ||
73 | + | ||
74 | + //初始化产品价格(表格中的价格) | ||
75 | + e.$tbody.find('tr').each(function(index) { | ||
76 | + | ||
77 | + var td = $(this).find('td'); | ||
78 | + var len = e.$tbody.find('tr').length; | ||
79 | + var subtotal = parseFloat(td.eq(1).html()) * parseInt(td.eq(3).html()); | ||
80 | + | ||
81 | + td.eq(1).html('¥' + td.eq(1).html()); | ||
82 | + | ||
83 | + if (td.hasClass('xforone')) { | ||
84 | + td.eq(4).find('del').html('¥' + c.strFixed(subtotal)); | ||
85 | + subtotal = 0; | ||
86 | + } else { | ||
87 | + td.eq(4).html('¥' + c.strFixed(subtotal)); | ||
88 | + } | ||
89 | + d.product += subtotal; | ||
90 | + if (!index) { | ||
91 | + td.last().attr('rowspan', len); | ||
92 | + } else { | ||
93 | + td.last().remove(); | ||
94 | + } | ||
95 | + if (index === len - 1) { | ||
96 | + e.$tbody.find('tr').eq(0).find('td').last().html('<strong>¥' + c.strFixed(d.product) + '</strong>'); | ||
97 | + } | ||
98 | + }); | ||
99 | + | ||
100 | + // 使用优惠券、使用yoho币点击展开 | ||
101 | + e.$pan.find('dt').click(function() { | ||
102 | + | ||
103 | + var pan = $(this).parent('dl.pan'); | ||
104 | + | ||
105 | + if (pan.find('dd').is(':hidden')) { | ||
106 | + c.winShow(pan); | ||
107 | + | ||
108 | + $(this).addClass('active'); | ||
109 | + } else { | ||
110 | + c.winHide(pan); | ||
111 | + | ||
112 | + $(this).removeClass('active'); | ||
113 | + } | ||
114 | + | ||
115 | + }); | ||
116 | + | ||
117 | + //请填写并核对一下信息 | ||
118 | + e.$orderSelectionSave.click(function() { | ||
119 | + var i = 0, | ||
120 | + $addressLi = $('.exist-address-list li'), | ||
121 | + liLen = $addressLi.length, | ||
122 | + notSelect = 0; | ||
123 | + | ||
124 | + if (!$(this).attr('expand')) { | ||
125 | + | ||
126 | + $(this).attr('expand', 'expand').text('[不保存并关闭]'); | ||
127 | + | ||
128 | + $('.exist-address-list li').removeClass('hide'); | ||
129 | + | ||
130 | + $('.save-btn').removeClass('hide'); | ||
131 | + | ||
132 | + e.$existAddressListWrap.addClass('address-expand'); | ||
133 | + | ||
134 | + if (liLen === 1) { | ||
135 | + e.$addressManage.removeClass('hide'); | ||
136 | + } | ||
137 | + | ||
138 | + } else { | ||
139 | + | ||
140 | + for (i = 0; i < liLen; i++) { | ||
141 | + | ||
142 | + if ($addressLi.eq(i).hasClass('address_select')) { | ||
143 | + notSelect++; | ||
144 | + } | ||
145 | + | ||
146 | + if (!$addressLi.eq(i).hasClass('address_select')) { | ||
147 | + $addressLi.eq(i).addClass('hide'); | ||
148 | + } | ||
149 | + } | ||
150 | + | ||
151 | + if (notSelect === 0) { | ||
152 | + $('.exist-address-list li:not(".use-new-address")').removeClass('hide'); | ||
153 | + | ||
154 | + $('.use-new-address input').removeAttr('checked'); | ||
155 | + } | ||
156 | + | ||
157 | + $('.address-list-inner li.address_select input').attr('checked', 'checked'); | ||
158 | + $('.address-list-inner li').removeClass('active'); | ||
159 | + $('.address-list-inner li.address_select').addClass('active'); | ||
160 | + | ||
161 | + $(this).removeAttr('expand').text('[修改]'); | ||
162 | + | ||
163 | + $('.save-btn').addClass('hide'); | ||
164 | + | ||
165 | + e.$existAddressListWrap.removeClass('address-expand'); | ||
166 | + | ||
167 | + e.$addressManage.addClass('hide'); | ||
168 | + } | ||
169 | + | ||
170 | + }); | ||
171 | + | ||
172 | + | ||
173 | + //支付及送货时间 | ||
174 | + e.$switchPayModify.click(function() { | ||
175 | + | ||
176 | + if (e.$payTimeModify.hasClass('hide')) { | ||
177 | + e.$payTimeModify.removeClass('hide'); | ||
178 | + e.$modityPayInfo.addClass('hide'); | ||
179 | + $(this).text('[不保存并关闭]'); | ||
180 | + } else { | ||
181 | + e.$payTimeModify.addClass('hide'); | ||
182 | + e.$modityPayInfo.removeClass('hide'); | ||
183 | + $(this).text('[修改]'); | ||
184 | + | ||
185 | + e.$payTimeModify.find('input[name="pay-type"]').filter('.checked').attr('checked', 'checked'); | ||
186 | + e.$payTimeModify.find('input[name="pay-time-radio"]').filter('.checked').attr('checked', 'checked'); | ||
187 | + e.$payTimeModify.find('input[name="call-me"]').filter('.checked').attr('checked', 'checked'); | ||
188 | + } | ||
189 | + }); | ||
190 | + | ||
191 | + e.$spanPayTypeLegend.click(function() { | ||
192 | + $(this).toggleClass('active'); | ||
193 | + | ||
194 | + e.$supportType.toggleClass('hide'); | ||
195 | + }); | ||
196 | + | ||
197 | + $(document).on('click', '.exist-address-list li', function() { | ||
198 | + | ||
199 | + $('.exist-address-list li').removeClass('active'); | ||
200 | + | ||
201 | + $(this).addClass('active'); | ||
202 | + | ||
203 | + $(this).find('input').attr('checked', 'checked'); | ||
204 | + | ||
205 | + if ($(this).hasClass('use-new-address')) { | ||
206 | + e.$addressManage.removeClass('hide'); | ||
207 | + | ||
208 | + $('.address-manage input').val(''); | ||
209 | + | ||
210 | + $('.save-btn').removeAttr('data-id'); | ||
211 | + | ||
212 | + // 0表示获取所有省的列表,'000000'表示无匹配的区域码 | ||
213 | + address.newAddress(0, '000000'); | ||
214 | + } | ||
215 | + }); | ||
216 | + }, | ||
217 | + | ||
218 | + //渲染价格明细 | ||
219 | + render: function(data, tips) { | ||
220 | + | ||
221 | + // 下面这段是在服务端算价格 | ||
222 | + var e = this.e, | ||
223 | + i, | ||
224 | + dArr = data.promotion_formula_list, | ||
225 | + packageList = data.package_list, | ||
226 | + str = '', | ||
227 | + isExpress = ''; | ||
228 | + | ||
229 | + var tipsStr; | ||
230 | + | ||
231 | + var envelopesVal; | ||
232 | + | ||
233 | + if (!!tips) { | ||
234 | + tipsStr = tips; | ||
235 | + } else { | ||
236 | + tipsStr = ''; | ||
237 | + } | ||
238 | + | ||
239 | + for (i = 0; i < dArr.length; i++) { | ||
240 | + | ||
241 | + if (dArr[i].promotion === '优惠券:') { | ||
242 | + dArr[i].promotion = (tipsStr ? tipsStr : '优惠券') + '<span class="juan-modify">[修改]</span>:'; | ||
243 | + } | ||
244 | + | ||
245 | + if (dArr[i].promotion === 'YOHO币:') { | ||
246 | + dArr[i].promotion = 'YOHO币<span class="bi-modify">[修改]</span>:'; | ||
247 | + } | ||
248 | + | ||
249 | + if (dArr[i].isExpress) { | ||
250 | + isExpress = 'total-express-w'; | ||
251 | + } else { | ||
252 | + isExpress = ''; | ||
253 | + } | ||
254 | + | ||
255 | + str += '<li class="' + isExpress + '">' + | ||
256 | + '<label>' + dArr[i].promotion + '</label>' + | ||
257 | + '<em>' + dArr[i].promotion_amount + '</em>' + | ||
258 | + '</li>'; | ||
259 | + } | ||
260 | + | ||
261 | + e.$payTotal.html(str); | ||
262 | + e.$toPay.html((data.last_order_amount).toFixed(2)); | ||
263 | + | ||
264 | + //有货币清零状态更新 | ||
265 | + $('#biprice').val(accMul(100, data.use_yoho_coin)); | ||
266 | + if (~~data.use_yoho_coin === 0) { | ||
267 | + $('.errbitip').text(''); | ||
268 | + } else { | ||
269 | + $('.errbitip').text('抵扣' + data.use_yoho_coin.toFixed(2) + '元'); | ||
270 | + } | ||
271 | + | ||
272 | + envelopesVal = e.$useEnvelopesInput.data('all') - data.use_red_envelopes; | ||
273 | + | ||
274 | + if (~~data.use_red_envelopes > 0) { | ||
275 | + e.$useEnvelopes.find('span').html('-¥' + data.use_red_envelopes.toFixed(2)); | ||
276 | + e.$useEnvelopes.find('input').attr('data-use', data.use_red_envelopes); | ||
277 | + } else { | ||
278 | + e.$useEnvelopes.find('span').html('-¥0.00'); | ||
279 | + e.$hasEnvelopes.html('¥' + (e.$useEnvelopesInput.attr('data-all') * 1).toFixed(2)); | ||
280 | + e.$redEnvelopes.removeClass('active'); | ||
281 | + e.$useEnvelopesInput.prop('checked', false); | ||
282 | + } | ||
283 | + e.$hasEnvelopes.html('¥' + envelopesVal.toFixed(2)); | ||
284 | + | ||
285 | + if (packageList) { | ||
286 | + e.$expressFee.each(function(index, expressCost) { | ||
287 | + var orignCost = packageList[index].shopping_orig_cost, | ||
288 | + disCount = packageList[index].shopping_cut_cost, | ||
289 | + realCost = packageList[index].shopping_cost; | ||
290 | + | ||
291 | + var cost = parseInt(orignCost) === 0 ? | ||
292 | + '运费:¥0.00元' : | ||
293 | + '运费:¥' + realCost + '元(原价' + orignCost + '元,优惠' + disCount + ')元'; | ||
294 | + | ||
295 | + $(expressCost).text(cost); | ||
296 | + }); | ||
297 | + } | ||
298 | + } | ||
299 | + }, | ||
300 | + /*公共方法*/ | ||
301 | + Common: { | ||
302 | + enterNUM: function(str1, str2) { | ||
303 | + str1 = str1.replace(/[^\d]/g, ''); | ||
304 | + if (str1 && str2) { | ||
305 | + str1 = parseInt(str1); | ||
306 | + str2 = parseInt(str2); | ||
307 | + if (str1 > str2) { | ||
308 | + str1 = str2; | ||
309 | + } | ||
310 | + } | ||
311 | + return str1; | ||
312 | + }, | ||
313 | + calucate: function() { | ||
314 | + var p = Order.Data; | ||
315 | + | ||
316 | + $.each(Order.Data, function(key, index) { | ||
317 | + p[key] = parseFloat(Order.Data[key]); | ||
318 | + }); | ||
319 | + return p.product - p.activity + p.carriage - p.juan - p.yohocoin; | ||
320 | + }, | ||
321 | + winShow: function(pan) { | ||
322 | + pan.find('dt').show(); | ||
323 | + pan.find('dd').show(); | ||
324 | + if (pan.attr('class').match(/(-bi-)|(-juan-)/g)) { | ||
325 | + pan.find('dt').hide(); | ||
326 | + } | ||
327 | + }, | ||
328 | + winHide: function(pan) { | ||
329 | + pan.find('dt').show(); | ||
330 | + pan.find('dd').hide(); | ||
331 | + | ||
332 | + /*if (pan.hasClass('play-juan-pan') && $('.juan-modify').length > 0) { | ||
333 | + pan.find('dt').hide(); | ||
334 | + } | ||
335 | + | ||
336 | + if (pan.hasClass('play-bi-pan') && $('.bi-modify').length > 0) { | ||
337 | + pan.find('dt').hide(); | ||
338 | + }*/ | ||
339 | + }, | ||
340 | + strFixed: function(str) { | ||
341 | + return parseFloat(str).toFixed(2); | ||
342 | + } | ||
343 | + }, | ||
344 | + /*业务逻辑*/ | ||
345 | + Bll: { | ||
346 | + e: { | ||
347 | + $juanok: $('#juansubmit'), | ||
348 | + $juantip: $('.errtip', '.play-juan-pan'), | ||
349 | + $biok: $('#bisubmit'), | ||
350 | + $carriageGroup: $('input[name="carriagegroup"]'), | ||
351 | + $selectExpress: $('.express-list input'), | ||
352 | + $bp: $('#biprice'), | ||
353 | + $errorTip: $('.errbitip'), | ||
354 | + $useEnvelopes: $('.use-envelopes'), | ||
355 | + $hasEnvelopes: $('.has-envelopes span'), | ||
356 | + $useEnvelopesInput: $('.use-envelopes').find('input'), | ||
357 | + $redEnvelopes: $('.red-envelopes'), | ||
358 | + $loading: $('.loading') | ||
359 | + }, | ||
360 | + init: function() { | ||
361 | + var e = this.e, | ||
362 | + u = Order.UI, | ||
363 | + options, | ||
364 | + c = Order.Common, | ||
365 | + envelopesVal; | ||
366 | + | ||
367 | + function getSelectData(callback) { | ||
368 | + | ||
369 | + var $juangroupInput = $('.play-juan.is-select input[name="juangroup"]:checked'); | ||
370 | + var expressVal = $('.express-list input[name="carriagegroup"]:checked').val(); | ||
371 | + var biVal = $('#biprice.is-select').val(); | ||
372 | + var codeVal = $juangroupInput.val(); | ||
373 | + var promotionVal = $juangroupInput.closest('li').find('#juancode').val(); | ||
374 | + var cartType = $('.address-manage').attr('cart-type'); | ||
375 | + var redEnvelopes = $('.use-envelopes input:checked').attr('data-use'); | ||
376 | + var resultData; | ||
377 | + | ||
378 | + codeVal = codeVal ? codeVal : $juangroupInput.closest('li').find('#juancode').val(); | ||
379 | + | ||
380 | + | ||
381 | + resultData = { | ||
382 | + cartType: cartType, | ||
383 | + deliveryWay: expressVal, | ||
384 | + couponCode: codeVal, | ||
385 | + promotionCode: promotionVal, | ||
386 | + yohoCoin: biVal | ||
387 | + | ||
388 | + //redEnvelopes: e.$useEnvelopesInput.length > 0 ? ~~e.$hasEnvelopes.text().substring(1) : '0' | ||
389 | + }; | ||
390 | + | ||
391 | + if (!!redEnvelopes) { | ||
392 | + resultData.redEnvelopes = redEnvelopes; | ||
393 | + } | ||
394 | + | ||
395 | + callback(resultData); | ||
396 | + | ||
397 | + } | ||
398 | + | ||
399 | + // 选择快递 | ||
400 | + e.$selectExpress.click(function() { | ||
401 | + | ||
402 | + var expressId = $(this).val(); | ||
403 | + | ||
404 | + e.$loading.show(); | ||
405 | + | ||
406 | + getSelectData(function(d) { | ||
407 | + | ||
408 | + d.deliveryWay = expressId; | ||
409 | + | ||
410 | + options = { | ||
411 | + type: 'POST', | ||
412 | + url: '/cart/index/orderCompute', | ||
413 | + data: d, | ||
414 | + success: function(data) { | ||
415 | + e.$loading.hide(); | ||
416 | + | ||
417 | + if (data.code === 200) { | ||
418 | + u.render(data.data); | ||
419 | + | ||
420 | + if (expressId === '1') { | ||
421 | + | ||
422 | + $('.express-list.sf').addClass('hide'); | ||
423 | + } else if (expressId === '2') { | ||
424 | + $('.express-list.sf').removeClass('hide'); | ||
425 | + } | ||
426 | + } else { | ||
427 | + new dialog.Alert(data.message).show(); | ||
428 | + } | ||
429 | + } | ||
430 | + }; | ||
431 | + | ||
432 | + $.ajax(options); | ||
433 | + }); | ||
434 | + }); | ||
435 | + | ||
436 | + //点击 优惠卷支付 确认按钮 | ||
437 | + e.$juanok.click(function() { | ||
438 | + | ||
439 | + var pan = $(this).parents('dl.pan'); | ||
440 | + | ||
441 | + var juanText = ''; | ||
442 | + | ||
443 | + $('.play-juan').addClass('is-select'); | ||
444 | + | ||
445 | + getSelectData(function(d) { | ||
446 | + | ||
447 | + var code = d.couponCode; | ||
448 | + | ||
449 | + if (!code) { | ||
450 | + | ||
451 | + e.$juantip.html('请选择或填写一个优惠券'); | ||
452 | + $('.play-juan').removeClass('is-select'); | ||
453 | + | ||
454 | + } else { | ||
455 | + | ||
456 | + e.$loading.show(); | ||
457 | + | ||
458 | + options = { | ||
459 | + type: 'POST', | ||
460 | + url: '/cart/index/orderCompute', | ||
461 | + data: d, | ||
462 | + success: function(data) { | ||
463 | + | ||
464 | + e.$loading.hide(); | ||
465 | + | ||
466 | + if (data.code === 200) { | ||
467 | + | ||
468 | + juanText = $('.play-juan input[value="' + code + '"]').next().text(); | ||
469 | + u.render(data.data, juanText); | ||
470 | + | ||
471 | + //$('#juancode').val(code); | ||
472 | + | ||
473 | + c.winHide(pan); | ||
474 | + e.$juantip.html(''); | ||
475 | + | ||
476 | + //$('.play-juan-pan dt').hide(); | ||
477 | + | ||
478 | + } else { | ||
479 | + e.$juantip.html(data.message); | ||
480 | + $('.play-juan').removeClass('is-select'); | ||
481 | + } | ||
482 | + } | ||
483 | + }; | ||
484 | + | ||
485 | + $.ajax(options); | ||
486 | + } | ||
487 | + }); | ||
488 | + | ||
489 | + }); | ||
490 | + | ||
491 | + // 优惠券修改 | ||
492 | + $(document).on('click', '.juan-modify', function() { | ||
493 | + | ||
494 | + | ||
495 | + var $pan = $('.play-juan-pan'); | ||
496 | + | ||
497 | + c.winShow($pan); | ||
498 | + }); | ||
499 | + | ||
500 | + e.$biok.click(function() { | ||
501 | + | ||
502 | + var pan = $(this).parents('dl.pan'); | ||
503 | + var juanText; | ||
504 | + | ||
505 | + $('#biprice').addClass('is-select'); | ||
506 | + | ||
507 | + getSelectData(function(d) { | ||
508 | + | ||
509 | + if (!!d.couponCode) { | ||
510 | + juanText = $('.play-juan input[value="' + d.couponCode + '"]').next().text(); | ||
511 | + } | ||
512 | + | ||
513 | + //if (d.yohoCoin * 1 === 0) { | ||
514 | + if (!/^\d+$/.test(d.yohoCoin + '') || d.yohoCoin * 1 === 0) { | ||
515 | + $('.errbitip').html('请输入一个正整数'); | ||
516 | + $('#biprice').removeClass('is-select'); | ||
517 | + | ||
518 | + } else if (d.yohoCoin * 1 > $('.play-pan em').text() * 1) { | ||
519 | + | ||
520 | + $('.errbitip').html('您的YOHO币不足'); | ||
521 | + $('#biprice').removeClass('is-select'); | ||
522 | + | ||
523 | + } else { | ||
524 | + e.$loading.show(); | ||
525 | + | ||
526 | + options = { | ||
527 | + type: 'POST', | ||
528 | + url: '/cart/index/orderCompute', | ||
529 | + data: d, | ||
530 | + success: function(data) { | ||
531 | + | ||
532 | + e.$loading.hide(); | ||
533 | + | ||
534 | + if (data.code === 200) { | ||
535 | + | ||
536 | + u.render(data.data, juanText); | ||
537 | + c.winHide(pan); | ||
538 | + | ||
539 | + //$('.play-bi-pan dt').hide(); | ||
540 | + | ||
541 | + } else { | ||
542 | + $('.errbitip').html(data.message); | ||
543 | + $('#biprice').removeClass('is-select'); | ||
544 | + } | ||
545 | + } | ||
546 | + }; | ||
547 | + | ||
548 | + $.ajax(options); | ||
549 | + } | ||
550 | + | ||
551 | + }); | ||
552 | + }); | ||
553 | + | ||
554 | + // 修改yoho币 | ||
555 | + $(document).on('click', '.bi-modify', function() { | ||
556 | + | ||
557 | + | ||
558 | + var $pan = $('.play-bi-pan'); | ||
559 | + | ||
560 | + c.winShow($pan); | ||
561 | + }); | ||
562 | + | ||
563 | + e.$bp.keyup(function() { | ||
564 | + | ||
565 | + var val = $(this).val(); | ||
566 | + | ||
567 | + //if (val * 1 < 0 || val.indexOf('.') > 0) { | ||
568 | + if (!/^\d+$/.test(val + '')) { | ||
569 | + e.$errorTip.html('请输入一个正整数'); | ||
570 | + } else if (val * 1 > $(this).data('bi') * 1) { | ||
571 | + e.$errorTip.html('您的YOHO币不足'); | ||
572 | + } else { | ||
573 | + e.$errorTip.html('抵扣' + (val / 100).toFixed(2) + '元'); | ||
574 | + } | ||
575 | + }); | ||
576 | + | ||
577 | + // 取消yoho 币 | ||
578 | + $('.cancel-bi').click(function() { | ||
579 | + | ||
580 | + | ||
581 | + var $pan = $('.play-bi-pan'); | ||
582 | + var juanText; | ||
583 | + | ||
584 | + $('.errbitip').html(''); | ||
585 | + | ||
586 | + if ($('#biprice').hasClass('is-select')) { | ||
587 | + | ||
588 | + e.$loading.show(); | ||
589 | + | ||
590 | + getSelectData(function(d) { | ||
591 | + | ||
592 | + d.yohoCoin = 0; | ||
593 | + | ||
594 | + if (!!d.couponCode) { | ||
595 | + juanText = $('.play-juan input[value="' + d.couponCode + '"]').next().text(); | ||
596 | + } | ||
597 | + | ||
598 | + options = { | ||
599 | + type: 'POST', | ||
600 | + url: '/cart/index/orderCompute', | ||
601 | + data: d, | ||
602 | + success: function(data) { | ||
603 | + | ||
604 | + e.$loading.hide(); | ||
605 | + | ||
606 | + if (data.code === 200) { | ||
607 | + u.render(data.data, juanText); | ||
608 | + c.winHide($pan); | ||
609 | + | ||
610 | + $('#biprice').val('0'); | ||
611 | + | ||
612 | + //$('.play-bi-pan dt').hide(); | ||
613 | + $('#biprice').removeClass('is-select'); | ||
614 | + | ||
615 | + $('.errbitip').html(''); | ||
616 | + | ||
617 | + // $('.use-envelopes input').attr('checked', 'checked'); | ||
618 | + // $('.red-envelopes').addClass('active'); | ||
619 | + | ||
620 | + } else { | ||
621 | + $('.errbitip').html(data.message); | ||
622 | + } | ||
623 | + } | ||
624 | + }; | ||
625 | + | ||
626 | + $.ajax(options); | ||
627 | + }); | ||
628 | + | ||
629 | + } else { | ||
630 | + c.winHide($pan); | ||
631 | + $('#biprice').val('0'); | ||
632 | + } | ||
633 | + | ||
634 | + }); | ||
635 | + | ||
636 | + // 取消优惠券 | ||
637 | + $('.cancel-code').click(function() { | ||
638 | + | ||
639 | + var $pan = $('.play-juan-pan'); | ||
640 | + | ||
641 | + if ($('.play-juan').hasClass('is-select')) { | ||
642 | + | ||
643 | + e.$loading.show(); | ||
644 | + | ||
645 | + getSelectData(function(d) { | ||
646 | + | ||
647 | + d.couponCode = ''; | ||
648 | + | ||
649 | + options = { | ||
650 | + type: 'POST', | ||
651 | + url: '/cart/index/orderCompute', | ||
652 | + data: d, | ||
653 | + success: function(data) { | ||
654 | + | ||
655 | + e.$loading.hide(); | ||
656 | + | ||
657 | + if (data.code === 200) { | ||
658 | + u.render(data.data); | ||
659 | + | ||
660 | + c.winHide($pan); | ||
661 | + $('.play-juan').removeClass('is-select'); | ||
662 | + | ||
663 | + $('#juancode').val('') | ||
664 | + .siblings('input[name="juangroup"]').attr('checked', 'checked'); | ||
665 | + | ||
666 | + // $('.use-envelopes input').attr('checked', 'checked'); | ||
667 | + // $('.red-envelopes').addClass('active'); | ||
668 | + | ||
669 | + } else { | ||
670 | + e.$juantip.html(data.message); | ||
671 | + } | ||
672 | + } | ||
673 | + }; | ||
674 | + | ||
675 | + $.ajax(options); | ||
676 | + }); | ||
677 | + } else { | ||
678 | + c.winHide($pan); | ||
679 | + } | ||
680 | + }); | ||
681 | + | ||
682 | + | ||
683 | + // 红包 | ||
684 | + envelopesVal = e.$useEnvelopesInput.data('all') - e.$useEnvelopesInput.data('use'); // 剩余的红包 | ||
685 | + e.$hasEnvelopes.text('¥' + envelopesVal.toFixed(2)); | ||
686 | + e.$useEnvelopes.find('input').click(function() { | ||
687 | + | ||
688 | + var $this = $(this), | ||
689 | + juanText; | ||
690 | + | ||
691 | + e.$loading.show(); | ||
692 | + | ||
693 | + $this.attr('disabled', 'disabled'); | ||
694 | + | ||
695 | + getSelectData(function(d) { | ||
696 | + | ||
697 | + if (!!$this.attr('checked')) { | ||
698 | + | ||
699 | + //d.redEnvelopes = $this.val(); | ||
700 | + d.redEnvelopes = $this.data('use'); | ||
701 | + | ||
702 | + } else { | ||
703 | + | ||
704 | + d.redEnvelopes = 0; | ||
705 | + } | ||
706 | + | ||
707 | + juanText = $('.play-juan input[value="' + d.couponCode + '"]').next().text(); | ||
708 | + | ||
709 | + options = { | ||
710 | + type: 'POST', | ||
711 | + url: '/cart/index/orderCompute', | ||
712 | + data: d, | ||
713 | + success: function(data) { | ||
714 | + e.$loading.hide(); | ||
715 | + | ||
716 | + if (data.code === 200) { | ||
717 | + u.render(data.data, juanText); | ||
718 | + | ||
719 | + $this.removeAttr('disabled'); | ||
720 | + | ||
721 | + if (!!$this.attr('checked')) { | ||
722 | + e.$redEnvelopes.addClass('active'); | ||
723 | + } else { | ||
724 | + e.$useEnvelopes.find('span').html('-¥0.00'); | ||
725 | + e.$hasEnvelopes.html('¥' + ($this.attr('data-all') * 1).toFixed(2)); | ||
726 | + e.$redEnvelopes.removeClass('active'); | ||
727 | + } | ||
728 | + } else { | ||
729 | + | ||
730 | + new dialog.Alert(data.message).show(); | ||
731 | + } | ||
732 | + } | ||
733 | + }; | ||
734 | + | ||
735 | + $.ajax(options); | ||
736 | + }); | ||
737 | + | ||
738 | + }); | ||
739 | + | ||
740 | + | ||
741 | + //发票抬头和备注字数限制 | ||
742 | + function limitStrLen($obj, len) { | ||
743 | + | ||
744 | + var $this = $obj; | ||
745 | + | ||
746 | + $this.keyup(function() { | ||
747 | + | ||
748 | + if ($this.val().length > len) { | ||
749 | + | ||
750 | + $this.val($this.val().substr(0, len)); | ||
751 | + } | ||
752 | + }); | ||
753 | + } | ||
754 | + | ||
755 | + limitStrLen($('#piaodesc'), 30); | ||
756 | + limitStrLen($('#notedesc'), 100); | ||
757 | + } | ||
758 | + } | ||
759 | +}; | ||
760 | + | ||
761 | +Order.Data.activity = 0; | ||
762 | +Order.Data.carriage = 0; | ||
763 | + | ||
764 | +Order.UI.init(); | ||
765 | +Order.Bll.init(); | ||
766 | + | ||
767 | + | ||
768 | +address.getUserAddressList(); | ||
769 | + | ||
770 | +// 0表示获取所有省的列表,'000000'表示无匹配的区域码 | ||
771 | +address.newAddress(0, '000000'); | ||
772 | +address.modifyAddress(); | ||
773 | +address.saveAddress(); | ||
774 | + | ||
775 | +//不同订单包裹提示 | ||
776 | + | ||
777 | +$('.why').click(function() { | ||
778 | + $('#differentBag').show(); | ||
779 | + return false; | ||
780 | + | ||
781 | +}); | ||
782 | +$('#differentBag').click(function() { | ||
783 | + return false; | ||
784 | +}); | ||
785 | +$(document).click(function() { | ||
786 | + $('#differentBag').hide(); | ||
787 | +}); | ||
788 | + | ||
789 | +//订单包裹左右切换 | ||
790 | +function lunBo($pre, $next, $ul, $iWidth) { | ||
791 | + var i = 1, | ||
792 | + j = 1; | ||
793 | + | ||
794 | + var iSpeed = 0, | ||
795 | + isMoving = false; | ||
796 | + | ||
797 | + $pre.click(function() { | ||
798 | + if (isMoving) { | ||
799 | + return; | ||
800 | + } | ||
801 | + | ||
802 | + if ($ul.css('left') === '0px') { | ||
803 | + iSpeed = 0; | ||
804 | + | ||
805 | + } else { | ||
806 | + iSpeed += j * $iWidth; | ||
807 | + isMoving = true; | ||
808 | + } | ||
809 | + $ul.stop().animate({ | ||
810 | + left: iSpeed | ||
811 | + }, 300, function() { | ||
812 | + isMoving = false; | ||
813 | + }); | ||
814 | + }); | ||
815 | + $next.click(function() { | ||
816 | + var $largeLeft = $ul.parent().width() - $ul.width() + 'px'; | ||
817 | + | ||
818 | + if (isMoving) { | ||
819 | + return; | ||
820 | + } | ||
821 | + | ||
822 | + if ($ul.css('left') === $largeLeft) { | ||
823 | + $ul.css('left', $largeLeft); | ||
824 | + } else { | ||
825 | + iSpeed += -i * $iWidth; | ||
826 | + isMoving = true; | ||
827 | + } | ||
828 | + | ||
829 | + $ul.stop().animate({ | ||
830 | + left: iSpeed | ||
831 | + }, 300, function() { | ||
832 | + isMoving = false; | ||
833 | + }); | ||
834 | + }); | ||
835 | +} | ||
836 | + | ||
837 | + | ||
838 | + | ||
839 | +//订单分类 | ||
840 | +$('.bag').find('ul').each(function() { | ||
841 | + var $pre = $(this).parent().parent().find('.pre'); | ||
842 | + var $next = $(this).parent().parent().find('.next'); | ||
843 | + | ||
844 | + var $iWidth = $(this).find('li').eq(0).width(); | ||
845 | + var $length = $(this).find('li').size(); | ||
846 | + var $ulWidth = $iWidth * $length; | ||
847 | + | ||
848 | + $(this).css('width', $ulWidth); | ||
849 | + if ($length > 5) { | ||
850 | + $pre.show(); | ||
851 | + $next.show(); | ||
852 | + lunBo($pre, $next, $(this), $iWidth); | ||
853 | + } else { | ||
854 | + $pre.hide(); | ||
855 | + $next.hide(); | ||
856 | + } | ||
857 | +}); |
@@ -24,6 +24,43 @@ lazyLoad($('img.lazy')); | @@ -24,6 +24,43 @@ lazyLoad($('img.lazy')); | ||
24 | * @num 每列存放商品的个数 | 24 | * @num 每列存放商品的个数 |
25 | */ | 25 | */ |
26 | exports.init = function(num) { | 26 | exports.init = function(num) { |
27 | + var $shopEntry = $('.shop-entry'), | ||
28 | + $shopEntryArea = $('.shop-entry-area'), | ||
29 | + shopEntryLen = $shopEntry.length; | ||
30 | + | ||
31 | + if (shopEntryLen > 0) { | ||
32 | + if (shopEntryLen % 3 === 1) { | ||
33 | + $shopEntry.eq(shopEntryLen - 1).css({ | ||
34 | + width: '100%' | ||
35 | + }); | ||
36 | + | ||
37 | + $shopEntry.eq(shopEntryLen - 1).find('.name').css({ | ||
38 | + width: '600px' | ||
39 | + }); | ||
40 | + } else if (shopEntryLen % 3 === 2) { | ||
41 | + $shopEntry.eq(shopEntryLen - 1).css({ | ||
42 | + width: '49%' | ||
43 | + }); | ||
44 | + | ||
45 | + $shopEntry.eq(shopEntryLen - 2).css({ | ||
46 | + width: '49%' | ||
47 | + }); | ||
48 | + | ||
49 | + $shopEntry.eq(shopEntryLen - 1).find('.name').css({ | ||
50 | + width: '230px' | ||
51 | + }); | ||
52 | + | ||
53 | + $shopEntry.eq(shopEntryLen - 2).find('.name').css({ | ||
54 | + width: '230px' | ||
55 | + }); | ||
56 | + } | ||
57 | + | ||
58 | + $('.shop-entry:nth-child(3n+1)').css({ | ||
59 | + marginLeft: 0 | ||
60 | + }); | ||
61 | + | ||
62 | + $shopEntryArea.show(); | ||
63 | + } | ||
27 | 64 | ||
28 | productList = null; | 65 | productList = null; |
29 | 66 |
web-static/js/product/shop-index.js
0 → 100644
1 | +/** | ||
2 | + * 首页 | ||
3 | + * @author: bikai<kai.bi@yoho.cn> | ||
4 | + * @date: 2016/4/26 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('yoho.jquery'), | ||
8 | + lazyLoad = require('yoho.lazyload'), | ||
9 | + product = require('../product/product'); | ||
10 | + | ||
11 | +var $shopIntro = $('.shop-intro'), | ||
12 | + $shopCollect = $('.shop-collect'), | ||
13 | + $sliderLeft = $('.slider-left'), | ||
14 | + $allGoods = $('.all-goods'), | ||
15 | + $fixedArea = $allGoods.find('.fixed-area'), | ||
16 | + fixedAreaTop = $fixedArea.offset() ? $fixedArea.offset().top : 0; | ||
17 | + | ||
18 | +// Pjax | ||
19 | +require('yoho.pjax'); | ||
20 | + | ||
21 | +require('../common/slider'); | ||
22 | +require('../product/list'); | ||
23 | + | ||
24 | +product.init(4); | ||
25 | + | ||
26 | +lazyLoad($('img.lazy')); | ||
27 | + | ||
28 | +if ($sliderLeft.length) { | ||
29 | + $sliderLeft.slider(); | ||
30 | +} | ||
31 | + | ||
32 | +$shopIntro.on('click', function() { | ||
33 | + $('.pop-shop-intro').show(); | ||
34 | + $('.mask').show(); | ||
35 | +}); | ||
36 | + | ||
37 | +$('.close-btn, .mask').on('click', function() { | ||
38 | + $('.pop-shop-intro').hide(); | ||
39 | + $('.mask').hide(); | ||
40 | +}); | ||
41 | + | ||
42 | + | ||
43 | +// 收藏店铺 | ||
44 | +function colloectAction() { | ||
45 | + var $colloectIcon = $shopCollect.find('.shop-collect-ico'), | ||
46 | + $colloectText = $shopCollect.find('.shop-collect-text'), | ||
47 | + isFavorite = $colloectIcon.hasClass('on'), | ||
48 | + needColloect = window.cookie('needColloect'); | ||
49 | + | ||
50 | + $.ajax({ | ||
51 | + type: 'post', | ||
52 | + url: '/shoplist/setFavorite', | ||
53 | + data: { | ||
54 | + isFavorite: isFavorite ? 0 : 1, | ||
55 | + needColloect: needColloect, | ||
56 | + shopId: $shopCollect.data('id') | ||
57 | + }, | ||
58 | + success: function(res) { | ||
59 | + if (res.code === 200) { | ||
60 | + if (isFavorite) { | ||
61 | + $colloectIcon.removeClass('on'); | ||
62 | + $colloectText.html('收藏'); | ||
63 | + } else { | ||
64 | + $colloectIcon.addClass('on'); | ||
65 | + $colloectText.html('已收藏'); | ||
66 | + } | ||
67 | + | ||
68 | + if (needColloect) { | ||
69 | + $colloectIcon.addClass('on'); | ||
70 | + $colloectText.html('已收藏'); | ||
71 | + } | ||
72 | + } else if (res.code === 401) { | ||
73 | + window.setCookie('needColloect', '1', { | ||
74 | + path: '/', | ||
75 | + domain: '.yohobuy.com', | ||
76 | + expires: 90 | ||
77 | + }); | ||
78 | + location.href = res.url; | ||
79 | + } | ||
80 | + } | ||
81 | + }); | ||
82 | +} | ||
83 | + | ||
84 | +$shopCollect.on('click', function() { | ||
85 | + colloectAction(); | ||
86 | +}); | ||
87 | + | ||
88 | +if (window.cookie('needColloect') * 1 === 1 && window.getUid()) { | ||
89 | + colloectAction(); | ||
90 | + window.setCookie('needColloect', '', { | ||
91 | + path: '/', | ||
92 | + domain: '.yohobuy.com', | ||
93 | + expires: 1 | ||
94 | + }); | ||
95 | +} | ||
96 | + | ||
97 | +// 全部商品使用 pjax 翻页 | ||
98 | +$allGoods.pjax('a.pjax', '.goods-wrap', { | ||
99 | + timeout: 5000, | ||
100 | + scrollTo: false // 默认滚动没有动画,禁止掉 | ||
101 | +}).on('pjax:end', function() { | ||
102 | + product.init(4); | ||
103 | + lazyLoad($('img.lazy')); | ||
104 | + | ||
105 | + $fixedArea = $allGoods.find('.fixed-area'); // 翻页后 fixed-area 区域有变化,需要更新选择器 | ||
106 | + | ||
107 | + // 分页后移动到全部商品 | ||
108 | + $('html, body').animate({ | ||
109 | + scrollTop: $allGoods.offset().top - 30 | ||
110 | + }); | ||
111 | +}).on('click', '.menu-list li', function() { | ||
112 | + var $this = $(this); | ||
113 | + | ||
114 | + $this.siblings().removeClass('on'); | ||
115 | + $this.addClass('on'); | ||
116 | +}); | ||
117 | + | ||
118 | +$(window).on('scroll', function() { | ||
119 | + var scrollTop = $(this).scrollTop(); | ||
120 | + | ||
121 | + if (scrollTop > fixedAreaTop) { | ||
122 | + $fixedArea.css({ | ||
123 | + position: 'fixed', | ||
124 | + top: 0 | ||
125 | + }); | ||
126 | + } else { | ||
127 | + $fixedArea.css({ | ||
128 | + position: 'static', | ||
129 | + top: 0 | ||
130 | + }); | ||
131 | + } | ||
132 | +}); |
-
Please register or login to post a comment