Showing
8 changed files
with
93 additions
and
10 deletions
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2016-05-21 10:59:20 | 3 | * @Date: 2016-05-21 10:59:20 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2016-06-07 18:10:14 | 5 | + * @Last Modified time: 2016-06-08 13:37:17 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 'use strict'; | 8 | 'use strict'; |
@@ -25,7 +25,6 @@ exports.getProductPic = (req, res) => { | @@ -25,7 +25,6 @@ exports.getProductPic = (req, res) => { | ||
25 | */ | 25 | */ |
26 | exports.index = (req, res) => { | 26 | exports.index = (req, res) => { |
27 | let params = Object.assign({ | 27 | let params = Object.assign({ |
28 | - saleType: 2, | ||
29 | order: 's_t_asc,s_s_asc' | 28 | order: 's_t_asc,s_s_asc' |
30 | }, req.query); | 29 | }, req.query); |
31 | 30 |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | 6 | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | const mRoot = '../models'; | 8 | const mRoot = '../models'; |
9 | - | ||
10 | const outlets = require(`${mRoot}/outlets`); | 9 | const outlets = require(`${mRoot}/outlets`); |
11 | 10 | ||
12 | // 开发用模拟数据 | 11 | // 开发用模拟数据 |
@@ -50,7 +49,7 @@ exports.index = (req, res) => { | @@ -50,7 +49,7 @@ exports.index = (req, res) => { | ||
50 | exports.channel = (req, res) => { | 49 | exports.channel = (req, res) => { |
51 | let resData = { | 50 | let resData = { |
52 | module: 'product', | 51 | module: 'product', |
53 | - page: 'outlets', | 52 | + page: 'outlets' |
54 | }; | 53 | }; |
55 | 54 | ||
56 | // 首页模拟数据 | 55 | // 首页模拟数据 |
@@ -91,3 +90,34 @@ exports.special = (req, res) => { | @@ -91,3 +90,34 @@ exports.special = (req, res) => { | ||
91 | res.render('error', resData); | 90 | res.render('error', resData); |
92 | }); | 91 | }); |
93 | }; | 92 | }; |
93 | + | ||
94 | +/** | ||
95 | + * 商品列表页 | ||
96 | + * @param {[type]} req [description] | ||
97 | + * @param {[type]} res [description] | ||
98 | + * @return {[type]} [description] | ||
99 | + */ | ||
100 | +exports.list = (req, res) => { | ||
101 | + let params = Object.assign({ | ||
102 | + saleType: '4', | ||
103 | + order: 's_t_asc,s_s_asc' | ||
104 | + }, req.query); | ||
105 | + | ||
106 | + let channel = req.query.channel || req.cookies._Channel || 'boys'; | ||
107 | + | ||
108 | + params.uid = req.user.uid || 0; | ||
109 | + | ||
110 | + let responseData = { | ||
111 | + module: 'product', | ||
112 | + page: 'outlets' | ||
113 | + }; | ||
114 | + | ||
115 | + outlets.getOutletsCategoryData(params, channel).then((result) => { | ||
116 | + responseData.resultShow = JSON.stringify(result, null, 4); | ||
117 | + res.render('sale/other', Object.assign(responseData, result)); | ||
118 | + }).catch(() => { | ||
119 | + responseData.pageErr = true; | ||
120 | + res.render('error', responseData); | ||
121 | + }); | ||
122 | + | ||
123 | +}; |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2016-06-02 15:11:15 | 3 | * @Date: 2016-06-02 15:11:15 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2016-06-07 17:50:53 | 5 | + * @Last Modified time: 2016-06-08 13:35:17 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 'use strict'; | 8 | 'use strict'; |
@@ -23,7 +23,7 @@ const publicHandler = require('./public-handler'); | @@ -23,7 +23,7 @@ const publicHandler = require('./public-handler'); | ||
23 | * @return {[type]} [description] | 23 | * @return {[type]} [description] |
24 | */ | 24 | */ |
25 | exports.getSaleOthersData = (params, channel) => { | 25 | exports.getSaleOthersData = (params, channel) => { |
26 | - | 26 | + console.log('ok'); |
27 | return api.all([ | 27 | return api.all([ |
28 | // headerModel.requestHeaderData(channel), | 28 | // headerModel.requestHeaderData(channel), |
29 | saleApi.getSaleGoodsList(params), | 29 | saleApi.getSaleGoodsList(params), |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2016-05-30 16:20:03 | 3 | * @Date: 2016-05-30 16:20:03 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2016-06-07 16:08:05 | 5 | + * @Last Modified time: 2016-06-08 14:19:17 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 'use strict'; | 8 | 'use strict'; |
@@ -168,3 +168,28 @@ exports.getOutletsSpecialData = (params, channel) => { | @@ -168,3 +168,28 @@ exports.getOutletsSpecialData = (params, channel) => { | ||
168 | return specialData; | 168 | return specialData; |
169 | }); | 169 | }); |
170 | }; | 170 | }; |
171 | + | ||
172 | +/** | ||
173 | + * 获取奥莱分类页面数据 | ||
174 | + * @param {[type]} params [description] | ||
175 | + * @param {[type]} channel [description] | ||
176 | + * @return {[type]} [description] | ||
177 | + */ | ||
178 | +exports.getOutletsCategoryData = (params, channel) => { | ||
179 | + return api.all([ | ||
180 | + headerModel.requestHeaderData('outlets') | ||
181 | + ]).then(result => { | ||
182 | + let finalResult = result[0]; | ||
183 | + | ||
184 | + return api.all([ | ||
185 | + list.getSaleOthersData(params, channel), | ||
186 | + saleApi.getSaleBannerList(channelCode.index) | ||
187 | + ]).then(listResult => { | ||
188 | + finalResult.saleList = listResult[0]; | ||
189 | + if (listResult[1].code === 200) { | ||
190 | + finalResult.saleList.topBanner = publicHandler.handleBannerData(listResult[1].data); | ||
191 | + } | ||
192 | + return finalResult; | ||
193 | + }); | ||
194 | + }); | ||
195 | +}; |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2016-06-02 15:50:47 | 3 | * @Date: 2016-06-02 15:50:47 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2016-06-07 16:26:14 | 5 | + * @Last Modified time: 2016-06-08 14:06:58 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 'use strict'; | 8 | 'use strict'; |
@@ -498,6 +498,33 @@ exports.handleSaleFilterData = (origin, params) => { | @@ -498,6 +498,33 @@ exports.handleSaleFilterData = (origin, params) => { | ||
498 | }; | 498 | }; |
499 | 499 | ||
500 | /** | 500 | /** |
501 | + * 处理首页 banner 数据 | ||
502 | + * @param {[type]} origin [description] | ||
503 | + * @return {[type]} [description] | ||
504 | + */ | ||
505 | +exports.handleBannerData = (origin) => { | ||
506 | + var dest = {}; | ||
507 | + | ||
508 | + dest.list = []; | ||
509 | + _.forEach(origin, function(value) { | ||
510 | + if (value.template_name === 'focus') { | ||
511 | + _.forEach(value.data, function(subValue) { | ||
512 | + let banner = {}; | ||
513 | + | ||
514 | + banner.bannerHeight = 450; | ||
515 | + banner.href = subValue.url; | ||
516 | + banner.img = subValue.src; | ||
517 | + | ||
518 | + dest.list.push(banner); | ||
519 | + }); | ||
520 | + } | ||
521 | + | ||
522 | + }); | ||
523 | + | ||
524 | + return dest; | ||
525 | +}; | ||
526 | + | ||
527 | +/** | ||
501 | * 筛选类链接处理的对外接口 | 528 | * 筛选类链接处理的对外接口 |
502 | * @type {[type]} | 529 | * @type {[type]} |
503 | */ | 530 | */ |
@@ -32,8 +32,10 @@ router.get('/sale/goods', sale.getGoodsList); // ajax 获取商品列表 | @@ -32,8 +32,10 @@ router.get('/sale/goods', sale.getGoodsList); // ajax 获取商品列表 | ||
32 | // 奥特莱斯routers | 32 | // 奥特莱斯routers |
33 | router.get('/outlets/index', outlets.index); | 33 | router.get('/outlets/index', outlets.index); |
34 | router.get('/outlets/special/detail', outlets.special); | 34 | router.get('/outlets/special/detail', outlets.special); |
35 | +router.get('/outlets/list', outlets.list); // 奥莱品类页 | ||
35 | router.get('/outlets/:channel', outlets.channel); | 36 | router.get('/outlets/:channel', outlets.channel); |
36 | 37 | ||
38 | + | ||
37 | // 商品列表页 | 39 | // 商品列表页 |
38 | router.get('/list', list.index); // 商品列表页 | 40 | router.get('/list', list.index); // 商品列表页 |
39 | 41 |
1 | -<pre>{{resultShow}}</pre> | 1 | +{{!-- <pre>{{resultShow}}</pre> --}} |
2 | <div class="outlets-special-page product-page yoho-page"> | 2 | <div class="outlets-special-page product-page yoho-page"> |
3 | {{> common/main-banner}} | 3 | {{> common/main-banner}} |
4 | <div class="center-content clearfix"> | 4 | <div class="center-content clearfix"> |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | </a> | 10 | </a> |
11 | <div class="item-text"> | 11 | <div class="item-text"> |
12 | <a href="{{url}}"> | 12 | <a href="{{url}}"> |
13 | - {{name}} | 13 | + {{productName}} |
14 | <p class="price"> | 14 | <p class="price"> |
15 | <span class="sale-price">{{salesPrice}}</span> | 15 | <span class="sale-price">{{salesPrice}}</span> |
16 | <span class="market-price">{{marketPrice}}</span> | 16 | <span class="market-price">{{marketPrice}}</span> |
-
Please register or login to post a comment