...
|
...
|
@@ -32,67 +32,56 @@ const handleBrandList = origin => { |
|
|
indexList: []
|
|
|
};
|
|
|
|
|
|
let keyList = [];
|
|
|
|
|
|
// 标记是否有数字,有数字先暂存
|
|
|
let hasNum = false;
|
|
|
let numTemp = {};
|
|
|
|
|
|
_.forEach(origin, (value, key) => {
|
|
|
let brands = [];
|
|
|
|
|
|
if (_.size(value) <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
_.forEach(value, function(subValue) {
|
|
|
subValue.brandUrl = '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain + '&app_type=1';
|
|
|
subValue.name = subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name;
|
|
|
subValue.domain = subValue.brand_domain;
|
|
|
});
|
|
|
|
|
|
if (key === '0~9') {
|
|
|
hasNum = true;
|
|
|
numTemp = origin[key];
|
|
|
} else {
|
|
|
_.forEach(value, (subValue) => {
|
|
|
brands.push({
|
|
|
name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name,
|
|
|
logo: subValue.brand_ico,
|
|
|
domain: subValue.brand_domain,
|
|
|
brandUrl: '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain + '&app_type=1'
|
|
|
});
|
|
|
|
|
|
keyList.push(key);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
keyList.sort();
|
|
|
|
|
|
_.forEach(keyList, function(key) {
|
|
|
let keyName = key;
|
|
|
|
|
|
dest.ListData.push({
|
|
|
index: key,
|
|
|
brands: brands
|
|
|
index: keyName,
|
|
|
brands: origin[key]
|
|
|
});
|
|
|
|
|
|
dest.indexList.push({
|
|
|
index: key,
|
|
|
index: keyName,
|
|
|
name: key === '0~9' ? '0' : key
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
// 商品列表排序一次
|
|
|
_.sortBy(dest.ListData, o => {
|
|
|
return o.index.charCodeAt();
|
|
|
});
|
|
|
|
|
|
// 字母列表排序一次
|
|
|
_.sortBy(dest.indexList, o => {
|
|
|
return o.index.charCodeAt();
|
|
|
});
|
|
|
|
|
|
// 如果有数字,单独处理
|
|
|
if (hasNum) {
|
|
|
let brands = [];
|
|
|
|
|
|
_.forEach(numTemp, (subValue) => {
|
|
|
brands.push({
|
|
|
name: subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name,
|
|
|
logo: subValue.brand_ico,
|
|
|
domain: subValue.brand_domain
|
|
|
});
|
|
|
});
|
|
|
dest.ListData.push({
|
|
|
index: '0~9',
|
|
|
brands: brands
|
|
|
brands: numTemp
|
|
|
});
|
|
|
|
|
|
dest.indexList.push({
|
...
|
...
|
@@ -167,6 +156,7 @@ const _getBrandListOriginData = (channel) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
// 全部分类数据
|
|
|
const _processCateData = (list, channel, appType) => {
|
|
|
let nav = ['MEN男士', 'WOMEN女士'];
|
|
|
|
...
|
...
|
@@ -301,8 +291,6 @@ const brandListData = (code, gender) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
indexData,
|
|
|
brandListData
|
...
|
...
|
|