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
d48e5574
Commit
d48e5574
authored
Jan 20, 2021
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 进货单购买数量不在价格范围内时取值问题
parent
e3a9a36e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
index.less
src/pages/lxMall/purchaseOrder/index.less
+2
-2
index.tsx
src/pages/lxMall/purchaseOrder/index.tsx
+8
-10
No files found.
src/pages/lxMall/purchaseOrder/index.less
View file @
d48e5574
...
...
@@ -201,8 +201,8 @@
color: #FFF;
height: 50px;
font-size: 16px;
background-color:
#D32F2F
;
border-color:
#D32F2F
;
background-color:
var(--mall_main_color)
;
border-color:
var(--mall_main_color)
;
border-radius: 0;
outline: none;
cursor: pointer;
...
...
src/pages/lxMall/purchaseOrder/index.tsx
View file @
d48e5574
...
...
@@ -309,7 +309,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
}
}
if
(
isEmpty
(
priceItem
))
{
priceItem
=
getMaxCountRange
(
priceRange
)
priceItem
=
getMaxCountRange
(
priceRange
,
count
)
}
return
parseFloat
(
priceItem
.
price
)
*
count
}
...
...
@@ -663,7 +663,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
return
Number
(
count
)
>=
Number
(
item
.
min
)
&&
Number
(
count
)
<=
Number
(
item
.
max
)
})
if
(
isEmpty
(
temp
))
{
const
maxItem
=
getMaxCountRange
(
detail
.
priceRange
)
const
maxItem
=
getMaxCountRange
(
detail
.
priceRange
,
count
)
unitPrice
=
maxItem
.
price
}
else
{
unitPrice
=
temp
[
0
]?.
price
...
...
@@ -673,14 +673,12 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
return
unitPrice
}
const
getMaxCountRange
=
(
priceRange
)
=>
{
let
maxItem
:
any
=
{}
for
(
const
item
of
priceRange
)
{
if
(
Number
(
item
.
max
)
>
Number
(
maxItem
.
max
||
0
))
{
maxItem
=
item
}
}
return
maxItem
const
getMaxCountRange
=
(
priceRange
,
buyCount
)
=>
{
const
priceList
=
[...
priceRange
]
const
result
=
priceList
.
sort
((
a
,
b
)
=>
(
Number
(
b
.
max
)
<
Number
(
buyCount
)
&&
Number
(
buyCount
)
<
Number
(
a
.
min
)
?
1
:
-
1
))
// const result = priceList.sort((a, b) => Math.abs(Number(b.max) - Number(buyCount)) < Math.abs(Number(a.min) - Number(buyCount)) ? 1 : -1 )
return
result
[
0
]
}
const
getDetailLink
=
(
info
)
=>
{
...
...
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