...
|
...
|
@@ -138,23 +138,26 @@ const handleBrandCheckedData = (params, origin) => { |
|
|
/**
|
|
|
* 新品、折扣、限量
|
|
|
*/
|
|
|
const hadleChecks = (name, params) => {
|
|
|
let tempParam = _.cloneDeep(params);
|
|
|
const hadleChecks = (name, params, filter) => {
|
|
|
let tempParam = _.cloneDeep(params),
|
|
|
checked= false;
|
|
|
|
|
|
tempParam[name] = 'Y';
|
|
|
let checksOpts = {
|
|
|
name: checksName[name],
|
|
|
checked: false,
|
|
|
href: handleFilterUrl(tempParam)
|
|
|
};
|
|
|
if(!params[name] && !filter[name]) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
if (params[name] && params[name] === 'Y') {
|
|
|
checksOpts.checked = true;
|
|
|
checked = true;
|
|
|
delete tempParam[name];
|
|
|
checksOpts.href = handleFilterUrl(tempParam);
|
|
|
} else {
|
|
|
tempParam[name] = 'Y';
|
|
|
}
|
|
|
|
|
|
return checksOpts;
|
|
|
return {
|
|
|
name: checksName[name],
|
|
|
checked: checked,
|
|
|
href: handleFilterUrl(tempParam)
|
|
|
};
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -335,19 +338,17 @@ exports.handleOptsData = (params, total, extra) => { |
|
|
|
|
|
if (extra) {
|
|
|
// 新品
|
|
|
if (extra.new === 'Y') {
|
|
|
dest.checks.push(hadleChecks('new', params));
|
|
|
}
|
|
|
dest.checks.push(hadleChecks('new', params, extra));
|
|
|
|
|
|
// 打折
|
|
|
if (extra.specialoffer === 'Y') {
|
|
|
dest.checks.push(hadleChecks('specialoffer', params));
|
|
|
}
|
|
|
dest.checks.push(hadleChecks('specialoffer', params, extra));
|
|
|
|
|
|
// 限量
|
|
|
if (extra.limited === 'Y') {
|
|
|
dest.checks.push(hadleChecks('limited', params));
|
|
|
}
|
|
|
dest.checks.push(hadleChecks('limited', params, extra));
|
|
|
|
|
|
dest.checks = _.filter(dest.checks, chk => {
|
|
|
return chk !== null;
|
|
|
});
|
|
|
}
|
|
|
return dest;
|
|
|
};
|
...
|
...
|
|