|
@@ -32,67 +32,56 @@ const handleBrandList = origin => { |
|
@@ -32,67 +32,56 @@ const handleBrandList = origin => { |
32
|
indexList: []
|
32
|
indexList: []
|
33
|
};
|
33
|
};
|
34
|
|
34
|
|
|
|
35
|
+ let keyList = [];
|
|
|
36
|
+
|
35
|
// 标记是否有数字,有数字先暂存
|
37
|
// 标记是否有数字,有数字先暂存
|
36
|
let hasNum = false;
|
38
|
let hasNum = false;
|
37
|
let numTemp = {};
|
39
|
let numTemp = {};
|
38
|
|
40
|
|
39
|
_.forEach(origin, (value, key) => {
|
41
|
_.forEach(origin, (value, key) => {
|
40
|
- let brands = [];
|
|
|
41
|
|
42
|
|
42
|
if (_.size(value) <= 0) {
|
43
|
if (_.size(value) <= 0) {
|
43
|
return;
|
44
|
return;
|
44
|
}
|
45
|
}
|
45
|
|
46
|
|
|
|
47
|
+ _.forEach(value, function(subValue) {
|
|
|
48
|
+ subValue.brandUrl = '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain + '&app_type=1';
|
|
|
49
|
+ subValue.name = subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name;
|
|
|
50
|
+ subValue.domain = subValue.brand_domain;
|
|
|
51
|
+ });
|
|
|
52
|
+
|
46
|
if (key === '0~9') {
|
53
|
if (key === '0~9') {
|
47
|
hasNum = true;
|
54
|
hasNum = true;
|
48
|
numTemp = origin[key];
|
55
|
numTemp = origin[key];
|
49
|
} else {
|
56
|
} else {
|
50
|
- _.forEach(value, (subValue) => {
|
|
|
51
|
- brands.push({
|
|
|
52
|
- name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name,
|
|
|
53
|
- logo: subValue.brand_ico,
|
|
|
54
|
- domain: subValue.brand_domain,
|
|
|
55
|
- brandUrl: '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain + '&app_type=1'
|
|
|
56
|
- });
|
|
|
57
|
- });
|
|
|
58
|
|
57
|
|
59
|
- dest.ListData.push({
|
|
|
60
|
- index: key,
|
|
|
61
|
- brands: brands
|
|
|
62
|
- });
|
|
|
63
|
-
|
|
|
64
|
- dest.indexList.push({
|
|
|
65
|
- index: key,
|
|
|
66
|
- name: key === '0~9' ? '0' : key
|
|
|
67
|
- });
|
58
|
+ keyList.push(key);
|
68
|
}
|
59
|
}
|
69
|
|
60
|
|
70
|
});
|
61
|
});
|
71
|
|
62
|
|
72
|
- // 商品列表排序一次
|
|
|
73
|
- _.sortBy(dest.ListData, o => {
|
|
|
74
|
- return o.index.charCodeAt();
|
|
|
75
|
- });
|
63
|
+ keyList.sort();
|
|
|
64
|
+
|
|
|
65
|
+ _.forEach(keyList, function(key) {
|
|
|
66
|
+ let keyName = key;
|
76
|
|
67
|
|
77
|
- // 字母列表排序一次
|
|
|
78
|
- _.sortBy(dest.indexList, o => {
|
|
|
79
|
- return o.index.charCodeAt();
|
68
|
+ dest.ListData.push({
|
|
|
69
|
+ index: keyName,
|
|
|
70
|
+ brands: origin[key]
|
|
|
71
|
+ });
|
|
|
72
|
+
|
|
|
73
|
+ dest.indexList.push({
|
|
|
74
|
+ index: keyName,
|
|
|
75
|
+ name: key === '0~9' ? '0' : key
|
|
|
76
|
+ });
|
80
|
});
|
77
|
});
|
81
|
|
78
|
|
82
|
// 如果有数字,单独处理
|
79
|
// 如果有数字,单独处理
|
83
|
if (hasNum) {
|
80
|
if (hasNum) {
|
84
|
- let brands = [];
|
|
|
85
|
|
81
|
|
86
|
- _.forEach(numTemp, (subValue) => {
|
|
|
87
|
- brands.push({
|
|
|
88
|
- name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name,
|
|
|
89
|
- logo: subValue.brand_ico,
|
|
|
90
|
- domain: subValue.brand_domain
|
|
|
91
|
- });
|
|
|
92
|
- });
|
|
|
93
|
dest.ListData.push({
|
82
|
dest.ListData.push({
|
94
|
index: '0~9',
|
83
|
index: '0~9',
|
95
|
- brands: brands
|
84
|
+ brands: numTemp
|
96
|
});
|
85
|
});
|
97
|
|
86
|
|
98
|
dest.indexList.push({
|
87
|
dest.indexList.push({
|
|
@@ -167,6 +156,7 @@ const _getBrandListOriginData = (channel) => { |
|
@@ -167,6 +156,7 @@ const _getBrandListOriginData = (channel) => { |
167
|
});
|
156
|
});
|
168
|
};
|
157
|
};
|
169
|
|
158
|
|
|
|
159
|
+// 全部分类数据
|
170
|
const _processCateData = (list, channel, appType) => {
|
160
|
const _processCateData = (list, channel, appType) => {
|
171
|
let nav = ['MEN男士', 'WOMEN女士'];
|
161
|
let nav = ['MEN男士', 'WOMEN女士'];
|
172
|
|
162
|
|
|
@@ -301,8 +291,6 @@ const brandListData = (code, gender) => { |
|
@@ -301,8 +291,6 @@ const brandListData = (code, gender) => { |
301
|
});
|
291
|
});
|
302
|
};
|
292
|
};
|
303
|
|
293
|
|
304
|
-
|
|
|
305
|
-
|
|
|
306
|
module.exports = {
|
294
|
module.exports = {
|
307
|
indexData,
|
295
|
indexData,
|
308
|
brandListData
|
296
|
brandListData
|