|
@@ -63,8 +63,9 @@ exports.getSaleGoodsData = (params) => { |
|
@@ -63,8 +63,9 @@ exports.getSaleGoodsData = (params) => { |
63
|
if (result[0].code === 200) {
|
63
|
if (result[0].code === 200) {
|
64
|
finalResult.goods = productProcess.processProductList(result[0].data.product_list);
|
64
|
finalResult.goods = productProcess.processProductList(result[0].data.product_list);
|
65
|
_.forEach(finalResult.goods, (value, key) => {
|
65
|
_.forEach(finalResult.goods, (value, key) => {
|
66
|
- finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
|
|
|
67
|
- finalResult.goods[key].tags.isSale = false;
|
66
|
+ delete finalResult.goods[key].tags.isNew; // 屏蔽 new 标签
|
|
|
67
|
+ delete finalResult.goods[key].tags.isSale;// 屏蔽 sale 标签
|
|
|
68
|
+ delete finalResult.goods[key].discount; // 屏蔽折扣信息
|
68
|
});
|
69
|
});
|
69
|
}
|
70
|
}
|
70
|
|
71
|
|
|
@@ -315,47 +316,54 @@ exports.getSaleOthersData = (params, channel) => { |
|
@@ -315,47 +316,54 @@ exports.getSaleOthersData = (params, channel) => { |
315
|
exports.getSaleDiscountData = (params, channel) => {
|
316
|
exports.getSaleDiscountData = (params, channel) => {
|
316
|
return api.all([
|
317
|
return api.all([
|
317
|
headerModel.requestHeaderData(channel),
|
318
|
headerModel.requestHeaderData(channel),
|
318
|
- saleApi.getSaleGoodsList(params),
|
|
|
319
|
- saleApi.getSaleActivityList(params, channel),
|
|
|
320
|
- saleApi.getSaleGoodsList({channel: channel, saleType: '3', limit: '1'})
|
319
|
+ saleApi.getSaleGoodsList({channel: channel, saleType: '3', limit: '1'}),
|
|
|
320
|
+ saleApi.getSaleActivityList(params, channel)
|
321
|
]).then(result => {
|
321
|
]).then(result => {
|
322
|
let finalResult = result[0];
|
322
|
let finalResult = result[0];
|
323
|
|
323
|
|
324
|
- // 处理商品数据,顶部分类
|
324
|
+ // 处理折扣专场标题 banner 数据
|
325
|
if (result[1].code === 200) {
|
325
|
if (result[1].code === 200) {
|
326
|
- finalResult.saleList = {};
|
|
|
327
|
- finalResult.saleList.goods = productProcess.processProductList(result[1].data.product_list);
|
|
|
328
|
- finalResult.saleList.totalCount = result[1].data.total;
|
|
|
329
|
-
|
|
|
330
|
- _.forEach(finalResult.saleList.goods, (value, key) => {
|
|
|
331
|
- delete finalResult.saleList.goods[key].tags.isNew; // 屏蔽 new 标签
|
|
|
332
|
- delete finalResult.saleList.goods[key].tags.isSale;// 屏蔽 sale 标签
|
|
|
333
|
- delete finalResult.saleList.goods[key].discount; // 屏蔽折扣信息
|
326
|
+ Object.assign(finalResult, {
|
|
|
327
|
+ leftContent: publicHandler.handleSaleSortData(result[1].data.filter.group_sort, params, 'discount'),
|
|
|
328
|
+ saleList: {
|
|
|
329
|
+ pager: publicHandler.handleSalePagerData(result[1].data.total, params),
|
|
|
330
|
+ opts: publicHandler.handleSaleOptsData(params, result[1].data.total)
|
|
|
331
|
+ }
|
334
|
});
|
332
|
});
|
335
|
}
|
333
|
}
|
336
|
|
334
|
|
337
|
- // 处理折扣专场标题 banner 数据
|
335
|
+ // 处理分页等筛选信息
|
338
|
if (result[2].code === 200) {
|
336
|
if (result[2].code === 200) {
|
|
|
337
|
+
|
339
|
if (_.size(result[2].data) === 1) {
|
338
|
if (_.size(result[2].data) === 1) {
|
340
|
finalResult.saleTitle = saleHandler.handleDiscountTitleData(result[2].data[0]);
|
339
|
finalResult.saleTitle = saleHandler.handleDiscountTitleData(result[2].data[0]);
|
341
|
finalResult.topBanner = {};
|
340
|
finalResult.topBanner = {};
|
342
|
finalResult.topBanner.list = [];
|
341
|
finalResult.topBanner.list = [];
|
343
|
- finalResult.topBanner.list[0] = {};
|
|
|
344
|
- finalResult.topBanner.list[0].img = result[2].data[0].web_url;
|
|
|
345
|
- }
|
342
|
+ finalResult.topBanner.list[0] = {
|
|
|
343
|
+ img: result[2].data[0].web_url
|
|
|
344
|
+ };
|
346
|
}
|
345
|
}
|
347
|
|
346
|
|
348
|
- // 处理分页等筛选信息
|
|
|
349
|
- if (result[3].code === 200) {
|
|
|
350
|
- finalResult.leftContent =
|
|
|
351
|
- publicHandler.handleSaleSortData(result[3].data.filter.group_sort, params, 'discount');
|
|
|
352
|
- finalResult.saleList.pager = publicHandler.handleSalePagerData(result[3].data.total, params);
|
|
|
353
|
- finalResult.saleList.opts = publicHandler.handleSaleOptsData(params, result[3].data.total);
|
|
|
354
|
- }
|
347
|
+ return api.all([
|
|
|
348
|
+ saleApi.getSaleGoodsList(Object.assign(params, {productPool: result[2].data[0].product_pool}))
|
|
|
349
|
+ ]).then(subResult => {
|
|
|
350
|
+ // 处理商品数据,顶部分类
|
|
|
351
|
+ if (subResult[0].code === 200) {
|
|
|
352
|
+ finalResult.saleList.goods = productProcess.processProductList(subResult[0].data.product_list);
|
|
|
353
|
+ finalResult.saleList.totalCount = subResult[0].data.total;
|
355
|
|
354
|
|
|
|
355
|
+ _.forEach(finalResult.saleList.goods, (value, key) => {
|
|
|
356
|
+ delete finalResult.saleList.goods[key].tags.isNew; // 屏蔽 new 标签
|
|
|
357
|
+ delete finalResult.saleList.goods[key].tags.isSale;// 屏蔽 sale 标签
|
|
|
358
|
+ delete finalResult.saleList.goods[key].discount; // 屏蔽折扣信息
|
|
|
359
|
+ });
|
|
|
360
|
+ }
|
356
|
|
361
|
|
357
|
return finalResult;
|
362
|
return finalResult;
|
358
|
});
|
363
|
});
|
|
|
364
|
+ }
|
|
|
365
|
+ return finalResult;
|
|
|
366
|
+ });
|
359
|
};
|
367
|
};
|
360
|
|
368
|
|
361
|
/**
|
369
|
/**
|
|
@@ -409,17 +417,18 @@ exports.getSalebreakingYardsData = (params, channel) => { |
|
@@ -409,17 +417,18 @@ exports.getSalebreakingYardsData = (params, channel) => { |
409
|
Object.assign(subResult[1].data.filter, {size: result[2].data}),
|
417
|
Object.assign(subResult[1].data.filter, {size: result[2].data}),
|
410
|
params);
|
418
|
params);
|
411
|
}
|
419
|
}
|
412
|
-
|
|
|
413
|
- finalResult.goods = productProcess.processProductList(subResult[1].data.product_list);
|
|
|
414
|
- finalResult.opts = publicHandler.handleSaleOptsData(params, subResult[1].data.total);
|
|
|
415
|
- finalResult.totalCount = subResult[1].data.total;
|
|
|
416
|
- finalResult.pager = publicHandler.handleSalePagerData(subResult[1].data.total, params);
|
420
|
+ Object.assign(finalResult, {
|
|
|
421
|
+ goods: productProcess.processProductList(subResult[1].data.product_list),
|
|
|
422
|
+ opts: publicHandler.handleSaleOptsData(params, subResult[1].data.total),
|
|
|
423
|
+ totalCount: subResult[1].data.total,
|
|
|
424
|
+ pager: publicHandler.handleSalePagerData(subResult[1].data.total, params)
|
|
|
425
|
+ });
|
417
|
|
426
|
|
418
|
// 处理所有商品标题数据
|
427
|
// 处理所有商品标题数据
|
419
|
- finalResult.saleTitle = {};
|
|
|
420
|
-
|
|
|
421
|
- finalResult.saleTitle.name = '所有商品';
|
|
|
422
|
- finalResult.saleTitle.count = subResult[1].data.count;
|
428
|
+ finalResult.saleTitle = {
|
|
|
429
|
+ name: '所有商品',
|
|
|
430
|
+ count: subResult[1].data.count
|
|
|
431
|
+ };
|
423
|
|
432
|
|
424
|
_.forEach(finalResult.goods, (value, key) => {
|
433
|
_.forEach(finalResult.goods, (value, key) => {
|
425
|
delete finalResult.goods[key].tags.isNew; // 屏蔽 new 标签
|
434
|
delete finalResult.goods[key].tags.isNew; // 屏蔽 new 标签
|