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
shenshaokai
jinfa-platform
Commits
f8758331
Commit
f8758331
authored
Oct 21, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:企业商城价格区间筛选接口对接
parent
00a66bb0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
19 deletions
+73
-19
index.tsx
...ages/lxMall/components/Filter/components/Points/index.tsx
+36
-8
index.tsx
...pages/lxMall/components/Filter/components/Price/index.tsx
+35
-9
index.tsx
src/pages/lxMall/components/InterestedCommodity/index.tsx
+2
-2
No files found.
src/pages/lxMall/components/Filter/components/Points/index.tsx
View file @
f8758331
import
React
,
{
useState
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Slider
}
from
'antd'
import
{
LAYOUT_TYPE
,
FILTER_TYPE
}
from
'@/constants'
import
{
PublicApi
}
from
'@/services/api'
import
FilterBox
from
'../FilterBox'
import
'./index.less'
...
...
@@ -10,8 +11,35 @@ interface PricePropsType {
}
const
Points
:
React
.
FC
<
PricePropsType
>
=
(
props
)
=>
{
const
{
layoutType
=
LAYOUT_TYPE
.
mall
}
=
props
const
{
onFilter
}
=
props
.
FilterStore
const
[
pointsRange
,
setPointsRange
]
=
useState
<
any
>
([
0
,
900
])
const
[
maxPrice
,
setMaxPrice
]
=
useState
<
number
>
(
900
)
const
[
pointsRange
,
setPointsRange
]
=
useState
<
any
>
([
0
,
maxPrice
])
useEffect
(()
=>
{
fetchMaxPrice
()
},
[])
const
fetchMaxPrice
=
()
=>
{
let
getFn
switch
(
layoutType
)
{
case
LAYOUT_TYPE
.
channel
:
case
LAYOUT_TYPE
.
ichannel
:
case
LAYOUT_TYPE
.
channelScoreMall
:
getFn
=
PublicApi
.
getSearchShopChannelGetCommodityMaxPrice
break
;
default
:
getFn
=
PublicApi
.
getSearchShopStoreGetCommodityMaxPrice
break
;
}
getFn
&&
getFn
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setMaxPrice
(
res
.
data
)
setPointsRange
([
0
,
res
.
data
])
}
})
}
const
handlePriceChange
=
(
value
)
=>
{
setPointsRange
(
value
)
...
...
@@ -36,15 +64,15 @@ const Points: React.FC<PricePropsType> = (props) => {
const
handleConfirmpointsRange
=
()
=>
{
let
min
=
pointsRange
[
0
]
let
max
=
pointsRange
[
1
]
if
(
min
===
900
)
{
if
(
min
===
maxPrice
)
{
filterMinPoints
(
min
)
}
else
if
(
min
===
0
&&
max
!==
900
)
{
}
else
if
(
min
===
0
&&
max
!==
maxPrice
)
{
filterMinPoints
(
min
,
false
)
filterMaxPoints
(
max
)
}
else
if
(
min
!==
0
&&
max
===
900
)
{
}
else
if
(
min
!==
0
&&
max
===
maxPrice
)
{
filterMinPoints
(
min
)
filterMaxPoints
(
max
,
false
)
}
else
if
((
min
===
0
&&
max
===
900
)
||
(
min
!==
0
&&
max
!==
900
))
{
}
else
if
((
min
===
0
&&
max
===
maxPrice
)
||
(
min
!==
0
&&
max
!==
maxPrice
))
{
filterMinPoints
(
min
)
filterMaxPoints
(
max
)
}
...
...
@@ -55,13 +83,13 @@ const Points: React.FC<PricePropsType> = (props) => {
title=
"所需积分范围"
>
<
div
className=
"filter_price"
>
<
Slider
range
step=
{
1
}
min=
{
0
}
max=
{
900
}
value=
{
pointsRange
}
onChange=
{
handlePriceChange
}
/>
<
Slider
range
step=
{
1
}
min=
{
0
}
max=
{
maxPrice
}
value=
{
pointsRange
}
onChange=
{
handlePriceChange
}
/>
<
div
className=
"price_box"
>
<
span
className=
"price_box_brief"
>
积分:
</
span
>
<
div
className=
"price_range"
>
<
span
className=
"price"
>
{
pointsRange
[
0
]
}
</
span
>
<
span
className=
"split"
>
-
</
span
>
<
span
className=
"price"
>
{
pointsRange
[
0
]
===
900
?
''
:
`${pointsRange[1]}`
}
</
span
>
<
span
className=
"price"
>
{
pointsRange
[
0
]
===
maxPrice
?
''
:
`${pointsRange[1]}`
}
</
span
>
</
div
>
<
div
className=
"confirm_btn"
onClick=
{
()
=>
handleConfirmpointsRange
()
}
>
确定
</
div
>
</
div
>
...
...
src/pages/lxMall/components/Filter/components/Price/index.tsx
View file @
f8758331
import
React
,
{
useState
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Slider
}
from
'antd'
import
{
LAYOUT_TYPE
,
FILTER_TYPE
}
from
'@/constants'
import
{
PublicApi
}
from
'@/services/api'
import
FilterBox
from
'../FilterBox'
import
'./index.less'
...
...
@@ -10,9 +11,34 @@ interface PricePropsType {
}
const
Price
:
React
.
FC
<
PricePropsType
>
=
(
props
)
=>
{
const
{
layoutType
=
LAYOUT_TYPE
.
mall
}
=
props
const
{
onFilter
,
filterList
}
=
props
.
FilterStore
const
MAX_COUNT
=
900
const
[
priceRange
,
setPriceRange
]
=
useState
<
any
>
([
0
,
MAX_COUNT
])
const
[
maxPrice
,
setMaxPrice
]
=
useState
<
number
>
(
900
)
const
[
priceRange
,
setPriceRange
]
=
useState
<
any
>
([
0
,
maxPrice
])
useEffect
(()
=>
{
fetchMaxPrice
()
},
[])
const
fetchMaxPrice
=
()
=>
{
let
getFn
switch
(
layoutType
)
{
case
LAYOUT_TYPE
.
channel
:
case
LAYOUT_TYPE
.
ichannel
:
case
LAYOUT_TYPE
.
shopScoreMall
:
getFn
=
PublicApi
.
getSearchShopChannelGetCommodityMaxPrice
break
;
default
:
getFn
=
PublicApi
.
getSearchShopStoreGetCommodityMaxPrice
break
;
}
getFn
&&
getFn
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setMaxPrice
(
res
.
data
)
setPriceRange
([
0
,
res
.
data
])
}
})
}
const
handlePriceChange
=
(
value
)
=>
{
setPriceRange
(
value
)
...
...
@@ -37,19 +63,19 @@ const Price: React.FC<PricePropsType> = (props) => {
const
handleConfirmPriceRange
=
()
=>
{
let
min
=
priceRange
[
0
]
let
max
=
priceRange
[
1
]
if
(
min
===
MAX_COUNT
)
{
if
(
min
===
maxPrice
)
{
filterMinPrice
(
min
)
}
else
if
(
min
===
0
&&
max
!==
MAX_COUNT
)
{
}
else
if
(
min
===
0
&&
max
!==
maxPrice
)
{
if
(
checkHasType
(
FILTER_TYPE
.
minPrice
))
{
filterMinPrice
(
min
,
false
)
}
filterMaxPrice
(
max
)
}
else
if
(
min
!==
0
&&
max
===
MAX_COUNT
)
{
}
else
if
(
min
!==
0
&&
max
===
maxPrice
)
{
filterMinPrice
(
min
)
if
(
checkHasType
(
FILTER_TYPE
.
maxPrice
))
{
filterMaxPrice
(
max
,
false
)
}
}
else
if
((
min
===
0
&&
max
===
MAX_COUNT
)
||
(
min
!==
0
&&
max
!==
MAX_COUNT
))
{
}
else
if
((
min
===
0
&&
max
===
maxPrice
)
||
(
min
!==
0
&&
max
!==
maxPrice
))
{
filterMinPrice
(
min
)
filterMaxPrice
(
max
)
}
...
...
@@ -64,13 +90,13 @@ const Price: React.FC<PricePropsType> = (props) => {
title=
"价格"
>
<
div
className=
"filter_price"
>
<
Slider
range
step=
{
1
}
min=
{
0
}
max=
{
MAX_COUNT
}
value=
{
priceRange
}
onChange=
{
handlePriceChange
}
/>
<
Slider
range
step=
{
1
}
min=
{
0
}
max=
{
maxPrice
}
value=
{
priceRange
}
onChange=
{
handlePriceChange
}
/>
<
div
className=
"price_box"
>
<
span
className=
"price_box_brief"
>
价格:
</
span
>
<
div
className=
"price_range"
>
<
span
className=
"price"
>
¥
{
priceRange
[
0
]
}
</
span
>
<
span
className=
"split"
>
-
</
span
>
<
span
className=
"price"
>
{
priceRange
[
0
]
===
MAX_COUNT
?
''
:
`¥${priceRange[1]}`
}
</
span
>
<
span
className=
"price"
>
{
priceRange
[
0
]
===
maxPrice
?
''
:
`¥${priceRange[1]}`
}
</
span
>
</
div
>
<
div
className=
"confirm_btn"
onClick=
{
()
=>
handleConfirmPriceRange
()
}
>
确定
</
div
>
</
div
>
...
...
src/pages/lxMall/components/InterestedCommodity/index.tsx
View file @
f8758331
...
...
@@ -46,7 +46,7 @@ const InterestedCommodity: React.FC<InterestedCommodityPropsType> = (props) => {
return
link
}
return
(
return
dataList
&&
dataList
.
length
>
0
&&
(
<
div
className=
{
styles
.
interested_commodity
}
>
<
div
className=
{
styles
.
interested_commodity_title
}
>
<
span
>
您可能也感兴趣:
</
span
>
...
...
@@ -57,7 +57,7 @@ const InterestedCommodity: React.FC<InterestedCommodityPropsType> = (props) => {
</
div
>
<
div
className=
{
styles
.
interested_commodity_list
}
>
{
dataList
&&
dataList
.
map
((
item
,
index
)
=>
index
<
5
&&
(
dataList
.
map
((
item
,
index
)
=>
index
<
5
&&
(
<
div
className=
{
styles
.
interested_commodity_list_item
}
key=
{
`interested_commodity_list_item_${item.id}`
}
>
<
a
href=
{
getCommodityDetailLink
(
item
)
}
target=
"_blank"
>
<
div
className=
{
styles
.
interested_commodity_list_item_imgbox
}
>
...
...
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