Authored by yyq

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

/**
*
* @Author: zhoushaofeng
* @Date: 2016-06-02 15:50:47
* @Last Modified time: 2016-06-08 19:31:52
*/
'use strict';
const library = '../../../library';
const utils = '../../../utils';
... ...
... ... @@ -9,6 +9,7 @@
const _ = require('lodash');
const library = '../../../library';
const helpers = require(`${library}/helpers`);
const queryString = require('querystring');
/**
* 处理用于筛选的 URL
... ... @@ -548,7 +549,12 @@ exports.handleSaleFilterData = (origin, params) => {
}
// 清除所有选中数据
dest.checkedConditions.clearUrl = '?';
let remainParams = {};
if (params.id) {
remainParams.id = params.id;
}
dest.checkedConditions.clearUrl = '?' + queryString.stringify(remainParams);
// 处理频道筛选数据
dest.checkedConditions.conditions = _.union(dest.checkedConditions.conditions,
... ...
... ... @@ -576,11 +576,22 @@ exports.handleSaleSortData = (origin, params, extra) => {
leftContent.allSort = {};
leftContent.allSort.list = [];
leftContent.allSort.all = {
name: '全部品类',
href: handleFilterUrl(params),
num: extra
};
if (extra === 'discount') {
let tempParams = _.cloneDeep(params);
delete tempParams.sort;
leftContent.allSort.all = {
name: '全部品类',
href: handleFilterUrl(tempParams),
active: _.isEmpty(params.sort) ? true : false
};
} else {
leftContent.allSort.all = {
name: '全部品类',
href: handleFilterUrl(params)
};
}
_.forEach(origin, function(value) {
... ... @@ -590,7 +601,7 @@ exports.handleSaleSortData = (origin, params, extra) => {
category.num = value.node_count;
category.childList = [];
category.href = handleFilterUrl(params, {sort: value.relation_parameter.sort});
category.active = false;
category.active = (params.sort === value.relation_parameter.sort) ? true : false;
_.forEach(value.sub, function(subValue) {
category.childList.push({
name: subValue.category_name,
... ... @@ -634,7 +645,7 @@ exports.handleSaleActivityData = (origin, channel) => {
if (key < 3) {
dest.big.push(activity);
} else if (key < 15) {
} else if (key < 27) {
dest.normal.push(activity);
}
});
... ...
... ... @@ -344,7 +344,8 @@ exports.getSaleDiscountData = (params, channel) => {
// 处理分页等筛选信息
if (result[3].code === 200) {
finalResult.leftContent = saleHandler.handleSaleSortData(result[3].data.filter.group_sort, params);
finalResult.leftContent =
saleHandler.handleSaleSortData(result[3].data.filter.group_sort, params, 'discount');
finalResult.saleList.pager = saleHandler.handleSalePagerData(result[3].data.total, params);
finalResult.saleList.opts = saleHandler.handleSaleOptsData(params, result[3].data.total);
}
... ...
... ... @@ -19,10 +19,10 @@
{{#leftContent}}
{{#allSort}}
{{#all}}
<li class="{{#if checked}}active{{/if}}"><a href="{{href}}">{{name}} {{#if num}}({{num}}){{/if}}</a></li>
<li class="{{#if active}}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>
<li class="{{#if active}}active{{/if}}"><a href="{{href}}">{{name}} {{#if num}}({{num}}){{/if}}</a></li>
{{/list}}
{{/allSort}}
{{/leftContent}}
... ...
... ... @@ -37,31 +37,32 @@ slide = new Slide({
index: 0
});
if ($item.length > 1) {
slide.on('change', function(data) {
if (current) {
current = false;
} else {
return;
}
index++;
$('.sale-list-pagation').find('span').removeClass('active');
$item.eq(data.from).animate({
opacity: 0
}, 300);
$item.eq(data.to).css({
zIndex: index
}).animate({
opacity: 1
}, 300, function() {
current = true;
});
$('.sale-list-pagation').find('span').eq(data.to).addClass('active');
slide.on('change', function(data) {
if (current) {
current = false;
} else {
return;
}
index++;
$('.sale-list-pagation').find('span').removeClass('active');
$item.eq(data.from).animate({
opacity: 0
}, 300);
$item.eq(data.to).css({
zIndex: index
}).animate({
opacity: 1
}, 300, function() {
current = true;
});
$('.sale-list-pagation').find('span').eq(data.to).addClass('active');
});
}
$contain.hover(function() {
if (current) {
... ...
... ... @@ -34,7 +34,6 @@
display: block;
}
.slide-wrapper {
height: 100%;
}
... ... @@ -514,9 +513,10 @@
display: inline-block;
margin-right: 10px;
padding: 0 10px;
height: 25px;
vertical-align: center;
font-weight: lighter;
line-height: 16px;
vertical-align: text-bottom;
line-height: 25px;
color: #fff;
background: #ff575c;
}
... ...