Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
yyq
9 years ago
Commit
82e7b2f903e4c08f6f007312d53abf1f5acd14b7
2 parents
c4e9055a
a7b903db
Merge branch 'release/4.6' of git.yoho.cn:fe/yohobuy-node into release/4.6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
11 deletions
apps/product/models/outlets-handler.js
apps/product/models/public-handler.js
apps/product/models/outlets-handler.js
View file @
82e7b2f
...
...
@@ -83,7 +83,7 @@ const handleOutletsGoodsMenuData = (origin, params) => {
Object
.
assign
(
oldParam
,
{
misort
:
urlSuffix
.
misort
});
}
goodsmenu
.
href
=
'?'
+
queryString
.
stringify
(
oldParam
);
goodsmenu
.
href
=
'?'
+
queryString
.
stringify
(
oldParam
)
+
'#otspool'
;
dest
.
menuList
.
push
(
goodsmenu
);
});
...
...
apps/product/models/public-handler.js
View file @
82e7b2f
...
...
@@ -133,6 +133,73 @@ const handleCheckedData = (params, origin, param) => {
};
/**
* 处理品牌筛选数据
* @param params
* @param origin
* @returns {{}}
*/
const
handleBrandCheckedData
=
(
params
,
origin
)
=>
{
let
dest
=
[];
// 分拆品牌参数
let
brands
=
_
.
split
(
params
.
brand
,
','
);
let
intBrands
=
[];
_
.
forEach
(
brands
,
value
=>
{
intBrands
.
push
(
parseInt
(
value
,
10
));
});
let
checkedCount
=
0
;
// 遍历品牌数据,如果在参数中,那么加 checked,将此数据加入到 checked 数组中
if
(
!
_
.
isEmpty
(
origin
))
{
_
.
forEach
(
origin
,
(
value
)
=>
{
if
(
typeof
_
.
find
(
intBrands
,
o
=>
{
return
_
.
isEqual
(
o
,
value
.
id
);
})
!==
'undefined'
)
{
let
checked
=
{
name
:
value
.
name
};
// push 到已选择数组
// 为了不污染原始数据
let
tempIntBrands
=
_
.
cloneDeep
(
intBrands
);
// 去掉当前选项
_
.
remove
(
tempIntBrands
,
n
=>
{
return
n
===
value
.
id
;
});
// 拼接参数
let
brand
=
''
;
// 建议保留,需要品牌可以单个删除时放开注释即可
// _.forEach(tempIntBrands, subValue => {
// brand += subValue + ',';
// });
// 清除参数,保留没有去掉的参数
let
tempParam
=
{
brand
:
brand
};
checked
.
href
=
handleFilterUrl
(
params
,
tempParam
);
if
(
checkedCount
===
0
)
{
dest
[
0
]
=
checked
;
}
else
if
(
checkedCount
===
1
)
{
dest
[
0
].
name
+=
'、'
+
checked
.
name
.
substring
(
0
,
3
)
+
'...'
;
}
checkedCount
++
;
// 建议保留,需要品牌可以单个删除时放开注释即可
// dest.push(checked);
}
});
}
return
dest
;
};
/**
* 处理分页数据
* @param {[type]} total [description]
* @param {[type]} params [description]
...
...
@@ -561,17 +628,17 @@ exports.handleSaleFilterData = (origin, params) => {
// 奥莱尺码处理
if
(
!
_
.
isEmpty
(
origin
.
size
))
{
dest
.
size
=
[];
_
.
forEach
(
origin
.
size
,
value
=>
{
let
size
=
{
checked
:
params
.
size
===
value
.
size_id
,
href
:
handleFilterUrl
(
params
,
{
size
:
value
.
size_id
}),
name
:
value
.
size_name
};
dest
.
size
.
push
(
size
);
dest
.
size
.
push
({
checked
:
parseInt
(
params
.
size
,
10
)
===
parseInt
(
origin
.
size
.
size_id
,
10
),
href
:
handleFilterUrl
(
params
,
{
size
:
origin
.
size
.
size_id
}),
name
:
origin
.
size
.
size_name
});
dest
.
checkedConditions
.
conditions
=
_
.
union
(
dest
.
checkedConditions
.
conditions
,
handleCheckedData
(
params
,
dest
.
size
,
'size'
));
}
// 断码区尺码数据处理
...
...
@@ -596,8 +663,10 @@ exports.handleSaleFilterData = (origin, params) => {
handleCheckedData
(
params
,
dest
.
gender
,
'gender'
));
// 处理品牌筛选数据
// dest.checkedConditions.conditions = _.union(dest.checkedConditions.conditions,
// handleCheckedData(params, dest.brand.brandsShow, 'brand'));
dest
.
checkedConditions
.
conditions
=
_
.
union
(
dest
.
checkedConditions
.
conditions
,
handle
CheckedData
(
params
,
dest
.
brand
.
brandsShow
,
'brand'
));
handle
BrandCheckedData
(
params
,
dest
.
brand
.
brandsShow
));
// 处理价格筛选数据
dest
.
checkedConditions
.
conditions
=
_
.
union
(
dest
.
checkedConditions
.
conditions
,
...
...
Please
register
or
login
to post a comment