Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
d786f09f
Commit
d786f09f
authored
Oct 19, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:商品属性筛选修改
parent
0665293a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
list.tsx
src/pages/lxMall/commodity/list.tsx
+3
-3
index.ts
src/store/filter/index.ts
+26
-2
No files found.
src/pages/lxMall/commodity/list.tsx
View file @
d786f09f
...
...
@@ -2,20 +2,20 @@ import React from 'react'
import
cx
from
'classnames'
import
{
Skeleton
}
from
'antd'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
Ge
tSearchShopEnterpriseGetCommodityListResponseDetail
}
from
'@/services/SearchApi'
import
{
Pos
tSearchShopEnterpriseGetCommodityListResponseDetail
}
from
'@/services/SearchApi'
import
{
priceFormat
,
numFormat
}
from
'@/utils/numberFomat'
import
creditIcon
from
'@/assets/imgs/credit_icon.png'
import
styles
from
'./list.less'
interface
CommodityListPropsType
{
showType
:
number
;
commodityList
:
Ge
tSearchShopEnterpriseGetCommodityListResponseDetail
[]
commodityList
:
Pos
tSearchShopEnterpriseGetCommodityListResponseDetail
[]
layoutType
:
LAYOUT_TYPE
}
const
CommodityList
:
React
.
FC
<
CommodityListPropsType
>
=
(
props
)
=>
{
const
{
showType
,
commodityList
=
[],
layoutType
=
LAYOUT_TYPE
.
mall
}
=
props
const
renderPrice
=
(
commodityItem
:
Ge
tSearchShopEnterpriseGetCommodityListResponseDetail
)
=>
{
const
renderPrice
=
(
commodityItem
:
Pos
tSearchShopEnterpriseGetCommodityListResponseDetail
)
=>
{
switch
(
commodityItem
.
priceType
)
{
// 现货价格
case
1
:
...
...
src/store/filter/index.ts
View file @
d786f09f
...
...
@@ -40,6 +40,28 @@ const getItemText = (key: number) => {
return
result
}
const
changeAttributeDate
=
(
list
)
=>
{
if
(
!
list
)
{
return
[]
}
let
flag
=
false
list
=
list
.
map
(
item
=>
{
delete
item
.
customerAttributeName
if
(
item
.
customerAttributeValueList
&&
item
.
customerAttributeValueList
.
length
<=
0
)
{
delete
item
.
customerAttributeValueList
delete
item
.
customerAttributeId
flag
=
true
}
else
{
item
.
customerAttributeValueList
=
item
.
customerAttributeValueList
.
map
(
attrItem
=>
{
delete
attrItem
.
name
return
attrItem
})
}
return
item
})
return
flag
?
[]
:
list
}
class
FilterStore
{
/**
* 筛选条件列表
...
...
@@ -120,7 +142,7 @@ class FilterStore {
for
(
let
filterItem
of
newFilterList
)
{
switch
(
filterItem
.
type
)
{
case
FILTER_TYPE
.
category
:
tempFilterParam
.
categoryId
=
filterItem
.
key
[
0
]
tempFilterParam
.
categoryId
=
Number
(
filterItem
.
key
[
0
])
break
case
FILTER_TYPE
.
brand
:
tempFilterParam
.
brandId
=
filterItem
.
key
...
...
@@ -158,7 +180,9 @@ class FilterStore {
tempFilterParam
.
orderType
=
4
break
case
FILTER_TYPE
.
attribute
:
tempFilterParam
.
customerAttributeList
=
filterItem
.
key
let
attributeList
=
JSON
.
parse
(
filterItem
.
key
)
attributeList
=
changeAttributeDate
(
attributeList
)
tempFilterParam
.
customerAttributeList
=
attributeList
break
case
FILTER_TYPE
.
shopArea
:
tempFilterParam
.
areaCode
=
filterItem
.
key
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment