Authored by 刘传洋

sale few goods page

... ... @@ -101,7 +101,9 @@ exports.brand = (req, res, next) => {
// 品牌
return list.getBrandData(req.query, Object.assign({uid: req.user.id}, brandInfo)).then(result => {
Object.assign(resData, result);
Object.assign(resData, result, {
page: 'search'
});
res.render('list/brand', resData);
});
}
... ...
... ... @@ -244,7 +244,7 @@ exports.getBrandData = (params, extra) => {
// 获取商品数据和顶部筛选条件
if (result[2].code === 200) {
Object.assign(finalResult.brand, {
filters: searchHandler.handleFilterData(result[2].data.filter, params),
filters: searchHandler.handleFilterDataAll(result[2].data, params),
opts: searchHandler.handleOptsData(params, result[2].data.total, result[2].data.filter),
totalCount: result[2].data.total,
footPager: searchHandler.handlePagerData(result[2].data.total, params),
... ... @@ -253,12 +253,13 @@ exports.getBrandData = (params, extra) => {
});
// 获取高级筛选条件
if (finalResult.list && finalResult.list.filters) {
/*if (finalResult.list && finalResult.list.filters) {
Object.assign(finalResult.list.filters, searchHandler.handleSeniorFilterData({
style: _.get(result[2], 'data.filter.style', []),
standard: _.get(result[2], 'data.standard', [])
}, params));
}
}*/
}
// 品牌页不显示品牌筛选项
... ...
... ... @@ -15,6 +15,7 @@ const helpers = global.yoho.helpers;
const images = require('../../../utils/images.js');
const cache = global.yoho.cache;
const logger = global.yoho.logger;
const md5 = require('md5');
const getSortByConditionAsync = (condition) => {
return api.get('sortgroup.json', condition);
... ... @@ -38,7 +39,7 @@ const getSearchCackeKey = params => {
}
});
return ks.join('_');
return md5(ks.join('_'));
}
/**
... ...
... ... @@ -742,7 +742,7 @@ exports.handleSeniorFilterData = (data, params) => {
_.forEach(data.standard, value => {
let sub = [];
let parKey = `parameter_${value.standard_id}`;
//let parKey = `parameter_${value.standard_id}`;
_.forEach(value.sub, subValue => {
let ched = qStandard[value.standard_id] === parseInt(subValue.standard_id, 10);
... ...
... ... @@ -162,7 +162,7 @@ exports.processProductList = (list, options) => {
thumb: product.defaultImages
});
product.isSoonSoldOut = product.isSoonSoldOut === 'Y';
product.isFew = product.isSoonSoldOut === 'Y';
product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line
// tar add 1606071146 品牌链接处理
... ... @@ -178,7 +178,8 @@ exports.processProductList = (list, options) => {
product.tags = {};
product.tags.isNew = options.showNew && product.isNew === 'Y'; // 新品
product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售
//product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售
product.tags.isSale = options.showSale && product.isDiscount === 'Y' && product.salesPrice && (product.marketPrice / product.salesPrice > 2);
product.tags.isLimited = product.isLimited === 'Y'; // 限量
product.tags.isYohood = product.isYohood === 'Y'; // YOHOOD
product.tags.midYear = product.midYear === 'Y'; // 年中
... ... @@ -186,15 +187,19 @@ exports.processProductList = (list, options) => {
product.tags.isAdvance = product.isAdvance === 'Y'; // 再到着
// 打折与即将售完组合显示打折
if (product.isSoonSoldOut && product.tags.isDiscount) {
product.tags.isFew = false;
} else if (product.tags.isDiscount &&
(product.tags.isFew || product.tags.isLimited || product.tags.isYohood || product.tags.isAdvance)) {
/*if (product.isFew && product.tags.isDiscount) {
product.isFew = false;
} else*/
if(product.tags.isNew) {
product.tags.isSale = false;
}
if (product.tags.isSale &&
(product.isFew || product.tags.isLimited || product.tags.isYohood || product.tags.isAdvance)) {
// 打折与其它组合则隐藏打折
product.tags.isDiscount = false;
} else if (product.tags.isYohood && product.tags.isFew) {
product.tags.isSale = false;
} else if (product.tags.isYohood && product.isFew) {
// YOHOOD和新品组合显示YOHOOD
product.tags.isFew = false;
product.isFew = false;
}
}
... ...