...
|
...
|
@@ -64,8 +64,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { |
|
|
if (!_.isEmpty(params.sort)) {
|
|
|
|
|
|
// 是否有分类筛选参数,如果有
|
|
|
_.forEach(params.sort.split(','), function(sortParam) {
|
|
|
_.forEach(origin, function(value) {
|
|
|
_.forEach(params.sort.split(','), sortParam => {
|
|
|
_.forEach(origin, value => {
|
|
|
|
|
|
// 判断是否在这组数据里面
|
|
|
if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
|
...
|
...
|
@@ -73,30 +73,29 @@ const handleSalebreakingYardsSortData = (origin, params) => { |
|
|
}))) {
|
|
|
|
|
|
// 如果在某组数据里面,组合数据退出循环
|
|
|
_.forEach(value.sub, function(subValue) {
|
|
|
let size = {};
|
|
|
|
|
|
size.checked =
|
|
|
(parseInt(params.size, 10) === parseInt(subValue.size_id, 10)) ? true : false;
|
|
|
size.href = handleFilterUrl(params, {size: subValue.size_id});
|
|
|
size.name = subValue.size_name;
|
|
|
|
|
|
dest.push(size);
|
|
|
_.forEach(value.sub, subValue => {
|
|
|
dest.push({
|
|
|
checked: +params.size === +subValue.size_id,
|
|
|
href: handleFilterUrl(params, {
|
|
|
size: subValue.size_id
|
|
|
}),
|
|
|
name: subValue.size_name
|
|
|
});
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
} else { // 如果没有筛选参数,返回所有分类
|
|
|
_.forEach(origin, function(value) {
|
|
|
_.forEach(value.sub, function(subValue) {
|
|
|
let size = {};
|
|
|
|
|
|
size.checked = (parseInt(params.size, 10) === parseInt(subValue.size_id, 10)) ? true : false;
|
|
|
size.href = handleFilterUrl(params, {size: subValue.size_id});
|
|
|
size.name = subValue.size_name;
|
|
|
|
|
|
dest.push(size);
|
|
|
_.forEach(origin, value => {
|
|
|
_.forEach(value.sub, subValue => {
|
|
|
dest.push({
|
|
|
checked: +params.size === +subValue.size_id,
|
|
|
href: handleFilterUrl(params, {
|
|
|
size: subValue.size_id
|
|
|
}),
|
|
|
name: subValue.size_name
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -116,19 +115,16 @@ const handleCheckedData = (params, origin, param) => { |
|
|
|
|
|
// 品牌选中数据
|
|
|
if (!_.isEmpty(origin)) {
|
|
|
_.forEach(origin, (value) => {
|
|
|
_.forEach(origin, value => {
|
|
|
if (value.checked) {
|
|
|
let checked = {};
|
|
|
|
|
|
checked.name = value.name;
|
|
|
|
|
|
let tempParam = {};
|
|
|
|
|
|
tempParam[param] = '';
|
|
|
let tempPatam = {};
|
|
|
|
|
|
checked.href = handleFilterUrl(params, tempParam);
|
|
|
tempPatam[param] = '';
|
|
|
|
|
|
dest.push(checked);
|
|
|
dest.push({
|
|
|
name: value.name,
|
|
|
href: handleFilterUrl(params, tempPatam)
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -225,9 +221,9 @@ exports.handleSalePagerData = (total, params) => { |
|
|
* @returns {{}}
|
|
|
*/
|
|
|
exports.handleSaleOptsData = (params, total, extra) => {
|
|
|
var dest = {};
|
|
|
|
|
|
dest.sortType = [];
|
|
|
let dest = {
|
|
|
sortType: []
|
|
|
};
|
|
|
|
|
|
// 用来标记是否是折扣专场,折扣专场只需要前三个排序参数
|
|
|
let count = (extra === 'discont') ? 3 : 4;
|
...
|
...
|
@@ -400,16 +396,17 @@ exports.handleSaleSortData = (origin, params, extra) => { |
|
|
};
|
|
|
}
|
|
|
|
|
|
_.forEach(origin, function(value) {
|
|
|
_.forEach(origin, value => {
|
|
|
|
|
|
let category = {};
|
|
|
let category = {
|
|
|
name: value.category_name,
|
|
|
num: value.node_count,
|
|
|
childList: [],
|
|
|
href: handleFilterUrl(params, {sort: value.relation_parameter.sort}),
|
|
|
active: params.sort === value.relation_parameter.sort
|
|
|
};
|
|
|
|
|
|
category.name = value.category_name;
|
|
|
category.num = value.node_count;
|
|
|
category.childList = [];
|
|
|
category.href = handleFilterUrl(params, {sort: value.relation_parameter.sort});
|
|
|
category.active = (params.sort === value.relation_parameter.sort) ? true : false;
|
|
|
_.forEach(value.sub, function(subValue) {
|
|
|
_.forEach(value.sub, subValue => {
|
|
|
category.childList.push({
|
|
|
name: subValue.category_name,
|
|
|
num: subValue.node_count,
|
...
|
...
|
@@ -435,39 +432,34 @@ exports.handleSaleSortData = (origin, params, extra) => { |
|
|
*/
|
|
|
exports.handleSaleFilterData = (origin, params) => {
|
|
|
|
|
|
var dest = {};
|
|
|
|
|
|
dest.brand = {};
|
|
|
dest.price = [];
|
|
|
dest.gender = [];
|
|
|
|
|
|
dest.brand.default = [];
|
|
|
dest.brand.brandsShow = [];
|
|
|
|
|
|
dest.brand.brandIndex = [];
|
|
|
|
|
|
dest.brand.showMore = true;
|
|
|
dest.brand.showMulti = true;
|
|
|
|
|
|
dest.checkedConditions = {};
|
|
|
dest.checkedConditions.conditions = [];
|
|
|
|
|
|
|
|
|
// 品牌索引数据处理
|
|
|
dest.brand.brandIndex = [];
|
|
|
|
|
|
dest.brand.brandIndex[0] = {
|
|
|
index: 'all',
|
|
|
name: '全部'
|
|
|
let dest = {
|
|
|
brand: {
|
|
|
default: [],
|
|
|
brandsShow: [],
|
|
|
brandIndex: [
|
|
|
{
|
|
|
index: 'all',
|
|
|
name: '全部'
|
|
|
},
|
|
|
{
|
|
|
index: '0-9',
|
|
|
name: '0~9'
|
|
|
}
|
|
|
],
|
|
|
showMore: true,
|
|
|
showMulti: true
|
|
|
},
|
|
|
price: [],
|
|
|
gender: [],
|
|
|
checkedConditions: {
|
|
|
conditions: []
|
|
|
}
|
|
|
};
|
|
|
|
|
|
dest.brand.brandIndex[1] = {
|
|
|
index: '0-9',
|
|
|
name: '0~9'
|
|
|
};
|
|
|
let brandIndex = dest.brand.brandIndex;
|
|
|
|
|
|
for (let i = 65; i < 91; i++) {
|
|
|
dest.brand.brandIndex.push({
|
|
|
brandIndex.push({
|
|
|
index: String.fromCharCode(i).toLowerCase(),
|
|
|
name: String.fromCharCode(i)
|
|
|
});
|
...
|
...
|
@@ -477,13 +469,15 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
if (!_.isEmpty(origin.brand)) {
|
|
|
let count = 0;
|
|
|
|
|
|
_.forEach(origin.brand, function(value) {
|
|
|
let brand = {};
|
|
|
|
|
|
brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10)) ? true : false;
|
|
|
brand.href = handleFilterUrl(params, {brand: value.id});
|
|
|
brand.name = value.brand_name;
|
|
|
brand.key = value.brand_domain;
|
|
|
_.forEach(origin.brand, value => {
|
|
|
let brand = {
|
|
|
checked: +params.brand === +value.id,
|
|
|
href: handleFilterUrl(params, {
|
|
|
brand: value.id
|
|
|
}),
|
|
|
name: value.brand_name,
|
|
|
key: value.brand_domain
|
|
|
};
|
|
|
|
|
|
if (!_.isEmpty(value.brand_alif)) {
|
|
|
if (!_.isNaN(parseInt(value.brand_alif, 10))) {
|
...
|
...
|
@@ -503,13 +497,13 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
}
|
|
|
|
|
|
// 来排排序
|
|
|
dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function(o) {
|
|
|
dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, o => {
|
|
|
return o.index;
|
|
|
});
|
|
|
|
|
|
// 处理 价格 筛选数据
|
|
|
if (!_.isEmpty(origin.priceRange)) {
|
|
|
_.forEach(origin.priceRange, function(value, key) {
|
|
|
_.forEach(origin.priceRange, (value, key) => {
|
|
|
let price = {
|
|
|
checked: (params.price === key) ? true : false,
|
|
|
href: handleFilterUrl(params, {price: key}),
|
...
|
...
|
@@ -522,17 +516,24 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
|
|
|
// 处理频道数据
|
|
|
for (let i = 0; i < 2; i++) {
|
|
|
dest.gender[i] = {};
|
|
|
|
|
|
dest.gender[i].checked = false;
|
|
|
}
|
|
|
|
|
|
dest.gender[0].name = 'BOYS';
|
|
|
dest.gender[0].href = handleFilterUrl(params, {gender: '1,3'});
|
|
|
dest.gender[0].checked = (params.gender === '1,3') ? true : false;
|
|
|
dest.gender[1].name = 'GIRLS';
|
|
|
dest.gender[1].href = handleFilterUrl(params, {gender: '2,3'});
|
|
|
dest.gender[1].checked = (params.gender === '2,3') ? true : false;
|
|
|
Object.assign(dest.gender[0], {
|
|
|
name: 'BOYS',
|
|
|
href: handleFilterUrl(params, {
|
|
|
gender: '1,3'
|
|
|
}),
|
|
|
checked: params.gender === '1,3'
|
|
|
});
|
|
|
|
|
|
Object.assign(dest.gender[1], {
|
|
|
name: 'GIRLS',
|
|
|
href: handleFilterUrl(params, {
|
|
|
gender: '2,3'
|
|
|
}),
|
|
|
checked: params.gender === '2,3'
|
|
|
});
|
|
|
|
|
|
// 最新降价数据处理
|
|
|
if (parseInt(params.saleType, 10) === 3) {
|
...
|
...
|
@@ -546,10 +547,12 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
// 奥莱尺码处理
|
|
|
if (!_.isEmpty(origin.size)) {
|
|
|
dest.size = [];
|
|
|
_.forEach(origin.size, (value) => {
|
|
|
_.forEach(origin.size, value => {
|
|
|
let size = {
|
|
|
checked: (params.size === value.size_id) ? true : false,
|
|
|
href: handleFilterUrl(params, {size: value.size_id}),
|
|
|
checked: params.size === value.size_id,
|
|
|
href: handleFilterUrl(params, {
|
|
|
size: value.size_id
|
|
|
}),
|
|
|
name: value.size_name
|
|
|
};
|
|
|
|
...
|
...
|
@@ -595,19 +598,18 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
exports.handleBannerData = (origin) => {
|
|
|
var dest = {};
|
|
|
let dest = {};
|
|
|
|
|
|
dest.list = [];
|
|
|
_.forEach(origin, function(value) {
|
|
|
if (value.template_name === 'focus') {
|
|
|
_.forEach(value.data, function(subValue) {
|
|
|
let banner = {};
|
|
|
|
|
|
banner.bannerHeight = 450;
|
|
|
banner.href = subValue.url;
|
|
|
banner.img = subValue.src;
|
|
|
_.forEach(value.data, subValue => {
|
|
|
|
|
|
dest.list.push(banner);
|
|
|
dest.list.push({
|
|
|
bannerHeight: 450,
|
|
|
href: subValue.url,
|
|
|
img: subValue.src
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -643,7 +645,7 @@ exports.handlePathNavData = (data, params) => { |
|
|
|
|
|
_.forEach(data, (sort) => {
|
|
|
if (!_.isEmpty(sort.sub)) {
|
|
|
_.forEach(sort.sub, (misort) => {
|
|
|
_.forEach(sort.sub, misort => {
|
|
|
if (misort.relation_parameter.sort === params.sort || misort.category_id === params.misort) {
|
|
|
pathNav.push(
|
|
|
{
|
...
|
...
|
@@ -655,12 +657,15 @@ exports.handlePathNavData = (data, params) => { |
|
|
href: helpers.urlFormat('outlets/list', {sort: params.sort}),
|
|
|
name: misort.category_name,
|
|
|
pathTitle: misort.category_name
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
return {pathNav: pathNav};
|
|
|
return {
|
|
|
pathNav: pathNav
|
|
|
};
|
|
|
}; |
...
|
...
|
|