Showing
4 changed files
with
33 additions
and
25 deletions
@@ -24,9 +24,10 @@ exports.index = (req, res) => { | @@ -24,9 +24,10 @@ exports.index = (req, res) => { | ||
24 | let channel = req.query.channel || req.cookies._Channel || 'boys'; | 24 | let channel = req.query.channel || req.cookies._Channel || 'boys'; |
25 | 25 | ||
26 | outlets.getOutletsIndexData(req.query, channel).then(result => { | 26 | outlets.getOutletsIndexData(req.query, channel).then(result => { |
27 | - resData.result = result; | ||
28 | - resData.headerData = result.headerData; | ||
29 | - resData.resultShow = JSON.stringify(result, null, 4); | 27 | + Object.assign(resData, { |
28 | + result: result, | ||
29 | + headerData: result.headerData | ||
30 | + }); | ||
30 | res.render('outlets/index', resData); | 31 | res.render('outlets/index', resData); |
31 | }).catch((e) => { | 32 | }).catch((e) => { |
32 | log.error(e); | 33 | log.error(e); |
@@ -171,8 +171,9 @@ exports.handleOutletsBannersData = (origin, params) => { | @@ -171,8 +171,9 @@ exports.handleOutletsBannersData = (origin, params) => { | ||
171 | 171 | ||
172 | // 处理焦点图数据 | 172 | // 处理焦点图数据 |
173 | if (value.template_name === 'focus') { | 173 | if (value.template_name === 'focus') { |
174 | - dest.mainBanner = {}; | ||
175 | - dest.mainBanner.list = value.data; | 174 | + dest.mainBanner = { |
175 | + list: value.data | ||
176 | + }; | ||
176 | } | 177 | } |
177 | 178 | ||
178 | // 处理三张小图数据 | 179 | // 处理三张小图数据 |
@@ -182,16 +183,18 @@ exports.handleOutletsBannersData = (origin, params) => { | @@ -182,16 +183,18 @@ exports.handleOutletsBannersData = (origin, params) => { | ||
182 | 183 | ||
183 | // 处理右侧一张图片 | 184 | // 处理右侧一张图片 |
184 | if (value.template_name === 'single_image') { | 185 | if (value.template_name === 'single_image') { |
185 | - dest.limitedBuy.extra.sourceImg = {}; | ||
186 | - dest.limitedBuy.extra.sourceImg.href = value.data[0].url; | ||
187 | - dest.limitedBuy.extra.sourceImg.img = value.data[0].src; | 186 | + dest.limitedBuy.extra.sourceImg = { |
187 | + href: value.data[0].url, | ||
188 | + img: value.data[0].src | ||
189 | + }; | ||
188 | } | 190 | } |
189 | 191 | ||
190 | // 处理热销推荐数据 | 192 | // 处理热销推荐数据 |
191 | if (value.template_name === 'recommendCategory') { | 193 | if (value.template_name === 'recommendCategory') { |
192 | - dest.limitedBuy.extra.hotType = {}; | ||
193 | - dest.limitedBuy.extra.hotType.title = _.isEmpty(value.data.title) ? '热销推荐' : value.data.title; | ||
194 | - dest.limitedBuy.extra.hotType.classify = []; | 194 | + dest.limitedBuy.extra.hotType = { |
195 | + title: _.isEmpty(value.data.title) ? '热销推荐' : value.data.title, | ||
196 | + classify: [] | ||
197 | + }; | ||
195 | _.forEach(value.data.categoryList, subValue => { | 198 | _.forEach(value.data.categoryList, subValue => { |
196 | let category = {}; | 199 | let category = {}; |
197 | 200 | ||
@@ -207,9 +210,9 @@ exports.handleOutletsBannersData = (origin, params) => { | @@ -207,9 +210,9 @@ exports.handleOutletsBannersData = (origin, params) => { | ||
207 | // 处理品类导航数据 | 210 | // 处理品类导航数据 |
208 | 211 | ||
209 | if (value.template_name === 'categoryNavigation') { | 212 | if (value.template_name === 'categoryNavigation') { |
210 | - dest.goodsBoard = {}; | ||
211 | - | ||
212 | - dest.goodsBoard.goodsMenu = handleOutletsGoodsMenuData(value.data, params); | 213 | + dest.goodsBoard = { |
214 | + goodsMenu: handleOutletsGoodsMenuData(value.data, params) | ||
215 | + }; | ||
213 | } | 216 | } |
214 | }); | 217 | }); |
215 | 218 | ||
@@ -233,9 +236,11 @@ exports.handleOutletsActivityData = (origin, name) => { | @@ -233,9 +236,11 @@ exports.handleOutletsActivityData = (origin, name) => { | ||
233 | 236 | ||
234 | // 处理奥莱活动列表数据 | 237 | // 处理奥莱活动列表数据 |
235 | _.forEach(origin, value => { | 238 | _.forEach(origin, value => { |
236 | - let activity = {}; | 239 | + let activity = { |
240 | + href: helpers.urlFormat('/product/outlets/special/detail', {id: value.id}) | ||
241 | + }; | ||
237 | 242 | ||
238 | - activity.href = helpers.urlFormat('/product/outlets/special/detail', { id: value.id }); | 243 | + activity.href = helpers.urlFormat('/product/outlets/special/detail', {id: value.id}); |
239 | activity.img = value.webCoverUrl; | 244 | activity.img = value.webCoverUrl; |
240 | activity.logo = value.logoUrl; | 245 | activity.logo = value.logoUrl; |
241 | activity.title = value.title; | 246 | activity.title = value.title; |
@@ -37,11 +37,11 @@ exports.getOutletsIndexData = (params, channel) => { | @@ -37,11 +37,11 @@ exports.getOutletsIndexData = (params, channel) => { | ||
37 | 37 | ||
38 | return api.all([ | 38 | return api.all([ |
39 | headerModel.requestHeaderData('outlets'), | 39 | headerModel.requestHeaderData('outlets'), |
40 | - outletsApi.getChannelResouceData({ content_code: channelCode.index }), | ||
41 | - outletsApi.getOutletsActivityOrigin({ type: '1', channel: channel }), // 获取限时活动列表 | ||
42 | - outletsApi.getOutletsActivityOrigin({ type: '2', channel: channel }), // 获取即将结束列表 | ||
43 | - outletsApi.getOutletsTrendData({ limit: '30' }), // 获取潮流速递商品数据 | ||
44 | - outletsApi.getOutletsGoodsList({ limit: params.limit || '100' }) // 获取底部商品数据 | 40 | + outletsApi.getChannelResouceData({content_code: channelCode.index}), |
41 | + outletsApi.getOutletsActivityOrigin({type: '1', channel: channel}), // 获取限时活动列表 | ||
42 | + outletsApi.getOutletsActivityOrigin({type: '2', channel: channel}), // 获取即将结束列表 | ||
43 | + outletsApi.getOutletsTrendData({limit: '30'}), // 获取潮流速递商品数据 | ||
44 | + outletsApi.getOutletsGoodsList({limit: params.limit || '100'}) // 获取底部商品数据 | ||
45 | 45 | ||
46 | ]).then(result => { | 46 | ]).then(result => { |
47 | let finalResult = {}; | 47 | let finalResult = {}; |
@@ -76,9 +76,10 @@ exports.getOutletsIndexData = (params, channel) => { | @@ -76,9 +76,10 @@ exports.getOutletsIndexData = (params, channel) => { | ||
76 | 76 | ||
77 | // 处理底部商品数据 | 77 | // 处理底部商品数据 |
78 | if (result[5].code === 200) { | 78 | if (result[5].code === 200) { |
79 | - finalResult.goodsBoard.list = productProcess.processProductList(result[5].data.product_list); | ||
80 | - finalResult.goodsBoard.sort = publicHandler.handleSaleOptsData(params, result[5].data.total); | ||
81 | - finalResult.goodsBoard.sort.newPage = true; | 79 | + finalResult.goodsBoard = { |
80 | + list: productProcess.processProductList(result[5].data.product_list), | ||
81 | + sort: Object.assign(publicHandler.handleSaleOptsData(params, result[5].data.total), {newPage: true}) | ||
82 | + }; | ||
82 | finalResult.pager = publicHandler.handleSalePagerData(result[5].data.total, params); | 83 | finalResult.pager = publicHandler.handleSalePagerData(result[5].data.total, params); |
83 | } | 84 | } |
84 | 85 | ||
@@ -129,6 +130,7 @@ exports.getOutletsChannelData = (params, channel) => { | @@ -129,6 +130,7 @@ exports.getOutletsChannelData = (params, channel) => { | ||
129 | if (result[1].code === 200) { | 130 | if (result[1].code === 200) { |
130 | Object.assign(channelData, outletsProcess.processFloor(result[1].data.list, params)); | 131 | Object.assign(channelData, outletsProcess.processFloor(result[1].data.list, params)); |
131 | } | 132 | } |
133 | + | ||
132 | // 限时嗨购 | 134 | // 限时嗨购 |
133 | if (result[2].code === 200) { | 135 | if (result[2].code === 200) { |
134 | channelData.nearOver = outletsProcess.handleOutletsActivityData(result[2].data, '限时嗨购'); | 136 | channelData.nearOver = outletsProcess.handleOutletsActivityData(result[2].data, '限时嗨购'); |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <div class="limit-extra right"> | 5 | <div class="limit-extra right"> |
6 | {{# extra}} | 6 | {{# extra}} |
7 | {{# sourceImg}} | 7 | {{# sourceImg}} |
8 | - <a href="{{#if herf}}{{href}}{{^}}javascript:;{{/if}}" class="source-img" target="_blank"> | 8 | + <a href="{{#if href}}{{href}}{{^}}javascript:;{{/if}}" class="source-img" target="_blank"> |
9 | <img class="lazy" data-original="{{image img 380 506}}" width=100%> | 9 | <img class="lazy" data-original="{{image img 380 506}}" width=100%> |
10 | </a> | 10 | </a> |
11 | {{/ sourceImg}} | 11 | {{/ sourceImg}} |
-
Please register or login to post a comment