Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sfp-program
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sweet Zhang
sfp-program
Commits
69dce9e7
Commit
69dce9e7
authored
Sep 08, 2022
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
千分位
parent
27b18981
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
21 deletions
+49
-21
pages/dataImport/data-import.vue
+25
-20
pages/index/index.vue
+6
-1
util/dataHandling.ts
+18
-0
No files found.
pages/dataImport/data-import.vue
View file @
69dce9e7
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
<
script
>
<
script
>
import
api
from
"../../api/api"
;
import
api
from
"../../api/api"
;
import
{
reactive
,
provide
}
from
"vue"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -228,32 +229,36 @@
...
@@ -228,32 +229,36 @@
return
;
return
;
}
}
}
}
const
params
=
{
const
params
=
reactive
(
{
...
this
.
calcuteData
,
...
this
.
calcuteData
,
calcuteMethod
:
2
,
calcuteMethod
:
2
,
decimal
:
5
,
decimal
:
5
,
irrAndSimpleInfos
:
this
.
policyYearLists
irrAndSimpleInfos
:
this
.
policyYearLists
};
});
api
.
irrAndSimpleCalcute
(
params
).
then
(
res
=>
{
provide
(
"dataImportIrrAndSimpleCalcuteParams"
,
params
);
if
(
res
.
success
===
true
){
this
.
irrAndSimpleResInfos
=
res
.
data
.
irrAndSimpleResInfos
;
// this.resultShowFlag = true;
//计算成功返回上一页
uni
.
setStorageSync
(
'resIrrAndSimpleResInfos'
,
this
.
irrAndSimpleResInfos
);
// uni.navigateBack({
// delta:1,//返回层数,2则上上页
// })
uni
.
navigateTo
({
uni
.
navigateTo
({
url
:
'/pages/index/index?isBack=1
'
url
:
'/pages/index/index
'
});
});
}
else
{
// api.irrAndSimpleCalcute(params).then(res=>{
uni
.
showToast
({
// if(res.success === true){
title
:
res
[
'message'
],
// this.irrAndSimpleResInfos = res.data.irrAndSimpleResInfos;
duration
:
2000
,
// // this.resultShowFlag = true;
icon
:
'none'
// //计算成功返回上一页
})
// uni.setStorageSync('resIrrAndSimpleResInfos',this.irrAndSimpleResInfos);
}
// // uni.navigateBack({
})
// // delta:1,//返回层数,2则上上页
// // })
// uni.navigateTo({
// url: '/pages/index/index?isBack=1'
// });
// }else{
// uni.showToast({
// title: res['message'],
// duration: 2000,
// icon: 'none'
// })
// }
// })
}
}
}
}
...
...
pages/index/index.vue
View file @
69dce9e7
...
@@ -167,7 +167,7 @@
...
@@ -167,7 +167,7 @@
</view>
</view>
<view
class=
"resultTd"
v-for=
"item in resIrrAndSimpleResInfos"
>
<view
class=
"resultTd"
v-for=
"item in resIrrAndSimpleResInfos"
>
<text>
{{
item
.
nyear
}}
</text>
<text>
{{
item
.
nyear
}}
</text>
<text>
{{
item
.
cashValue
}}
</text>
<text>
{{
numberConverter
(
item
.
cashValue
)
}}
</text>
<text
class=
"resultNumber"
>
{{
(
item
.
irrValue
*
100
).
toFixed
(
3
)
}}
%
</text>
<text
class=
"resultNumber"
>
{{
(
item
.
irrValue
*
100
).
toFixed
(
3
)
}}
%
</text>
<text
class=
"resultNumber"
>
{{
(
item
.
simpleValue
*
100
).
toFixed
(
3
)
}}
%
</text>
<text
class=
"resultNumber"
>
{{
(
item
.
simpleValue
*
100
).
toFixed
(
3
)
}}
%
</text>
</view>
</view>
...
@@ -200,6 +200,7 @@
...
@@ -200,6 +200,7 @@
import
{
nanoid
}
from
'nanoid'
;
import
{
nanoid
}
from
'nanoid'
;
import
dataHandling
from
"../../util/dataHandling"
;
import
dataHandling
from
"../../util/dataHandling"
;
import
dataImport
from
"../dataImport/data-import.vue"
;
import
dataImport
from
"../dataImport/data-import.vue"
;
import
{
inject
}
from
"vue"
;
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -280,6 +281,10 @@
...
@@ -280,6 +281,10 @@
}
}
},
},
methods
:
{
methods
:
{
// 数字千分位处理
numberConverter
(
val
){
return
dataHandling
.
numberConverter
(
val
)
},
// 封装报错弹窗
// 封装报错弹窗
errorDialog
(
type
,
content
){
errorDialog
(
type
,
content
){
// type 1 必填项校验 2 规则校验
// type 1 必填项校验 2 规则校验
...
...
util/dataHandling.ts
View file @
69dce9e7
...
@@ -7,5 +7,22 @@ export default{
...
@@ -7,5 +7,22 @@ export default{
return
r
[
2
];
return
r
[
2
];
}
}
return
null
;
return
null
;
},
// 数字千分位
numberConverter
(
value
){
if
(
!
value
)
return
0
// 获取整数部分
const
intPart
=
Math
.
trunc
(
value
)
// 整数部分处理,增加,
const
intPartFormat
=
intPart
.
toString
().
replace
(
/
(\d)(?=(?:\d{3})
+$
)
/g
,
'$1,'
)
// 预定义小数部分
let
floatPart
=
''
// 将数值截取为小数部分和整数部分
const
valueArray
=
value
.
toString
().
split
(
'.'
)
if
(
valueArray
.
length
===
2
)
{
// 有小数部分
floatPart
=
valueArray
[
1
].
toString
()
// 取得小数部分
return
intPartFormat
+
'.'
+
floatPart
}
return
intPartFormat
+
floatPart
}
}
}
}
\ No newline at end of file
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