Authored by 郭成尧

'不麻烦接口了,自己搞了'

... ... @@ -374,13 +374,13 @@ exports.handleSaleSortData = (origin, params, extra) => {
leftContent.allSort.all = {
name: '全部品类',
href: handleFilterUrl(tempParams),
href: handleFilterUrl(tempParams, {sort: ''}),
active: _.isEmpty(params.sort)
};
} else {
leftContent.allSort.all = {
name: '全部品类',
href: handleFilterUrl(params)
href: handleFilterUrl(params, {sort: ''})
};
}
... ...
... ... @@ -80,7 +80,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.web_cover_url,
... ... @@ -127,9 +127,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,
... ... @@ -153,9 +153,9 @@ exports.handleSaleBannerSmallData = (origin) => {
let 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,
... ... @@ -202,6 +202,7 @@ exports.handleSaleCategoryData = (origin, saleType, channel, breakingSizeSort) =
urlLocation = {
url: '?saleType=' + saleType + '&order=s_t_desc&channel=' + channel +
'&breakSize=' + breakingSizeSort.breakSize + '&breakSort=' + breakingSizeSort.breakSort,
localUrl: '?saleType=' + saleType + '&order=s_t_desc&channel=' + channel,
limit: 14
};
break;
... ... @@ -229,13 +230,21 @@ exports.handleSaleCategoryData = (origin, saleType, channel, breakingSizeSort) =
_.forEach(origin, (value) => {
if (count++ < 4) {
let forBreakingUrl = '';
if (saleType === '1') {
forBreakingUrl = urlLocation.localUrl;
} else {
forBreakingUrl = urlLocation.url;
}
let nav = {
urlLocation: urlLocation.url + '&sort=' + value.relation_parameter.sort +
urlLocation: forBreakingUrl + '&sort=' + value.relation_parameter.sort +
`&limit=${(urlLocation.limit + 1)}`,
title: value.category_name,
newDiscount: true
};
dest.navItem.push(nav);
}
});
... ...
... ... @@ -453,6 +453,15 @@ exports.getSalebreakingYardsData = (params, channel) => {
let breakingSizeSort = saleHandler.handleSaleBreakingSizeData(result[2].data);
let breakParam = {}; // 为断码区筛选参数存储,为了不影响 params ,否则会导致链接过长
if (params.sort) {
Object.assign(breakParam, params);
} else {
Object.assign(breakParam, params, {
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
});
}
return api.all([
saleApi.getSaleGoodsList({
channel: channel,
... ... @@ -461,10 +470,7 @@ exports.getSalebreakingYardsData = (params, channel) => {
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
}),
saleApi.getSaleGoodsList(Object.assign(breakParam, params, {
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
}))
saleApi.getSaleGoodsList(breakParam)
]).then(subResult => {
// 处理筛选条件数据
if (subResult[0].code === 200) {
... ...