Showing
7 changed files
with
64 additions
and
55 deletions
@@ -128,7 +128,9 @@ let discount = (req, res, next) => { | @@ -128,7 +128,9 @@ let discount = (req, res, next) => { | ||
128 | let params = _processPublicData(req, '折扣专场', 'discount'); | 128 | let params = _processPublicData(req, '折扣专场', 'discount'); |
129 | 129 | ||
130 | saleModel.getDiscountData(params.channel).then((result) => { | 130 | saleModel.getDiscountData(params.channel).then((result) => { |
131 | - res.render('sale/discount', Object.assign(params.renderData, result)); | 131 | + res.render('sale/discount', Object.assign(params.renderData, { |
132 | + data: result | ||
133 | + })); | ||
132 | }).catch(next); | 134 | }).catch(next); |
133 | }; | 135 | }; |
134 | 136 | ||
@@ -143,7 +145,7 @@ let discountDetail = (req, res, next) => { | @@ -143,7 +145,7 @@ let discountDetail = (req, res, next) => { | ||
143 | let id = req.query.id; | 145 | let id = req.query.id; |
144 | let params = _processPublicData(req, '', 'discount-detail'); | 146 | let params = _processPublicData(req, '', 'discount-detail'); |
145 | 147 | ||
146 | - saleModel.getDiscountDetailData(id, params.channel).then((result) => { | 148 | + saleModel.getDiscountDetailData(id, req.yoho.channel).then((result) => { |
147 | params.renderData.pageHeader.navTitle = result.title; | 149 | params.renderData.pageHeader.navTitle = result.title; |
148 | res.render('sale/discount-detail', Object.assign(params.renderData, result)); | 150 | res.render('sale/discount-detail', Object.assign(params.renderData, result)); |
149 | }).catch(next); | 151 | }).catch(next); |
@@ -49,7 +49,7 @@ const contentCode = contentCodeConfig.sale; | @@ -49,7 +49,7 @@ const contentCode = contentCodeConfig.sale; | ||
49 | * @param {[array]} list | 49 | * @param {[array]} list |
50 | * @return {[array]} | 50 | * @return {[array]} |
51 | */ | 51 | */ |
52 | -const _processDiscount = (list, channel) => { | 52 | +const _processDiscount = (list) => { |
53 | const formatData = []; | 53 | const formatData = []; |
54 | let flag = true; | 54 | let flag = true; |
55 | 55 | ||
@@ -63,7 +63,6 @@ const _processDiscount = (list, channel) => { | @@ -63,7 +63,6 @@ const _processDiscount = (list, channel) => { | ||
63 | 63 | ||
64 | _.forEach(list, (data) => { | 64 | _.forEach(list, (data) => { |
65 | if (flag === true) { | 65 | if (flag === true) { |
66 | - data.specialUrl = `/product/sale/discount/detail?id=${data.id}&channel=${channel}`; | ||
67 | Object.assign(data, processTime(data.leftTime)); | 66 | Object.assign(data, processTime(data.leftTime)); |
68 | } | 67 | } |
69 | 68 | ||
@@ -84,7 +83,7 @@ const _discount = (params) => { | @@ -84,7 +83,7 @@ const _discount = (params) => { | ||
84 | return api.get('', Object.assign({ | 83 | return api.get('', Object.assign({ |
85 | method: 'app.activity.get', | 84 | method: 'app.activity.get', |
86 | sort: 2, | 85 | sort: 2, |
87 | - plateform: 3 | 86 | + plateform: 2 |
88 | }, params)); | 87 | }, params)); |
89 | }; | 88 | }; |
90 | 89 | ||
@@ -300,14 +299,13 @@ const getBreakCodeData = (params) => { | @@ -300,14 +299,13 @@ const getBreakCodeData = (params) => { | ||
300 | * @return {[object]} | 299 | * @return {[object]} |
301 | */ | 300 | */ |
302 | const getDiscountData = (yhChannel) => { | 301 | const getDiscountData = (yhChannel) => { |
303 | - const discountData = {}; | ||
304 | - | ||
305 | return _discount({ | 302 | return _discount({ |
306 | yh_channel: channelType[yhChannel] || '1' | 303 | yh_channel: channelType[yhChannel] || '1' |
307 | }).then((result) => { | 304 | }).then((result) => { |
308 | if (result && result.code === 200) { | 305 | if (result && result.code === 200) { |
309 | - discountData.data = _processDiscount(result.data, yhChannel); | ||
310 | - return discountData; | 306 | + return { |
307 | + list: _processDiscount(result.data) | ||
308 | + }; | ||
311 | } else { | 309 | } else { |
312 | logger.error('折扣专场专题列表返回 code 不是 200'); | 310 | logger.error('折扣专场专题列表返回 code 不是 200'); |
313 | return {}; | 311 | return {}; |
@@ -2,17 +2,17 @@ | @@ -2,17 +2,17 @@ | ||
2 | {{#if ../discountActivity}} | 2 | {{#if ../discountActivity}} |
3 | {{> common/floor-header-more}} | 3 | {{> common/floor-header-more}} |
4 | {{/if}} | 4 | {{/if}} |
5 | -<ul class="special-list"> | ||
6 | - {{#each list}} | 5 | +<ul class="discount-list"> |
6 | + {{#list}} | ||
7 | <li> | 7 | <li> |
8 | - <a href="{{specialUrl}}"> | 8 | + <a href="/product/sale/discount/detail?id={{id}}"> |
9 | <img class="lazy" data-original="{{image coverUrl 640 250}}" /> | 9 | <img class="lazy" data-original="{{image coverUrl 640 250}}" /> |
10 | - <p class="special-cont"> | ||
11 | - <span class="special-title">{{title}}</span> | ||
12 | - <span class="special-time {{#if warnColor}}red-color{{/if}}">{{time}}</span> | 10 | + <p class="discount-cont"> |
11 | + <span class="discount-title">{{title}}</span> | ||
12 | + <span class="discount-time {{#if warnColor}}red-color{{/if}}">{{time}}</span> | ||
13 | </p> | 13 | </p> |
14 | </a> | 14 | </a> |
15 | </li> | 15 | </li> |
16 | - {{/each}} | 16 | + {{/list}} |
17 | </ul> | 17 | </ul> |
18 | {{/data}} | 18 | {{/data}} |
public/scss/channel/_discount-list.css
0 → 100644
1 | +.discount-list { | ||
2 | + li { | ||
3 | + margin-bottom: 30px; | ||
4 | + background: #fff; | ||
5 | + } | ||
6 | + | ||
7 | + img { | ||
8 | + width: 100%; | ||
9 | + height: 250px; | ||
10 | + } | ||
11 | + | ||
12 | + .discount-cont { | ||
13 | + box-sizing: border-box; | ||
14 | + padding: 0 20px; | ||
15 | + height: 77px; | ||
16 | + border-bottom: 1px solid #e0e0e0; | ||
17 | + line-height: 77px; | ||
18 | + } | ||
19 | + | ||
20 | + .discount-title { | ||
21 | + float: left; | ||
22 | + overflow: hidden; | ||
23 | + width: 450px; | ||
24 | + height: 77px; | ||
25 | + text-overflow: ellipsis; | ||
26 | + white-space: nowrap; | ||
27 | + font-size: 24px; | ||
28 | + } | ||
29 | + | ||
30 | + .discount-time { | ||
31 | + float: right; | ||
32 | + font-size: 22px; | ||
33 | + } | ||
34 | + | ||
35 | + .red-color { | ||
36 | + color: #d0021b; | ||
37 | + } | ||
38 | +} |
@@ -2,43 +2,4 @@ | @@ -2,43 +2,4 @@ | ||
2 | overflow: hidden; | 2 | overflow: hidden; |
3 | height: auto; | 3 | height: auto; |
4 | background: #f0f0f0; | 4 | background: #f0f0f0; |
5 | - | ||
6 | - .special-list { | ||
7 | - li { | ||
8 | - margin-bottom: 30px; | ||
9 | - background: #fff; | ||
10 | - } | ||
11 | - | ||
12 | - img { | ||
13 | - width: 100%; | ||
14 | - height: 250px; | ||
15 | - } | ||
16 | - | ||
17 | - .special-cont { | ||
18 | - box-sizing: border-box; | ||
19 | - padding: 0 20px; | ||
20 | - height: 77px; | ||
21 | - border-bottom: 1px solid #e0e0e0; | ||
22 | - line-height: 77px; | ||
23 | - } | ||
24 | - | ||
25 | - .special-title { | ||
26 | - float: left; | ||
27 | - overflow: hidden; | ||
28 | - width: 450px; | ||
29 | - height: 77px; | ||
30 | - text-overflow: ellipsis; | ||
31 | - white-space: nowrap; | ||
32 | - font-size: 24px; | ||
33 | - } | ||
34 | - | ||
35 | - .special-time { | ||
36 | - float: right; | ||
37 | - font-size: 22px; | ||
38 | - } | ||
39 | - | ||
40 | - .red-color { | ||
41 | - color: #d0021b; | ||
42 | - } | ||
43 | - } | ||
44 | } | 5 | } |
1 | const _ = require('lodash'); | 1 | const _ = require('lodash'); |
2 | +const processTime = require('./time-process'); | ||
2 | const camelCase = global.yoho.camelCase; | 3 | const camelCase = global.yoho.camelCase; |
3 | 4 | ||
4 | /** | 5 | /** |
@@ -33,6 +34,7 @@ module.exports = (list) => { | @@ -33,6 +34,7 @@ module.exports = (list) => { | ||
33 | } | 34 | } |
34 | } | 35 | } |
35 | 36 | ||
37 | + // OUTLETS | ||
36 | if (floor.titleImage && floor.data) { | 38 | if (floor.titleImage && floor.data) { |
37 | if (floor.data.image) { | 39 | if (floor.data.image) { |
38 | floor.data.bigImage = { | 40 | floor.data.bigImage = { |
@@ -47,6 +49,13 @@ module.exports = (list) => { | @@ -47,6 +49,13 @@ module.exports = (list) => { | ||
47 | }; | 49 | }; |
48 | } | 50 | } |
49 | 51 | ||
52 | + // 折扣专场 | ||
53 | + if (floor.discountActivity && floor.data && floor.data.list.length) { | ||
54 | + _.map(floor.data.list, (item) => { | ||
55 | + Object.assign(item, processTime(item.leftTime)); | ||
56 | + }); | ||
57 | + } | ||
58 | + | ||
50 | formatData.push(floor); | 59 | formatData.push(floor); |
51 | }); | 60 | }); |
52 | 61 |
-
Please register or login to post a comment