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
陈智峰
jinfa-platform
Commits
2dddbbf0
Commit
2dddbbf0
authored
Sep 22, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:商品详情价格阶梯的从大到小排序
parent
02806211
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
3 deletions
+36
-3
index.tsx
src/pages/lxMall/commodityDetail/index.tsx
+34
-2
LXShopLayout.tsx
src/pages/lxMall/layouts/LXShopLayout.tsx
+2
-1
No files found.
src/pages/lxMall/commodityDetail/index.tsx
View file @
2dddbbf0
...
@@ -204,7 +204,7 @@ const CommodityDetail = (props) => {
...
@@ -204,7 +204,7 @@ const CommodityDetail = (props) => {
if
(
judgeArrisCommon
(
temp
,
selectAttrVal
))
{
if
(
judgeArrisCommon
(
temp
,
selectAttrVal
))
{
setSelectCommodityId
(
item
.
id
)
setSelectCommodityId
(
item
.
id
)
setCurrentPriceRange
(
item
.
unitPrice
)
setCurrentPriceRange
(
sortUnitPrice
(
item
.
unitPrice
)
)
setAttrAndValList
(
item
)
setAttrAndValList
(
item
)
setStockCount
(
item
.
stockCount
)
setStockCount
(
item
.
stockCount
)
}
}
...
@@ -441,13 +441,45 @@ const CommodityDetail = (props) => {
...
@@ -441,13 +441,45 @@ const CommodityDetail = (props) => {
}
}
}
}
}
}
setCurrentPriceRange
(
unitPriceAndPicList
[
0
].
unitPrice
)
setCurrentPriceRange
(
sortUnitPrice
(
unitPriceAndPicList
[
0
].
unitPrice
)
)
setStockCount
(
unitPriceAndPicList
[
0
].
stockCount
)
setStockCount
(
unitPriceAndPicList
[
0
].
stockCount
)
setCommodityImgList
(
tempImgList
)
setCommodityImgList
(
tempImgList
)
setAttributeList
(
tempAttrList
)
setAttributeList
(
tempAttrList
)
}
}
/**
/**
* 对阶梯价格进行从大到小的排序
* @param priceObj
*/
const
sortUnitPrice
=
(
priceObj
)
=>
{
if
(
!
priceObj
)
{
return
{}
}
if
(
Object
.
keys
(
priceObj
).
length
<=
1
)
{
return
priceObj
}
let
tempList
=
[]
Object
.
keys
(
priceObj
).
forEach
(
key
=>
{
tempList
.
push
({
key
,
value
:
priceObj
[
key
]
})
})
for
(
let
i
=
0
;
i
<
tempList
.
length
;
i
++
)
{
if
(
tempList
[
i
+
1
]
&&
tempList
[
i
].
value
<
tempList
[
i
+
1
].
value
)
{
let
temp
=
tempList
[
i
]
tempList
[
i
]
=
tempList
[
i
+
1
]
tempList
[
i
+
1
]
=
temp
}
}
let
result
=
{}
for
(
let
tempItem
of
tempList
)
{
result
[
tempItem
.
key
]
=
tempItem
.
value
}
return
result
}
/**
* 设置当前选择的sku的价格区间
* 设置当前选择的sku的价格区间
* @param uniPrice
* @param uniPrice
*/
*/
...
...
src/pages/lxMall/layouts/LXShopLayout.tsx
View file @
2dddbbf0
...
@@ -5,6 +5,7 @@ import {
...
@@ -5,6 +5,7 @@ import {
}
from
'@ant-design/pro-layout'
;
}
from
'@ant-design/pro-layout'
;
import
{
useIntl
,
history
}
from
'umi'
;
import
{
useIntl
,
history
}
from
'umi'
;
import
TopBar
from
'../components/TopBar'
import
TopBar
from
'../components/TopBar'
import
SelectLang
from
'@/layouts/components/SelectLang'
import
{
inject
,
observer
}
from
'mobx-react'
import
{
inject
,
observer
}
from
'mobx-react'
import
ShopHeader
from
'../components/ShopHeader'
import
ShopHeader
from
'../components/ShopHeader'
import
MainNav
from
'../components/MainNav'
import
MainNav
from
'../components/MainNav'
...
@@ -81,7 +82,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
...
@@ -81,7 +82,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return
(
return
(
<
div
className=
{
styles
.
lxmall_page
}
>
<
div
className=
{
styles
.
lxmall_page
}
>
<
TopBar
name=
{
mallInfo
.
name
}
/>
<
TopBar
langComponent=
{
<
SelectLang
/>
}
name=
{
mallInfo
.
name
}
/>
<
div
className=
{
styles
.
content
}
>
<
div
className=
{
styles
.
content
}
>
<
ShopHeader
logo=
{
mallInfo
.
logoUrl
}
shopId=
{
query
.
shopId
}
shopUrlParam=
{
shopId
}
shopInfo=
{
shopInfo
}
/>
<
ShopHeader
logo=
{
mallInfo
.
logoUrl
}
shopId=
{
query
.
shopId
}
shopUrlParam=
{
shopId
}
shopInfo=
{
shopInfo
}
/>
<
MainNav
menuData=
{
menuData
}
pathname=
{
location
.
pathname
}
type=
{
LAYOUT_TYPE
.
shop
}
shopId=
{
query
.
shopId
}
shopUrlParam=
{
shopId
}
/>
<
MainNav
menuData=
{
menuData
}
pathname=
{
location
.
pathname
}
type=
{
LAYOUT_TYPE
.
shop
}
shopId=
{
query
.
shopId
}
shopUrlParam=
{
shopId
}
/>
...
...
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