Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-system
Project
Overview
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
姜雷
dcxy-system
Commits
d15ea41f
Commit
d15ea41f
authored
May 22, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改负数情况下格式化价格问题
parent
6b94a9f1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
index.js
src/utils/index.js
+4
-0
No files found.
src/utils/index.js
View file @
d15ea41f
...
@@ -354,6 +354,7 @@ export const allowLetterNumber = value => {
...
@@ -354,6 +354,7 @@ export const allowLetterNumber = value => {
export
const
formatterMoneyToDouble
=
val
=>
{
export
const
formatterMoneyToDouble
=
val
=>
{
return
val
?
Number
(
val
).
toFixed
(
2
)
:
Number
(
0
).
toFixed
(
2
);
return
val
?
Number
(
val
).
toFixed
(
2
)
:
Number
(
0
).
toFixed
(
2
);
};
};
export
const
formatPrice
=
price
=>
{
export
const
formatPrice
=
price
=>
{
var
result
=
[],
var
result
=
[],
counter
=
0
;
counter
=
0
;
...
@@ -361,6 +362,9 @@ export const formatPrice = price => {
...
@@ -361,6 +362,9 @@ export const formatPrice = price => {
result
.
push
(
price
.
slice
(
-
3
).
join
(
''
));
result
.
push
(
price
.
slice
(
-
3
).
join
(
''
));
for
(
var
i
=
price
.
length
-
4
;
i
>=
0
;
i
--
)
{
for
(
var
i
=
price
.
length
-
4
;
i
>=
0
;
i
--
)
{
counter
++
;
counter
++
;
if
(
i
==
0
&&
isNaN
(
Number
(
price
[
i
]))
&&
result
[
0
]
===
','
)
{
result
.
shift
();
}
result
.
unshift
(
price
[
i
]);
result
.
unshift
(
price
[
i
]);
if
(
!
(
counter
%
3
)
&&
i
!=
0
)
{
if
(
!
(
counter
%
3
)
&&
i
!=
0
)
{
result
.
unshift
(
','
);
result
.
unshift
(
','
);
...
...
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