Authored by yyq

Merge branch 'release/4.6' of git.yoho.cn:fe/yohobuy-node into release/4.6

... ... @@ -329,14 +329,6 @@ exports.handleSaleOptsData = (params, total) => {
dest.curPage = _.isEmpty(params.page) ? 1 : params.page; // 当前页码数
// 上一页下一页
let preHref = (!_.isEmpty(params.page) && parseInt(params.page, 10) > 1) ?
parseInt(params.page, 10) - 1 : 1;
let nextHref = (!_.isEmpty(params.page)) ? parseInt(params.page, 10) + 1 : 2;
dest.preHref = handleFilterUrl(params, {page: preHref});
dest.nextHref = handleFilterUrl(params, {page: nextHref});
// 每页商品数量
dest.countPerPage = _.isEmpty(params.limit) ? 60 : params.limit;
... ... @@ -346,6 +338,21 @@ exports.handleSaleOptsData = (params, total) => {
// 每页多少商品
let paramsLimit = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10);
// 上一页下一页
let preHref = (!_.isEmpty(params.page) && parseInt(params.page, 10) > 1) ?
parseInt(params.page, 10) - 1 : 1;
let nextHref = (!_.isEmpty(params.page)) ? parseInt(params.page, 10) + 1 : 2;
if (dest.pageCount > 1 && (parseInt(params.page, 10) !== 1) &&
(parseInt(params.page, 10) !== dest.pageCount)) {
dest.preHref = handleFilterUrl(params, {page: preHref});
dest.nextHref = handleFilterUrl(params, {page: nextHref});
} else if (dest.pageCount > 1 && (parseInt(params.page, 10) === 1)) {
dest.nextHref = handleFilterUrl(params, {page: nextHref});
} else if (dest.pageCount > 1 && (parseInt(params.page, 10) === dest.pageCount)) {
dest.preHref = handleFilterUrl(params, {page: preHref});
}
// 商品开始结束数
dest.start = (!_.isEmpty(params.page) ? (params.page - 1) : 0) * paramsLimit + 1;
dest.end = (dest.pageCount === parseInt(params.page, 10)) ?
... ...
... ... @@ -190,6 +190,38 @@ const handleCheckedData = (params, origin, param) => {
};
/**
* 处理品牌筛选数据 待处理
* @param params
* @param origin
* @returns {{}}
*/
// const handleBrandCheckedData = (params, origin) => {
// let dest = {};
//
// let brands = _.split(params.brand, ',');
//
// if (!_.isEmpty(origin)) {
// _.forEach(origin, (value) => {
// if (!_.isEmpty(_.find(brands, o => {
// return o === value.id;
// }))) {
// let checked = {};
//
// checked.name = value.name;
//
// let tempParam = {};
//
// tempParam.brand = '';
// checked.href = handleFilterUrl(params, tempParam);
//
// dest.push(checked);
// }
// });
// }
// return dest;
// };
/**
* 处理断码区尺码筛选数据
* @param origin 尺码原始数据
* @param params 当前 URL 中已有的参数
... ... @@ -416,7 +448,11 @@ exports.handleSaleOptsData = (params, total, extra) => {
} else {
opt.name = '最新';
opt.hasSortOrient = true;
opt.active = true;
if (_.isEmpty(params.order) || params.order === 's_t_desc') {
opt.active = true;
} else {
opt.active = false;
}
opt.desc = true;
}
break;
... ... @@ -495,14 +531,6 @@ exports.handleSaleOptsData = (params, total, extra) => {
dest.curPage = _.isEmpty(params.page) ? 1 : params.page; // 当前页码数
// 上一页下一页
let preHref = (!_.isEmpty(params.page) && parseInt(params.page, 10) > 1) ?
parseInt(params.page, 10) - 1 : 1;
let nextHref = (!_.isEmpty(params.page)) ? parseInt(params.page, 10) + 1 : 2;
dest.preHref = handleFilterUrl(params, {page: preHref});
dest.nextHref = handleFilterUrl(params, {page: nextHref});
// 每页商品数量
dest.countPerPage = _.isEmpty(params.limit) ? 60 : params.limit;
... ... @@ -512,6 +540,21 @@ exports.handleSaleOptsData = (params, total, extra) => {
// 每页多少商品
let paramsLimit = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10);
// 上一页下一页
let preHref = (!_.isEmpty(params.page) && parseInt(params.page, 10) > 1) ?
parseInt(params.page, 10) - 1 : 1;
let nextHref = (!_.isEmpty(params.page)) ? parseInt(params.page, 10) + 1 : 2;
if (dest.pageCount > 1 && (parseInt(params.page, 10) !== 1) &&
(parseInt(params.page, 10) !== dest.pageCount)) {
dest.preHref = handleFilterUrl(params, {page: preHref});
dest.nextHref = handleFilterUrl(params, {page: nextHref});
} else if (dest.pageCount > 1 && (parseInt(params.page, 10) === 1)) {
dest.nextHref = handleFilterUrl(params, {page: nextHref});
} else if (dest.pageCount > 1 && (parseInt(params.page, 10) === dest.pageCount)) {
dest.preHref = handleFilterUrl(params, {page: preHref});
}
// 商品开始结束数
dest.start = (!_.isEmpty(params.page) ? (params.page - 1) : 0) * paramsLimit + 1;
dest.end = (dest.pageCount === parseInt(params.page, 10)) ?
... ... @@ -584,7 +627,7 @@ exports.handleSaleActivityData = (origin, channel) => {
activity.link =
helpers.urlFormat('/product/sale/discount/detail', {id: value.id, channel: channel});
activity.img = value.cover_url;
activity.time = processTime(value.left_time);
activity.time = processTime(parseInt(value.left_time, 10) * 1000);
activity.brand = value.logo_url;
activity.title = value.title;
activity = Object.assign(activity, discountSplit(value.promotion_name));
... ... @@ -610,7 +653,7 @@ exports.handleDiscountTitleData = (origin) => {
dest.up = true;
// dest.time = processTimes(origin.left_time);
dest.time = origin.left_time;
dest.time = parseInt(origin.left_time, 10) * 1000;
Object.assign(dest, discountSplit(origin.promotion_name));
return dest;
... ...
... ... @@ -61,6 +61,10 @@ exports.getSaleGoodsData = (params) => {
if (result[0].code === 200) {
finalResult.goods = productProcess.processProductList(result[0].data.product_list);
_.forEach(finalResult.goods, (value, key) => {
finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
finalResult.goods[key].tags.isSale = false;
});
}
// 处理 VIP 商品数据
... ... @@ -88,11 +92,6 @@ exports.getSaleGoodsData = (params) => {
});
}
if (params.saleType === '3') {
_.forEach(finalResult.goods, (value, key) => {
finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
});
}
}
// 需要判断是否为今日推荐,今日推荐需要添加最后的全部商品图片
... ... @@ -252,6 +251,11 @@ exports.getSaleOthersData = (params, channel) => {
name: '所有商品',
count: result[1].data.total
};
_.forEach(finalResult.goods, (value, key) => {
finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
finalResult.goods[key].tags.isSale = false;
});
}
// 获取焦点图数据
... ... @@ -320,6 +324,11 @@ exports.getSaleDiscountData = (params, channel) => {
finalResult.saleList = {};
finalResult.saleList.goods = productProcess.processProductList(result[1].data.product_list);
finalResult.saleList.totalCount = result[1].data.total;
_.forEach(finalResult.saleList.goods, (value, key) => {
finalResult.saleList.goods[key].tags.isNew = false; // 屏蔽 new 标签
finalResult.saleList.goods[key].tags.isSale = false;
});
}
// 处理折扣专场标题 banner 数据
... ... @@ -409,6 +418,7 @@ exports.getSalebreakingYardsData = (params, channel) => {
_.forEach(finalResult.goods, (value, key) => {
finalResult.goods[key].tags.isNew = false; // 屏蔽 new 标签
finalResult.goods[key].tags.isSale = false;
});
}
return finalResult;
... ...
... ... @@ -5,8 +5,8 @@
{{#if discount}}
<span class="discount">{{discount}}</span>
{{/if}}
{{#if up}}
{{#if discountText}}
{{discountText}}
{{/if}}
<div class="time pull-right">
<span class="iconfont">&#xe60a;</span>
... ... @@ -18,6 +18,9 @@
<li class="title">分类:</li>
{{#leftContent}}
{{#allSort}}
{{#all}}
<li class="{{#if checked}}active{{/if}}"><a href="{{href}}">{{name}} {{#if num}}({{num}}){{/if}}</a></li>
{{/all}}
{{#list}}
<li class="{{#if checked}}active{{/if}}"><a href="{{href}}">{{name}} {{#if num}}({{num}}){{/if}}</a></li>
{{/list}}
... ...
... ... @@ -78,8 +78,8 @@ function convertTime(time) {
s = Math.floor(time / aSecond % 60);
showTime += d > 0 ? d + '天' : '';
showTime += h > 0 ? h + '小时' : '';
showTime += m > 0 ? m + '分钟' : '';
showTime += h > 0 ? h + '时' : '';
showTime += m > 0 ? m + '分' : '';
showTime += s > 0 ? s + '秒' : '';
}
... ... @@ -87,11 +87,23 @@ function convertTime(time) {
}
function setPageTime() {
var i, showTime;
var i, text, showTime;
for (i = 0; i < limitTime.length; i++) {
if (limitTime[i].time < 0) {
return;
}
limitTime[i].time -= 1000;
showTime = convertTime(limitTime[i].time);
if (showTime) {
text = showTime;
if (limitTime[i].pre) {
text = limitTime[i].pre + ' ' + text;
}
} else {
text = '活动已结束';
}
$('.time-calculate').removeClass('hidden');
$('.time-calculate').text(showTime);
}
... ...