Showing
37 changed files
with
442 additions
and
507 deletions
apps/channel/models/floor-data-handler.js
0 → 100644
1 | +/** | ||
2 | + * 获取各个楼层的数据 | ||
3 | + * @author: 赵彪<bill.zhao@yoho.cn> | ||
4 | + * @date: 2016/08/05 | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict'; | ||
8 | + | ||
9 | +const _ = require('lodash'); | ||
10 | + | ||
11 | +/** | ||
12 | + * 获取楼层title | ||
13 | + * @param {String || Object} 原始title | ||
14 | + * @return {Object} 转换后的title | ||
15 | + */ | ||
16 | +const _getTitle = t => { | ||
17 | + const reg = /\w+/g; | ||
18 | + let arr = []; | ||
19 | + let r; | ||
20 | + let cn; | ||
21 | + let en; | ||
22 | + | ||
23 | + if (!t) { | ||
24 | + return { | ||
25 | + en: '', | ||
26 | + cn: '' | ||
27 | + }; | ||
28 | + } | ||
29 | + | ||
30 | + if (_.isObject(t)) { | ||
31 | + t = t.title; | ||
32 | + } | ||
33 | + | ||
34 | + do { | ||
35 | + r = reg.exec(t); | ||
36 | + | ||
37 | + if (r) { | ||
38 | + arr.push(r[0]); | ||
39 | + } | ||
40 | + | ||
41 | + } while (r); | ||
42 | + | ||
43 | + en = arr.join(' '); | ||
44 | + cn = t.replace(en, ''); | ||
45 | + | ||
46 | + return { | ||
47 | + en, | ||
48 | + cn | ||
49 | + }; | ||
50 | +}; | ||
51 | + | ||
52 | +/** | ||
53 | + * 获取slider楼层数据 | ||
54 | + * @param {Object} d 接口返回的楼层数据 | ||
55 | + * @return {Object} 处理之后的数据 | ||
56 | + */ | ||
57 | +const getSliderData = d => { | ||
58 | + | ||
59 | + return { | ||
60 | + slider: d | ||
61 | + }; | ||
62 | +}; | ||
63 | + | ||
64 | +/** | ||
65 | + * 获取BrandsAd楼层数据 | ||
66 | + * @param {Object} d 接口返回的楼层数据 | ||
67 | + * @return {Object} 处理之后的数据 | ||
68 | + */ | ||
69 | +const getBrandAdFloor = d => { | ||
70 | + const list = d.list; | ||
71 | + | ||
72 | + _.forEach(list, data => { | ||
73 | + data.btnText = 'shop now'; | ||
74 | + }); | ||
75 | + | ||
76 | + return { | ||
77 | + brandsAd: list | ||
78 | + }; | ||
79 | +}; | ||
80 | + | ||
81 | +/** | ||
82 | + * 获取new arrivals楼层数据 | ||
83 | + * @param {Object} d 接口返回的楼层数据 | ||
84 | + * @return {Object} 处理之后的数据 | ||
85 | + */ | ||
86 | +const getNewArrivals = d => { | ||
87 | + const list = d.list; | ||
88 | + const title = _getTitle(d.title); | ||
89 | + | ||
90 | + _.forEach(list, (data, index) => { | ||
91 | + if (index === 0 || index === list.length - 1) { | ||
92 | + data.smallImg = true; | ||
93 | + } | ||
94 | + | ||
95 | + if (index % 2 !== 0) { | ||
96 | + data.even = true; | ||
97 | + } | ||
98 | + }); | ||
99 | + | ||
100 | + return { | ||
101 | + floorZh: title.cn, | ||
102 | + floorEn: title.en, | ||
103 | + newArrivals: list | ||
104 | + }; | ||
105 | +}; | ||
106 | + | ||
107 | +/** | ||
108 | + * 获取classic brands楼层数据 | ||
109 | + * @param {Object} d 接口返回的楼层数据 | ||
110 | + * @return {Object} 处理之后的数据 | ||
111 | + */ | ||
112 | +const getClassicBrands = d => { | ||
113 | + let brands = []; | ||
114 | + let subArr; | ||
115 | + let i = 0; | ||
116 | + | ||
117 | + const list = d.list; | ||
118 | + const title = _getTitle(d.title); | ||
119 | + | ||
120 | + | ||
121 | + _.forEach(list, (data, index) => { | ||
122 | + if (index === 0 || index === 1 || index === 6 || index === 7) { | ||
123 | + brands.push({ | ||
124 | + big: [list[index]] | ||
125 | + }); | ||
126 | + } else if ((index > 1 && index < 6 || index > 7 && index < 12) && index % 2 === 0) { | ||
127 | + if (i < 4) { | ||
128 | + subArr = list.slice(index, index + 2); | ||
129 | + brands[i].small = subArr; | ||
130 | + i += 1; | ||
131 | + } | ||
132 | + } | ||
133 | + }); | ||
134 | + | ||
135 | + _.forEach(brands, (data, index) => { | ||
136 | + if (index < 2) { | ||
137 | + data.bottomSpace = true; | ||
138 | + } | ||
139 | + | ||
140 | + if (index === 1 || index === 3) { | ||
141 | + data.right = true; | ||
142 | + } | ||
143 | + }); | ||
144 | + | ||
145 | + return { | ||
146 | + floorZh: title.cn, | ||
147 | + floorEn: title.en, | ||
148 | + classicBrands: brands | ||
149 | + }; | ||
150 | +}; | ||
151 | + | ||
152 | +/** | ||
153 | + * 获取潮流标志楼层数据 | ||
154 | + * @param {Object} d 接口返回的楼层数据 | ||
155 | + * @return {Object} 处理之后的数据 | ||
156 | + */ | ||
157 | +const getStyleIcon = d => { | ||
158 | + const list = d.list; | ||
159 | + const title = _getTitle(d.title); | ||
160 | + | ||
161 | + _.forEach(list, data => { | ||
162 | + data.btnText = '去看看'; | ||
163 | + }); | ||
164 | + | ||
165 | + return { | ||
166 | + floorZh: title.cn, | ||
167 | + floorEn: title.en, | ||
168 | + styleIcon: list | ||
169 | + }; | ||
170 | +}; | ||
171 | + | ||
172 | +/** | ||
173 | + * 获取广告楼层数据 | ||
174 | + * @param {Object} d 接口返回的楼层数据 | ||
175 | + * @return {Object} 处理之后的数据 | ||
176 | + */ | ||
177 | +const getAdBanner = d => { | ||
178 | + return { | ||
179 | + adBanner: d | ||
180 | + }; | ||
181 | +}; | ||
182 | + | ||
183 | +/** | ||
184 | + * 获取咨询楼层数据 | ||
185 | + * @param {Object} d 接口返回的楼层数据 | ||
186 | + * @return {Object} 处理之后的数据 | ||
187 | + */ | ||
188 | +const getEditorial = d => { | ||
189 | + const list = d.list; | ||
190 | + const title = _getTitle(d.title); | ||
191 | + | ||
192 | + let e = { | ||
193 | + big: {}, | ||
194 | + small: [] | ||
195 | + }; | ||
196 | + | ||
197 | + _.forEach(list, (data, index) => { | ||
198 | + if (index === 0) { | ||
199 | + e.big = data; | ||
200 | + } else { | ||
201 | + e.small.push(data); | ||
202 | + } | ||
203 | + }); | ||
204 | + | ||
205 | + _.forEach(e.small, (data, index) => { | ||
206 | + if (index === 0 || index === 1) { | ||
207 | + data.bottomSpace = true; | ||
208 | + } | ||
209 | + | ||
210 | + if (index === 0 || index === 2) { | ||
211 | + data.rightSpace = true; | ||
212 | + } | ||
213 | + }); | ||
214 | + | ||
215 | + return { | ||
216 | + floorZh: title.cn, | ||
217 | + floorEn: title.en, | ||
218 | + editorial: e | ||
219 | + }; | ||
220 | +}; | ||
221 | + | ||
222 | +module.exports = { | ||
223 | + getSliderData, | ||
224 | + getBrandAdFloor, | ||
225 | + getNewArrivals, | ||
226 | + getClassicBrands, | ||
227 | + getStyleIcon, | ||
228 | + getAdBanner, | ||
229 | + getEditorial | ||
230 | + | ||
231 | +}; |
@@ -6,199 +6,90 @@ | @@ -6,199 +6,90 @@ | ||
6 | 'use strict'; | 6 | 'use strict'; |
7 | 7 | ||
8 | const channelApi = require('./channel-api'); | 8 | const channelApi = require('./channel-api'); |
9 | +const floorDataHandler = require('./floor-data-handler'); | ||
9 | const camelCase = global.yoho.camelCase; | 10 | const camelCase = global.yoho.camelCase; |
10 | const _ = require('lodash'); | 11 | const _ = require('lodash'); |
11 | 12 | ||
12 | -/** | ||
13 | - * 获取slider楼层数据 | ||
14 | - * @param {Object} d 接口返回的楼层数据 | ||
15 | - * @return {Object} 处理之后的数据 | ||
16 | - */ | ||
17 | -const _getSliderData = d => { | ||
18 | - | ||
19 | - return { | ||
20 | - slider: d | ||
21 | - }; | ||
22 | -}; | ||
23 | 13 | ||
24 | /** | 14 | /** |
25 | - * 获取BrandsAd楼层数据 | 15 | + * 获取模板名为single_image的数据 |
26 | * @param {Object} d 接口返回的楼层数据 | 16 | * @param {Object} d 接口返回的楼层数据 |
27 | * @return {Object} 处理之后的数据 | 17 | * @return {Object} 处理之后的数据 |
28 | */ | 18 | */ |
29 | -const _getBrandAdFloor = d => { | ||
30 | - | ||
31 | - _.forEach(d, data => { | ||
32 | - data.btnText = 'shop now'; | ||
33 | - }); | ||
34 | - | ||
35 | - return { | ||
36 | - brandsAd: d | ||
37 | - }; | 19 | +const _processSingleImage = (d) => { |
20 | + return floorDataHandler.getAdBanner(d); | ||
38 | }; | 21 | }; |
39 | 22 | ||
40 | /** | 23 | /** |
41 | - * 获取new arrivals楼层数据 | 24 | + * 获取模板名为focus的数据 |
42 | * @param {Object} d 接口返回的楼层数据 | 25 | * @param {Object} d 接口返回的楼层数据 |
43 | * @return {Object} 处理之后的数据 | 26 | * @return {Object} 处理之后的数据 |
44 | */ | 27 | */ |
45 | -const _getNewArrivals = d => { | ||
46 | - _.forEach(d, (data, index) => { | ||
47 | - if (index === 0 || index === d.length - 1) { | ||
48 | - data.smallImg = true; | ||
49 | - } | ||
50 | - | ||
51 | - if (index % 2 !== 0) { | ||
52 | - data.even = true; | ||
53 | - } | ||
54 | - }); | ||
55 | - | ||
56 | - return { | ||
57 | - floorZh: '新品抢鲜看', | ||
58 | - floorEn: 'NEW ARRIVALS', | ||
59 | - newArrivals: d | ||
60 | - }; | 28 | +const _processFocus = (d) => { |
29 | + return floorDataHandler.getSliderData(d); | ||
61 | }; | 30 | }; |
62 | 31 | ||
63 | /** | 32 | /** |
64 | - * 获取classic brands楼层数据 | 33 | + * 获取模板名为blk_brand的数据 |
65 | * @param {Object} d 接口返回的楼层数据 | 34 | * @param {Object} d 接口返回的楼层数据 |
66 | * @return {Object} 处理之后的数据 | 35 | * @return {Object} 处理之后的数据 |
67 | */ | 36 | */ |
68 | -const _getClassicBrands = d => { | ||
69 | - let brands = []; | ||
70 | - let subArr; | ||
71 | - let i = 0; | 37 | +const _processBlkBrand = (d) => { |
38 | + let len; | ||
72 | 39 | ||
73 | - _.forEach(d, (data, index) => { | ||
74 | - if (index === 0 || index === 1 || index === 6 || index === 7) { | ||
75 | - brands.push({ | ||
76 | - big: [d[index]] | ||
77 | - }); | ||
78 | - } else if ((index > 1 && index < 6 || index > 7 && index < 12) && index % 2 === 0) { | ||
79 | - if (i < 4) { | ||
80 | - subArr = d.slice(index, index + 2); | ||
81 | - brands[i].small = subArr; | ||
82 | - i += 1; | ||
83 | - } | ||
84 | - } | ||
85 | - }); | 40 | + if (!d.list) { |
41 | + return false; | ||
42 | + } | ||
86 | 43 | ||
87 | - _.forEach(brands, (data, index) => { | ||
88 | - if (index < 2) { | ||
89 | - data.bottomSpace = true; | ||
90 | - } | ||
91 | - | ||
92 | - if (index === 1 || index === 3) { | ||
93 | - data.right = true; | ||
94 | - } | ||
95 | - }); | 44 | + len = d.list.length; |
96 | 45 | ||
97 | - return { | ||
98 | - floorZh: '经典品牌', | ||
99 | - floorEn: 'CLASSIC BRANDS', | ||
100 | - classicBrands: brands | ||
101 | - }; | 46 | + if (len === 2) { |
47 | + return floorDataHandler.getBrandAdFloor(d); | ||
48 | + } else if (len === 4) { | ||
49 | + return floorDataHandler.getStyleIcon(d); | ||
50 | + } | ||
102 | }; | 51 | }; |
103 | 52 | ||
104 | /** | 53 | /** |
105 | - * 获取潮流标志楼层数据 | 54 | + * 获取模板名为image_list的数据 |
106 | * @param {Object} d 接口返回的楼层数据 | 55 | * @param {Object} d 接口返回的楼层数据 |
107 | * @return {Object} 处理之后的数据 | 56 | * @return {Object} 处理之后的数据 |
108 | */ | 57 | */ |
109 | -const _getStyleIcon = d => { | ||
110 | - _.forEach(d, data => { | ||
111 | - data.btnText = '去看看'; | ||
112 | - }); | 58 | +const _processImageList = (d) => { |
59 | + let len; | ||
113 | 60 | ||
114 | - return { | ||
115 | - floorZh: '潮流标志', | ||
116 | - floorEn: 'STYLE ICON', | ||
117 | - styleIcon: d | ||
118 | - }; | ||
119 | -}; | 61 | + if (!d.list) { |
62 | + return false; | ||
63 | + } | ||
120 | 64 | ||
121 | -const _getAdBanner = d => { | ||
122 | - return { | ||
123 | - adBanner: d | ||
124 | - }; | 65 | + len = d.list.length; |
66 | + | ||
67 | + if (len === 4) { | ||
68 | + return floorDataHandler.getNewArrivals(d); | ||
69 | + } else if (len === 5) { | ||
70 | + return floorDataHandler.getEditorial(d); | ||
71 | + } | ||
125 | }; | 72 | }; |
126 | 73 | ||
127 | /** | 74 | /** |
128 | - * 获取咨询楼层数据 | 75 | + * 获取模板名为recommend_content_five的数据 |
129 | * @param {Object} d 接口返回的楼层数据 | 76 | * @param {Object} d 接口返回的楼层数据 |
130 | * @return {Object} 处理之后的数据 | 77 | * @return {Object} 处理之后的数据 |
131 | */ | 78 | */ |
132 | -const _getEditorial = d => { | ||
133 | - let e = { | ||
134 | - big: {}, | ||
135 | - small: [] | ||
136 | - }; | ||
137 | - | ||
138 | - _.forEach(d, (data, index) => { | ||
139 | - if (index === 0) { | ||
140 | - e.big = data; | ||
141 | - } else { | ||
142 | - e.small.push(data); | ||
143 | - } | ||
144 | - }); | ||
145 | - | ||
146 | - _.forEach(e.small, (data, index) => { | ||
147 | - if (index === 0 || index === 1) { | ||
148 | - data.bottomSpace = true; | ||
149 | - } | ||
150 | - | ||
151 | - if (index === 0 || index === 2) { | ||
152 | - data.rightSpace = true; | ||
153 | - } | ||
154 | - }); | ||
155 | - | ||
156 | - return { | ||
157 | - floorZh: '资讯', | ||
158 | - floorEn: 'EDITORIAL', | ||
159 | - editorial: e | ||
160 | - }; | 79 | +const _processRecommendContentFive = (d) => { |
80 | + return floorDataHandler.getClassicBrands(d); | ||
161 | }; | 81 | }; |
162 | 82 | ||
163 | 83 | ||
164 | -const floorMap = { | ||
165 | - slider: _getSliderData, | ||
166 | - 标题: _getBrandAdFloor, | ||
167 | - NEW: _getNewArrivals, | ||
168 | - CLASSIC: _getClassicBrands, | ||
169 | - STYLE: _getStyleIcon, | ||
170 | - EDITORIAL: _getEditorial, | ||
171 | - adBanner: _getAdBanner | ||
172 | -}; | ||
173 | - | ||
174 | -/** | ||
175 | - * 获取floorMap中对应的key | ||
176 | - * @param {String} d 含有key的字符串 | ||
177 | - * @return {String} 得到的key值 | ||
178 | - */ | ||
179 | -const _getKey = d => { | ||
180 | - let k = d.split(' ')[0]; | ||
181 | - | ||
182 | - return k; | ||
183 | -}; | ||
184 | - | ||
185 | -/** | ||
186 | - * 判断title类型是否为对象 | ||
187 | - * @param {Object} t title | ||
188 | - * @return {Boolen} | ||
189 | - */ | ||
190 | -const _isObjectTitle = t => { | ||
191 | - return _.isObject(t); | 84 | +// 根据templete_name字段找到不同的处理方法 |
85 | +const templateMap = { | ||
86 | + single_image: _processSingleImage, | ||
87 | + blkBrand: _processBlkBrand, | ||
88 | + image_list: _processImageList, | ||
89 | + focus: _processFocus, | ||
90 | + recommend_content_five: _processRecommendContentFive | ||
192 | }; | 91 | }; |
193 | 92 | ||
194 | -/** | ||
195 | - * 判断是否为Banner焦点图楼层 | ||
196 | - * @param {Object} d 楼层数据 | ||
197 | - * @return {Boolen} | ||
198 | - */ | ||
199 | -const _isBannerFloor = d => { | ||
200 | - return d.templateName === 'focus' && d.templateIntro === '焦点图'; | ||
201 | -}; | ||
202 | 93 | ||
203 | /** | 94 | /** |
204 | * 获取用于渲染模板的数据 | 95 | * 获取用于渲染模板的数据 |
@@ -209,32 +100,14 @@ const _processFloorData = d => { | @@ -209,32 +100,14 @@ const _processFloorData = d => { | ||
209 | let floorList = []; | 100 | let floorList = []; |
210 | 101 | ||
211 | _.forEach(d, data => { | 102 | _.forEach(d, data => { |
212 | - let floorTitle; | ||
213 | let floorData; | 103 | let floorData; |
214 | 104 | ||
215 | if (!data.data) { | 105 | if (!data.data) { |
216 | return false; | 106 | return false; |
217 | } | 107 | } |
218 | 108 | ||
219 | - // 处理banner | ||
220 | - if (_isBannerFloor(data)) { | ||
221 | - floorData = floorMap.slider(data.data); | ||
222 | - | ||
223 | - // 判断标题类型 | ||
224 | - } else if (_isObjectTitle(data.data.title)) { | ||
225 | - floorTitle = _getKey(data.data.title.title); | ||
226 | - | ||
227 | - if (floorMap[floorTitle]) { | ||
228 | - floorData = floorMap[floorTitle](data.data.list); | ||
229 | - } | ||
230 | - } else if (data.data.title) { | ||
231 | - floorTitle = _getKey(data.data.title); | ||
232 | - | ||
233 | - if (floorMap[floorTitle]) { | ||
234 | - floorData = floorMap[floorTitle](data.data.list); | ||
235 | - } | ||
236 | - } else if (data.templateName === 'single_image') { | ||
237 | - floorData = floorMap.adBanner(data.data); | 109 | + if (templateMap[data.templateName]) { |
110 | + floorData = templateMap[data.templateName](data.data); | ||
238 | } | 111 | } |
239 | 112 | ||
240 | floorList.push(floorData); | 113 | floorList.push(floorData); |
@@ -243,6 +116,11 @@ const _processFloorData = d => { | @@ -243,6 +116,11 @@ const _processFloorData = d => { | ||
243 | return floorList; | 116 | return floorList; |
244 | }; | 117 | }; |
245 | 118 | ||
119 | +/** | ||
120 | + * 获取楼层数据 | ||
121 | + * @param {String} type 当前的频道 | ||
122 | + * @return {Object} 完整的楼层数据 | ||
123 | + */ | ||
246 | const getContent = type => { | 124 | const getContent = type => { |
247 | return channelApi.getChannelDataAsync(type).then(result => { | 125 | return channelApi.getChannelDataAsync(type).then(result => { |
248 | if (result.data && result.data.list) { | 126 | if (result.data && result.data.list) { |
@@ -254,259 +132,6 @@ const getContent = type => { | @@ -254,259 +132,6 @@ const getContent = type => { | ||
254 | return floor; | 132 | return floor; |
255 | } | 133 | } |
256 | }); | 134 | }); |
257 | - | ||
258 | - /* eslint-disable */ | ||
259 | - const content = { | ||
260 | - content: [ | ||
261 | - { | ||
262 | - slider: [ | ||
263 | - { | ||
264 | - img: '//placehold.it/{width}x{height}', | ||
265 | - link: '/' | ||
266 | - }, | ||
267 | - { | ||
268 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1920/h/650', | ||
269 | - link: '/' | ||
270 | - }, | ||
271 | - { | ||
272 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450', | ||
273 | - link: '/' | ||
274 | - }, | ||
275 | - { | ||
276 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450', | ||
277 | - link: '/' | ||
278 | - }, | ||
279 | - { | ||
280 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450', | ||
281 | - link: '/' | ||
282 | - }, | ||
283 | - { | ||
284 | - img: '//placehold.it/{width}x{height}', | ||
285 | - link: '/' | ||
286 | - }, | ||
287 | - { | ||
288 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450', | ||
289 | - link: '/' | ||
290 | - }, | ||
291 | - { | ||
292 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450', | ||
293 | - link: '/' | ||
294 | - }, | ||
295 | - { | ||
296 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450', | ||
297 | - link: '/' | ||
298 | - }, | ||
299 | - { | ||
300 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450', | ||
301 | - link: '/' | ||
302 | - } | ||
303 | - ] | ||
304 | - }, | ||
305 | - { | ||
306 | - brandsAd: [ | ||
307 | - { | ||
308 | - img: '//placehold.it/{width}x{height}', | ||
309 | - name: 'GINZA', | ||
310 | - des: '藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场', | ||
311 | - btnText: 'shop now' | ||
312 | - }, | ||
313 | - { | ||
314 | - img: '//placehold.it/{width}x{height}', | ||
315 | - name: 'STUSSY', | ||
316 | - des: '藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场', | ||
317 | - btnText: 'shop now' | ||
318 | - } | ||
319 | - ] | ||
320 | - }, | ||
321 | - { | ||
322 | - floorZh: '新品抢鲜看', | ||
323 | - floorEn: 'NEW ARRIVALS', | ||
324 | - newArrivals: [ | ||
325 | - { | ||
326 | - img: '//placehold.it/{width}x{height}', | ||
327 | - name: 'STUSSY', | ||
328 | - link: '/', | ||
329 | - smallImg: true | ||
330 | - }, | ||
331 | - { | ||
332 | - img: '//placehold.it/{width}x{height}', | ||
333 | - name: 'DAILY PAPER', | ||
334 | - link: '/', | ||
335 | - even: true | ||
336 | - }, | ||
337 | - { | ||
338 | - img: '//placehold.it/{width}x{height}', | ||
339 | - name: 'BAPE', | ||
340 | - link: '/' | ||
341 | - }, | ||
342 | - { | ||
343 | - img: '//placehold.it/{width}x{height}', | ||
344 | - name: 'SUPREME', | ||
345 | - link: '/', | ||
346 | - even: true, | ||
347 | - smallImg: true | ||
348 | - } | ||
349 | - ] | ||
350 | - }, | ||
351 | - { | ||
352 | - floorZh: '经典品牌', | ||
353 | - floorEn: 'CLASSIC BRANDS', | ||
354 | - classicBrands: [ | ||
355 | - { | ||
356 | - big: [ | ||
357 | - { | ||
358 | - img: '//placehold.it/{width}x{height}', | ||
359 | - link: '' | ||
360 | - } | ||
361 | - ], | ||
362 | - small: [ | ||
363 | - { | ||
364 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/30/10/01714bacda5e9fa323a1dc5f720a7f7140.jpg?imageView2/1/w/185/h/248', | ||
365 | - link: '' | ||
366 | - }, | ||
367 | - { | ||
368 | - img: '//img10.static.yhbimg.com/yhb-img01/2016/06/30/10/01714bacda5e9fa323a1dc5f720a7f7140.jpg?imageView2/1/w/185/h/248', | ||
369 | - link: '' | ||
370 | - } | ||
371 | - ], | ||
372 | - bottomSpace: true | ||
373 | - }, | ||
374 | - { | ||
375 | - big: [ | ||
376 | - { | ||
377 | - img: '//placehold.it/{width}x{height}', | ||
378 | - link: '' | ||
379 | - } | ||
380 | - ], | ||
381 | - small: [ | ||
382 | - { | ||
383 | - img: '//placehold.it/{width}x{height}', | ||
384 | - link: '' | ||
385 | - }, | ||
386 | - { | ||
387 | - img: '//placehold.it/{width}x{height}', | ||
388 | - link: '' | ||
389 | - } | ||
390 | - ], | ||
391 | - right: true, | ||
392 | - bottomSpace: true | ||
393 | - }, | ||
394 | - { | ||
395 | - big: [ | ||
396 | - { | ||
397 | - img: '//placehold.it/{width}x{height}', | ||
398 | - link: '' | ||
399 | - } | ||
400 | - ], | ||
401 | - small: [ | ||
402 | - { | ||
403 | - img: '//placehold.it/{width}x{height}', | ||
404 | - link: '' | ||
405 | - }, | ||
406 | - { | ||
407 | - img: '//placehold.it/{width}x{height}', | ||
408 | - link: '' | ||
409 | - } | ||
410 | - ] | ||
411 | - }, | ||
412 | - { | ||
413 | - big: [ | ||
414 | - { | ||
415 | - img: '//placehold.it/{width}x{height}', | ||
416 | - link: '' | ||
417 | - } | ||
418 | - ], | ||
419 | - small: [ | ||
420 | - { | ||
421 | - img: '//placehold.it/{width}x{height}', | ||
422 | - link: '' | ||
423 | - }, | ||
424 | - { | ||
425 | - img: '//placehold.it/{width}x{height}', | ||
426 | - link: '' | ||
427 | - } | ||
428 | - ], | ||
429 | - right: true | ||
430 | - } | ||
431 | - ] | ||
432 | - }, | ||
433 | - { | ||
434 | - floorZh: '潮流标志', | ||
435 | - floorEn: 'STYLE ICON', | ||
436 | - styleIcon: [ | ||
437 | - { | ||
438 | - img: '//placehold.it/{width}x{height}', | ||
439 | - name: 'COTE&CIEL', | ||
440 | - des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生', | ||
441 | - link: '/ ', | ||
442 | - btnText: '去看看' | ||
443 | - }, | ||
444 | - { | ||
445 | - img: '//placehold.it/{width}x{height}', | ||
446 | - name: 'COTE&CIEL', | ||
447 | - des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生', | ||
448 | - link: '/ ', | ||
449 | - btnText: '去看看' | ||
450 | - }, | ||
451 | - { | ||
452 | - img: '//placehold.it/{width}x{height}', | ||
453 | - name: 'COTE&CIEL', | ||
454 | - des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生', | ||
455 | - link: '/ ', | ||
456 | - btnText: '去看看' | ||
457 | - }, | ||
458 | - { | ||
459 | - img: '//placehold.it/{width}x{height}', | ||
460 | - name: 'COTE&CIEL', | ||
461 | - des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生', | ||
462 | - link: '/ ', | ||
463 | - btnText: '去看看' | ||
464 | - } | ||
465 | - ] | ||
466 | - }, | ||
467 | - { | ||
468 | - adBanner: { | ||
469 | - img: '//placehold.it/{width}x{height}', | ||
470 | - link: '' | ||
471 | - } | ||
472 | - }, | ||
473 | - { | ||
474 | - floorZh: '资讯', | ||
475 | - floorEn: 'EDITORIAL', | ||
476 | - editorial: { | ||
477 | - big: { | ||
478 | - img: '//placehold.it/{width}x{height}', | ||
479 | - link: '' | ||
480 | - }, | ||
481 | - small: [ | ||
482 | - { | ||
483 | - img: '//placehold.it/{width}x{height}', | ||
484 | - link: '/', | ||
485 | - bottomSpace: true, | ||
486 | - rightSpace: true | ||
487 | - }, | ||
488 | - { | ||
489 | - img: '//placehold.it/{width}x{height}', | ||
490 | - link: '/', | ||
491 | - bottomSpace: true | ||
492 | - }, | ||
493 | - { | ||
494 | - img: '//placehold.it/{width}x{height}', | ||
495 | - link: '/', | ||
496 | - rightSpace: true | ||
497 | - }, | ||
498 | - { | ||
499 | - img: '//placehold.it/{width}x{height}', | ||
500 | - link: '' | ||
501 | - } | ||
502 | - ] | ||
503 | - } | ||
504 | - } | ||
505 | - ] | ||
506 | - }; | ||
507 | - /* eslint-enable */ | ||
508 | - | ||
509 | - // return content; | ||
510 | }; | 135 | }; |
511 | 136 | ||
512 | module.exports = { | 137 | module.exports = { |
1 | {{# classicBrands}} | 1 | {{# classicBrands}} |
2 | <div class="brand-img-box {{#if right}}right{{/if}} {{#if bottomSpace}}mb10{{/if}}"> | 2 | <div class="brand-img-box {{#if right}}right{{/if}} {{#if bottomSpace}}mb10{{/if}}"> |
3 | - <a href="{{url}}"> | 3 | + <a href="{{url}}" target="_blank"> |
4 | {{# big}} | 4 | {{# big}} |
5 | <img class="big-img lazy-img" data-original="{{image src 565 340}}" alt="big-img"> | 5 | <img class="big-img lazy-img" data-original="{{image src 565 340}}" alt="big-img"> |
6 | {{/ big}} | 6 | {{/ big}} |
@@ -65,6 +65,7 @@ const getOrderList = (req, res) => { | @@ -65,6 +65,7 @@ const getOrderList = (req, res) => { | ||
65 | page: 'order', | 65 | page: 'order', |
66 | isMe: true, | 66 | isMe: true, |
67 | orderList: result.order.orderList, | 67 | orderList: result.order.orderList, |
68 | + paginationOpts: result.order.paginationOpts, | ||
68 | orderData: result.order.orderData | 69 | orderData: result.order.orderData |
69 | }); | 70 | }); |
70 | }); | 71 | }); |
@@ -16,15 +16,18 @@ const index = (req, res, next) => { | @@ -16,15 +16,18 @@ const index = (req, res, next) => { | ||
16 | const uid = req.user.uid; | 16 | const uid = req.user.uid; |
17 | const page = req.query.page; | 17 | const page = req.query.page; |
18 | 18 | ||
19 | - returns.getUserReturn(uid, page).then(result => { | 19 | + Promise.all([returns.getUserReturn(uid, page), mcHandler.getMeThumb()]).then(result => { |
20 | + const pageData = result[0]; | ||
21 | + const thumb = result[1]; | ||
22 | + | ||
20 | res.display('index', { | 23 | res.display('index', { |
21 | page: 'return-list', | 24 | page: 'return-list', |
22 | isMe: true, | 25 | isMe: true, |
23 | content: Object.assign({ | 26 | content: Object.assign({ |
24 | nav: mcHandler.getMeCrumb('我的退/换货'), | 27 | nav: mcHandler.getMeCrumb('我的退/换货'), |
25 | navigation: mcHandler.getSideMenu('我的退/换货'), | 28 | navigation: mcHandler.getSideMenu('我的退/换货'), |
26 | - banner: 'http://placehold.it/{width}x{height}' | ||
27 | - }, result) | 29 | + banner: thumb |
30 | + }, pageData) | ||
28 | }); | 31 | }); |
29 | }).catch(next); | 32 | }).catch(next); |
30 | }; | 33 | }; |
@@ -43,6 +43,7 @@ const btnMap = { | @@ -43,6 +43,7 @@ const btnMap = { | ||
43 | classStr: 'btn white cancel-btn mr' | 43 | classStr: 'btn white cancel-btn mr' |
44 | }, | 44 | }, |
45 | { | 45 | { |
46 | + isEditBtn: true, | ||
46 | name: '修改订单', | 47 | name: '修改订单', |
47 | classStr: 'btn white edit-btn' | 48 | classStr: 'btn white edit-btn' |
48 | } | 49 | } |
@@ -518,6 +519,12 @@ const getOrderDetail = (uid, code) => { | @@ -518,6 +519,12 @@ const getOrderDetail = (uid, code) => { | ||
518 | } | 519 | } |
519 | }); | 520 | }); |
520 | 521 | ||
522 | + if (detail.canUpdateDeliveryAddress === 'N') { | ||
523 | + _.remove(detail.btns, btn => { | ||
524 | + return btn.isEditBtn; | ||
525 | + }); | ||
526 | + } | ||
527 | + | ||
521 | if (parseInt(detail.paymentType, 10) === 2 && | 528 | if (parseInt(detail.paymentType, 10) === 2 && |
522 | (statusMap[st].valueStr === '备货中' || | 529 | (statusMap[st].valueStr === '备货中' || |
523 | detail.statusStr === '备货中')) { | 530 | detail.statusStr === '备货中')) { |
@@ -86,8 +86,8 @@ | @@ -86,8 +86,8 @@ | ||
86 | {{!-- 在线客服和返回顶部 --}} | 86 | {{!-- 在线客服和返回顶部 --}} |
87 | <div class="service-top"> | 87 | <div class="service-top"> |
88 | <a class="service" href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=703953&configID=149819&jid=1099911094" target="_blank"> | 88 | <a class="service" href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=703953&configID=149819&jid=1099911094" target="_blank"> |
89 | - <span class="iconfont"></span> | ||
90 | - <span class="hover-text hide">在线<br>客服</span> | 89 | + <span class="iconfont hide"></span> |
90 | + <span class="hover-text">在线<br>客服</span> | ||
91 | </a> | 91 | </a> |
92 | <div class="return-top hide"> | 92 | <div class="return-top hide"> |
93 | <span class="iconfont bold"></span> | 93 | <span class="iconfont bold"></span> |
@@ -16,14 +16,15 @@ | @@ -16,14 +16,15 @@ | ||
16 | <td class="width-name">{{consignee}}</td> | 16 | <td class="width-name">{{consignee}}</td> |
17 | <td class="width-address">{{area}}</td> | 17 | <td class="width-address">{{area}}</td> |
18 | <td class="width-fulladdress">{{address}}</td> | 18 | <td class="width-fulladdress">{{address}}</td> |
19 | - <td class="width-mobile"><p>{{mobile}}</p><p>{{phone}}</p></td> | 19 | + <td class="width-mobile"><p>{{mobile}}</p> |
20 | + <p>{{phone}}</p></td> | ||
20 | <td class="width-opearte"> | 21 | <td class="width-opearte"> |
21 | <div> | 22 | <div> |
22 | <span class="blue opreation update-address" data-id="{{address_id}}">修改</span> | 23 | <span class="blue opreation update-address" data-id="{{address_id}}">修改</span> |
23 | <em class="op-sep">|</em> | 24 | <em class="op-sep">|</em> |
24 | <span class="blue opreation del-address" data-id="{{address_id}}">删除</span> | 25 | <span class="blue opreation del-address" data-id="{{address_id}}">删除</span> |
25 | {{#if default}} | 26 | {{#if default}} |
26 | - <span class="btn set-default opreation current-default ">默认地址</span> | 27 | + <span class="btn set-default opreation current-default" data-id={{address_id}}>默认地址</span> |
27 | {{else}} | 28 | {{else}} |
28 | <span class="btn set-default opreation " data-id={{address_id}}>设为默认</span> | 29 | <span class="btn set-default opreation " data-id={{address_id}}>设为默认</span> |
29 | {{/if}} | 30 | {{/if}} |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | {{> order/goods-box}} | 7 | {{> order/goods-box}} |
8 | <div class="common-column special-border"> | 8 | <div class="common-column special-border"> |
9 | <p class="bold">¥{{amount}}</p> | 9 | <p class="bold">¥{{amount}}</p> |
10 | - <p class="subtext">{{paymentTypeStr}}</p> | 10 | + <p class="subtext no-pointer">{{paymentTypeStr}}</p> |
11 | {{#if isRefundOrder}} | 11 | {{#if isRefundOrder}} |
12 | <p class="subtext refund-tag">换货订单</p> | 12 | <p class="subtext refund-tag">换货订单</p> |
13 | {{/if}} | 13 | {{/if}} |
@@ -87,15 +87,24 @@ const helpers = { | @@ -87,15 +87,24 @@ const helpers = { | ||
87 | * 男女条件 | 87 | * 男女条件 |
88 | * @returns {*[]} | 88 | * @returns {*[]} |
89 | */ | 89 | */ |
90 | - genders() { | ||
91 | - return [ | ||
92 | - { | ||
93 | - name: '男士', | ||
94 | - value: '1,3' | ||
95 | - }, { | ||
96 | - name: '女士', | ||
97 | - value: '2,3' | ||
98 | - }]; | 90 | + genders(gender) { |
91 | + if (gender) { | ||
92 | + return Object.keys(gender).map(g => { | ||
93 | + return { | ||
94 | + name: gender[g], | ||
95 | + value: g | ||
96 | + }; | ||
97 | + }); | ||
98 | + } else { | ||
99 | + return [ | ||
100 | + { | ||
101 | + name: '男士', | ||
102 | + value: '1,3' | ||
103 | + }, { | ||
104 | + name: '女士', | ||
105 | + value: '2,3' | ||
106 | + }]; | ||
107 | + } | ||
99 | }, | 108 | }, |
100 | 109 | ||
101 | /** | 110 | /** |
@@ -216,7 +225,7 @@ const helpers = { | @@ -216,7 +225,7 @@ const helpers = { | ||
216 | filterHandle(filter, q) { | 225 | filterHandle(filter, q) { |
217 | let priceRange = filter.priceRange; | 226 | let priceRange = filter.priceRange; |
218 | let sizeInfo = filter.size; | 227 | let sizeInfo = filter.size; |
219 | - let genders = this.genders(); | 228 | + let genders = this.genders(filter.gender); |
220 | let brands = filter.brand; | 229 | let brands = filter.brand; |
221 | let colors = this.colorConvert(filter.color); | 230 | let colors = this.colorConvert(filter.color); |
222 | let sorts = filter.groupSort; | 231 | let sorts = filter.groupSort; |
@@ -234,20 +243,20 @@ const helpers = { | @@ -234,20 +243,20 @@ const helpers = { | ||
234 | }); | 243 | }); |
235 | 244 | ||
236 | if (sorts) { | 245 | if (sorts) { |
237 | - // singleSort = true; | ||
238 | - // | ||
239 | - // if (sorts[0].sub && sorts[0].sub.length === 1) { | ||
240 | - // sorts[0].sub[0].checked = true; | ||
241 | - // } | ||
242 | - // | ||
243 | - // if (q.misort) { | ||
244 | - // sorts[0].sub.forEach(s => { | ||
245 | - // s.checked = s.categoryId === q.misort; | ||
246 | - // }); | ||
247 | - // } | ||
248 | - // | ||
249 | - // sorts = sorts[0].sub; | ||
250 | - // } else if (sorts && sorts.length > 1) { | 246 | + // singleSort = true; |
247 | + // | ||
248 | + // if (sorts[0].sub && sorts[0].sub.length === 1) { | ||
249 | + // sorts[0].sub[0].checked = true; | ||
250 | + // } | ||
251 | + // | ||
252 | + // if (q.misort) { | ||
253 | + // sorts[0].sub.forEach(s => { | ||
254 | + // s.checked = s.categoryId === q.misort; | ||
255 | + // }); | ||
256 | + // } | ||
257 | + // | ||
258 | + // sorts = sorts[0].sub; | ||
259 | + // } else if (sorts && sorts.length > 1) { | ||
251 | 260 | ||
252 | _.forEach(sorts, s => { | 261 | _.forEach(sorts, s => { |
253 | s.sub.unshift({ | 262 | s.sub.unshift({ |
@@ -140,11 +140,11 @@ const getProductItemData = (params, url, uid) => { | @@ -140,11 +140,11 @@ const getProductItemData = (params, url, uid) => { | ||
140 | * 获取商品尺寸,颜色,和缩略图 | 140 | * 获取商品尺寸,颜色,和缩略图 |
141 | * @function getProductInfo | 141 | * @function getProductInfo |
142 | * @param { Number } productId 商品ID | 142 | * @param { Number } productId 商品ID |
143 | - * @param { String } uid 用户ID | ||
144 | * @param { Number } skn 商品skn | 143 | * @param { Number } skn 商品skn |
144 | + * @param { String } uid 用户ID | ||
145 | * @return { Object } 接口返回单个商品的基本信息 | 145 | * @return { Object } 接口返回单个商品的基本信息 |
146 | */ | 146 | */ |
147 | -const getProductInfo = (productId, uid, skn) => { | 147 | +const getProductInfo = (productId, skn, uid) => { |
148 | return itemApi.getProductBaseAsync(productId, uid, skn).then(result => { | 148 | return itemApi.getProductBaseAsync(productId, uid, skn).then(result => { |
149 | return itemFun.setProductData(result); | 149 | return itemFun.setProductData(result); |
150 | }); | 150 | }); |
@@ -9,6 +9,13 @@ | @@ -9,6 +9,13 @@ | ||
9 | {{# goodInfo}} | 9 | {{# goodInfo}} |
10 | <div class="product-main clearfix" data-id="{{id}}"> | 10 | <div class="product-main clearfix" data-id="{{id}}"> |
11 | <div class="thumbs left clearfix"> | 11 | <div class="thumbs left clearfix"> |
12 | + <div class="thumb-show right"> | ||
13 | + <img id="main-thumb" src="{{image img 482 643}}" style="display: block;"> | ||
14 | + <div class="check-btns"> | ||
15 | + <span class="iconfont pre-thumb"></span> | ||
16 | + <span class="iconfont next-thumb"></span> | ||
17 | + </div> | ||
18 | + </div> | ||
12 | <div class="thumb-list hide"> | 19 | <div class="thumb-list hide"> |
13 | {{# colors}} | 20 | {{# colors}} |
14 | <div class="thumb-wrap{{#unless cur}} hide{{/unless}}"> | 21 | <div class="thumb-wrap{{#unless cur}} hide{{/unless}}"> |
@@ -24,13 +31,6 @@ | @@ -24,13 +31,6 @@ | ||
24 | </div> | 31 | </div> |
25 | {{/ colors}} | 32 | {{/ colors}} |
26 | </div> | 33 | </div> |
27 | - <div class="thumb-show right"> | ||
28 | - <img id="main-thumb" src="{{image img 482 643}}" style="display: block;"> | ||
29 | - <div class="check-btns"> | ||
30 | - <span class="iconfont pre-thumb"></span> | ||
31 | - <span class="iconfont next-thumb"></span> | ||
32 | - </div> | ||
33 | - </div> | ||
34 | </div> | 34 | </div> |
35 | <div class="infos left clearfix"> | 35 | <div class="infos left clearfix"> |
36 | <p class="brand-name">{{brandName}}</p> | 36 | <p class="brand-name">{{brandName}}</p> |
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | <div class="brand-list nano"> | 74 | <div class="brand-list nano"> |
75 | <div class="nano-content"> | 75 | <div class="nano-content"> |
76 | {{#each brandData}} | 76 | {{#each brandData}} |
77 | - <div class="input-radio {{#if checked}}default-check{{/if}}" data-value="{{id}}"> | 77 | + <div class="input-radio {{#if checked}}default-check{{/if}}" data-value="{{id}}" data-word="{{brandAlif}}"> |
78 | {{> icon/radio}} | 78 | {{> icon/radio}} |
79 | {{#if brandNameEn}} | 79 | {{#if brandNameEn}} |
80 | <label>{{brandNameEn}}</label> | 80 | <label>{{brandNameEn}}</label> |
@@ -79,13 +79,13 @@ const callback = (req, res) => { | @@ -79,13 +79,13 @@ const callback = (req, res) => { | ||
79 | if (result.code === 200) { | 79 | if (result.code === 200) { |
80 | let data = result.data; | 80 | let data = result.data; |
81 | 81 | ||
82 | - res.render('pay-success', { | 82 | + res.display('pay-success', { |
83 | defaultHeader: false, | 83 | defaultHeader: false, |
84 | content: { | 84 | content: { |
85 | cost: data.pay, | 85 | cost: data.pay, |
86 | orderNum: data.orderCode, | 86 | orderNum: data.orderCode, |
87 | onlineCost: data.pay, | 87 | onlineCost: data.pay, |
88 | - orderHref: helpers.urlFormat('/me/order/detail', {code: data.orderCode}), | 88 | + orderHref: helpers.urlFormat('/me/order/detail', {orderCode: data.orderCode}), |
89 | walkHref: helpers.urlFormat('/') | 89 | walkHref: helpers.urlFormat('/') |
90 | } | 90 | } |
91 | }); | 91 | }); |
@@ -18,7 +18,7 @@ const pay = require(`${cRoot}/pay`); // 支付 | @@ -18,7 +18,7 @@ const pay = require(`${cRoot}/pay`); // 支付 | ||
18 | router.get('/cart', cartCtrl.index); | 18 | router.get('/cart', cartCtrl.index); |
19 | router.post('/cart/product/change_num', cartCtrl.changeProductNum); | 19 | router.post('/cart/product/change_num', cartCtrl.changeProductNum); |
20 | router.delete('/cart/product/remove', cartCtrl.removeProduct); | 20 | router.delete('/cart/product/remove', cartCtrl.removeProduct); |
21 | -router.post('/cart/product/send_to_favorite', cartCtrl.sendToFavorite); | 21 | +router.post('/cart/product/send_to_favorite', auth, cartCtrl.sendToFavorite); |
22 | router.post('/cart/add', cartCtrl.addToCart); | 22 | router.post('/cart/add', cartCtrl.addToCart); |
23 | router.post('/cart/toggleSelectGoods', cartCtrl.toggleSelectGoods); | 23 | router.post('/cart/toggleSelectGoods', cartCtrl.toggleSelectGoods); |
24 | router.get('/cart/checkStorage', cartCtrl.checkStorage); | 24 | router.get('/cart/checkStorage', cartCtrl.checkStorage); |
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | 1.每天15:00以前成功支付的订单将在当天发货,15:00-00:00成功付款的订单将在第二天发货。 | 21 | 1.每天15:00以前成功支付的订单将在当天发货,15:00-00:00成功付款的订单将在第二天发货。 |
22 | 2.当订单发货后,您可以登录<a class="blue" href="/me/order">订单中心</a>查询快递发货详情。 | 22 | 2.当订单发货后,您可以登录<a class="blue" href="/me/order">订单中心</a>查询快递发货详情。 |
23 | 3.YOHO!BLK有货支持“开箱验货”和“15天退换货保障”收货后请当面验货,如果发现商品有任何问题请致电客服电话400-889-9646, | 23 | 3.YOHO!BLK有货支持“开箱验货”和“15天退换货保障”收货后请当面验货,如果发现商品有任何问题请致电客服电话400-889-9646, |
24 | - <a class="blue" href="">“退换货政策”</a>请点击查看。<em class="blue">4.尊敬的用户:近期为网络诈骗高发期,YOHO!BLK有货郑重声明,不会以任何形式索取客户的账户信息或引导转账,敬请提高警惕,谨防诈骗</em> | 24 | + <a class="blue" href="/help?id=43">“退换货政策”</a>请点击查看。<em class="blue">4.尊敬的用户:近期为网络诈骗高发期,YOHO!BLK有货郑重声明,不会以任何形式索取客户的账户信息或引导转账,敬请提高警惕,谨防诈骗</em> |
25 | </p> | 25 | </p> |
26 | </div> | 26 | </div> |
27 | {{/ content}} | 27 | {{/ content}} |
@@ -33,9 +33,9 @@ | @@ -33,9 +33,9 @@ | ||
33 | {{/if}} | 33 | {{/if}} |
34 | <span class="iconfont"></span> | 34 | <span class="iconfont"></span> |
35 | </div> | 35 | </div> |
36 | - {{#expect_arrival_time}} | 36 | + {{#if expect_arrival_time}} |
37 | <div class="published-at">上市期: {{expect_arrival_time}}</div> | 37 | <div class="published-at">上市期: {{expect_arrival_time}}</div> |
38 | - {{/expect_arrival_time}} | 38 | + {{/if}} |
39 | </li> | 39 | </li> |
40 | <li class="price-num"> | 40 | <li class="price-num"> |
41 | <span class="price sale-price">¥ {{round sales_price 2}}</span> | 41 | <span class="price sale-price">¥ {{round sales_price 2}}</span> |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | </label> | 8 | </label> |
9 | </div> | 9 | </div> |
10 | <div class="item product">货品</div> | 10 | <div class="item product">货品</div> |
11 | - <div class="item price">价格</div> | 11 | + <div class="item price">单价</div> |
12 | <div class="item num">数量</div> | 12 | <div class="item num">数量</div> |
13 | <div class="item pro-total-price">总价</div> | 13 | <div class="item pro-total-price">总价</div> |
14 | <div class="item actions">操作</div> | 14 | <div class="item actions">操作</div> |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | </p> | 7 | </p> |
8 | {{^}} | 8 | {{^}} |
9 | <p class="info-text"> | 9 | <p class="info-text"> |
10 | - 温馨提示: 亲爱的顾客,您还没有<a href="/passport/login">登录</a>哦, 所有的商品价购、活动信息以登录后显示为准。 | 10 | + 温馨提示: 亲爱的顾客,您还没有<a href="/passport/login">登录</a>哦, 所有的商品价格、活动信息以登录后显示为准。 |
11 | <span class="iconfont pull-right close"></span> | 11 | <span class="iconfont pull-right close"></span> |
12 | </p> | 12 | </p> |
13 | {{/if}} | 13 | {{/if}} |
@@ -84,7 +84,7 @@ const getBrandItems = (data) => { | @@ -84,7 +84,7 @@ const getBrandItems = (data) => { | ||
84 | _.forEach(data, item => { | 84 | _.forEach(data, item => { |
85 | brandItems.push({ | 85 | brandItems.push({ |
86 | link: item.sort_url, | 86 | link: item.sort_url, |
87 | - hot: item.is_hot === 'Y' ? true : false, | 87 | + hot: item.is_hot === 'Y', |
88 | name: item.sort_name | 88 | name: item.sort_name |
89 | }); | 89 | }); |
90 | }); | 90 | }); |
@@ -103,16 +103,15 @@ const getThirdNav = (data) => { | @@ -103,16 +103,15 @@ const getThirdNav = (data) => { | ||
103 | _.forEach(data, item => { | 103 | _.forEach(data, item => { |
104 | let obj = { | 104 | let obj = { |
105 | link: item.sort_url, | 105 | link: item.sort_url, |
106 | - name: item.sort_name | 106 | + hot: item.is_hot === 'Y', |
107 | + name: item.sort_name, | ||
108 | + category: true | ||
107 | }; | 109 | }; |
108 | 110 | ||
109 | thirdNav.push(obj); | 111 | thirdNav.push(obj); |
110 | 112 | ||
111 | if (item.sub) { | 113 | if (item.sub) { |
112 | thirdNav = _.concat(thirdNav, getBrandItems(item.sub)); | 114 | thirdNav = _.concat(thirdNav, getBrandItems(item.sub)); |
113 | - obj.category = true; | ||
114 | - | ||
115 | - // obj.brandItems = getBrandItems(item.sub); | ||
116 | } | 115 | } |
117 | 116 | ||
118 | }); | 117 | }); |
@@ -183,6 +182,9 @@ const requestNavBar = (type) => { | @@ -183,6 +182,9 @@ const requestNavBar = (type) => { | ||
183 | cache: true, | 182 | cache: true, |
184 | code: 200 | 183 | code: 200 |
185 | }).then(res => { | 184 | }).then(res => { |
185 | + if (!res) { | ||
186 | + return {}; | ||
187 | + } | ||
186 | return setHeaderData(res.data, type); | 188 | return setHeaderData(res.data, type); |
187 | }); | 189 | }); |
188 | }; | 190 | }; |
@@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
10 | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> | 10 | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
11 | <meta content="telephone=no" name="format-detection" /> | 11 | <meta content="telephone=no" name="format-detection" /> |
12 | <meta content="email=no" name="format-detection" /> | 12 | <meta content="email=no" name="format-detection" /> |
13 | + <meta name="renderer" content="webkit"> | ||
13 | <link rel="dns-prefetch" href="//cdn.yoho.cn"> | 14 | <link rel="dns-prefetch" href="//cdn.yoho.cn"> |
14 | <link rel="dns-prefetch" href="//static.yohobuy.com"> | 15 | <link rel="dns-prefetch" href="//static.yohobuy.com"> |
15 | <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> | 16 | <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> |
@@ -7,7 +7,7 @@ module.exports = function(leftNumber) { | @@ -7,7 +7,7 @@ module.exports = function(leftNumber) { | ||
7 | leftNumber = typeof num1 === 'number' ? leftNumber : parseFloat(leftNumber, 10); | 7 | leftNumber = typeof num1 === 'number' ? leftNumber : parseFloat(leftNumber, 10); |
8 | 8 | ||
9 | if (leftNumber <= 3 && leftNumber >= 0) { | 9 | if (leftNumber <= 3 && leftNumber >= 0) { |
10 | - return `仅剩${leftNumber}件`; | 10 | + return '仅剩' + leftNumber + '件'; |
11 | } else if (leftNumber < 0) { | 11 | } else if (leftNumber < 0) { |
12 | return '库存不足'; | 12 | return '库存不足'; |
13 | } | 13 | } |
@@ -17,6 +17,19 @@ function showOrNot() { | @@ -17,6 +17,19 @@ function showOrNot() { | ||
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | +function reposReturnTop() { | ||
21 | + var $top = $returnTop.parent(); | ||
22 | + | ||
23 | + if (!$top.hasClass('service-top')) { | ||
24 | + $top = $returnTop; | ||
25 | + } | ||
26 | + if ($(window).width() < 1380) { | ||
27 | + $top.addClass('for-min'); | ||
28 | + } else { | ||
29 | + $top.removeClass('for-min'); | ||
30 | + } | ||
31 | +} | ||
32 | + | ||
20 | $returnTop.click(function() { | 33 | $returnTop.click(function() { |
21 | $('html,body').animate({ | 34 | $('html,body').animate({ |
22 | scrollTop: 0 | 35 | scrollTop: 0 |
@@ -36,4 +49,10 @@ if ($returnTop.hasClass('hide')) { | @@ -36,4 +49,10 @@ if ($returnTop.hasClass('hide')) { | ||
36 | $('img').load(showOrNot); | 49 | $('img').load(showOrNot); |
37 | } | 50 | } |
38 | 51 | ||
52 | +reposReturnTop(); | ||
53 | + | ||
54 | +if ($returnTop.length) { | ||
55 | + $(window).resize(reposReturnTop); | ||
56 | +} | ||
57 | + | ||
39 | exports.returnTopShowOrNot = showOrNot; | 58 | exports.returnTopShowOrNot = showOrNot; |
@@ -25,11 +25,11 @@ require('../common/return-top'); // return-top | @@ -25,11 +25,11 @@ require('../common/return-top'); // return-top | ||
25 | lazyLoad($('.banner-img')); | 25 | lazyLoad($('.banner-img')); |
26 | 26 | ||
27 | // 浮动在线客服和返回顶部的鼠标移入移出切换效果 | 27 | // 浮动在线客服和返回顶部的鼠标移入移出切换效果 |
28 | -$('.service, .return-top').hover(function() { | ||
29 | - $(this).find('.iconfont').addClass('hide').end().find('.hover-text').removeClass('hide'); | ||
30 | -}, function() { | ||
31 | - $(this).find('.iconfont').removeClass('hide').end().find('.hover-text').addClass('hide'); | ||
32 | -}); | 28 | +function toggleShow(e) { |
29 | + $(e.target).find('span').toggleClass('hide'); | ||
30 | +} | ||
31 | + | ||
32 | +$('.service, .return-top').hover(toggleShow, toggleShow); | ||
33 | 33 | ||
34 | // repos service-return when window resize | 34 | // repos service-return when window resize |
35 | $(window).resize(reposServiceTop); | 35 | $(window).resize(reposServiceTop); |
@@ -19,7 +19,6 @@ var confirmReceive = require('./order/confirm-receive'); | @@ -19,7 +19,6 @@ var confirmReceive = require('./order/confirm-receive'); | ||
19 | // 订单剩余时间显示及倒计时 | 19 | // 订单剩余时间显示及倒计时 |
20 | var countDown = require('./order/countdown'); | 20 | var countDown = require('./order/countdown'); |
21 | 21 | ||
22 | -require('../common/foreach-polyfill'); | ||
23 | 22 | ||
24 | // 更新表格 | 23 | // 更新表格 |
25 | var tableOperation = { | 24 | var tableOperation = { |
@@ -41,6 +40,8 @@ var typeMap = { | @@ -41,6 +40,8 @@ var typeMap = { | ||
41 | delivering: 3 | 40 | delivering: 3 |
42 | }; | 41 | }; |
43 | 42 | ||
43 | +require('../common/foreach-polyfill'); | ||
44 | + | ||
44 | // 个人中心共用代码加载 | 45 | // 个人中心共用代码加载 |
45 | require('./me'); | 46 | require('./me'); |
46 | 47 | ||
@@ -150,9 +151,9 @@ function updateTableContent($el) { | @@ -150,9 +151,9 @@ function updateTableContent($el) { | ||
150 | 151 | ||
151 | // 绑定分页点击事件 | 152 | // 绑定分页点击事件 |
152 | function bindPaginationClick() { | 153 | function bindPaginationClick() { |
153 | - $('.blk-pagination li').off('click').on('click', function(e) { | 154 | + $('.blk-pagination a').off('click').on('click', function(e) { |
154 | var $this = $(this); | 155 | var $this = $(this); |
155 | - var page = $this.find('a').attr('href').split('=')[1]; | 156 | + var page = $this.attr('href').split('=')[1]; |
156 | var type = getCurrentTabType(); | 157 | var type = getCurrentTabType(); |
157 | 158 | ||
158 | e.preventDefault(); | 159 | e.preventDefault(); |
1 | var _alert = require('../plugins/dialog').Alert; | 1 | var _alert = require('../plugins/dialog').Alert; |
2 | +var lazyLoad = require('yoho-jquery-lazyload'); | ||
3 | + | ||
4 | +lazyLoad($('img.banner-img')); | ||
2 | 5 | ||
3 | $('.cancel-apply').on('click', function() { | 6 | $('.cancel-apply').on('click', function() { |
4 | var id = $(this).data('applyId'); | 7 | var id = $(this).data('applyId'); |
@@ -338,16 +338,18 @@ var YohoListPage = { | @@ -338,16 +338,18 @@ var YohoListPage = { | ||
338 | }, | 338 | }, |
339 | filterBrand: function(letter) { | 339 | filterBrand: function(letter) { |
340 | $('.yoho-product-list .brand-list .input-radio').each(function() { | 340 | $('.yoho-product-list .brand-list .input-radio').each(function() { |
341 | - if (letter === '0-9') { | ||
342 | - var first = $('label', this).text().toLowerCase().charAt(0); // eslint-disable-line | 341 | + var first = $(this).data('word').toString(); // eslint-disable-line |
343 | 342 | ||
343 | + first = first.toLowerCase(); | ||
344 | + if (letter === '0-9') { | ||
345 | + console.log(first); | ||
344 | if ((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z')) { | 346 | if ((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z')) { |
345 | $(this).hide(); | 347 | $(this).hide(); |
346 | } else { | 348 | } else { |
347 | $(this).show(); | 349 | $(this).show(); |
348 | } | 350 | } |
349 | } else { | 351 | } else { |
350 | - if ($('label', this).text().toLowerCase().indexOf(letter) === 0) { | 352 | + if (!letter || first === letter) { |
351 | $(this).show(); | 353 | $(this).show(); |
352 | } else { | 354 | } else { |
353 | $(this).hide(); | 355 | $(this).hide(); |
@@ -72,8 +72,8 @@ $(function() { | @@ -72,8 +72,8 @@ $(function() { | ||
72 | 72 | ||
73 | // 编辑商品颜色和属性 | 73 | // 编辑商品颜色和属性 |
74 | Cart.editColorOrSize( | 74 | Cart.editColorOrSize( |
75 | - $this.attr('data-productId'), | ||
76 | - $this.attr('data-productSkn'), | 75 | + $this.attr('data-productid'), |
76 | + $this.attr('data-productskn'), | ||
77 | $this.find('.default-color').text(), | 77 | $this.find('.default-color').text(), |
78 | $this.find('.default-size').text(), function() { | 78 | $this.find('.default-size').text(), function() { |
79 | editable = true; | 79 | editable = true; |
@@ -91,7 +91,7 @@ $(function() { | @@ -91,7 +91,7 @@ $(function() { | ||
91 | if ($('.chk-group').length) { | 91 | if ($('.chk-group').length) { |
92 | // 防止回退history.go(-1)时页面状态不改变 | 92 | // 防止回退history.go(-1)时页面状态不改变 |
93 | // 这里可以添加loading效果 | 93 | // 这里可以添加loading效果 |
94 | - window.location.reload(); | 94 | + // window.location.reload(); |
95 | Cart.checkStorage(function() { | 95 | Cart.checkStorage(function() { |
96 | if (!$(this).hasClass('disable')) { | 96 | if (!$(this).hasClass('disable')) { |
97 | window.location.href = '/shopping/order'; | 97 | window.location.href = '/shopping/order'; |
@@ -22,7 +22,19 @@ var removedProsInfo = []; | @@ -22,7 +22,19 @@ var removedProsInfo = []; | ||
22 | var removedGoodsTpl = require('../../../tpl/shopping/removed-goods.hbs'); | 22 | var removedGoodsTpl = require('../../../tpl/shopping/removed-goods.hbs'); |
23 | var editTpl = require('../../../tpl/shopping/edit-color-size.hbs'); | 23 | var editTpl = require('../../../tpl/shopping/edit-color-size.hbs'); |
24 | 24 | ||
25 | -var Cart = { | 25 | +var Cart; |
26 | + | ||
27 | +require('yoho-jquery-dotdotdot'); | ||
28 | + | ||
29 | +function dotName() { | ||
30 | + | ||
31 | + // product name dotdotdot | ||
32 | + $('.pro-name a').dotdotdot({ | ||
33 | + wrap: 'letter' | ||
34 | + }); | ||
35 | +} | ||
36 | + | ||
37 | +Cart = { | ||
26 | /* | 38 | /* |
27 | * 添加到购物车 | 39 | * 添加到购物车 |
28 | * @function [addToCart] | 40 | * @function [addToCart] |
@@ -111,6 +123,7 @@ var Cart = { | @@ -111,6 +123,7 @@ var Cart = { | ||
111 | success: function(res) { | 123 | success: function(res) { |
112 | Util.refreshCart(res, function() { | 124 | Util.refreshCart(res, function() { |
113 | Stepper.init(); | 125 | Stepper.init(); |
126 | + | ||
114 | if (callback) { | 127 | if (callback) { |
115 | return callback(); | 128 | return callback(); |
116 | } | 129 | } |
@@ -298,6 +311,7 @@ var Cart = { | @@ -298,6 +311,7 @@ var Cart = { | ||
298 | success: function(res) { | 311 | success: function(res) { |
299 | Util.refreshCart(res, function() { | 312 | Util.refreshCart(res, function() { |
300 | Stepper.init(); | 313 | Stepper.init(); |
314 | + | ||
301 | if (callback) { | 315 | if (callback) { |
302 | return callback(); | 316 | return callback(); |
303 | } | 317 | } |
@@ -445,6 +459,9 @@ var Cart = { | @@ -445,6 +459,9 @@ var Cart = { | ||
445 | }, | 459 | }, |
446 | fail: function() { | 460 | fail: function() { |
447 | new _alert('此商品无法编辑颜色和尺寸').show(); | 461 | new _alert('此商品无法编辑颜色和尺寸').show(); |
462 | + }, | ||
463 | + complete: function() { | ||
464 | + setEditable(); | ||
448 | } | 465 | } |
449 | }); | 466 | }); |
450 | 467 | ||
@@ -471,4 +488,6 @@ var Cart = { | @@ -471,4 +488,6 @@ var Cart = { | ||
471 | } | 488 | } |
472 | }; | 489 | }; |
473 | 490 | ||
491 | +dotName(); | ||
492 | + | ||
474 | module.exports = Cart; | 493 | module.exports = Cart; |
@@ -11,8 +11,15 @@ | @@ -11,8 +11,15 @@ | ||
11 | position: relative; | 11 | position: relative; |
12 | 12 | ||
13 | h4 { | 13 | h4 { |
14 | + height: 18px; | ||
15 | + line-height: 18px; | ||
16 | + padding-right: 10px; | ||
17 | + display: -webkit-box; | ||
14 | font-size: 16px; | 18 | font-size: 16px; |
15 | font-weight: bold; | 19 | font-weight: bold; |
20 | + overflow: hidden; | ||
21 | + -webkit-line-clamp: 1; | ||
22 | + -webkit-box-orient: vertical; | ||
16 | } | 23 | } |
17 | 24 | ||
18 | p { | 25 | p { |
@@ -14,6 +14,10 @@ | @@ -14,6 +14,10 @@ | ||
14 | margin: $space 0; | 14 | margin: $space 0; |
15 | } | 15 | } |
16 | 16 | ||
17 | + .no-pointer { | ||
18 | + cursor: auto !important; | ||
19 | + } | ||
20 | + | ||
17 | .refund-tag { | 21 | .refund-tag { |
18 | width: 55%; | 22 | width: 55%; |
19 | padding: 5px 0; | 23 | padding: 5px 0; |
@@ -122,7 +126,7 @@ | @@ -122,7 +126,7 @@ | ||
122 | 126 | ||
123 | .iconfont { | 127 | .iconfont { |
124 | font-weight: normal; | 128 | font-weight: normal; |
125 | - color: #000000; | 129 | + color: #000; |
126 | } | 130 | } |
127 | 131 | ||
128 | &.last { | 132 | &.last { |
@@ -112,9 +112,6 @@ $hoverColor: #379ed6; | @@ -112,9 +112,6 @@ $hoverColor: #379ed6; | ||
112 | width: 234px; | 112 | width: 234px; |
113 | word-wrap: break-word; | 113 | word-wrap: break-word; |
114 | margin-bottom: 13px; | 114 | margin-bottom: 13px; |
115 | - display: -webkit-box; | ||
116 | - -webkit-box-orient: vertical; | ||
117 | - -webkit-line-clamp: 2; | ||
118 | line-height: 1.3em; | 115 | line-height: 1.3em; |
119 | overflow: hidden; | 116 | overflow: hidden; |
120 | :hover { | 117 | :hover { |
-
Please register or login to post a comment