|
@@ -2,7 +2,7 @@ |
|
@@ -2,7 +2,7 @@ |
2
|
* @Author: Targaryen
|
2
|
* @Author: Targaryen
|
3
|
* @Date: 2016-05-19 10:20:08
|
3
|
* @Date: 2016-05-19 10:20:08
|
4
|
* @Last Modified by: Targaryen
|
4
|
* @Last Modified by: Targaryen
|
5
|
- * @Last Modified time: 2016-06-01 18:46:02
|
5
|
+ * @Last Modified time: 2016-06-02 12:53:05
|
6
|
*/
|
6
|
*/
|
7
|
|
7
|
|
8
|
'use strict';
|
8
|
'use strict';
|
|
@@ -15,6 +15,34 @@ const saleHandler = require('./sale-handler'); |
|
@@ -15,6 +15,34 @@ const saleHandler = require('./sale-handler'); |
15
|
const productProcess = require(`${utils}/product-process`);
|
15
|
const productProcess = require(`${utils}/product-process`);
|
16
|
const _ = require('lodash');
|
16
|
const _ = require('lodash');
|
17
|
|
17
|
|
|
|
18
|
+
|
|
|
19
|
+/**
|
|
|
20
|
+ * 资源位code码
|
|
|
21
|
+ */
|
|
|
22
|
+const contentCode = {
|
|
|
23
|
+ boys: {
|
|
|
24
|
+ sale: 'f6400250a73a2a1a8764a0d9be73abf2',
|
|
|
25
|
+ breakCode: 'a97451680222cb1b215de14bbef64921',
|
|
|
26
|
+ vip: '0400ac0dffbb2fefe84949200cf2be4a'
|
|
|
27
|
+ },
|
|
|
28
|
+ girls: {
|
|
|
29
|
+ sale: 'd74adc70f939a6658b68386ee39199e7',
|
|
|
30
|
+ breakCode: '91e604f06449783a5bd93c6f4f99a396',
|
|
|
31
|
+ vip: 'e261419fde3613781a3ec9d367a2e534'
|
|
|
32
|
+ },
|
|
|
33
|
+ kids: {
|
|
|
34
|
+ sale: '01937a472a5a3ccf7204f734f2506865',
|
|
|
35
|
+ breakCode: '4c1dff47c68aace0608eb821fbaf40fd',
|
|
|
36
|
+ vip: '40db7c9a491548fa8d441815cc7a0617'
|
|
|
37
|
+ },
|
|
|
38
|
+ lifestyle: {
|
|
|
39
|
+ sale: '32944e49d627a031f1d7e14a1f90ccac',
|
|
|
40
|
+ breakCode: 'c605c9d2f1a426cecad232a7d41e6b97',
|
|
|
41
|
+ vip: '6ac5f0ee1cf0f2dab89c9cf80263028a'
|
|
|
42
|
+ }
|
|
|
43
|
+};
|
|
|
44
|
+
|
|
|
45
|
+
|
18
|
/**
|
46
|
/**
|
19
|
* 获取Sale首页商品列表数据 仅 Ajax 调用 Controller 调用
|
47
|
* 获取Sale首页商品列表数据 仅 Ajax 调用 Controller 调用
|
20
|
* @return {[type]} [description]
|
48
|
* @return {[type]} [description]
|
|
@@ -107,27 +135,22 @@ exports.getSaleIndexData = () => { |
|
@@ -107,27 +135,22 @@ exports.getSaleIndexData = () => { |
107
|
* 获取 VIP 会员专享和新降价专区数据 Controller 调用
|
135
|
* 获取 VIP 会员专享和新降价专区数据 Controller 调用
|
108
|
* @return {[type]} [description]
|
136
|
* @return {[type]} [description]
|
109
|
*/
|
137
|
*/
|
110
|
-exports.getSaleOthersData = (params) => {
|
138
|
+exports.getSaleOthersData = (params, channel) => {
|
111
|
|
139
|
|
112
|
let promiseObject;
|
140
|
let promiseObject;
|
113
|
|
141
|
|
114
|
- // cCode 是资源位代码,根据页面不同传不同的 CODE,目前一样,待处理
|
|
|
115
|
// saleType: 1表示断码区,2表示会员专区,3 折扣专区,4表示奥莱
|
142
|
// saleType: 1表示断码区,2表示会员专区,3 折扣专区,4表示奥莱
|
116
|
- let cCode;
|
|
|
117
|
-
|
|
|
118
|
if (!_.isEmpty(params) && params.saleType === 2) {
|
143
|
if (!_.isEmpty(params) && params.saleType === 2) {
|
119
|
- cCode = '7c2b77093421efa8ae9302c91460db73';
|
|
|
120
|
promiseObject = [
|
144
|
promiseObject = [
|
121
|
saleApi.getSaleGoodsList(params),
|
145
|
saleApi.getSaleGoodsList(params),
|
122
|
- saleApi.getSaleBannerList(cCode),
|
146
|
+ saleApi.getSaleBannerList(contentCode[channel].vip),
|
123
|
saleApi.getLeftContentList(),
|
147
|
saleApi.getLeftContentList(),
|
124
|
saleApi.getUserProfile(params.uid)
|
148
|
saleApi.getUserProfile(params.uid)
|
125
|
];
|
149
|
];
|
126
|
} else {
|
150
|
} else {
|
127
|
- cCode = '7c2b77093421efa8ae9302c91460db73';
|
|
|
128
|
promiseObject = [
|
151
|
promiseObject = [
|
129
|
saleApi.getSaleGoodsList(params),
|
152
|
saleApi.getSaleGoodsList(params),
|
130
|
- saleApi.getSaleBannerList(cCode),
|
153
|
+ saleApi.getSaleBannerList(contentCode[channel].vip),
|
131
|
saleApi.getLeftContentList()
|
154
|
saleApi.getLeftContentList()
|
132
|
];
|
155
|
];
|
133
|
}
|
156
|
}
|
|
@@ -169,30 +192,32 @@ exports.getSaleOthersData = (params) => { |
|
@@ -169,30 +192,32 @@ exports.getSaleOthersData = (params) => { |
169
|
}
|
192
|
}
|
170
|
}
|
193
|
}
|
171
|
|
194
|
|
172
|
- // 处理 VIP 商品数据
|
|
|
173
|
- if (result[3].code === 200 && parseInt(params.saleType, 10) === 2) {
|
|
|
174
|
- _.forEach(finalResult.goods, (value, key) => {
|
|
|
175
|
-
|
|
|
176
|
- switch (result[3].curLevel) {
|
|
|
177
|
- case '1':
|
|
|
178
|
- finalResult.goods[key].vipPrice = value.vip1_price;
|
|
|
179
|
- finalResult.goods[key].vip1 = true;
|
|
|
180
|
- break;
|
|
|
181
|
- case '2':
|
|
|
182
|
- finalResult.goods[key].vipPrice = value.vip2_price;
|
|
|
183
|
- finalResult.goods[key].vip2 = true;
|
|
|
184
|
- break;
|
|
|
185
|
- case '3':
|
|
|
186
|
- finalResult.goods[key].vipPrice = value.vip3_price;
|
|
|
187
|
- finalResult.goods[key].vip3 = true;
|
|
|
188
|
- break;
|
|
|
189
|
- default:
|
|
|
190
|
- finalResult.goods[key].vipPrice = value.vip_price;
|
|
|
191
|
- finalResult.goods[key].vip = true;
|
|
|
192
|
- break;
|
|
|
193
|
- }
|
|
|
194
|
-
|
|
|
195
|
- });
|
195
|
+ if (!_.isEmpty(result[3])) {
|
|
|
196
|
+ // 处理 VIP 商品数据
|
|
|
197
|
+ if (result[3].code === 200 && parseInt(params.saleType, 10) === 2) {
|
|
|
198
|
+ _.forEach(finalResult.goods, (value, key) => {
|
|
|
199
|
+
|
|
|
200
|
+ switch (result[3].curLevel) {
|
|
|
201
|
+ case '1':
|
|
|
202
|
+ finalResult.goods[key].vipPrice = value.vip1_price;
|
|
|
203
|
+ finalResult.goods[key].vip1 = true;
|
|
|
204
|
+ break;
|
|
|
205
|
+ case '2':
|
|
|
206
|
+ finalResult.goods[key].vipPrice = value.vip2_price;
|
|
|
207
|
+ finalResult.goods[key].vip2 = true;
|
|
|
208
|
+ break;
|
|
|
209
|
+ case '3':
|
|
|
210
|
+ finalResult.goods[key].vipPrice = value.vip3_price;
|
|
|
211
|
+ finalResult.goods[key].vip3 = true;
|
|
|
212
|
+ break;
|
|
|
213
|
+ default:
|
|
|
214
|
+ finalResult.goods[key].vipPrice = value.vip_price;
|
|
|
215
|
+ finalResult.goods[key].vip = true;
|
|
|
216
|
+ break;
|
|
|
217
|
+ }
|
|
|
218
|
+
|
|
|
219
|
+ });
|
|
|
220
|
+ }
|
196
|
}
|
221
|
}
|
197
|
|
222
|
|
198
|
return finalResult;
|
223
|
return finalResult;
|
|
@@ -203,10 +228,10 @@ exports.getSaleOthersData = (params) => { |
|
@@ -203,10 +228,10 @@ exports.getSaleOthersData = (params) => { |
203
|
* 获取折扣专场数据 Controller 调用
|
228
|
* 获取折扣专场数据 Controller 调用
|
204
|
* @return {[type]} [description]
|
229
|
* @return {[type]} [description]
|
205
|
*/
|
230
|
*/
|
206
|
-exports.getSaleDiscountData = (params) => {
|
231
|
+exports.getSaleDiscountData = (params, channel) => {
|
207
|
return api.all([
|
232
|
return api.all([
|
208
|
saleApi.getSaleGoodsList(params),
|
233
|
saleApi.getSaleGoodsList(params),
|
209
|
- saleApi.getSaleBannerList('7c2b77093421efa8ae9302c91460db73'),
|
234
|
+ saleApi.getSaleBannerList(contentCode[channel].sale),
|
210
|
saleApi.getSaleActivityList(params)
|
235
|
saleApi.getSaleActivityList(params)
|
211
|
]).then(result => {
|
236
|
]).then(result => {
|
212
|
let finalResult = {};
|
237
|
let finalResult = {};
|
|
@@ -219,7 +244,7 @@ exports.getSaleDiscountData = (params) => { |
|
@@ -219,7 +244,7 @@ exports.getSaleDiscountData = (params) => { |
219
|
finalResult.saleList.totalCount = result[0].data.total;
|
244
|
finalResult.saleList.totalCount = result[0].data.total;
|
220
|
finalResult.saleList.pager = saleHandler.handleSalePagerData(result[0].data.total, params);
|
245
|
finalResult.saleList.pager = saleHandler.handleSalePagerData(result[0].data.total, params);
|
221
|
|
246
|
|
222
|
- // 处理所有商品标题数据
|
247
|
+ // 处理所有商品标题数据
|
223
|
finalResult.saleTitle = {};
|
248
|
finalResult.saleTitle = {};
|
224
|
|
249
|
|
225
|
finalResult.saleTitle.name = '所有商品';
|
250
|
finalResult.saleTitle.name = '所有商品';
|
|
@@ -247,11 +272,11 @@ exports.getSaleDiscountData = (params) => { |
|
@@ -247,11 +272,11 @@ exports.getSaleDiscountData = (params) => { |
247
|
* @param {[type]} params [description]
|
272
|
* @param {[type]} params [description]
|
248
|
* @return {[type]} [description]
|
273
|
* @return {[type]} [description]
|
249
|
*/
|
274
|
*/
|
250
|
-exports.getSalebreakingYardsData = (params) => {
|
275
|
+exports.getSalebreakingYardsData = (params, channel) => {
|
251
|
return api.all([
|
276
|
return api.all([
|
252
|
saleApi.getSaleGoodsList(params),
|
277
|
saleApi.getSaleGoodsList(params),
|
253
|
saleApi.getSalebreakingYardsSortList(),
|
278
|
saleApi.getSalebreakingYardsSortList(),
|
254
|
- saleApi.getSaleBannerList('7c2b77093421efa8ae9302c91460db73'),
|
279
|
+ saleApi.getSaleBannerList(contentCode[channel].breakCode),
|
255
|
saleApi.getLeftContentList()
|
280
|
saleApi.getLeftContentList()
|
256
|
]).then(result => {
|
281
|
]).then(result => {
|
257
|
let finalResult = {};
|
282
|
let finalResult = {};
|