Authored by hf

merge fixes bug 2015/10/26

Showing 77 changed files with 942 additions and 416 deletions
@@ -38,11 +38,12 @@ class NewsaleData @@ -38,11 +38,12 @@ class NewsaleData
38 * 38 *
39 * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 39 * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
40 * @param string $channel 1表示男, 2表示女 40 * @param string $channel 1表示男, 2表示女
41 - * @param integer $limit 查询返回的最大限制数, 默认为50 41 + * @param string $order 排序方式,默认s_t_desc表示按照时间倒序排列
  42 + * @param integer $limit 查询返回的最大限制数, 默认为60
42 * @param integer $page 分页第几页, 默认第1页 43 * @param integer $page 分页第几页, 默认第1页
43 * @return array 新品到着商品数据 44 * @return array 新品到着商品数据
44 */ 45 */
45 - public static function getNewProducts($gender, $channel, $limit = 50, $page = 1) 46 + public static function getNewProducts($gender, $channel, $order = 's_t_desc', $limit = 60, $page = 1)
46 { 47 {
47 // 构建url地址列表 48 // 构建url地址列表
48 $urlList = array(); 49 $urlList = array();
@@ -50,6 +51,7 @@ class NewsaleData @@ -50,6 +51,7 @@ class NewsaleData
50 $param = Yohobuy::param(); 51 $param = Yohobuy::param();
51 $param['method'] = 'app.search.newProduct'; 52 $param['method'] = 'app.search.newProduct';
52 $param['gender'] = $gender; 53 $param['gender'] = $gender;
  54 + $param['order'] = $order;
53 $param['page'] = $page; 55 $param['page'] = $page;
54 $param['limit'] = $limit; 56 $param['limit'] = $limit;
55 $param['yh_channel'] = $channel; 57 $param['yh_channel'] = $channel;
@@ -89,9 +91,11 @@ class NewsaleData @@ -89,9 +91,11 @@ class NewsaleData
89 * @param integer $dayLimit 限制读取多少天,默认为1天 91 * @param integer $dayLimit 限制读取多少天,默认为1天
90 * @param integer $limit 查询返回的最大限制数, 默认为50 92 * @param integer $limit 查询返回的最大限制数, 默认为50
91 * @param integer $page 分页第几页, 默认第1页 93 * @param integer $page 分页第几页, 默认第1页
  94 + * @param string $order 排序方式,默认s_t_desc表示按照时间倒序排列
  95 + *
92 * @return array 根据指定条件筛选出来的商品 96 * @return array 根据指定条件筛选出来的商品
93 */ 97 */
94 - public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 50, $page = 1) 98 + public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 60, $page = 1, $order = 's_t_desc')
95 { 99 {
96 $selectItems = array( 100 $selectItems = array(
97 'gender' => $gender, 101 'gender' => $gender,
@@ -109,9 +113,14 @@ class NewsaleData @@ -109,9 +113,14 @@ class NewsaleData
109 }); 113 });
110 114
111 $param = Yohobuy::param(); 115 $param = Yohobuy::param();
  116 + if(!is_null($dayLimit)) {
112 $param['method'] = 'app.search.newProduct'; 117 $param['method'] = 'app.search.newProduct';
  118 + }else {
  119 + $param['method'] = 'app.search.sales';
  120 + }
113 $param['page'] = $page; 121 $param['page'] = $page;
114 $param['limit'] = $limit; 122 $param['limit'] = $limit;
  123 + $param['order'] = $order;
115 $param['yh_channel'] = $channel; 124 $param['yh_channel'] = $channel;
116 $param = array_merge($param, $queriedParams); 125 $param = array_merge($param, $queriedParams);
117 126
@@ -140,22 +149,7 @@ class NewsaleData @@ -140,22 +149,7 @@ class NewsaleData
140 149
141 // 构建url地址列表 150 // 构建url地址列表
142 $urlList = array(); 151 $urlList = array();
143 - $param['p_d'] = '0.1,0.3';  
144 - $param['client_secret'] = Sign::getSign($param);  
145 - $urlList['1-3折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);  
146 -  
147 - $param['p_d'] = '0.4,0.6';  
148 - unset($param['client_secret']);  
149 - $param['client_secret'] = Sign::getSign($param);  
150 - $urlList['4-6折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);  
151 -  
152 - $param['p_d'] = '0.7,0.9';  
153 - unset($param['client_secret']);  
154 - $param['client_secret'] = Sign::getSign($param);  
155 - $urlList['7-9折'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);  
156 -  
157 $param['p_d'] = '0.1,0.9'; 152 $param['p_d'] = '0.1,0.9';
158 - unset($param['client_secret']);  
159 $param['client_secret'] = Sign::getSign($param); 153 $param['client_secret'] = Sign::getSign($param);
160 $urlList['ALL'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); 154 $urlList['ALL'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
161 155
@@ -146,7 +146,7 @@ class FloorProcess @@ -146,7 +146,7 @@ class FloorProcess
146 $build = array(); 146 $build = array();
147 foreach ($data['list'] as $one) { 147 foreach ($data['list'] as $one) {
148 $build['url'] = Helpers::getFilterUrl($one['url']); 148 $build['url'] = Helpers::getFilterUrl($one['url']);
149 - $build['img'] = Helpers::getImageUrl($one['src'], 140, 140); 149 + $build['img'] = Helpers::getImageUrl($one['src'], 128, 140);
150 $build['textCn'] = $one['title']; 150 $build['textCn'] = $one['title'];
151 $result['hotCategory']['list'][] = $build; 151 $result['hotCategory']['list'][] = $build;
152 } 152 }
@@ -314,7 +314,7 @@ class FloorProcess @@ -314,7 +314,7 @@ class FloorProcess
314 if (isset($one['url'])) { 314 if (isset($one['url'])) {
315 $one['url'] = Helpers::getFilterUrl($one['url']); 315 $one['url'] = Helpers::getFilterUrl($one['url']);
316 } 316 }
317 - $one['img'] = Helpers::getImageUrl($one['src'], 640, 400); 317 + $one['img'] = Helpers::getImageUrl($one['src'], 640, 403);
318 unset($one['src']); 318 unset($one['src']);
319 } 319 }
320 $data['banner'] = $data['big_image']; 320 $data['banner'] = $data['big_image'];
@@ -324,7 +324,7 @@ class FloorProcess @@ -324,7 +324,7 @@ class FloorProcess
324 if (isset($one['url'])) { 324 if (isset($one['url'])) {
325 $one['url'] = Helpers::getFilterUrl($one['url']); 325 $one['url'] = Helpers::getFilterUrl($one['url']);
326 } 326 }
327 - $one['img'] = Helpers::getImageUrl($one['src'], 212, 192); 327 + $one['img'] = Helpers::getImageUrl($one['src'], 191, 191);
328 unset($one['src']); 328 unset($one['src']);
329 } 329 }
330 $result['creativeLife'] = $data; 330 $result['creativeLife'] = $data;
@@ -150,15 +150,15 @@ class ListProcess @@ -150,15 +150,15 @@ class ListProcess
150 'subs' => array( 150 'subs' => array(
151 array( 151 array(
152 'chosed' => true, 152 'chosed' => true,
153 - 'dataId' => 0, 153 + 'dataId' => '0.1,0.9',
154 'name' => '所有商品' 154 'name' => '所有商品'
155 ) 155 )
156 ) 156 )
157 ); 157 );
158 158
159 - foreach ($data as $one) { 159 + foreach ($data as $key => $one) {
160 $discount = array(); 160 $discount = array();
161 - $discount['dataId'] = $one['count']; 161 + $discount['dataId'] = $key;
162 $discount['name'] = $one['name'] .'折商品'; 162 $discount['name'] = $one['name'] .'折商品';
163 163
164 $result['subs'][] = $discount; 164 $result['subs'][] = $discount;
1 -<?xml version="1.0" standalone="no"?>  
2 -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >  
3 -<svg xmlns="http://www.w3.org/2000/svg">  
4 -<metadata>  
5 -Created by FontForge 20120731 at Fri Oct 23 16:38:57 2015  
6 - By Ads  
7 -</metadata>  
8 -<defs>  
9 -<font id="iconfont" horiz-adv-x="1024" >  
10 - <font-face  
11 - font-family="iconfont"  
12 - font-weight="500"  
13 - font-stretch="normal"  
14 - units-per-em="1024"  
15 - panose-1="2 0 6 3 0 0 0 0 0 0"  
16 - ascent="812"  
17 - descent="-212"  
18 - x-height="792"  
19 - bbox="-0.75 -224 3943 812.871"  
20 - underline-thickness="50"  
21 - underline-position="-100"  
22 - unicode-range="U+0078-E628"  
23 - />  
24 -<missing-glyph horiz-adv-x="374"  
25 -d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />  
26 - <glyph glyph-name=".notdef" horiz-adv-x="374"  
27 -d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />  
28 - <glyph glyph-name=".null" horiz-adv-x="0"  
29 - />  
30 - <glyph glyph-name="nonmarkingreturn" horiz-adv-x="341"  
31 - />  
32 - <glyph glyph-name="x" unicode="x" horiz-adv-x="1001"  
33 -d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5  
34 -t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5  
35 -t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />  
36 - <glyph glyph-name="uniE600" unicode="&#xe600;" horiz-adv-x="1463"  
37 -d="M798 -160q0 -46 25 -58t61 16l537 420q36 28 36 68t-36 68l-537 424q-36 29 -61 16.5t-25 -57.5v-238q-138 0 -252.5 -24.5t-192 -63.5t-137.5 -94t-94.5 -109t-57.5 -117t-31.5 -109.5t-11 -94t-1.5 -63.5t2 -25q47 62 87 104t90 78t103.5 57.5t127 36.5t161.5 21t207 6  
38 -v-262z" />  
39 - <glyph glyph-name="uniE601" unicode="&#xe601;"  
40 -d="M281 372q-9 -6 -16.5 -14.5t-11.5 -18t-4 -18.5v-7v-483h1q4 -15 13.5 -28t24 -20t30.5 -7h582q28 0 48.5 20t20.5 49t-20.5 49t-48.5 20h41q35 0 59 24.5t24 58.5t-24 58.5t-59 24.5q35 0 59 24t24 59q0 16 -6.5 31.5t-17.5 26.5t-26.5 17.5t-32.5 6.5h-48q21 0 38 10.5  
41 -t27.5 27.5t10.5 38v-13q0 31 -22.5 54t-53.5 24q-125 6 -259 9q40 148 16 278q-4 25 -13.5 44.5t-22 31.5t-27 19.5t-29.5 8t-29.5 -2.5t-27.5 -12t-23 -21t-15.5 -30t-5.5 -38q-3 -19 -4.5 -36.5t-2.5 -28.5v-22q-1 -11 -2 -18.5t-2 -16t-3 -16.5t-5.5 -18t-8.5 -23  
42 -q-24 -60 -133 -115q-4 -1 -7 -2.5t-6 -3.5l-2 -1v0zM60 356q-25 0 -42.5 -17.5t-17.5 -42.5v-405q0 -25 17.5 -42.5t42.5 -17.5h134v525h-134z" />  
43 - <glyph glyph-name="uniE602" unicode="&#xe602;" horiz-adv-x="1323"  
44 -d="M643 472q0 -68 -47.5 -116t-113.5 -48q0 -68 47 -116t113.5 -48t113.5 48t47 116t-47 116t-113 48zM643 800q-68 0 -139.5 -21.5t-133 -57t-119 -80.5t-102.5 -93t-79 -94t-52 -84t-18 -62q0 -28 25 -75t68 -102t105 -111t131 -101.5t152 -74.5t161.5 -29t161.5 29  
45 -t152 74.5t131 101.5t105 111t68 102t25 75t-25 75t-68 101.5t-105 110.5t-131 102t-152 74.5t-161 28.5zM643 -21q-88 0 -162 44t-117 120t-43 165q0 66 25.5 127t68.5 105t102.5 70t125.5 26q131 0 225 -94q94 -99 96 -234q0 -30 -5.5 -59t-15 -55.5t-23.5 -51.5t-32 -46  
46 -t-38.5 -39.5t-44.5 -32.5t-50 -24t-54.5 -15.5t-57.5 -5.5z" />  
47 - <glyph glyph-name="uniE603" unicode="&#xe603;"  
48 -d="M512 286v343h85v-426h-81v-2h-256v85h252zM512 -224q139 0 257 68.5t186.5 186.5t68.5 257t-68.5 257t-186.5 186.5t-257 68.5t-257 -68.5t-186.5 -186.5t-68.5 -257t68.5 -257t186.5 -186.5t257 -68.5z" />  
49 - <glyph glyph-name="uniE604" unicode="&#xe604;"  
50 -d="M774 324q6 -9 9.5 -19t2.5 -20.5t-5.5 -20.5t-12.5 -18l-1 -1l-427 -428q-18 -17 -42.5 -17t-41.5 17q-12 12 -16 27t0 30.5t15 26.5l387 387l-387 387q-17 17 -17 41.5t17.5 42t42 17.5t42.5 -17l427 -428q1 0 1 -1q2 -1 3.5 -2.5t2.5 -3.5z" />  
51 - <glyph glyph-name="uniE605" unicode="&#xe605;"  
52 -d="M707 748q-55 0 -105 -20.5t-90 -56.5q-40 36 -90 56.5t-105 20.5q-34 0 -67 -8t-62 -23t-54.5 -35.5t-45.5 -46.5t-34.5 -55.5t-22 -63t-7.5 -68.5q0 -110 69 -194l2 -2l344 -391q30 -33 73 -33t73 33l344 391q0 1 1 2h1q22 27 37.5 58.5t23.5 66t8 69.5q0 49 -14.5 94.5  
53 -t-42 82.5t-63.5 64.5t-80.5 43t-92.5 15.5z" />  
54 - <glyph glyph-name="uniE606" unicode="&#xe606;" horiz-adv-x="1000"  
55 -d="M109 415q19 0 35.5 -7t28.5 -19t19.5 -29t7.5 -35q0 -25 -12.5 -45.5t-33 -32.5t-45.5 -12q-37 0 -63.5 26.5t-26.5 63.5t26.5 63.5t63.5 26.5zM515.5 415q37.5 0 63.5 -26.5t26 -63.5t-26 -63.5t-63.5 -26.5t-64 26.5t-26.5 63.5t26.5 63.5t64 26.5zM921 415  
56 -q37 0 63.5 -26.5t26.5 -63.5t-26.5 -63.5t-63.5 -26.5t-63.5 26.5t-26.5 63.5t26.5 63.5t63.5 26.5z" />  
57 - <glyph glyph-name="uniE607" unicode="&#xe607;" horiz-adv-x="1643"  
58 -d="M547 190h-1l45 -46l248 239l-45 46l-201 -194l-195 201l-46 -44z" />  
59 - <glyph glyph-name="uniE608" unicode="&#xe608;" horiz-adv-x="1821"  
60 -d="M930 135q-14 -13 -33.5 -13t-33.5 13l-252 242q-14 13 -14 32t14 32t34 13t34 -13l251 -242q6 -5 9.5 -11.5t4.5 -13.5t0 -14t-4.5 -13.5t-9.5 -11.5zM360 135q-14 13 -14 32t14 32l251 242q14 13 34 13t34 -13q6 -6 9.5 -15t3.5 -17.5t-3.5 -17t-9.5 -14.5l-252 -242  
61 -q-14 -13 -33.5 -13t-33.5 13z" />  
62 - <glyph glyph-name="uniE609" unicode="&#xe609;" horiz-adv-x="1821"  
63 -d="M930 377l-251 -242q-14 -13 -34 -13t-34 13q-9 9 -12 20.5t0 23.5t12 20l252 242q14 13 33.5 13t33.5 -13t14 -32t-14 -32zM427 441l252 -242q9 -8 12 -20t0 -23.5t-12 -20.5q-14 -13 -34 -13t-34 13l-251 242q-14 13 -14 32t14 32q6 7 15 10.5t18 3.5t18 -3.5t16 -10.5z  
64 -" />  
65 - <glyph glyph-name="uniE60A" unicode="&#xe60a;"  
66 -d="M1024 288q0 -139 -68.5 -257t-186.5 -186.5t-257 -68.5t-257 68.5t-186.5 186.5t-68.5 257t68.5 257t186.5 186.5t257 68.5t257 -68.5t186.5 -186.5t68.5 -257zM801 498l-365 -366l-156 156l-37 -37l193 -193l403 403z" />  
67 - <glyph glyph-name="uniE60B" unicode="&#xe60b;" horiz-adv-x="1344"  
68 -d="M1280 236h-1216q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5h1216q27 0 45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM1280 -212h-1216q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5h1216q27 0 45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM1280 684  
69 -h-1216q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5h1216q27 0 45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5z" />  
70 - <glyph glyph-name="uniE60C" unicode="&#xe60c;"  
71 -d="M1024 300q0 -139 -68.5 -257t-186.5 -186.5t-257 -68.5t-257 68.5t-186.5 186.5t-68.5 257t68.5 257t186.5 186.5t257 68.5t257 -68.5t186.5 -186.5t68.5 -257z" />  
72 - <glyph glyph-name="uniE60D" unicode="&#xe60d;" horiz-adv-x="1685"  
73 -d="M1229 -77l289 -135l58 124l-281 131q-7 -18 -18 -39.5t-23 -41.5t-25 -39zM944 475v-134h137v258q42 47 62 81l-118 69q-2 -4 -8 -12t-24.5 -30.5t-41 -45.5t-60.5 -54.5t-81 -59.5l75 -114q6 4 12.5 8t12.5 8.5t11.5 8.5t11.5 8t11 9zM1524 19v304h-605v-304h137v167  
74 -h332v-167h136zM1283 169h-137v-66q0 -26 -13.5 -48.5t-37 -40t-52 -32t-63 -25.5t-64 -19t-60.5 -14l74 -124q55 14 103 30.5t95.5 43t80.5 58t53.5 75.5t20.5 96v66zM1088 570l31 -133q42 9 85 21q19 -49 59 -78q49 -36 120 -36q26 0 49.5 4t42.5 10q69 21 133 78l-67 125  
75 -q-7 -7 -17 -16t-24 -20.5t-31 -21t-34 -14.5q-29 -9 -53.5 -8.5t-37.5 9.5q-4 3 -8 9q147 51 240 103l-81 111q-74 -38 -173 -74v85h-137v-129q-50 -14 -97 -25zM755 477v137h-348q11 42 19 84l-134 26q-4 -19 -8 -37.5t-9.5 -36.5t-10.5 -36h-200v-137h142  
76 -q-79 -149 -206 -260l90 -103q43 38 85 83v-389h137v165h260v-24h-124l48 -137h83q54 0 92 38t38 92v490h-373q11 22 21 45h398zM312 134h260v-24h-260v24zM312 295h260v-24h-260v24zM1683 732q0 -33 -22.5 -56t-55.5 -23q-22 0 -40 10.5t-28.5 28.5t-10.5 40q0 16 6 30.5  
77 -t16.5 25t25.5 16.5t31 6q33 0 55.5 -22.5t22.5 -55.5zM1545 732q0 -10 3 -20t8.5 -17.5t13 -13.5t16.5 -9t19 -3q25 0 41.5 18t16.5 44q0 27 -16.5 45.5t-42.5 18.5q-25 0 -42 -18.5t-17 -44.5zM1592 691h-17v79q17 2 29 2q18 0 26 -6q2 -1 3.5 -3t2.5 -4t1.5 -4.5t0.5 -5.5  
78 -q0 -7 -4.5 -11.5t-11.5 -7.5v-1q10 -3 14 -19q1 -8 2.5 -12t3.5 -7h-19q-2 3 -6 19q-2 12 -16 12h-9v-31zM1593 735h8q18 0 18 12q0 5 -4 8.5t-12 3.5q-4 0 -6 -0.5t-4 -0.5v-23z" />  
79 - <glyph glyph-name="uniE60E" unicode="&#xe60e;" horiz-adv-x="3958"  
80 -d="M611 639h-177l-150 -222l-95 222h-178l168 -395v-2l-31 -243h156l30 231zM699 481q-100 0 -179.5 -72.5t-92.5 -175.5q-13 -105 51 -178q61 -68 157 -68q99 0 178.5 72.5t92.5 175.5q13 104 -51 177q-60 69 -156 69zM759 233q-2 -16 -8.5 -31.5t-16.5 -27.5t-22.5 -21.5  
81 -t-27 -14.5t-29.5 -5q-12 0 -23 3t-20.5 9t-16.5 15q-13 14 -18.5 33.5t-2.5 41.5q2 16 8.5 31t16.5 27.5t22.5 21.5t27.5 14.5t30 5.5q36 0 59 -27q27 -30 21 -75zM1656 481q-65 0 -124.5 -33t-99 -90.5t-48.5 -124.5q-13 -105 51 -178q20 -22 44.5 -37t53 -23t59.5 -8  
82 -q99 0 178.5 72.5t92.5 175.5q3 25 1.5 49.5t-8 47t-17.5 43t-27 37.5q-29 34 -69.5 51.5t-86.5 17.5zM1717 233q-4 -27 -19 -50t-38 -36.5t-48 -13.5q-18 0 -33.5 7t-26.5 20q-13 14 -18.5 33.5t-2.5 41.5q5 41 36 70.5t69 29.5q8 0 16.5 -2t16 -5.5t14.5 -8.5t13 -11  
83 -q26 -30 21 -75zM1332 418q-44 50 -114 50q-13 0 -25.5 -1.5t-24.5 -5t-24 -9t-23 -11.5l-10 -6l26 204h-156l-80 -640h155l37 288q3 24 22 41t43 17q12 0 22.5 -4.5t17.5 -12.5q16 -18 12 -42l-36 -287h156l37 298q2 13 1.5 26.5t-3 26.5t-7 25t-11 23t-15.5 20zM2949 460  
84 -l-37 -288q-3 -24 -22 -41t-44 -17q-24 0 -39 17q-5 6 -8.5 12.5t-4.5 14t0 15.5l37 287h-156l-38 -298q-9 -71 36 -121q21 -25 50.5 -37.5t63.5 -12.5q25 0 49.5 7t47.5 20l9 6l-3 -25h156l58 461h-155zM1951 639l-55 -432h156l55 432h-156zM1970 168q-18 0 -36 -7.5  
85 -t-31.5 -19.5t-22.5 -28.5t-12 -34.5q-4 -37 19 -63q11 -13 26 -19.5t33 -6.5q37 0 67 26.5t34 63.5q5 37 -18 63q-4 5 -9.5 9t-11 7t-12 5.5t-13 3.5t-13.5 1zM2608 178q4 34 -3.5 64.5t-26.5 55t-47 39.5l-8 5l8 5q19 10 35.5 25t28.5 32.5t19.5 37t10.5 40.5q8 63 -30 108  
86 -q-37 44 -97 48l-6 1h-314l-81 -640h317q72 3 128.5 55t65.5 124zM2451 200q-3 -27 -25 -46.5t-50 -19.5h-106l17 134h107q27 -1 43.5 -20.5t13.5 -47.5zM2483 447q-2 -16 -12 -30t-25 -22.5t-31 -8.5h-113l15 124h112q25 0 41.5 -18.5t12.5 -44.5zM3132 -211q65 0 124 37.5  
87 -t89 99.5l264 534h-156l-127 -258l-63 258h-156l113 -471l-7 -14q-8 -18 -25 -29t-36 -11q-5 0 -10 1t-10 3l-29 11l-67 -139l29 -10q31 -12 67 -12zM3943 646q0 -16 -3 -31.5t-9 -29.5t-14.5 -26.5t-19 -23t-23 -19t-26.5 -14.5t-29.5 -9t-31.5 -3q-32 0 -61 12t-50 33  
88 -t-33 50t-12 61q0 43 20.5 79t57 56.5t79.5 20.5q65 0 110 -45t45 -111zM3670 646q0 -25 9 -48t24.5 -40t37.5 -26.5t47 -9.5q24 0 46 9.5t37 26t24 39.5t9 48q0 53 -33.5 89.5t-84.5 36.5q-32 0 -59 -17t-42 -45.5t-15 -62.5zM3763 566h-35v155q11 2 16.5 2.5t18 1.5t23.5 1  
89 -q21 0 32.5 -3t19.5 -9q7 -6 11.5 -14.5t4.5 -19.5q0 -13 -8.5 -22.5t-23.5 -14.5v-2q20 -6 27 -37q2 -9 3.5 -15.5t3 -11t2.5 -7t2 -4.5h-37q-4 5 -12 38q-2 12 -9.5 17.5t-21.5 5.5h-17v-61zM3764 653h17q35 0 35 23t-32 23q-7 0 -12 -0.5t-8 -0.5v-45z" />  
90 - <glyph glyph-name="uniE60F" unicode="&#xe60f;"  
91 -d="M682 74q-108 -89 -249 -89q-53 0 -104.5 14.5t-94.5 39.5t-79.5 61.5t-61.5 79.5t-39.5 94t-14.5 105q0 107 53 197.5t143.5 143.5t197.5 53t197.5 -53t143.5 -143.5t53 -197.5q0 -141 -89 -249l286 -286l-56 -56zM433 64q131 0 223 92t92 222.5t-92 223t-223 92.5  
92 -t-223 -93q-91 -93 -92 -222q0 -86 42 -158.5t115 -114.5t158 -42z" />  
93 - <glyph glyph-name="uniE610" unicode="&#xe610;"  
94 -d="M245 300l-9 9l472 472l80 -80l-400 -401l400 -401l-80 -80l-472 472z" />  
95 - <glyph glyph-name="uniE611" unicode="&#xe611;"  
96 -d="M509 780q-4 -2 -245 -245q-221 -224 -235 -245q-6 -9 -6 -15q0 -35 42 -33q7 0 233 227l225 228l226 -228q105 -106 167 -166.5t65 -60.5q21 -1 31.5 7.5t10.5 25.5q0 12 -32 46q-33 36 -206 212q-241 243 -246 246q-15 8 -30 1zM171 245q-12 -8 -14 -38.5t-2 -188  
97 -t2 -188t14 -38.5q7 -6 352.5 -6t352.5 6q11 8 13 36q2 30 2 190q0 158 -2 188.5t-13 38.5q-8 7 -21.5 5.5t-21.5 -10.5l-10 -9v-381h-600v381l-10 9q-15 16 -36 9q-4 -2 -6 -4zM398 202l-11 -12v-215l11 -12q6 -8 11 -10.5t14 -2.5q16 0 26 13l10 12v175h128v-175l11 -12  
98 -q7 -9 16 -12t18.5 0t16.5 12l10 12v215l-20 24h-231z" />  
99 - <glyph glyph-name="uniE612" unicode="&#xe612;"  
100 -d="M951 -7h-878l439 614z" />  
101 - <glyph glyph-name="uniE613" unicode="&#xe613;"  
102 -d="M512 -7l-439 614h878z" />  
103 - <glyph glyph-name="uniE614" unicode="&#xe614;"  
104 -d="M313 -49l349 349l-349 349q-7 7 -7 16.5t6.5 16t16 6.5t16.5 -6l345 -345q16 -15 21 -20q7 -7 7 -17t-7 -17q-4 -4 -25.5 -25t-22.5 -22l-318 -318q-7 -6 -16.5 -6t-16 6.5t-6.5 16t7 16.5z" />  
105 - <glyph glyph-name="uniE615" unicode="&#xe615;"  
106 -d="M527.5 475q2.5 0 4.5 -1l6 -2q2 -1 3 -3l293 -288q3 -3 5 -6.5t2 -7.5t-1.5 -8t-4.5 -7q-6 -6 -14.5 -6t-14.5 6l-279 273l-278 -273q-7 -6 -15 -6t-14 6t-6 14.5t6 14.5l293 288q2 2 4 3t5 2t5.5 1z" />  
107 - <glyph glyph-name="uniE616" unicode="&#xe616;"  
108 -d="M527 146q-4 0 -7.5 1.5t-6.5 4.5l-293 288q-6 6 -6 14t6 14.5t14 6.5t15 -6l278 -274l279 274q6 6 14.5 6t14.5 -6.5t5.5 -14.5t-6.5 -14l-293 -288q-5 -6 -14 -6z" />  
109 - <glyph glyph-name="uniE617" unicode="&#xe617;" horiz-adv-x="1030"  
110 -d="M-195 162zM520 770q-98 0 -187.5 -38t-154 -102.5t-102.5 -154t-38 -187.5q0 -79 24 -152.5t69 -132.5t104 -103.5t132.5 -69t152.5 -24.5q98 0 187.5 38t154 102.5t102.5 154t38 187.5t-38 187.5t-102.5 154t-154 102.5t-187.5 38zM857 485l-339 -451l-328 238  
111 -q-12 9 -14 23.5t7 26.5q5 8 13.5 11.5t18 2.5t17.5 -6l271 -198l297 396q6 8 14.5 11.5t18 2.5t17.5 -7q12 -9 14 -23.5t-7 -26.5z" />  
112 - <glyph glyph-name="uniE618" unicode="&#xe618;"  
113 -d="M224 192q-40 0 -68 28t-28 68t28 68t68 28t68 -28t28 -68t-28 -68t-68 -28zM512 192q-40 0 -68 28t-28 68t28 68t68 28t68 -28t28 -68t-28 -68t-68 -28zM800 192q-40 0 -68 28t-28 68t28 68t68 28t68 -28t28 -68t-28 -68t-68 -28z" />  
114 - <glyph glyph-name="uniE619" unicode="&#xe619;"  
115 -d="M126 225q30 0 50.5 21.5t20.5 52.5q0 33 -20.5 54.5t-51 21.5t-51.5 -21.5t-21 -54.5q0 -45 38 -66q17 -8 35 -8zM512 225q15 0 28.5 5.5t23 15.5t15 24t5.5 29q0 9 -2 18t-5.5 16.5t-8 14t-10.5 11.5t-13.5 9t-15.5 5.5t-17 1.5q-30 0 -51 -21.5t-21 -54.5q0 -45 38 -66  
116 -q16 -8 34 -8zM899.5 225q30.5 0 51 21.5t20.5 52.5q0 9 -2 18t-5.5 16.5t-8 14t-11 11.5t-13.5 9t-15 5.5t-17 1.5q-20 0 -36.5 -9.5t-26 -27t-9.5 -39.5q0 -31 21 -52.5t51.5 -21.5z" />  
117 - <glyph glyph-name="uniE61A" unicode="&#xe61a;"  
118 -d="M512 -146q-91 0 -173.5 35.5t-142 95t-95 142t-35.5 173.5q0 61 16 118.5t45 106.5t70 90t90 70t106.5 45t118.5 16q91 0 173.5 -35.5t142 -95t95 -142t35.5 -173.5q0 -61 -16 -118.5t-45 -106.5t-70 -90t-90 -70t-106.5 -45t-118.5 -16zM512 682q-104 0 -192 -51  
119 -t-139 -139t-51 -192t51 -192t139 -139t192 -51t192 51t139 139t51 192t-51 192t-139 139t-192 51zM512 508zM464 508q0 20 14 34t34 14t34 -14t14 -34t-14 -34t-34 -14t-34 14t-14 34zM512 44q-13 0 -22.5 9.5t-9.5 22.5v288q0 13 9.5 22.5t22.5 9.5t22.5 -9.5t9.5 -22.5  
120 -v-288q0 -13 -9.5 -22.5t-22.5 -9.5z" />  
121 - <glyph glyph-name="uniE61B" unicode="&#xe61b;"  
122 -d="M437 41h-193q-27 2 -41.5 22.5t-17.5 45.5q3 25 17.5 41t41.5 18h193v63l-193 1q-27 2 -41.5 19t-17.5 43q3 25 17.5 41t41.5 18h144l-134 236q-10 12 -19 30.5t-8 40.5q5 28 20 45.5t56 22.5q24 -2 43 -16.5t31 -31.5l152 -278l167 280q12 17 31 30t43 16q15 -1 27.5 -4  
123 -t22 -10t16 -20t9.5 -34q0 -29 -20 -55l-155 -252h147q26 -2 41 -18t17 -41q-2 -26 -17.5 -44t-41.5 -20l-191 -1v-61h192q26 -2 41 -20t17 -43q-2 -26 -17 -43.5t-41 -19.5l-192 1v-106q-4 -85 -93 -85q-44 0 -68.5 21t-26.5 64v104z" />  
124 - <glyph glyph-name="uniE61C" unicode="&#xe61c;"  
125 -d="M946 -196h-868q-26 0 -44 18t-18 44v868q0 26 18 44t44 18h868q26 0 44 -18t18 -44v-868q0 -26 -18 -44t-44 -18zM946 703q0 13 -9 22t-22 9h-806q-13 0 -22 -9t-9 -22v-806q0 -13 9 -22t22 -9h806q13 0 22 9t9 22v806z" />  
126 - <glyph glyph-name="uniE61D" unicode="&#xe61d;"  
127 -d="M939 -202h-876q-17 0 -31.5 8.5t-23 23t-8.5 31.5v876q0 26 18.5 44.5t44.5 18.5h876q26 0 44.5 -18.5t18.5 -44.5v-876q0 -39 -35 -57q-14 -6 -28 -6zM814 612l-376 -438l-250 188l-63 -126l313 -250l439 501z" />  
128 - <glyph glyph-name="uniE61E" unicode="&#xe61e;"  
129 -d="M224 211l416 410l179 -179l-416 -410zM659 525l-19 19l-333 -333l19 -19zM698 486l-20 20l-332 -333l19 -19zM736 448l-19 19l-333 -333l19 -19zM717 704q14 14 38 14t39 -14l102 -102q6 -6 9.5 -14t4.5 -16.5t0 -17t-4.5 -16.5t-9.5 -13l-64 -58l-173 173zM211 186  
130 -l167 -167l-148 -51l-70 70zM205 -45l-83 -32l32 83z" />  
131 - <glyph glyph-name="uniE61F" unicode="&#xe61f;"  
132 -d="M512 812q-138 0 -256 -69t-187 -187t-69 -256t69 -256t187 -187t256 -69t256 69t187 187t69 256t-69 256t-187 187t-256 69zM563 44h-102v307h102v-307zM563 454h-102v102h102v-102z" />  
133 - <glyph glyph-name="uniE620" unicode="&#xe620;"  
134 -d="M938 276h-400v274h-50v-274h-399q-15 0 -29 5.5t-24 15.5t-16 24t-6 29v175q0 31 22 53t53 22h90q-18 21 -29 46t-11 54q0 27 10 47.5t25 30t29.5 15t24.5 6.5l11 1q53 0 100 -15.5t81 -42t56 -50t39 -50.5q17 27 39.5 51t56 50t79.5 41.5t98 15.5h4q2 0 8.5 -1.5  
135 -t13.5 -3t16 -5.5t16.5 -9t15.5 -13t13.5 -17.5t9 -23.5t3.5 -30q0 -28 -9.5 -52t-25.5 -45h85q31 0 53 -22t22 -53v-175q0 -44 -39 -65q-17 -9 -36 -9zM264 725q-15 0 -26 -2.5t-15.5 -6t-6.5 -7.5t-2 -6v-3q0 -49 66 -100h173q-14 30 -30 52.5t-34 35.5t-33 21t-34.5 11.5  
136 -t-30 4t-27.5 0.5zM763 723q-13 0 -20 -0.5t-21.5 -1.5t-24.5 -4.5t-24 -9t-25.5 -14.5t-24 -21.5t-24.5 -30.5t-22 -41h177q59 50 59 97v3q0 2 -2 6.5t-7 7.5t-15.5 6t-25.5 3zM488 -224h-349q-15 0 -29 6t-24 16t-16 24t-6 29v375h424v-450zM538 226h400v-375  
137 -q0 -31 -22 -53t-53 -22h-325v450z" />  
138 - <glyph glyph-name="uniE621" unicode="&#xe621;"  
139 -d="M160 492v-640q0 -26 19 -45t45 -19h576q26 0 45 19t19 45v640h-704zM352 -84h-64v448h64v-448zM480 -84h-64v448h64v-448zM608 -84h-64v448h64v-448zM736 -84h-64v448h64v-448zM880 684h-208v80q0 20 -14 34t-34 14h-224q-8 0 -15 -2.5t-13 -7t-10.5 -10.5t-7 -13  
140 -t-2.5 -15v-80h-208q-20 0 -34 -14t-14 -34v-80h832v80q0 6 -1.5 11t-3.5 10t-5.5 9t-7.5 7.5t-9 5.5t-10 3.5t-11 1.5zM608 684h-192v63h192v-63z" />  
141 - <glyph glyph-name="uniE622" unicode="&#xe622;" horiz-adv-x="1173"  
142 -d="M586 588q-64 150 -188 203q-114 47 -222 -7q-112 -56 -155 -192q-20 -67 -21 -144q0 -41 9 -78.5t24 -66.5t39 -57.5t47 -48.5t55.5 -43t56.5 -38t58.5 -35.5t53.5 -33.5q63 -42 118 -94.5t86.5 -95t39.5 -69.5q4 19 25.5 50t53.5 66t75 74t88 71q21 15 53.5 35.5t58 36  
143 -t57 38t55 43t47 48t39 56.5t25 66.5t8.5 78.5q0 75 -19.5 138t-52.5 105.5t-76.5 70.5t-91 37.5t-98 1t-96 -34.5t-85.5 -72.5t-67 -108.5z" />  
144 - <glyph glyph-name="uniE623" unicode="&#xe623;"  
145 -d="M835 576l-60 63l-263 -275v0l-263 275l-60 -63l262 -276l-262 -276l60 -63l263 275v0l263 -275l60 63l-262 276z" />  
146 - <glyph glyph-name="uniE624" unicode="&#xe624;" horiz-adv-x="1000"  
147 -d="M459 754h22h23h20h22h22v-191v-191h191h191v-109h-191h-191v-191v-190h-109v190v191h-191h-190q-1 37 -1 109h128h127h127v116v150v116z" />  
148 - <glyph glyph-name="uniE625" unicode="&#xe625;" horiz-adv-x="1000"  
149 -d="M77 372h873v-109h-873v109z" />  
150 - <glyph glyph-name="uniE626" unicode="&#xe626;"  
151 -d="M866.5 663.5q-97.5 97.5 -228 132t-261.5 0t-228.5 -132t-132 -228.5t0 -261.5t132 -228t228.5 -132t261.5 0t228 132t132 228t0 261.5t-132 228.5zM798 115l-101 -101l-187 186l-186 -186l-101 101l186 186l-186 187l101 101l186 -186l187 186l101 -101l-186 -187z" />  
152 - <glyph glyph-name="uniE628" unicode="&#xe628;"  
153 -d="M505 776q77 0 148.5 -23.5t129 -67t101 -101.5t67.5 -129.5t24 -147.5q0 -64 -17 -125t-47.5 -112t-74 -94.5t-94.5 -74t-112 -47.5t-125 -17q-95 0 -182 37.5t-150 100.5t-100 150t-37 182t37 182t100 150t150 100t182 37zM505 -104q112 0 206.5 55t149.5 149.5  
154 -t55 206.5q0 37 -6.5 73.5t-19.5 69.5t-30.5 64t-40.5 57.5t-49.5 49.5t-57.5 40.5t-64 30t-69.5 19t-73.5 6.5q-111 0 -205.5 -55t-149.5 -149.5t-55 -206t55 -206t149.5 -149.5t205.5 -55zM528 138v-59h-58v59h58zM470 564h58v-349h-58v349z" />  
155 - </font>  
156 -</defs></svg>  
1 /** 1 /**
2 - * 分类  
3 - * @author: xuqi<qi.xu@yoho.cn>  
4 - * @date: 2015/10/14 2 + * 品牌一览
  3 + * @author: liangzhifeng<zhifeng.liang@yoho.cn>
  4 + * @date: 2015/10/23
5 */ 5 */
6 6
7 var $ = require('yoho.zepto'), 7 var $ = require('yoho.zepto'),
@@ -18,3 +18,8 @@ swiper = new Swiper('.swiper-container', { @@ -18,3 +18,8 @@ swiper = new Swiper('.swiper-container', {
18 }); 18 });
19 19
20 lazyLoad($('img.lazy')); 20 lazyLoad($('img.lazy'));
  21 +$('.yoho-header').css({
  22 + 'z-index': 2,
  23 + position: 'fixed'
  24 +});
  25 +$('.banner-top').css('padding-top', '90px');
@@ -24,23 +24,6 @@ $('#clear-history').bind('touchstart', function() { @@ -24,23 +24,6 @@ $('#clear-history').bind('touchstart', function() {
24 }); 24 });
25 }); 25 });
26 26
27 -$('#search').bind('touchstart', function() {  
28 - var val = $input.val();  
29 -  
30 - $.ajax({  
31 - type: 'POST',  
32 - url: '/search',  
33 - data: {  
34 - val: val  
35 - },  
36 - success: function(data) {  
37 - if (data.code === 200) {  
38 - location.href = data.data;  
39 - }  
40 - }  
41 - });  
42 -});  
43 -  
44 $input.bind('input', function() { 27 $input.bind('input', function() {
45 if ($input.val() === '') { 28 if ($input.val() === '') {
46 $clear.addClass('hide'); 29 $clear.addClass('hide');
@@ -191,7 +191,7 @@ function search(opt) { @@ -191,7 +191,7 @@ function search(opt) {
191 lazyLoad($container.find('.lazy')); 191 lazyLoad($container.find('.lazy'));
192 } 192 }
193 193
194 - nav.reload = true; 194 + nav.reload = false;
195 nav.page = page; 195 nav.page = page;
196 196
197 searching = false; 197 searching = false;
  1 +/**
  2 + * 商品列表页
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/20
  5 + */
  6 +
1 var $ = require('yoho.zepto'), 7 var $ = require('yoho.zepto'),
2 Swiper = require('yoho.iswiper'), 8 Swiper = require('yoho.iswiper'),
3 lazyLoad = require('yoho.zeptolazyload'); 9 lazyLoad = require('yoho.zeptolazyload');
4 10
5 -var $curNav,  
6 - $navList = $('#discount-nav'),  
7 - $newArrivalList = $('#discount-goods-list'),  
8 - $goods = $newArrivalList.children('.goods-list'),  
9 - $goodList = $('.goods-list');  
10 -  
11 var swiper; 11 var swiper;
12 -var index = 0,  
13 - winH = $(window).height(),  
14 - loadMoreH = $('#load-more').height(),  
15 - loading = false,  
16 - page = 0,  
17 - pd = ""; 12 +
  13 +var filter = require('../../plugin/filter');
  14 +
  15 +var $goodsContainer = $('#goods-container'),
  16 + $ngc = $goodsContainer.children('.new-goods'),
  17 + $pgc = $goodsContainer.children('.price-goods'),
  18 + $dgc = $goodsContainer.children('.discount-goods');
  19 +
  20 +var winH = $(window).height();
  21 +
  22 +//默认筛选条件
  23 +var defaultOpt = {
  24 + gender: $('#gender').val(),
  25 + brand: $('#brand').val(),
  26 + msort: $('#msort').val(),
  27 + color: $('#color').val(),
  28 + size: $('#size').val(),
  29 + price: $('#price').val(),
  30 + discount: $('#discount').val()
  31 +};
  32 +
  33 +var $listNav = $('#list-nav'),
  34 +
  35 + //导航数据信息
  36 + navInfo = {
  37 + newest: {
  38 + order: 1,
  39 + reload: true,
  40 + page: 0,
  41 + end: false
  42 + },
  43 + price: {
  44 + order: 0,
  45 + reload: true,
  46 + page: 0,
  47 + end: false
  48 + },
  49 + discount: {
  50 + order: 0,
  51 + reload: true,
  52 + page: 0,
  53 + end: false
  54 + }
  55 + },
  56 + $pre, //纪录进入筛选前的active项
  57 + searching;
18 58
19 swiper = new Swiper('.swiper-container', { 59 swiper = new Swiper('.swiper-container', {
20 lazyLoading: true, 60 lazyLoading: true,
21 pagination: '.swiper-pagination' 61 pagination: '.swiper-pagination'
22 }); 62 });
23 63
24 -lazyLoad($('img.lazy'));  
25 -$curNav = $navList.children('.focus'); 64 +/**
  65 + * 筛选注册的回调,筛选子项点击后逻辑
  66 + * 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载
  67 + * @param opt {type, id}
  68 + */
  69 +function search(opt) {
  70 + var setting = {},
  71 + ext,
  72 + att,
  73 + nav, navType,
  74 + page;
26 75
27 -$('#discount-nav').delegate('li', 'touchstart', function() {  
28 - var $this = $(this),  
29 - $content; 76 + if (opt) {
30 77
31 - if ($this.hasClass('focus')) {  
32 - return; 78 + //筛选项变更则重置reload为true
  79 + for (att in navInfo) {
  80 + if (navInfo.hasOwnProperty(att)) {
  81 + navInfo[att].reload = true;
  82 + }
33 } 83 }
34 84
35 - index = $this.index();  
36 - pd = getSalePdByChoose(index); 85 + //处理active状态
  86 + $listNav.children('.active').removeClass('active');
  87 + $pre.addClass('active');
37 88
38 - $this.addClass('focus');  
39 - $curNav.removeClass('focus'); 89 + switch (opt.type) {
  90 + case 'gender':
  91 + ext = {
  92 + gender: opt.id
  93 + };
  94 + break;
  95 + case 'brand':
  96 + ext = {
  97 + brand: opt.id
  98 + };
  99 + break;
  100 + case 'msort':
  101 + ext = {
  102 + msort: opt.id
  103 + };
  104 + break;
  105 + case 'color':
  106 + ext = {
  107 + color: opt.id
  108 + };
  109 + break;
  110 + case 'size':
  111 + ext = {
  112 + size: opt.id
  113 + };
  114 + break;
  115 + case 'price':
  116 + ext = {
  117 + price: opt.id
  118 + };
  119 + break;
  120 + case 'discount':
  121 + ext = {
  122 + discount: opt.id
  123 + };
  124 + break;
  125 + }
40 126
41 - $goods.not('.hide').addClass('hide');  
42 - $content = $goods.eq(index);  
43 - $content.removeClass('hide'); 127 + $.extend(defaultOpt, ext); //扩展筛选项
  128 + }
44 129
45 - $curNav = $this; 130 + if (searching) {
  131 + return;
  132 + }
46 133
47 - $(document).trigger('scroll'); //Trigger lazyLoad  
48 -}); 134 + //导航类别
  135 + if ($pre === undefined || $pre.hasClass('new')) {
  136 + navType = 'newest';
  137 + } else if ($pre.hasClass('price')) {
  138 + navType = 'price';
  139 + } else if ($pre.hasClass('discount')) {
  140 + navType = 'discount';
  141 + }
  142 +
  143 + nav = navInfo[navType];
  144 +
  145 + page = nav.page + 1;
  146 + if (nav.reload) {
  147 + page = 1;
  148 + } else if (nav.end) {
49 149
50 -//srcoll to load more  
51 -$(window).scroll(function () {  
52 - if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {  
53 - if (loading) { 150 + //不需要重新加载并且数据请求结束
54 return; 151 return;
55 } 152 }
56 - loading = true;  
57 153
58 - // num = $goodList.children('.good-info').length; 154 + $.extend(setting, defaultOpt, {
  155 + type: navType,
  156 + order: nav.order,
  157 + page: page
  158 + });
  159 +
  160 + searching = true;
  161 +
59 $.ajax({ 162 $.ajax({
60 type: 'GET', 163 type: 'GET',
61 url: '/product/newsale/selectNewSale', 164 url: '/product/newsale/selectNewSale',
62 - data: {  
63 - p_d: pd,  
64 - page: page + 1  
65 - }, 165 + data: setting,
66 success: function(data) { 166 success: function(data) {
  167 + var noResult = '<p class="no-result">未找到相关搜索结果</p>',
  168 + $container;
  169 +
  170 + switch (navType) {
  171 + case 'newest':
  172 + $container = $ngc;
  173 + break;
  174 + case 'price':
  175 + $container = $pgc;
  176 + break;
  177 + case 'discount':
  178 + $container = $dgc;
  179 + break;
  180 + }
  181 +
67 if (data === ' ') { 182 if (data === ' ') {
  183 + nav.end = true;
68 184
69 - //opt.end = true;  
70 - loading = false;  
71 - return; 185 + if (nav.reload) {
  186 + $container.html(noResult);
  187 + }
  188 + } else {
  189 + if (nav.reload) {
  190 + $container.html(data);
  191 + } else {
  192 + $container.append(data);
72 } 193 }
73 194
74 - $goodList.append(data); 195 + lazyLoad($container.find('.lazy'));
  196 + }
75 197
76 - //lazyLoad  
77 - //lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));  
78 - lazyLoad($('.good-info').find('img.lazy')); 198 + nav.reload = false;
  199 + nav.page = page;
79 200
80 - loading = false;  
81 - page++;  
82 - },  
83 - error: function() {  
84 - tip.show('网络断开连接了~');  
85 - loading = false; 201 + searching = false;
86 } 202 }
87 }); 203 });
  204 +
  205 +}
  206 +
  207 +lazyLoad($('.lazy'));
  208 +
  209 +filter.registerCbFn(search);
  210 +
  211 +//导航栏点击逻辑说明:
  212 +//1.点击非active项时切换active状态
  213 +//2.价格和折扣active状态时继续点击切换排序
  214 +//3.筛选无active时点击展开筛选面板
  215 +//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
  216 +//5.当前active为筛选并且点击其他项时,隐藏筛选面板
  217 +$listNav.delegate('li', 'touchstart', function() {
  218 + var $this = $(this),
  219 + nav,
  220 + navType,
  221 + $active;
  222 +
  223 + if ($this.hasClass('filter')) {
  224 +
  225 + //筛选面板切换状态
  226 + if ($this.hasClass('active')) {
  227 + filter.hideFilter();
  228 +
  229 + //点击筛选钱的active项回复active
  230 + $pre.addClass('active');
  231 + $this.removeClass('active');
  232 + } else {
  233 + $pre = $this.siblings('.active');
  234 +
  235 + $pre.removeClass('active');
  236 + $this.addClass('active');
  237 +
  238 + filter.showFilter();
88 } 239 }
  240 + } else {
89 241
90 -}); 242 + if ($this.hasClass('new')) {
  243 + navType = 'newest';
  244 + } else if ($this.hasClass('price')) {
  245 + navType = 'price';
  246 + } else if ($this.hasClass('discount')) {
  247 + navType = 'discount';
  248 + }
91 249
92 -/**  
93 - * 根据用户的选择获取商品折扣值  
94 - *  
95 - * @param int index  
96 - * @return string  
97 - */  
98 -function getSalePdByChoose(index) {  
99 - var pd = "0.1,0.3";  
100 - switch (index) {  
101 - case 0:  
102 - pd = "0.1,0.3";  
103 - break;  
104 - case 1:  
105 - pd = "0.4,0.6"; 250 + nav = navInfo[navType];
  251 +
  252 + if ($this.hasClass('active')) {
  253 +
  254 + //最新无排序切换
  255 + if ($this.hasClass('new')) {
  256 + return;
  257 + }
  258 +
  259 + if ($this.hasClass('price') || $this.hasClass('discount')) {
  260 +
  261 + // 价格/折扣切换排序状态
  262 + $this.find('.icon > .iconfont').toggleClass('cur');
  263 + $pre = $this; //更新pre为当前项
  264 + nav.reload = true; //重置reload,HTML会被替换为逆序的HTML
  265 + nav.order = nav.order === 0 ? 1 : 0; //切换排序
  266 + }
  267 + } else {
  268 + $active = $this.siblings('.active');
  269 +
  270 + $pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
  271 +
  272 + if ($active.hasClass('filter')) {
  273 +
  274 + //若之前active项为筛选,则隐藏筛选面板
  275 + filter.hideFilter();
  276 + } else {
  277 +
  278 + //切换container显示
  279 + $goodsContainer.children('.container:not(.hide)').addClass('hide');
  280 +
  281 + switch (navType) {
  282 + case 'newest':
  283 + $ngc.removeClass('hide');
106 break; 284 break;
107 - case 2:  
108 - pd = "0.7,0.9"; 285 +
  286 + case 'price':
  287 + $pgc.removeClass('hide');
109 break; 288 break;
110 - case 3:  
111 - pd = "0.1,0.9"; 289 +
  290 + case 'discount':
  291 + $dgc.removeClass('hide');
112 break; 292 break;
113 } 293 }
114 - return pd;  
115 -}  
  294 + }
  295 +
  296 + $active.removeClass('active');
  297 + $this.addClass('active');
  298 + }
  299 +
  300 + if (nav.reload) {
  301 + search();
  302 + }
  303 + }
  304 +});
  305 +
  306 +$(window).scroll(function() {
  307 +
  308 + //当scroll到1/4$goodsContainer高度后继续请求下一页数据
  309 + if ($(window).scrollTop() + winH >
  310 + $(document).height() - 0.25 * $goodsContainer.height()) {
  311 + search();
  312 + }
  313 +});
  1 +/**
  2 + * 新品到着
  3 + * @author: liangzhifeng<zhifeng.liang@yoho.cn>
  4 + * @date: 2015/10/24
  5 + */
  6 +
1 var $ = require('yoho.zepto'), 7 var $ = require('yoho.zepto'),
2 - tip = require('../../plugin/tip'),  
3 Swiper = require('yoho.iswiper'), 8 Swiper = require('yoho.iswiper'),
4 lazyLoad = require('yoho.zeptolazyload'); 9 lazyLoad = require('yoho.zeptolazyload');
5 10
6 -var $curNav,  
7 - $navList = $('#newarrival-nav'),  
8 - $newArrivalList = $('#newarrival-goods-list'),  
9 - $goods = $newArrivalList.children('.goods-list'); 11 +var swiper;
10 12
11 -var winH = $(window).height(),  
12 - loadMoreH = $('#load-more').height(),  
13 - $goodList = $('.goods-list'),  
14 - loading = false,  
15 - page = 0,  
16 - index = 0; 13 +var filter = require('../../plugin/filter');
17 14
18 -var swiper; 15 +var $goodsContainer = $('#goods-container'),
  16 + $ngc = $($goodsContainer.children().get(0)),
  17 + $pgc = $($goodsContainer.children().get(1)),
  18 + $dgc = $($goodsContainer.children().get(2));
  19 +
  20 +var winH = $(window).height();
  21 +
  22 +//默认筛选条件
  23 +var defaultOpt = {
  24 + gender: $('#gender').val(),
  25 + brand: $('#brand').val(),
  26 + msort: $('#msort').val(),
  27 + color: $('#color').val(),
  28 + size: $('#size').val(),
  29 + price: $('#price').val(),
  30 + discount: $('#discount').val(),
  31 + limit: $('#limit').val(),
  32 + channel: $('#channel').val(),
  33 + p_d: $('#p_d').val()
  34 +};
  35 +
  36 +var $listNav = $('#list-nav'),
  37 +
  38 + //导航数据信息
  39 + navInfo = {
  40 + today: {
  41 + reload: true,
  42 + page: 0,
  43 + end: false
  44 + },
  45 + week: {
  46 + reload: true,
  47 + page: 0,
  48 + end: false
  49 + },
  50 + sale: {
  51 + reload: true,
  52 + page: 0,
  53 + end: false
  54 + }
  55 + },
  56 + $pre, //纪录进入筛选前的active项
  57 + searching;
  58 +
  59 +$pgc.addClass('hide');
  60 +$dgc.addClass('hide');
19 61
20 swiper = new Swiper('.swiper-container', { 62 swiper = new Swiper('.swiper-container', {
21 lazyLoading: true, 63 lazyLoading: true,
22 pagination: '.swiper-pagination' 64 pagination: '.swiper-pagination'
23 }); 65 });
24 66
25 -lazyLoad($('img.lazy'));  
26 -$curNav = $navList.children('.focus'); 67 +/**
  68 + * 筛选注册的回调,筛选子项点击后逻辑
  69 + * 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载
  70 + * @param opt {type, id}
  71 + */
  72 +function search(opt) {
  73 + var setting = {},
  74 + ext,
  75 + att,
  76 + nav, navType,
  77 + dayLimit,
  78 + page;
27 79
28 -$('#newarrival-nav').delegate('li', 'touchstart', function() {  
29 - var $this = $(this),  
30 - $content; 80 + if (opt) {
31 81
32 - if ($this.hasClass('focus')) {  
33 - return; 82 + //筛选项变更则重置reload为true
  83 + for (att in navInfo) {
  84 + if (navInfo.hasOwnProperty(att)) {
  85 + navInfo[att].reload = true;
  86 + }
34 } 87 }
35 88
36 - index = $this.index(); 89 + //处理active状态
  90 + $listNav.children('.active').removeClass('active');
  91 + $pre.addClass('active');
37 92
38 - $this.addClass('focus');  
39 - $curNav.removeClass('focus'); 93 + switch (opt.type) {
  94 + case 'gender':
  95 + ext = {
  96 + gender: opt.id
  97 + };
  98 + break;
  99 + case 'brand':
  100 + ext = {
  101 + brand: opt.id
  102 + };
  103 + break;
  104 + case 'msort':
  105 + ext = {
  106 + msort: opt.id
  107 + };
  108 + break;
  109 + case 'color':
  110 + ext = {
  111 + color: opt.id
  112 + };
  113 + break;
  114 + case 'size':
  115 + ext = {
  116 + size: opt.id
  117 + };
  118 + break;
  119 + case 'price':
  120 + ext = {
  121 + price: opt.id
  122 + };
  123 + break;
  124 + case 'discount':
  125 + ext = {
  126 + discount: opt.id
  127 + };
  128 + break;
  129 + case 'limit':
  130 + ext = {
  131 + limit: opt.id
  132 + };
  133 + break;
  134 + case 'channel':
  135 + ext = {
  136 + channel: opt.id
  137 + };
  138 + break;
  139 + case 'p_d':
  140 + ext = {
  141 + p_d: opt.id
  142 + };
  143 + break;
  144 + }
40 145
41 - $goods.not('.hide').addClass('hide');  
42 - $content = $goods.eq(index);  
43 - $content.removeClass('hide'); 146 + $.extend(defaultOpt, ext); //扩展筛选项
  147 + }
44 148
45 - $curNav = $this; 149 + if (searching) {
  150 + return;
  151 + }
46 152
47 - $(document).trigger('scroll'); //Trigger lazyLoad  
48 -}); 153 + //导航类别
  154 + if ($pre === undefined || $pre.hasClass('today')) {
  155 + navType = 'today';
  156 + dayLimit = 1;
  157 + } else if ($pre.hasClass('week')) {
  158 + navType = 'week';
  159 + dayLimit = 2;
  160 + } else if ($pre.hasClass('sale')) {
  161 + navType = 'sale';
  162 + dayLimit = 3;
  163 + }
49 164
50 -//srcoll to load more  
51 -$(window).scroll(function () {  
52 - if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {  
53 - if (loading) { 165 + nav = navInfo[navType];
  166 +
  167 + page = nav.page + 1;
  168 + if (nav.reload) {
  169 + page = 1;
  170 + } else if (nav.end) {
  171 +
  172 + //不需要重新加载并且数据请求结束
54 return; 173 return;
55 } 174 }
56 - loading = true;  
57 175
58 - //num = $goodList.children('.good-info').length; 176 + $.extend(setting, defaultOpt, {
  177 + dayLimit: dayLimit,
  178 + page: page
  179 + });
  180 +
  181 + searching = true;
  182 +
59 $.ajax({ 183 $.ajax({
60 type: 'GET', 184 type: 'GET',
61 url: '/product/newsale/selectNewSale', 185 url: '/product/newsale/selectNewSale',
62 - data: {  
63 - dayLimit: index + 1,  
64 - page: page + 1  
65 - }, 186 + data: setting,
66 success: function(data) { 187 success: function(data) {
  188 + var noResult = '<p class="no-result">未找到相关搜索结果</p>',
  189 + $container;
  190 +
  191 + switch (navType) {
  192 + case 'today':
  193 + $container = $ngc;
  194 + break;
  195 + case 'week':
  196 + $container = $pgc;
  197 + break;
  198 + case 'sale':
  199 + $container = $dgc;
  200 + break;
  201 + }
  202 +
67 if (data === ' ') { 203 if (data === ' ') {
68 - loading = true;  
69 - return; 204 + nav.end = true;
  205 +
  206 + if (nav.reload) {
  207 + $container.html(noResult);
  208 + }
  209 + } else {
  210 + if (nav.reload) {
  211 + $container.html(data);
  212 + } else {
  213 + $container.append(data);
70 } 214 }
71 215
72 - $goodList.append(data); 216 + lazyLoad($container.find('.lazy'));
  217 + }
73 218
74 - //lazyLoad  
75 - //lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));  
76 - lazyLoad($('.good-info').find('img.lazy')); 219 + nav.reload = false;
  220 + nav.page = page;
77 221
78 - loading = false;  
79 - page++;  
80 - },  
81 - error: function() {  
82 - tip.show('网络断开连接了~');  
83 - loading = false; 222 + searching = false;
84 } 223 }
85 }); 224 });
  225 +
  226 +}
  227 +
  228 +lazyLoad($('.lazy'));
  229 +
  230 +filter.registerCbFn(search);
  231 +
  232 +//导航栏点击逻辑说明:
  233 +//1.点击非active项时切换active状态
  234 +//2.价格和折扣active状态时继续点击切换排序
  235 +//3.筛选无active时点击展开筛选面板
  236 +//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
  237 +//5.当前active为筛选并且点击其他项时,隐藏筛选面板
  238 +$listNav.delegate('li', 'touchstart', function() {
  239 + var $this = $(this),
  240 + nav,
  241 + navType,
  242 + $active;
  243 +
  244 + if ($this.hasClass('filter')) {
  245 +
  246 + //筛选面板切换状态
  247 + if ($this.hasClass('active')) {
  248 + filter.hideFilter();
  249 +
  250 + //点击筛选钱的active项回复active
  251 + $pre.addClass('active');
  252 + $this.removeClass('active');
  253 + } else {
  254 + $pre = $this.siblings('.active');
  255 +
  256 + $pre.removeClass('active');
  257 + $this.addClass('active');
  258 +
  259 + filter.showFilter();
  260 + }
  261 + } else {
  262 +
  263 + if ($this.hasClass('today')) {
  264 + navType = 'today';
  265 + } else if ($this.hasClass('week')) {
  266 + navType = 'week';
  267 + } else if ($this.hasClass('sale')) {
  268 + navType = 'sale';
86 } 269 }
87 270
  271 + nav = navInfo[navType];
  272 +
  273 + if ($this.hasClass('hide')) {
  274 + $active = $this.siblings('.active');
  275 +
  276 + $pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
  277 +
  278 + if ($active.hasClass('filter')) {
  279 +
  280 + //若之前active项为筛选,则隐藏筛选面板
  281 + filter.hideFilter();
  282 + } else {
  283 +
  284 + //切换container显示
  285 + $goodsContainer.children('.container:not(.hide)').addClass('hide');
  286 +
  287 + switch (navType) {
  288 + case 'today':
  289 + $ngc.removeClass('hide');
  290 + break;
  291 +
  292 + case 'week':
  293 + $pgc.removeClass('hide');
  294 + break;
  295 +
  296 + case 'sale':
  297 + $dgc.removeClass('hide');
  298 + break;
  299 + }
  300 + }
  301 +
  302 + $active.removeClass('active');
  303 + $this.addClass('active');
  304 + }
  305 +
  306 + if (nav.reload) {
  307 + search();
  308 + }
  309 + }
  310 +});
  311 +
  312 +$(window).scroll(function() {
  313 +
  314 + //当scroll到1/4$goodsContainer高度后继续请求下一页数据
  315 + if ($(window).scrollTop() + winH >
  316 + $(document).height() - 0.25 * $goodsContainer.height()) {
  317 + search();
  318 + }
88 }); 319 });
@@ -6,7 +6,9 @@ @@ -6,7 +6,9 @@
6 padding: 7px 3.125%; 6 padding: 7px 3.125%;
7 background-color: #f8f8f8; 7 background-color: #f8f8f8;
8 left: 0; 8 left: 0;
9 - z-index: 10; 9 + top: 44px;
  10 + position: fixed;
  11 + z-index: 2;
10 .search-box { 12 .search-box {
11 position: relative; 13 position: relative;
12 height: 30px; 14 height: 30px;
@@ -114,5 +116,4 @@ @@ -114,5 +116,4 @@
114 .con { 116 .con {
115 padding-top: 5px; 117 padding-top: 5px;
116 } 118 }
117 -  
118 } 119 }
@@ -71,6 +71,10 @@ @@ -71,6 +71,10 @@
71 } 71 }
72 } 72 }
73 73
  74 + .info-list-container {
  75 + overflow-x: hidden;
  76 + }
  77 +
74 .info-list.hide { 78 .info-list.hide {
75 display: none; 79 display: none;
76 } 80 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 font-size: 12px; 9 font-size: 12px;
10 top: 16px; 10 top: 16px;
11 left: 24px; 11 left: 24px;
  12 + color: #b2b2b2;
12 } 13 }
13 14
14 input { 15 input {
@@ -24,6 +25,7 @@ @@ -24,6 +25,7 @@
24 position: absolute; 25 position: absolute;
25 top: 12px; 26 top: 12px;
26 right: 50px; 27 right: 50px;
  28 + color: #b2b2b2;
27 } 29 }
28 30
29 .search { 31 .search {
@@ -43,8 +43,83 @@ @@ -43,8 +43,83 @@
43 } 43 }
44 } 44 }
45 45
46 - .goods-list.hide {  
47 - display: none; 46 + .list-nav {
  47 + > li {
  48 + float: left;
  49 + width: 25%;
  50 + height: 33px;
  51 + line-height: 33px;
  52 + text-align: center;
  53 + font-size: 14px;
  54 + }
  55 +
  56 + a {
  57 + display: block;
  58 + box-sizing: border-box;
  59 + width: 100%;
  60 + height: 100%;
  61 + color: #999;
  62 + }
  63 +
  64 + .active > a {
  65 + border-bottom: 2px solid #000;
  66 + color: #000;
  67 +
  68 + .iconfont {
  69 + color: #999;
  70 +
  71 + &.cur {
  72 + color: #000;
  73 + }
  74 + }
  75 + }
  76 +
  77 + .new .iconfont {
  78 + @include scale(0.8);
  79 + font-weight: bold;
  80 + }
  81 +
  82 + .filter .iconfont {
  83 + font-size: 12px;
  84 + @include transition(transform 0.1 ease-in);
  85 + }
  86 +
  87 + .filter.active .iconfont {
  88 + @include rotate(-180deg);
  89 + }
  90 +
  91 + .icon {
  92 + position: relative;
  93 +
  94 + i {
  95 + position: absolute;
  96 + @include scale(0.8);
  97 + font-weight: bold;
  98 + }
  99 +
  100 + .up {
  101 + top: -11px;
  102 + }
  103 +
  104 + .down {
  105 + top: -4px;
  106 + }
  107 + }
  108 + }
  109 +
  110 + .no-result {
  111 + text-align: center;
  112 + vertical-align: middle;
  113 + color: #ccc;
  114 + font-size: 1.2em;
  115 + margin-top: 220px;
  116 + }
  117 +
  118 + .goods-container {
  119 + position: relative;
  120 + min-height: 440px;
48 } 121 }
49 122
50 } 123 }
  124 +
  125 +
@@ -26,12 +26,20 @@ @@ -26,12 +26,20 @@
26 height: 60rem / $pxConvertRem; 26 height: 60rem / $pxConvertRem;
27 padding: 10rem / $pxConvertRem 0; 27 padding: 10rem / $pxConvertRem 0;
28 background-color: #fff; 28 background-color: #fff;
  29 +
  30 + a {
  31 + display: block;
  32 + box-sizing: border-box;
  33 + width: 100%;
  34 + height: 100%;
  35 + color: #999;
  36 + }
29 } 37 }
30 38
31 .newarrival-nav-item { 39 .newarrival-nav-item {
32 box-sizing: border-box; 40 box-sizing: border-box;
33 float: left; 41 float: left;
34 - width: 33.333333%; 42 + width: 25%;
35 height: 60rem / $pxConvertRem; 43 height: 60rem / $pxConvertRem;
36 line-height: 60rem / $pxConvertRem; 44 line-height: 60rem / $pxConvertRem;
37 text-align: center; 45 text-align: center;
@@ -43,8 +51,4 @@ @@ -43,8 +51,4 @@
43 } 51 }
44 } 52 }
45 53
46 - .goods-list.hide {  
47 - display: none;  
48 - }  
49 -  
50 } 54 }
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="brand-page yoho-page"> 2 <div class="brand-page yoho-page">
3 3
4 - <div class="newbrand-search" style="position: fixed; top: 44px;"> 4 + <div class="newbrand-search">
5 <div class="search-box clearfix"> 5 <div class="search-box clearfix">
6 <a href="/index/search/index" > 6 <a href="/index/search/index" >
7 - <input type="text" class="search-input" placeholder="查找品牌" name="query" id="query" value="" disabled="">  
8 - <i class="search-icon iconfont clearfix"></i> 7 + <input type="text" class="search-input" placeholder="查找品牌">
  8 + <i class="search-icon iconfont">&#xe60f;</i>
9 </a> 9 </a>
10 </div> 10 </div>
11 </div> 11 </div>
@@ -85,5 +85,18 @@ @@ -85,5 +85,18 @@
85 </div> 85 </div>
86 </div> 86 </div>
87 87
  88 +
  89 + <div class="float_layer" id="float_layer_app">
  90 + <div class="float_layer_left">
  91 + <img src="http://static.yohobuy.com/m/v1/img/yohobuy_new.png" alt="">
  92 + <p>新用户首单减10元</p>
  93 + </div>
  94 + <a href="javascript:void(0);" id="float_layer_close" onclick="appLayer();">
  95 + <img src="http://static.yohobuy.com/m/v1/img/close_new.png" width="22">
  96 + </a>
  97 + <a href="http://m.yohobuy.com/download/hyapp" id="float_layer_btn">立即下载</a>
  98 + </div>
  99 +
  100 +
88 </div> 101 </div>
89 {{> layout/footer}} 102 {{> layout/footer}}
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 {{/ navs}} 35 {{/ navs}}
36 </ul> 36 </ul>
37 37
38 - <div id="info-list"> 38 + <div id="info-list" class="info-list-container">
39 {{# infos}} 39 {{# infos}}
40 <div class="info-list {{^show}}hide{{/show}}"> 40 <div class="info-list {{^show}}hide{{/show}}">
41 {{# info}} 41 {{# info}}
@@ -2,10 +2,12 @@ @@ -2,10 +2,12 @@
2 <div class="search-page yoho-page"> 2 <div class="search-page yoho-page">
3 {{# search}} 3 {{# search}}
4 <div id="search-input" class="search-input"> 4 <div id="search-input" class="search-input">
  5 + <form action="/product/list/index" method="get">
5 <i class="search-icon iconfont">&#xe60f;</i> 6 <i class="search-icon iconfont">&#xe60f;</i>
6 - <input type="text" placeholder="搜索商品">  
7 - <i class="clear-input iconfont hide">&#xe61a;</i>  
8 - <button id="search" class="search">搜索</button> 7 + <input type="text" placeholder="搜索商品" name="query">
  8 + <i class="clear-input iconfont hide">&#xe626;</i>
  9 + <button id="search" class="search" type="submit">搜索</button>
  10 + </form>
9 </div> 11 </div>
10 <div class="search-items"> 12 <div class="search-items">
11 <div class="hot-search"> 13 <div class="hot-search">
@@ -3,10 +3,12 @@ @@ -3,10 +3,12 @@
3 {{# goodList}} 3 {{# goodList}}
4 {{# search}} 4 {{# search}}
5 <div id="search-input" class="search-input"> 5 <div id="search-input" class="search-input">
  6 + <form action="/product/list/index" method="get">
6 <i class="search-icon iconfont">&#xe60f;</i> 7 <i class="search-icon iconfont">&#xe60f;</i>
7 - <input type="text" value={{default}}> 8 + <input type="text" value={{default}} name="query">
8 <i class="clear-input iconfont hide">&#xe61a;</i> 9 <i class="clear-input iconfont hide">&#xe61a;</i>
9 - <button id="search" class="search">搜索</button> 10 + <button id="search" class="search" type="submit">搜索</button>
  11 + </form>
10 </div> 12 </div>
11 {{/ search}} 13 {{/ search}}
12 14
1 -{{>layout/header}}  
2 -<div class="newarrival-page yoho-page"> 1 +{{> layout/header}}
  2 +<div class="good-list-page yoho-page">
3 {{# headerBanner}} 3 {{# headerBanner}}
4 {{> product/banner_swipe_and_single}} 4 {{> product/banner_swipe_and_single}}
5 {{/ headerBanner}} 5 {{/ headerBanner}}
6 6
7 - <ul id="newarrival-nav" class="newarrival-nav clearfix">  
8 - {{# tabs}}  
9 - <li class="newarrival-nav-item {{#focus}}focus{{/focus}}">{{title}}</li>  
10 - {{/ tabs}} 7 + <ul id="list-nav" class="list-nav clearfix">
  8 + <li class="today active">
  9 + <a href="javascript:void(0);">
  10 + 1026
  11 + </a>
  12 + </li>
  13 + <li class="week">
  14 + <a href="javascript:void(0);">
  15 + 本周上新
  16 + </a>
  17 + </li>
  18 + <li class="sale">
  19 + <a href="javascript:void(0);">
  20 + 销量
  21 + </a>
  22 + </li>
  23 + <li class="filter">
  24 + <a href="javascript:void(0);">
  25 + 筛选
  26 + <span class="iconfont">&#xe613;</span>
  27 + </a>
  28 + </li>
11 </ul> 29 </ul>
12 30
13 - <div id="newarrival-goods-list">  
14 - {{> product/goods_container}} 31 + <div id="goods-container" class="goods-container">
  32 + {{# goodsContainer}}
  33 + <div class="new-goods container">
  34 + {{#if goods}}
  35 + {{# goods}}
  36 + {{> good}}
  37 + {{/ goods}}
  38 + {{^}}
  39 + <p class="no-result">未找到相关搜索结果</p>
  40 + {{/if}}
15 </div> 41 </div>
  42 + {{/ goodsContainer}}
16 43
17 - <div id="load-more-info" class="load-more-info">  
18 - <div class="loading status hide">  
19 - 正在加载...  
20 - </div>  
21 - <span class="no-more status hide">没有更多啦</span> 44 +
  45 +
  46 + {{> filter}}
22 </div> 47 </div>
23 48
24 -</div>  
25 -{{>layout/footer}} 49 + {{#if brand}}
  50 + <input id="brand" type="hidden" value={{brand}}>
  51 + {{/if}}
  52 +
  53 + {{#if gender}}
  54 + <input id="gender" type="hidden" value={{gender}}>
  55 + {{/if}}
  56 +
  57 + {{#if msort}}
  58 + <input id="msort" type="hidden" value={{msort}}>
  59 + {{/if}}
  60 +
  61 + {{#if color}}
  62 + <input id="color" type="hidden" value={{color}}>
  63 + {{/if}}
26 64
  65 + {{#if size}}
  66 + <input id="size" type="hidden" value={{size}}>
  67 + {{/if}}
27 68
  69 + {{#if price}}
  70 + <input id="price" type="hidden" value={{price}}>
  71 + {{/if}}
  72 +
  73 + {{#if p_d}}
  74 + <input id="p_d" type="hidden" value={{p_d}}>
  75 + {{/if}}
  76 +
  77 + {{#if channel}}
  78 + <input id="channel" type="hidden" value={{channel}}>
  79 + {{/if}}
  80 +
  81 + {{#if dayLimit}}
  82 + <input id="dayLimit" type="hidden" value={{dayLimit}}>
  83 + {{/if}}
  84 +
  85 + {{#if limit}}
  86 + <input id="limit" type="hidden" value={{limit}}>
  87 + {{/if}}
  88 +
  89 + {{#if page}}
  90 + <input id="page" type="hidden" value={{page}}>
  91 + {{/if}}
  92 +
  93 +</div>
  94 +{{> layout/footer}}
1 -{{>layout/header}} 1 +{{> layout/header}}
2 <div class="discount-page yoho-page"> 2 <div class="discount-page yoho-page">
3 {{# headerBanner}} 3 {{# headerBanner}}
4 {{> product/banner_swipe_and_single}} 4 {{> product/banner_swipe_and_single}}
5 {{/ headerBanner}} 5 {{/ headerBanner}}
6 6
7 - <ul id="discount-nav" class="discount-nav clearfix">  
8 - {{# tabs}}  
9 - <li class="discount-nav-item {{#focus}}focus{{/focus}}">{{title}}</li>  
10 - {{/ tabs}} 7 + <ul id="list-nav" class="list-nav clearfix">
  8 + <li class="new active">
  9 + <a href="javascript:void(0);">
  10 + 最新
  11 + <span class="iconfont cur">&#xe616;</span>
  12 + </a>
  13 + </li>
  14 + <li class="price">
  15 + <a href="javascript:void(0);">
  16 + 价格
  17 + <span class="icon">
  18 + <i class="iconfont up">&#xe615;</i>
  19 + <i class="iconfont down cur">&#xe616;</i>
  20 + </span>
  21 + </a>
  22 + </li>
  23 + <li class="discount">
  24 + <a href="javascript:void(0);">
  25 + 折扣
  26 + <span class="icon">
  27 + <i class="iconfont up">&#xe615;</i>
  28 + <i class="iconfont down cur">&#xe616;</i>
  29 + </span>
  30 + </a>
  31 + </li>
  32 + <li class="filter">
  33 + <a href="javascript:void(0);">
  34 + 筛选
  35 + <span class="iconfont">&#xe613;</span>
  36 + </a>
  37 + </li>
11 </ul> 38 </ul>
12 39
13 - <div id="discount-goods-list">  
14 - {{> product/goods_container}} 40 + <div id="goods-container" class="goods-container">
  41 + {{# goodsContainer}}
  42 + <div class="new-goods container">
  43 + {{# goods}}
  44 + {{> good}}
  45 + {{/ goods}}
15 </div> 46 </div>
  47 + {{/ goodsContainer}}
16 48
17 - <div id="load-more-info" class="load-more-info">  
18 - <div class="loading status hide">  
19 - 正在加载...  
20 - </div>  
21 - <span class="no-more status hide">没有更多啦</span> 49 + {{> filter}}
22 </div> 50 </div>
23 51
24 -</div>  
25 -{{>layout/footer}} 52 + {{#if brand}}
  53 + <input id="brand" type="hidden" value={{brand}}>
  54 + {{/if}}
  55 +
  56 + {{#if gender}}
  57 + <input id="gender" type="hidden" value={{gender}}>
  58 + {{/if}}
  59 +
  60 + {{#if msort}}
  61 + <input id="msort" type="hidden" value={{msort}}>
  62 + {{/if}}
  63 +
  64 + {{#if color}}
  65 + <input id="color" type="hidden" value={{color}}>
  66 + {{/if}}
  67 +
  68 + {{#if size}}
  69 + <input id="size" type="hidden" value={{size}}>
  70 + {{/if}}
26 71
  72 + {{#if price}}
  73 + <input id="price" type="hidden" value={{price}}>
  74 + {{/if}}
27 75
  76 + {{#if p_d}}
  77 + <input id="p_d" type="hidden" value={{p_d}}>
  78 + {{/if}}
28 79
  80 + {{#if channel}}
  81 + <input id="channel" type="hidden" value={{channel}}>
  82 + {{/if}}
  83 +
  84 + {{#if limit}}
  85 + <input id="limit" type="hidden" value={{limit}}>
  86 + {{/if}}
  87 +
  88 + {{#if page}}
  89 + <input id="page" type="hidden" value={{page}}>
  90 + {{/if}}
  91 +
  92 + {{#if discount}}
  93 + <input id="page" type="hidden" value={{page}}>
  94 + {{/if}}
  95 +
  96 +</div>
  97 +{{> layout/footer}}
@@ -66,7 +66,7 @@ class ClassModel @@ -66,7 +66,7 @@ class ClassModel
66 $subitem = array(); 66 $subitem = array();
67 $subitem['name'] = $value['category_name']; 67 $subitem['name'] = $value['category_name'];
68 $subitem['id'] = $value['relation_parameter']['sort']; 68 $subitem['id'] = $value['relation_parameter']['sort'];
69 - $subitem['url'] = $value['category_id']; 69 + $subitem['url'] = '/product/list/class?sort='.$value['relation_parameter']['sort'];
70 70
71 $item['sub'][] = $subitem; 71 $item['sub'][] = $subitem;
72 } 72 }
@@ -206,7 +206,7 @@ class NewsaleModel @@ -206,7 +206,7 @@ class NewsaleModel
206 */ 206 */
207 public static function selectData($data) 207 public static function selectData($data)
208 { 208 {
209 - $result = array('goods' => array()); 209 + $result = array();
210 210
211 if (isset($data['code']) && $data['code'] === 200) { 211 if (isset($data['code']) && $data['code'] === 200) {
212 foreach ($data['data']['product_list'] as $val) { 212 foreach ($data['data']['product_list'] as $val) {
@@ -12,11 +12,18 @@ class ClassController extends AbstractAction @@ -12,11 +12,18 @@ class ClassController extends AbstractAction
12 $classes = ClassModel::getClassData(); 12 $classes = ClassModel::getClassData();
13 13
14 $data = array( 14 $data = array(
15 - "searchUrl" => "", 15 + 'categoryPage' => true,
  16 + 'pageHeader' => array (
  17 + 'navBack' => true,
  18 + 'navHome' => '/',
  19 + 'navTitle' => '商品分类'
  20 + ),
  21 + 'category' => array(
16 "class" => $classes 22 "class" => $classes
  23 + )
17 ); 24 );
18 25
19 $this->_view->assign('title', 'YOHO!有货'); 26 $this->_view->assign('title', 'YOHO!有货');
20 - $this->_view->display('index', array('categoryPage' => true, 'category' => $data)); 27 + $this->_view->display('index', $data);
21 } 28 }
22 } 29 }
@@ -20,22 +20,20 @@ class NewsaleController extends AbstractAction @@ -20,22 +20,20 @@ class NewsaleController extends AbstractAction
20 $this->setTitle('新品到着'); 20 $this->setTitle('新品到着');
21 $this->setNavHeader('新品到着'); 21 $this->setNavHeader('新品到着');
22 22
23 - $channel = $this->get('channel', 1);  
24 - if (!is_numeric($channel)) {  
25 - $this->error();  
26 - } 23 + $channel = $this->getCookie('_Channel', 'boys');
  24 + $this->channelTrans($channel);
27 25
28 $data = array(); 26 $data = array();
29 $data['newArrival'] = true; 27 $data['newArrival'] = true;
30 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel); 28 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel);
31 - $goodsList = \Product\NewsaleModel::getNewProducts($channel, 20); 29 + $goodsList = \Product\NewsaleModel::getNewProducts($channel, 60);
32 if (!empty($goodsList)) { 30 if (!empty($goodsList)) {
33 $data += $goodsList; 31 $data += $goodsList;
34 } 32 }
35 // 设置一些筛选的默认参数 33 // 设置一些筛选的默认参数
36 $data += array( 34 $data += array(
37 'brand' => 0, 35 'brand' => 0,
38 - 'sort' => 0, 36 + 'msort' => 0,
39 'gender' => $this->getCookie('_Channel', 'boys'), 37 'gender' => $this->getCookie('_Channel', 'boys'),
40 'price' => 0, 38 'price' => 0,
41 'size' => 0, 39 'size' => 0,
@@ -56,46 +54,23 @@ class NewsaleController extends AbstractAction @@ -56,46 +54,23 @@ class NewsaleController extends AbstractAction
56 $this->setTitle('折扣专区'); 54 $this->setTitle('折扣专区');
57 $this->setNavHeader('Sale'); 55 $this->setNavHeader('Sale');
58 56
59 - $channel = $this->get('channel', 1);  
60 - if (!is_numeric($channel)) {  
61 - $this->error();  
62 - } 57 + $channel = $this->getCookie('_Channel', 'boys');
  58 + $this->channelTrans($channel);
63 59
64 $data = array(); 60 $data = array();
65 - $data['discount'] = true;  
66 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel); 61 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel);
67 - $goodsList = \Product\NewsaleModel::getSaleProducts($channel, 20); 62 + $goodsList = \Product\NewsaleModel::getSaleProducts($channel, 60);
68 if (!empty($goodsList)) { 63 if (!empty($goodsList)) {
69 $data += $goodsList; 64 $data += $goodsList;
70 } 65 }
71 // 设置一些筛选的默认参数 66 // 设置一些筛选的默认参数
72 $data += array( 67 $data += array(
73 'brand' => 0, 68 'brand' => 0,
74 - 'sort' => 0, 69 + 'msort' => 0,
75 'gender' => $this->getCookie('_Channel', 'boys'), 70 'gender' => $this->getCookie('_Channel', 'boys'),
76 'price' => 0, 71 'price' => 0,
77 'size' => 0, 72 'size' => 0,
78 - 'dayLimit' => 1,  
79 - 'discount' => '0.1,0.3'  
80 - );  
81 - $data['tabs'] = array(  
82 - array(  
83 - 'title' => '1-3折',  
84 - 'dataId' => '0.1,0.3',  
85 - 'focus' => true  
86 - ),  
87 - array(  
88 - 'title' => '4-6折',  
89 - 'dataId' => '0.4,0.6',  
90 - ),  
91 - array(  
92 - 'title' => '7-9折',  
93 - 'dataId' => '0.7,0.9',  
94 - ),  
95 - array(  
96 - 'title' => 'ALL',  
97 - 'dataId' => '0.1,0.9',  
98 - ) 73 + 'discount' => '0.1,0.9'
99 ); 74 );
100 75
101 $this->_view->display('sale', $data); 76 $this->_view->display('sale', $data);
@@ -109,16 +84,16 @@ class NewsaleController extends AbstractAction @@ -109,16 +84,16 @@ class NewsaleController extends AbstractAction
109 public function selectNewSaleAction() 84 public function selectNewSaleAction()
110 { 85 {
111 if ($this->isAjax()) { 86 if ($this->isAjax()) {
112 - $gender = $this->get('gender', '1,3'); 87 + $gender = $this->get('gender', 'boys');
113 $brand = $this->get('brand', null); 88 $brand = $this->get('brand', null);
114 - $sort = $this->get('sort', null); 89 + $sort = $this->get('msort', null);
115 $color = $this->get('color', null); 90 $color = $this->get('color', null);
116 $size = $this->get('size', null); 91 $size = $this->get('size', null);
117 $price = $this->get('price', null); 92 $price = $this->get('price', null);
118 - $p_d = $this->get('p_d', null);  
119 - $channel = $this->get('channel', '1');  
120 - $dayLimit = $this->get('dayLimit', '1');  
121 - $limit = $this->get('limit', 20); 93 + $p_d = $this->get('discount', null);
  94 + $channel = $this->getCookie('_Channel', 'boys');
  95 + $dayLimit = $this->get('dayLimit', null);
  96 + $limit = $this->get('limit', 60);
122 $page = $this->get('page', 1); 97 $page = $this->get('page', 1);
123 98
124 // 转换性别 99 // 转换性别
@@ -135,16 +110,66 @@ class NewsaleController extends AbstractAction @@ -135,16 +110,66 @@ class NewsaleController extends AbstractAction
135 $gender = '1,2,3'; 110 $gender = '1,2,3';
136 } 111 }
137 112
  113 + // 转换排序方式
  114 + $order = $this->get('order', null);
  115 + $type = $this->get('type', '');
  116 + switch ($type) {
  117 + case 'price':
  118 + $order = ($order == 0) ? 's_p_desc' : 's_p_asc';
  119 + break;
  120 + case 'discount':
  121 + $order = ($order == 0) ? 'p_d_desc' : 'p_d_asc';
  122 + break;
  123 + case 'newest':
  124 + default:
  125 + $order = ($order == 0) ? 's_t_desc' : 's_t_asc';
  126 + break;
  127 + }
  128 +
  129 + // 转换频道
  130 + $this->channelTrans($channel);
  131 +
138 $data = NewsaleData::selectNewSaleProducts( 132 $data = NewsaleData::selectNewSaleProducts(
139 $gender, $brand, $sort, $color, 133 $gender, $brand, $sort, $color,
140 $size, $price, $p_d, $channel, $dayLimit, $limit, $page 134 $size, $price, $p_d, $channel, $dayLimit, $limit, $page
141 ); 135 );
142 $result = \Product\NewsaleModel::selectData($data); 136 $result = \Product\NewsaleModel::selectData($data);
143 137
  138 + if(empty($result))
  139 + {
  140 + echo ' ';
  141 + }
  142 + else
  143 + {
144 $this->_view->display('product', $result); 144 $this->_view->display('product', $result);
  145 + }
145 } else { 146 } else {
146 echo ' '; 147 echo ' ';
147 } 148 }
148 } 149 }
149 150
  151 + /**
  152 + * 转换频道
  153 + * @param string &$channel 待转换的频道
  154 + * @return integer 转换之后的频道
  155 + */
  156 + private function channelTrans(&$channel)
  157 + {
  158 + switch ($channel) {
  159 + case 'girls':
  160 + $channel = 2;
  161 + break;
  162 + case 'kids':
  163 + $channel = 3;
  164 + break;
  165 + case 'lifestyle':
  166 + $channel = 4;
  167 + break;
  168 + case 'boys':
  169 + default:
  170 + $channel = 1;
  171 + break;
  172 + }
  173 + }
  174 +
150 } 175 }