|
@@ -2,14 +2,13 @@ |
|
@@ -2,14 +2,13 @@ |
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-05-26 11:11:37
|
5
|
+ * @Last Modified time: 2016-05-26 13:32:58
|
6
|
*/
|
6
|
*/
|
7
|
|
7
|
|
8
|
'use strict';
|
8
|
'use strict';
|
9
|
const library = '../../../library';
|
9
|
const library = '../../../library';
|
10
|
const API = require(`${library}/api`).API;
|
10
|
const API = require(`${library}/api`).API;
|
11
|
const api = new API();
|
11
|
const api = new API();
|
12
|
-const _ = require('lodash');
|
|
|
13
|
const saleApi = require('./sale-api');
|
12
|
const saleApi = require('./sale-api');
|
14
|
const saleHandler = require('./sale-handler');
|
13
|
const saleHandler = require('./sale-handler');
|
15
|
|
14
|
|
|
@@ -61,21 +60,13 @@ exports.getSaleOthersData = (params) => { |
|
@@ -61,21 +60,13 @@ exports.getSaleOthersData = (params) => { |
61
|
let finalResult = {};
|
60
|
let finalResult = {};
|
62
|
|
61
|
|
63
|
if (result[0].code === 200) {
|
62
|
if (result[0].code === 200) {
|
64
|
-
|
|
|
65
|
- if (!_.isEmpty(result[0].data.product_list)) { // 处理商品列表数据
|
|
|
66
|
finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list);
|
63
|
finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list);
|
67
|
- }
|
|
|
68
|
-
|
|
|
69
|
- if (!_.isEmpty(result[0].data.filter)) {
|
|
|
70
|
finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
|
64
|
finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
|
71
|
- }
|
|
|
72
|
-
|
|
|
73
|
- if (!_.isEmpty(result[0].data.filter.group_sort)) {
|
|
|
74
|
finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params);
|
65
|
finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params);
|
75
|
}
|
66
|
}
|
76
|
|
67
|
|
77
|
- }
|
|
|
78
|
finalResult.opts = saleHandler.handleSaleOptsData();
|
68
|
finalResult.opts = saleHandler.handleSaleOptsData();
|
|
|
69
|
+
|
79
|
return finalResult;
|
70
|
return finalResult;
|
80
|
});
|
71
|
});
|
81
|
};
|
72
|
};
|
|
@@ -104,23 +95,19 @@ exports.getSaleDiscountData = (params) => { |
|
@@ -104,23 +95,19 @@ exports.getSaleDiscountData = (params) => { |
104
|
* @return {[type]} [description]
|
95
|
* @return {[type]} [description]
|
105
|
*/
|
96
|
*/
|
106
|
exports.getSalebreakingYardsData = (params) => {
|
97
|
exports.getSalebreakingYardsData = (params) => {
|
107
|
- return api.all([saleApi.getSalebreakingYardsSortList(), saleApi.getSaleGoodsList(params)]).then(result => {
|
98
|
+ return api.all([saleApi.getSaleGoodsList(params), saleApi.getSalebreakingYardsSortList()]).then(result => {
|
108
|
let finalResult = {};
|
99
|
let finalResult = {};
|
109
|
|
100
|
|
110
|
if (result[0].code === 200) {
|
101
|
if (result[0].code === 200) {
|
111
|
- finalResult.size = saleHandler.handleSalebreakingYardsSortData(result[0].data); // 待处理
|
102
|
+ finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list);
|
|
|
103
|
+ finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
|
|
|
104
|
+ finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params);
|
112
|
}
|
105
|
}
|
113
|
- if (result[1].code === 200) {
|
|
|
114
|
|
106
|
|
115
|
- if (!_.isEmpty(result[1].data.product_list)) { // 处理商品列表数据
|
|
|
116
|
- finalResult.goods = saleHandler.handleSaleGoodsListData(result[1].data.product_list);
|
107
|
+ if (result[1].code === 200) {
|
|
|
108
|
+ finalResult.filters.size = saleHandler.handleSalebreakingYardsSortData(result[1].data, params);
|
117
|
}
|
109
|
}
|
118
|
|
110
|
|
119
|
- if (!_.isEmpty(result[1].data.filter)) {
|
|
|
120
|
- finalResult.filters = saleHandler.handleSaleFilterData(result[1].data.filter);
|
|
|
121
|
- finalResult.leftContent = saleHandler.handleSaleSortData(result[1].data.filter.group_sort, params);
|
|
|
122
|
- }
|
|
|
123
|
- }
|
|
|
124
|
finalResult.opts = saleHandler.handleSaleOptsData(params);
|
111
|
finalResult.opts = saleHandler.handleSaleOptsData(params);
|
125
|
return finalResult;
|
112
|
return finalResult;
|
126
|
});
|
113
|
});
|