Showing
4 changed files
with
208 additions
and
24 deletions
@@ -9,50 +9,79 @@ use Plugin\Helpers; | @@ -9,50 +9,79 @@ use Plugin\Helpers; | ||
9 | */ | 9 | */ |
10 | class ShopProcess | 10 | class ShopProcess |
11 | { | 11 | { |
12 | + private static $shopData = array(); | ||
12 | /** | 13 | /** |
13 | * 组织店铺页面数据 | 14 | * 组织店铺页面数据 |
14 | * @param array $data 接口返回的店铺页所需数据 | 15 | * @param array $data 接口返回的店铺页所需数据 |
16 | + * @param int $type 店铺模板id | ||
15 | * @author sefon 2016-4-26 21:56:32 | 17 | * @author sefon 2016-4-26 21:56:32 |
16 | * @return array | 18 | * @return array |
17 | */ | 19 | */ |
18 | - public static function formShopData($data) | 20 | + public static function formShopData($data, $type = 2) |
19 | { | 21 | { |
20 | - $result = array(); | ||
21 | foreach ($data as $key => $val) { | 22 | foreach ($data as $key => $val) { |
22 | if (empty($val) || !is_callable("self::$key")) { | 23 | if (empty($val) || !is_callable("self::$key")) { |
23 | continue; | 24 | continue; |
24 | } | 25 | } |
25 | - $result[] = self::$key($val); | 26 | + self::$key($val); |
26 | } | 27 | } |
27 | - return $result; | 28 | +// print_r($data); |
29 | +// exit; | ||
30 | + return self::$shopData; | ||
28 | } | 31 | } |
29 | 32 | ||
30 | /** | 33 | /** |
31 | - * 店铺介绍 | 34 | + * 组织店铺装修 |
32 | * @param array $data | 35 | * @param array $data |
33 | - * @author sefon 2016-4-26 22:06:44 | 36 | + * @author sefon 2016-4-26 22:04:04 |
34 | * @return array | 37 | * @return array |
35 | */ | 38 | */ |
36 | - private static function shopInfo($data) | 39 | + private static function decorator($data) |
37 | { | 40 | { |
38 | - return $data; | 41 | + if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['list']) || empty($data['data']['list'])) { |
42 | + return; | ||
43 | + } | ||
44 | + foreach ($data['data']['list'] as $val) { | ||
45 | + if (empty($val['resource_data']) || !is_callable("self::$val[resource_name]")) { | ||
46 | + continue; | ||
47 | + } | ||
48 | + self::$val['resource_name'](json_decode($val['resource_data'], true)); | ||
49 | + } | ||
50 | +// print_r($data); exit; | ||
39 | } | 51 | } |
40 | 52 | ||
41 | /** | 53 | /** |
42 | - * 组织店铺装修 | 54 | + * 店铺Banner |
43 | * @param array $data | 55 | * @param array $data |
44 | - * @author sefon 2016-4-26 22:04:04 | 56 | + * @author sefon 2016-4-27 08:40:05 |
45 | * @return array | 57 | * @return array |
46 | */ | 58 | */ |
47 | - private static function decretion($data) | 59 | + private static function shopTopBanner($data) |
48 | { | 60 | { |
49 | - //优惠券 | ||
50 | - | ||
51 | - //广告图 | ||
52 | - | ||
53 | - //热门分类 | 61 | + foreach ($data as $val) { |
62 | + self::$shopData['bannerTop']['list'][] = array('url' => '', 'img' => $val['shopSrc']); | ||
63 | + } | ||
64 | + } | ||
54 | 65 | ||
55 | - //人气单品 | 66 | + /** |
67 | + * 资源位小图 | ||
68 | + * @param array $data | ||
69 | + * @author sefon 2016-4-27 08:37:30 | ||
70 | + * @return array | ||
71 | + */ | ||
72 | + private static function oneRowTwoColImages($data) | ||
73 | + { | ||
74 | + foreach ($data as $key => $val) { | ||
75 | + if (empty($val['data'])) { | ||
76 | + continue; | ||
77 | + } | ||
78 | + foreach ($val['data'] as $val) { | ||
79 | + self::$shopData['spring'][] = array( | ||
80 | + 'url' => $val['url'], | ||
81 | + 'springType' => $val['src'] | ||
82 | + ); | ||
83 | + } | ||
84 | + } | ||
56 | return $data; | 85 | return $data; |
57 | } | 86 | } |
58 | 87 | ||
@@ -62,17 +91,47 @@ class ShopProcess | @@ -62,17 +91,47 @@ class ShopProcess | ||
62 | * @author sefon 2016-4-26 22:04:04 | 91 | * @author sefon 2016-4-26 22:04:04 |
63 | * @return array | 92 | * @return array |
64 | */ | 93 | */ |
65 | - private static function shopBrands($data) | 94 | + private static function brandBrowse($data) |
95 | + { | ||
96 | + foreach ($data as $val) { | ||
97 | + self::$shopData['multi-list'][] = array( | ||
98 | + 'url' => '', | ||
99 | + 'img' => $val['brandIco'], | ||
100 | + 'brandName' => $val['brandName'] | ||
101 | + ); | ||
102 | + } | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * 热门分类 | ||
107 | + * @param array $data | ||
108 | + * @author sefon 2016-4-27 08:38:36 | ||
109 | + * @return array | ||
110 | + */ | ||
111 | + private static function hotRecommend($data) | ||
66 | { | 112 | { |
67 | 113 | ||
68 | return $data; | 114 | return $data; |
69 | } | 115 | } |
70 | 116 | ||
71 | /** | 117 | /** |
72 | - * 店铺商品列表 可能不需要 | 118 | + * 人气单品 |
119 | + * @param array $data | ||
120 | + * @author sefon 2016-4-27 08:38:36 | ||
121 | + * @return array | ||
73 | */ | 122 | */ |
74 | - private static function products($data) | 123 | + private static function hotProducts($data) |
75 | { | 124 | { |
125 | +// print_r($data); | ||
126 | + foreach ($data as $val) { | ||
127 | + echo $val['src']; | ||
128 | + self::$shopData['hotList'][] = array( | ||
129 | + 'url' => $val['url'], | ||
130 | + 'img' => $val['src'], | ||
131 | + 'salesPrice' => '¥'.$val['salesPrice'], | ||
132 | + 'presentPrice' => '¥'.$val['salesPrice'] | ||
133 | + ); | ||
134 | + } | ||
76 | 135 | ||
77 | return $data; | 136 | return $data; |
78 | } | 137 | } |
1 | +{{> layout/header}} | ||
2 | + {{# shopIndex}} | ||
3 | + <div class="shop-index yoho-page" id="wrapper"> | ||
4 | + <div id="scroller"> | ||
5 | + <div id="nav-top"> | ||
6 | + {{# headerBanner}} | ||
7 | + {{> product/banner-swipe-and-single}} | ||
8 | + {{/ headerBanner}} | ||
9 | + <div class="search-area"> | ||
10 | + <div id="search-input" class="search-input"> | ||
11 | + <form id="search-form" action={{url}} method="get"> | ||
12 | + <i class="search-icon iconfont"></i> | ||
13 | + <input type="text" placeholder="搜索店铺内潮品" name="query"> | ||
14 | + <input type="hidden" name="from" value="search"> | ||
15 | + <i class="clear-input iconfont hide"></i> | ||
16 | + <span id="search" class="search" type="submit">搜索</span> | ||
17 | + </form> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | + <div class="branner-top"> | ||
21 | + <img src="{{branerImg}}"> | ||
22 | + <div class="collect"></div> | ||
23 | + </div> | ||
24 | + </div> | ||
25 | + | ||
26 | + <ul id="nav" class="nav"> | ||
27 | + <li class="active color">首页</li> | ||
28 | + <li>上新</li> | ||
29 | + <li>人气</li> | ||
30 | + <li> | ||
31 | + <a href="#" target="_blank">全部商品</a> | ||
32 | + </li> | ||
33 | + </ul> | ||
34 | + | ||
35 | + <div id="nav-main" class="main"> | ||
36 | + {{#unless brands}} | ||
37 | + <div class="multi-brands"> | ||
38 | + <h2>品牌一览</h2> | ||
39 | + <!-- {{#each brandImg}} | ||
40 | + <div class="brand-img"> | ||
41 | + <img src="{{brandType}}"> | ||
42 | + <p>{{brandName}}</p> | ||
43 | + </div> | ||
44 | + {{/each}} --> | ||
45 | + | ||
46 | + <div class="multi-browse swiper-container"> | ||
47 | + <ul class="swiper-wrapper"> | ||
48 | + {{#each multi-list}} | ||
49 | + <li class="swiper-slide brand-img"> | ||
50 | + <a href="{{url}}"> | ||
51 | + <img src="{{img}}"> | ||
52 | + </a> | ||
53 | + <p>{{brandName}}</p> | ||
54 | + </li> | ||
55 | + {{/each}} | ||
56 | + </ul> | ||
57 | + </div> | ||
58 | + </div> | ||
59 | + {{/unless}} | ||
60 | + | ||
61 | + <div class="banner-area"> | ||
62 | + {{# bannerTop}} | ||
63 | + {{> home/banner_top}} | ||
64 | + {{/ bannerTop}} | ||
65 | + </div> | ||
66 | + | ||
67 | + <ul class="spring"> | ||
68 | + {{#each spring}} | ||
69 | + <li> | ||
70 | + <img src="{{springType}}"> | ||
71 | + </li> | ||
72 | + {{/each}} | ||
73 | + </ul> | ||
74 | + | ||
75 | + {{! 热门品类}} | ||
76 | + {{# hotCategory}} | ||
77 | + {{> home/hot_category}} | ||
78 | + {{/ hotCategory}} | ||
79 | + | ||
80 | + <div class="title"> | ||
81 | + 人气单品 | ||
82 | + <a class="more" href="{{more_url}}"></a> | ||
83 | + </div> | ||
84 | + | ||
85 | + <ul class="product-list"> | ||
86 | + {{#each hotList}} | ||
87 | + <li> | ||
88 | + <img src="{{listUrl}}"> | ||
89 | + <div class="list-price"> | ||
90 | + <p>VANS AP M BERZE</p> | ||
91 | + <p><span class="red">{{originalPrice}}</span> | ||
92 | + <span>{{presentPrice}}</span> | ||
93 | + </p> | ||
94 | + </div> | ||
95 | + </li> | ||
96 | + {{/each}} | ||
97 | + </ul> | ||
98 | + </div> | ||
99 | + | ||
100 | + <div class="discount-area"> | ||
101 | + {{> product/goods-nav-top}} | ||
102 | + </div> | ||
103 | + </div> | ||
104 | + | ||
105 | + <ul id="pos-nav" class="nav hide"> | ||
106 | + <li class="active color">首页</li> | ||
107 | + <li>上新</li> | ||
108 | + <li>人气</li> | ||
109 | + <li> | ||
110 | + <a href="#" target="_blank">全部商品</a> | ||
111 | + </li> | ||
112 | + </ul> | ||
113 | + <ul id="pos-list" class="nav hide"> | ||
114 | + <li>最新</li> | ||
115 | + <li>价格</li> | ||
116 | + <li>折扣</li> | ||
117 | + <li>筛选</li> | ||
118 | + </ul> | ||
119 | + </div> | ||
120 | + {{/ shopIndex}} | ||
121 | +{{> layout/footer}} |
@@ -399,14 +399,13 @@ class ListModel | @@ -399,14 +399,13 @@ class ListModel | ||
399 | 399 | ||
400 | } | 400 | } |
401 | //店铺信息 | 401 | //店铺信息 |
402 | - $data['shopInfo'] = ListData::getShopInfo($shopId); | 402 | +// $data['shopInfo'] = ListData::getShopInfo($shopId); |
403 | //店铺装修资源数据 | 403 | //店铺装修资源数据 |
404 | $data['decorator'] = ListData::getShopDecorator($shopId); | 404 | $data['decorator'] = ListData::getShopDecorator($shopId); |
405 | //品牌一览 | 405 | //品牌一览 |
406 | - $data['shopBrands'] = ListData::getShopBrands($shopId); | 406 | + //$data['shopBrands'] = ListData::getShopBrands($shopId); |
407 | //商品列表 | 407 | //商品列表 |
408 | $data['products'] = array(); | 408 | $data['products'] = array(); |
409 | - | ||
410 | //组织楼层数据 | 409 | //组织楼层数据 |
411 | $result = ShopProcess::formShopData($data); | 410 | $result = ShopProcess::formShopData($data); |
412 | return $result; | 411 | return $result; |
@@ -322,14 +322,19 @@ class IndexController extends AbstractAction | @@ -322,14 +322,19 @@ class IndexController extends AbstractAction | ||
322 | public function shopAction() | 322 | public function shopAction() |
323 | { | 323 | { |
324 | $title = ''; | 324 | $title = ''; |
325 | + $domain = 'vans'; | ||
325 | //TODO | 326 | //TODO |
327 | + $brandLogo = Product\ListModel::getBrandLogoByDomain($domain, $title); | ||
326 | $shopId = 0; | 328 | $shopId = 0; |
327 | $shopId = 323; | 329 | $shopId = 323; |
328 | $uid = $this->getUid(true); | 330 | $uid = $this->getUid(true); |
329 | $data = ListModel::shopData($shopId, $uid); | 331 | $data = ListModel::shopData($shopId, $uid); |
330 | $this->setTitle($title); | 332 | $this->setTitle($title); |
331 | $this->setNavHeader($title, true, SITE_MAIN); | 333 | $this->setNavHeader($title, true, SITE_MAIN); |
332 | - $this->_view->display('shop', $data); | 334 | + $this->_view->display('shop', array( |
335 | + 'shopIndex' => $data, | ||
336 | + 'shopPage' => true | ||
337 | + )); | ||
333 | } | 338 | } |
334 | 339 | ||
335 | /** | 340 | /** |
-
Please register or login to post a comment