...
|
...
|
@@ -80,7 +80,7 @@ const handleFilterUrl = (originParam, newParam) => { |
|
|
|
|
|
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
|
|
|
|
|
|
_.forEach(tempOriginParam, function(value, key) {
|
|
|
_.forEach(tempOriginParam, function (value, key) {
|
|
|
dest = dest + key + '=' + value + '&';
|
|
|
});
|
|
|
|
...
|
...
|
@@ -93,9 +93,7 @@ const handleFilterUrl = (originParam, newParam) => { |
|
|
* @returns {Array|*[]}
|
|
|
*/
|
|
|
const handleSaleNewSaleSortData = (params) => {
|
|
|
var dest;
|
|
|
|
|
|
dest = [{
|
|
|
return [{
|
|
|
name: '1~3折',
|
|
|
href: handleFilterUrl(params, {p_d: '0.1,0.3'}),
|
|
|
checked: params.p_d === '0.1,0.3'
|
...
|
...
|
@@ -108,8 +106,6 @@ const handleSaleNewSaleSortData = (params) => { |
|
|
href: handleFilterUrl(params, {p_d: '0.7,1'}),
|
|
|
checked: params.p_d === '0.7,1'
|
|
|
}];
|
|
|
|
|
|
return dest;
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -165,8 +161,8 @@ const handleBrandCheckedData = (params, origin) => { |
|
|
if (!_.isEmpty(origin)) {
|
|
|
_.forEach(origin, (value) => {
|
|
|
if (typeof _.find(intBrands, o => {
|
|
|
return _.isEqual(o, value.id);
|
|
|
}) !== 'undefined') {
|
|
|
return _.isEqual(o, value.id);
|
|
|
}) !== 'undefined') {
|
|
|
|
|
|
let checked = {
|
|
|
name: value.name
|
...
|
...
|
@@ -221,22 +217,21 @@ const handleSalebreakingYardsSortData = (origin, params) => { |
|
|
if (!_.isEmpty(params.sort)) {
|
|
|
|
|
|
// 是否有分类筛选参数,如果有
|
|
|
_.forEach(params.sort.split(','), function(sortParam) {
|
|
|
_.forEach(origin, function(value) {
|
|
|
_.forEach(params.sort.split(','), function (sortParam) {
|
|
|
_.forEach(origin, function (value) {
|
|
|
|
|
|
// 判断是否在这组数据里面
|
|
|
if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
|
|
|
return o === sortParam;
|
|
|
}))) {
|
|
|
return o === sortParam;
|
|
|
}))) {
|
|
|
|
|
|
// 如果在某组数据里面,组合数据退出循环
|
|
|
_.forEach(value.sub, function(subValue) {
|
|
|
let size = {};
|
|
|
|
|
|
size.checked =
|
|
|
parseInt(params.size, 10) === parseInt(subValue.size_id, 10);
|
|
|
size.href = handleFilterUrl(params, {size: subValue.size_id});
|
|
|
size.name = subValue.size_name;
|
|
|
_.forEach(value.sub, function (subValue) {
|
|
|
let size = {
|
|
|
checked: parseInt(params.size, 10) === parseInt(subValue.size_id, 10),
|
|
|
href: handleFilterUrl(params, {size: subValue.size_id}),
|
|
|
name: subValue.size_name
|
|
|
};
|
|
|
|
|
|
dest.push(size);
|
|
|
});
|
...
|
...
|
@@ -245,13 +240,13 @@ const handleSalebreakingYardsSortData = (origin, params) => { |
|
|
});
|
|
|
});
|
|
|
} else { // 如果没有筛选参数,返回所有分类
|
|
|
_.forEach(origin, function(value) {
|
|
|
_.forEach(value.sub, function(subValue) {
|
|
|
let size = {};
|
|
|
|
|
|
size.checked = parseInt(params.size, 10) === parseInt(subValue.size_id, 10);
|
|
|
size.href = handleFilterUrl(params, {size: subValue.size_id});
|
|
|
size.name = subValue.size_name;
|
|
|
_.forEach(origin, function (value) {
|
|
|
_.forEach(value.sub, function (subValue) {
|
|
|
let size = {
|
|
|
checked: parseInt(params.size, 10) === parseInt(subValue.size_id, 10),
|
|
|
href: handleFilterUrl(params, {size: subValue.size_id}),
|
|
|
name: subValue.size_name
|
|
|
};
|
|
|
|
|
|
dest.push(size);
|
|
|
});
|
...
|
...
|
@@ -273,7 +268,16 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
brand: {
|
|
|
default: [],
|
|
|
brandsShow: [],
|
|
|
brandIndex: [],
|
|
|
brandIndex: [
|
|
|
{
|
|
|
index: 'all',
|
|
|
name: '全部'
|
|
|
},
|
|
|
{
|
|
|
index: '0-9',
|
|
|
name: '0~9'
|
|
|
}
|
|
|
],
|
|
|
showMore: true,
|
|
|
showMulti: true
|
|
|
},
|
...
|
...
|
@@ -285,16 +289,6 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
};
|
|
|
|
|
|
// 品牌索引数据处理
|
|
|
dest.brand.brandIndex[0] = {
|
|
|
index: 'all',
|
|
|
name: '全部'
|
|
|
};
|
|
|
|
|
|
dest.brand.brandIndex[1] = {
|
|
|
index: '0-9',
|
|
|
name: '0~9'
|
|
|
};
|
|
|
|
|
|
for (let i = 65; i < 91; i++) {
|
|
|
dest.brand.brandIndex.push({
|
|
|
index: String.fromCharCode(i).toLowerCase(),
|
...
|
...
|
@@ -313,7 +307,7 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
if (!_.isEmpty(origin.brand)) {
|
|
|
let count = 0;
|
|
|
|
|
|
_.forEach(origin.brand, function(value) {
|
|
|
_.forEach(origin.brand, function (value) {
|
|
|
let brand = {
|
|
|
checked: (typeof _.find(intBrands, o => {
|
|
|
return _.isEqual(o, value.id);
|
...
|
...
|
@@ -342,13 +336,13 @@ exports.handleSaleFilterData = (origin, params) => { |
|
|
}
|
|
|
|
|
|
// 来排排序
|
|
|
dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function(o) {
|
|
|
dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function (o) {
|
|
|
return o.index;
|
|
|
});
|
|
|
|
|
|
// 处理 价格 筛选数据
|
|
|
if (!_.isEmpty(origin.priceRange)) {
|
|
|
_.forEach(origin.priceRange, function(value, key) {
|
|
|
_.forEach(origin.priceRange, function (value, key) {
|
|
|
let price = {
|
|
|
checked: params.price === key,
|
|
|
href: handleFilterUrl(params, {price: key}),
|
...
|
...
|
@@ -423,7 +417,7 @@ exports.handleSaleActivityData = (origin, channel) => { |
|
|
normal: []
|
|
|
};
|
|
|
|
|
|
_.forEach(origin, function(value, key) {
|
|
|
_.forEach(origin, function (value, key) {
|
|
|
let activity = {
|
|
|
link: helpers.urlFormat('/product/sale/discount/detail', {id: value.id, channel: channel}),
|
|
|
img: value.cover_url,
|
...
|
...
|
@@ -470,9 +464,9 @@ exports.handleSaleBannerData = (origin) => { |
|
|
list: []
|
|
|
};
|
|
|
|
|
|
_.forEach(origin, function(value) {
|
|
|
_.forEach(origin, function (value) {
|
|
|
if (value.template_name === 'focus') {
|
|
|
_.forEach(value.data, function(subValue) {
|
|
|
_.forEach(value.data, function (subValue) {
|
|
|
let banner = {
|
|
|
bannerHeight: 450,
|
|
|
href: subValue.url,
|
...
|
...
|
@@ -496,9 +490,9 @@ exports.handleSaleBannerSmallData = (origin) => { |
|
|
var dest = [];
|
|
|
let count = 0;
|
|
|
|
|
|
_.forEach(origin, function(value) {
|
|
|
_.forEach(origin, function (value) {
|
|
|
if (value.template_name === 'threePicture') {
|
|
|
_.forEach(value.data, function(picList) {
|
|
|
_.forEach(value.data, function (picList) {
|
|
|
if (count++ < 3) {
|
|
|
let smallPic = {
|
|
|
link: picList.url,
|
...
|
...
|
|