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
9ef23f3d
Commit
9ef23f3d
authored
Oct 19, 2022
by
kyle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
子女教育
parent
640b7a72
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
467 additions
and
86 deletions
+467
-86
api/api.ts
+4
-0
pages/childEdu/childEdu.css
+86
-5
pages/childEdu/childEdu.vue
+325
-57
util/mock-data.ts
+52
-24
No files found.
api/api.ts
View file @
9ef23f3d
...
@@ -42,6 +42,10 @@ export default {
...
@@ -42,6 +42,10 @@ export default {
// 各城市商品住宅销售价格查询接口
// 各城市商品住宅销售价格查询接口
queryCommercialHousingPrice
(
params
){
queryCommercialHousingPrice
(
params
){
return
request
(
`
${
baseURL
}
/api/sfp/calcuteConfig/queryCommercialHousingPrice`
,
"POST"
,
params
)
return
request
(
`
${
baseURL
}
/api/sfp/calcuteConfig/queryCommercialHousingPrice`
,
"POST"
,
params
)
},
// 子女教育测算
educationEstimate
(
params
){
return
request
(
`
${
baseURL
}
/api/sfp/calcuteUtil/educationEstimate`
,
"POST"
,
params
)
}
}
}
}
pages/childEdu/childEdu.css
View file @
9ef23f3d
...
@@ -4,12 +4,18 @@
...
@@ -4,12 +4,18 @@
justify-content
:
space-between
;
justify-content
:
space-between
;
border-bottom
:
1px
solid
#E4E4E4
;
border-bottom
:
1px
solid
#E4E4E4
;
padding
:
16
rpx
0
;
padding
:
16
rpx
0
;
font-size
:
28
rpx
;
}
}
.listContent
li
.multiline
{
.listContent
li
.multiline
{
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
center
;
justify-content
:
center
;
align-items
:
flex-start
;
align-items
:
flex-start
;
}
}
.listContent
li
>
div
:last-child
{
display
:
flex
;
align-items
:
center
;
white-space
:
nowrap
;
}
.multilineItem
{
.multilineItem
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
...
@@ -60,6 +66,7 @@
...
@@ -60,6 +66,7 @@
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
margin
:
12
rpx
auto
;
margin
:
12
rpx
auto
;
width
:
100%
;
}
}
.listContent
li
.planGradeRange
>
div
:last-child
text
{
.listContent
li
.planGradeRange
>
div
:last-child
text
{
position
:
relative
;
position
:
relative
;
...
@@ -77,7 +84,7 @@
...
@@ -77,7 +84,7 @@
}
}
.schoolingContent
li
{
.schoolingContent
li
{
display
:
flex
;
display
:
flex
;
min-height
:
40
px
;
height
:
80
r
px
;
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
border-bottom
:
1px
solid
#E4E4E4
;
border-bottom
:
1px
solid
#E4E4E4
;
...
@@ -86,19 +93,27 @@
...
@@ -86,19 +93,27 @@
.schoolingContent
li
:first-child
{
.schoolingContent
li
:first-child
{
background
:
linear-gradient
(
to
right
,
#CEB07D
,
#FFDDA9
);
background
:
linear-gradient
(
to
right
,
#CEB07D
,
#FFDDA9
);
color
:
#6B4000
;
color
:
#6B4000
;
font-weight
:
bold
;
}
}
.schoolingContent
li
div
{
.schoolingContent
li
>
div
{
width
:
0
;
width
:
0
;
flex
:
1
;
flex
:
1
;
height
:
100%
;
white-space
:
nowrap
;
white-space
:
nowrap
;
text-align
:
center
;
font-size
:
24
rpx
;
font-size
:
28
rpx
;
border-right
:
1
rpx
solid
#E4E4E4
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.schoolingContent
li
>
div
:last-child
{
border-right
:
none
;
}
}
.settingButton
{
.settingButton
{
border-radius
:
8
rpx
;
border-radius
:
8
rpx
;
background
:
#F7D295
;
background
:
#F7D295
;
color
:
#6B4000
;
color
:
#6B4000
;
padding
:
4
rpx
6
rpx
;
padding
:
10
rpx
20
rpx
;
}
}
.summaryContent
{
.summaryContent
{
margin
:
0
20
rpx
;
margin
:
0
20
rpx
;
...
@@ -111,4 +126,69 @@
...
@@ -111,4 +126,69 @@
}
}
.failInfo
{
.failInfo
{
background-color
:
#FFE6E6
;
background-color
:
#FFE6E6
;
}
input
{
text-align
:
right
!important
;
}
.dialogContainer
{
position
:
fixed
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
background
:
rgba
(
0
,
0
,
0
,
0.35
);
z-index
:
2
;
}
.dialogContent
{
position
:
absolute
;
left
:
50%
;
top
:
30%
;
transform
:
translateX
(
-50%
);
width
:
95%
;
background-color
:
#fff
;
border-radius
:
10
rpx
;
padding
:
20
rpx
40
rpx
;
box-sizing
:
border-box
;
}
.dialogContent
.closeBtn
{
text-align
:
right
;
font-size
:
56
rpx
;
}
.dialogContent
ul
{
border-radius
:
5
rpx
;
box-shadow
:
0
0
10
rpx
4
rpx
rgba
(
0
,
0
,
0
,
0.25
);
margin-top
:
20
rpx
;
}
.dialogContent
ul
li
{
display
:
flex
;
height
:
80
rpx
;
border-bottom
:
1
rpx
solid
#E4E4E4
;
color
:
#6B4000
;
}
.dialogContent
ul
li
:first-child
{
background
:
linear-gradient
(
to
right
,
#CEB07D
,
#FFDDA9
);
}
.dialogContent
ul
li
>
div
{
flex
:
1
;
text-align
:
center
;
height
:
100%
;
align-items
:
center
;
display
:
flex
;
justify-content
:
center
;
border-right
:
1px
solid
#E4E4E4
;
}
.dialogContent
ul
li
>
div
:last-child
{
border-right
:
none
;
}
.dialogContent
button
{
margin-top
:
40
rpx
;
background
:
linear-gradient
(
to
bottom
right
,
#CEB07D
,
#FFDDA9
);
color
:
#6B4000
;
border
:
none
;
width
:
50%
;
font-weight
:
bold
;
}
.dialogContainer
.dialogContent
input
,
.schoolingContent
li
>
div
input
{
text-align
:
center
!important
;
padding-left
:
10
rpx
;
}
}
\ No newline at end of file
pages/childEdu/childEdu.vue
View file @
9ef23f3d
...
@@ -14,38 +14,42 @@
...
@@ -14,38 +14,42 @@
<ul>
<ul>
<li>
<li>
<div>
昵称:
</div>
<div>
昵称:
</div>
<div><input
class=
"uni-input"
maxlength=
"10"
placeholder=
"昵称长度不超过10"
/></div>
<div><input
class=
"uni-input"
v-model=
"eduPlanParam.name"
maxlength=
"10"
placeholder=
"昵称长度不超过10"
/></div>
</li>
</li>
<li>
<li>
<div>
年龄:
</div>
<div>
年龄:
</div>
<div><input
class=
"uni-input"
type=
"number"
maxlength=
"3
"
placeholder=
"请输入周岁年龄"
/></div>
<div><input
class=
"uni-input"
v-model=
"eduPlanParam.age"
type=
"number"
maxlength=
"2
"
placeholder=
"请输入周岁年龄"
/></div>
</li>
</li>
<li
class=
"multiline"
>
<li
class=
"multiline"
>
<div
class=
"multilineItem"
>
<div
class=
"multilineItem"
>
<div>
是否已上学:
</div>
<div>
是否已上学:
</div>
<div
class=
"selectBtnContent"
>
<div
class=
"selectBtnContent"
>
<text
class=
"actived
"
>
是
</text>
<text
:class=
"
{'actived':haveAcceptEduFlag}" @click="haveAcceptEduFlag=true;eduPlanParam.ngoLearn=null
">是
</text>
<text>
否
</text>
<text
:class=
"
{'actived':!haveAcceptEduFlag}" @click="haveAcceptEduFlag=false;eduPlanParam.maxGrade=null"
>否
</text>
</div>
</div>
</div>
</div>
<div
class=
"multilineItem"
>
<div
class=
"multilineItem"
v-if=
"haveAcceptEduFlag"
>
<div>
最高学历:
</div>
<div>
最高学历:
</div>
<div>
<div>
<uni-data-picker
placeholder=
"请选择最高学历"
popup-title=
"请选择最高学历"
:localdata=
"dataTree"
v-model=
"
classes
"
<uni-data-picker
placeholder=
"请选择最高学历"
popup-title=
"请选择最高学历"
:localdata=
"dataTree"
v-model=
"
eduPlanParam.maxGrade
"
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
@
popupopened=
"onpopupopened"
@
popupclosed=
"onpopupclosed"
>
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
>
</uni-data-picker>
</uni-data-picker>
</div>
</div>
</div>
</div>
<div
class=
"multilineItem"
v-if=
"!haveAcceptEduFlag"
>
<div>
几年后上学:
</div>
<div><input
class=
"uni-input"
v-model=
"eduPlanParam.ngoLearn"
type=
"number"
maxlength=
"1"
placeholder=
"请输入整数"
/></div>
</div>
</li>
</li>
<li
class=
"planGradeRange"
>
<li
class=
"planGradeRange"
>
<div>
规划阶段
</div>
<div>
规划阶段
</div>
<div>
<div>
<uni-data-picker
placeholder=
"
请选择最高学历"
popup-title=
"请选择最高学历"
:localdata=
"dataTree"
v-model=
"classes
"
<uni-data-picker
placeholder=
"
起始规划"
popup-title=
"请选择起始规划阶段"
:localdata=
"dataTree"
v-model=
"eduPlanParam.startPlan
"
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
@
popupopened=
"onpopupopened"
@
popupclosed=
"onpopupclosed"
>
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
>
</uni-data-picker>
</uni-data-picker>
<text></text>
<text></text>
<uni-data-picker
placeholder=
"
请选择最高学历"
popup-title=
"请选择最高学历"
:localdata=
"dataTree"
v-model=
"classes
"
<uni-data-picker
placeholder=
"
结束规划"
popup-title=
"请选择结束规划阶段"
:localdata=
"dataTree"
v-model=
"eduPlanParam.endPlan
"
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
@
popupopened=
"onpopupopened"
@
popupclosed=
"onpopupclosed"
>
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
>
</uni-data-picker>
</uni-data-picker>
</div>
</div>
</li>
</li>
...
@@ -56,11 +60,11 @@
...
@@ -56,11 +60,11 @@
<ul>
<ul>
<li>
<li>
<div>
已备教育资金总额:
</div>
<div>
已备教育资金总额:
</div>
<div>
万元
</div>
<div>
<input
class=
"uni-input"
type=
"digit"
maxlength=
"15"
v-model=
"eduPlanParam.initEducationFund"
placeholder=
"最高保留两位小数"
/>
万元
</div>
</li>
</li>
<li>
<li>
<div>
每年预备投入教育资金总额:
</div>
<div>
每年预备投入教育资金总额:
</div>
<div>
万元
</div>
<div>
<input
class=
"uni-input"
type=
"digit"
maxlength=
"15"
v-model=
"eduPlanParam.educationDeposit"
placeholder=
"最高保留两位小数"
/>
万元
</div>
</li>
</li>
</ul>
</ul>
</view>
</view>
...
@@ -69,11 +73,11 @@
...
@@ -69,11 +73,11 @@
<ul>
<ul>
<li>
<li>
<div>
学费增长率:
</div>
<div>
学费增长率:
</div>
<div>
%
</div>
<div>
<input
class=
"uni-input"
type=
"digit"
maxlength=
"5"
v-model=
"eduPlanParam.tuitionAddRate"
placeholder=
"最高保留两位小数"
/>
%
</div>
</li>
</li>
<li>
<li>
<div>
资产投资回报率:
</div>
<div>
资产投资回报率:
</div>
<div>
%
</div>
<div>
<input
class=
"uni-input"
type=
"digit"
maxlength=
"5"
v-model=
"eduPlanParam.investmentRate"
placeholder=
"最高保留两位小数"
/>
%
</div>
</li>
</li>
</ul>
</ul>
</view>
</view>
...
@@ -83,14 +87,17 @@
...
@@ -83,14 +87,17 @@
<li>
<li>
<div>
学历
</div>
<div>
学历
</div>
<div>
学制(年)
</div>
<div>
学制(年)
</div>
<div>
首年预估学费
</div>
<div
style=
"flex-direction: column;"
>
<view>
首年预估费用
</view>
<view>
(元)
</view>
</div>
<div></div>
<div></div>
</li>
</li>
<li>
<li
v-for=
"item in schoolingLists"
:key=
"item.value"
>
<div>
幼儿园
</div>
<div>
{{
item
.
text
}}
</div>
<div><input
class=
"uni-input"
maxlength=
"1"
type=
"number"
placeholder=
"最高不超过10"
/></div>
<div><input
class=
"uni-input"
maxlength=
"1"
type=
"number"
placeholder=
"最高不超过10"
v-model=
"item.commonYears"
/></div>
<div><input
class=
"uni-input"
maxlength=
"10"
type=
"digit"
placeholder=
""
/></div>
<div><input
class=
"uni-input"
maxlength=
"10"
type=
"digit"
v-model=
"item.publicTuition"
/></div>
<div><view
class=
"settingButton"
>
逐年设定
</view></div>
<div><view
class=
"settingButton"
@
click=
"settingYBY(item)"
>
逐年设定
</view></div>
</li>
</li>
</ul>
</ul>
</view>
</view>
...
@@ -98,20 +105,23 @@
...
@@ -98,20 +105,23 @@
<view
class=
"title"
><view>
测算结果及建议
</view></view>
<view
class=
"title"
><view>
测算结果及建议
</view></view>
<!-- 图表 -->
<!-- 图表 -->
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div
id=
"main"
style=
"width:
600px;height:400px;
"
></div>
<div
id=
"main"
style=
"width:
96vw;height:400px"
v-if=
"resultInfo
"
></div>
<view
class=
"summaryContent"
>
<view
class=
"summaryContent"
v-if=
"resultInfo"
>
<view
class=
"successInfo"
>
<view
class=
"successInfo"
v-if=
"resultInfo.code=='B001'"
>
<strong>
恭喜您!
</strong>
<strong>
恭喜您!
</strong>
<text>
经过测算,您的资金可以负担
XXX宝贝从XXX到XXX的学费。
</text>
<text>
经过测算,您的资金可以负担
{{
eduPlanParam
.
name
}}
同学从
{{
getClassesInfo
(
getEducationNo
(
eduPlanParam
.
startPlan
))
}}
到
{{
getClassesInfo
(
getEducationNo
(
eduPlanParam
.
endPlan
))
}}
阶段的上学费用
</text>
</view>
</view>
<view
class=
"failInfo"
>
<view
class=
"failInfo"
v-if=
"resultInfo.code=='A001'"
>
<strong>
很遗憾!
</strong>
<strong>
很遗憾!
</strong>
<text>
经过测算,您的资金
不可以负担XXX宝贝从XXX到XXX的学费
。
</text>
<text>
经过测算,您的资金
只能负担到
{{
eduPlanParam
.
name
}}
同学到
{{
getClassesInfo
(
resultInfo
.
educationNo
)
}}
。
</text>
</view>
</view>
<view
class=
"suggestionInfo"
>
<view
class=
"suggestionInfo"
v-if=
"resultInfo.code=='A001'"
>
<view>
您可以这样做来实现:
</view>
<view>
您可以这样做来实现:
</view>
<view>
<view>
1.提高教育储蓄到XXX元
<ul>
<li>
1.提高已被教育资金总额到
{{
resultInfo
.
retEducationDeposit
}}
元
</li>
<li>
2.提高每年预备投入教育资金总额到
{{
resultInfo
.
retInitEducationFund
}}
元
</li>
</ul>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -120,13 +130,30 @@
...
@@ -120,13 +130,30 @@
<button
type=
"default"
plain=
"true"
form-type=
"reset"
<button
type=
"default"
plain=
"true"
form-type=
"reset"
@
click=
"resetData()"
>
全部清空
</button>
@
click=
"resetData()"
>
全部清空
</button>
<button
type=
"default"
plain=
"true"
<button
type=
"default"
plain=
"true"
class=
"btn"
@
click=
"
startCount
()"
>
开始计算
</button>
class=
"btn"
@
click=
"
educationEstimate
()"
>
开始计算
</button>
</view>
</view>
</scroll-view>
</scroll-view>
</view>
</view>
<!--底部技术支持组件-->
<!--底部技术支持组件-->
<foot></foot>
<foot></foot>
<!-- 逐年设定弹窗 -->
<view
class=
"dialogContainer"
v-if=
"settingYBYFlag"
>
<view
class=
"dialogContent"
>
<view
class=
"closeBtn"
@
click=
"closeDialog()"
>
×
</view>
<ul>
<li>
<div>
{{
settingItem
.
text
}}
</div>
<div>
预估学费
</div>
</li>
<li
v-for=
"(item,index) in settingItem.children"
>
<div>
{{
item
.
text
}}
</div>
<div><input
class=
"uni-input"
type=
"digit"
placeholder=
"最高保留两位小数"
v-model=
"item.tuition"
/></div>
</li>
</ul>
<button
type=
"default"
plain=
"true"
@
click=
"confirmOption()"
>
确定
</button>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -137,62 +164,303 @@
...
@@ -137,62 +164,303 @@
import
foot
from
"../footer/footer.vue"
;
import
foot
from
"../footer/footer.vue"
;
import
{
eduGradeLists
}
from
"../../util/mock-data"
;
import
{
eduGradeLists
}
from
"../../util/mock-data"
;
import
*
as
echarts
from
'echarts'
;
import
*
as
echarts
from
'echarts'
;
import
api
from
"../../api/api"
;
import
common
from
"../../common/common"
;
import
dataHandling
from
"../../util/dataHandling"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
accountBalanceEnd
:[],
currentYearExpenditure
:[],
xAxisLists
:[],
settingItem
:{},
haveAcceptEduFlag
:
true
,
eduPlanParam
:{
name
:
'大宝'
,
age
:
null
,
ngoLearn
:
null
,
maxGrade
:
null
,
startPlan
:
null
,
endPlan
:
null
,
initEducationFund
:
null
,
educationDeposit
:
null
,
tuitionAddRate
:
2.1
,
investmentRate
:
3.74
,
incomeAddRate
:
0
,
decimal
:
2
},
resultInfo
:
null
,
settingYBYFlag
:
false
,
isNeedOfficialAccountQrcode
:
true
,
isNeedOfficialAccountQrcode
:
true
,
classes
:
'1-1'
,
classes
:
'1-1'
,
dataTree
:
eduGradeLists
dataTree
:
[],
schoolingLists
:
eduGradeLists
,
flatEduGradeLists
:[],
}
}
},
},
methods
:
{
methods
:
{
getEducationNo
(
val
){
if
(
val
){
return
this
.
flatEduGradeLists
.
filter
(
item
=>
item
.
value
==
val
)[
0
].
educationNo
;
}
else
{
return
null
;
}
},
getClassesInfo
(
val
){
if
(
val
){
const
value
=
this
.
flatEduGradeLists
.
filter
(
item
=>
item
.
educationNo
==
val
)[
0
].
value
;
const
schooling
=
value
.
split
(
'-'
)[
0
];
const
grade
=
value
.
split
(
'-'
)[
1
];
let
schoolingName
=
''
;
switch
(
schooling
){
case
'1'
:
schoolingName
=
'幼儿园'
;
break
;
case
'2'
:
schoolingName
=
'小学'
;
break
;
case
'3'
:
schoolingName
=
'初中'
;
break
;
case
'4'
:
schoolingName
=
'高中'
;
break
;
case
'5'
:
schoolingName
=
'大学'
;
break
;
case
'6'
:
schoolingName
=
'硕士'
;
break
;
case
'7'
:
schoolingName
=
'博士'
;
break
;
default
:
schoolingName
=
'幼儿园'
;
break
;
}
return
(
schoolingName
+
grade
+
'年级'
);
}
},
getFollowData
(
e
){
getFollowData
(
e
){
this
.
isNeedOfficialAccountQrcode
=
ref
(
e
);
this
.
isNeedOfficialAccountQrcode
=
ref
(
e
);
},
},
onnodeclick
(
e
)
{
onnodeclick
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
},
},
onpopupopened
(
e
)
{
console
.
log
(
'popupopened'
);
},
onpopupclosed
(
e
)
{
console
.
log
(
'popupclosed'
);
},
onchange
(
e
)
{
onchange
(
e
)
{
console
.
log
(
'onchange:'
,
e
);
//
console.log('onchange:', e);
},
},
drawLine
(){
drawLine
(){
// 基于准备好的dom,初始化echarts实例
// 基于准备好的dom,初始化echarts实例
var
myChart
=
echarts
.
init
(
document
.
getElementById
(
'main'
));
var
myChart
=
echarts
.
init
(
document
.
getElementById
(
'main'
));
// 指定图表的配置项和数据
// 指定图表的配置项和数据
var
option
=
{
var
option
=
{
xAxis
:
{
title
:
{},
type
:
'category'
,
tooltip
:
{
boundaryGap
:
true
,
trigger
:
'axis'
,
axisLabel
:{
axisPointer
:
{
interval
:
0
type
:
'cross'
,
},
label
:
{
data
:
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
]
backgroundColor
:
'#6a7985'
},
}
yAxis
:
{
}
type
:
'value'
},
},
legend
:
{
series
:
[
data
:
[
'教育金账户'
,
'学费现金流'
],
{
left
:
'1%'
data
:
[
820
,
932
,
901
,
934
,
1290
,
1330
,
1320
],
},
type
:
'line'
,
grid
:
{
areaStyle
:
{}
left
:
'2%'
,
}
containLabel
:
true
]
},
xAxis
:
[
{
type
:
'category'
,
boundaryGap
:
false
,
axisLabel
:{
interval
:
0
,
rotate
:
0
},
textStyle
:{
fontSize
:
10
},
data
:
this
.
xAxisLists
}
],
yAxis
:
[
{
type
:
'value'
}
],
series
:
[
{
name
:
'教育金账户'
,
type
:
'line'
,
itemStyle
:{
color
:
'#2E9200'
},
lineStyle
:{
color
:
'#46B700'
},
areaStyle
:
{
color
:
'#A5D58F'
},
emphasis
:
{
focus
:
'series'
},
data
:
this
.
accountBalanceEnd
},
{
name
:
'学费现金流'
,
type
:
'line'
,
stack
:
'Total'
,
itemStyle
:{
color
:
'#C58906'
},
lineStyle
:{
color
:
'#E39C00'
},
areaStyle
:
{
color
:
'#FFAF00'
},
emphasis
:
{
focus
:
'series'
},
data
:
this
.
currentYearExpenditure
}
]
};
};
// 使用刚指定的配置项和数据显示图表。
// 使用刚指定的配置项和数据显示图表。
myChart
.
setOption
(
option
);
myChart
.
setOption
(
option
);
},
settingYBY
(
item
){
// 逐年设定
this
.
settingYBYFlag
=
true
;
this
.
settingItem
=
item
;
},
closeDialog
(){
this
.
settingYBYFlag
=
false
;
},
confirmOption
(){
this
.
settingYBYFlag
=
false
;
console
.
log
(
this
.
settingItem
)
},
objFlat
(
Data
){
// 对象数组拍平
const
flatData
=
(
data
,
parentId
=
undefined
)
=>
{
return
data
.
reduce
((
prev
,
curr
)
=>
{
if
(
parentId
!=
undefined
)
{
Object
.
assign
(
curr
,
{
parentId
:
parentId
,
});
}
if
(
parentId
){
prev
.
push
(
curr
);
}
if
(
curr
.
children
&&
curr
.
children
.
length
>
0
)
{
prev
.
push
(...
flatData
(
curr
.
children
,
curr
.
value
));
}
return
prev
;
},
[]);
};
let
flated
=
flatData
(
Data
);
return
flated
;
},
educationEstimate
(){
// 数据校验
if
(
this
.
eduPlanParam
.
age
&&
this
.
eduPlanParam
.
age
>
50
){
common
.
errorDialog
(
2
,
'子女教育规划一般年龄不会超过40岁'
);
return
false
;
}
else
if
(
this
.
haveAcceptEduFlag
&&
!
this
.
eduPlanParam
.
maxGrade
){
common
.
errorDialog
(
1
,
'为了精准测算,请选择小孩的最高学历'
);
return
false
;
}
else
if
(
!
this
.
haveAcceptEduFlag
&&
!
this
.
eduPlanParam
.
ngoLearn
&&
this
.
eduPlanParam
.
ngoLearn
!=
0
){
common
.
errorDialog
(
1
,
'为了精准测算,请填写小孩几年后上学'
);
return
false
;
}
else
if
(
!
this
.
eduPlanParam
.
startPlan
||
!
this
.
eduPlanParam
.
endPlan
){
common
.
errorDialog
(
1
,
'为了精准测算,请选择规划阶段'
);
return
false
;
}
else
if
(
this
.
getEducationNo
(
this
.
eduPlanParam
.
startPlan
)
>=
this
.
getEducationNo
(
this
.
eduPlanParam
.
endPlan
)){
common
.
errorDialog
(
1
,
'您的规划起始阶段应小于结束阶段'
);
return
false
;
}
else
if
((
!
this
.
eduPlanParam
.
initEducationFund
&&
this
.
eduPlanParam
.
initEducationFund
!=
0
)
||
this
.
eduPlanParam
.
initEducationFund
<
0
){
common
.
errorDialog
(
1
,
'请输入目前您已备教育资金总额'
);
return
false
;
}
else
if
(
!
this
.
eduPlanParam
.
educationDeposit
&&
this
.
eduPlanParam
.
educationDeposit
!=
0
){
common
.
errorDialog
(
1
,
'请输入您每年预备投入教育资金总额'
);
return
false
;
}
const
flatSchoolingLists
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
objFlat
(
this
.
schoolingLists
)));
for
(
let
i
=
0
;
i
<
flatSchoolingLists
.
length
;
i
++
){
flatSchoolingLists
[
i
][
'educationNo'
]
=
i
+
1
;
flatSchoolingLists
[
i
][
'educationGrade'
]
=
flatSchoolingLists
[
i
].
value
?
flatSchoolingLists
[
i
].
value
.
split
(
'-'
)[
0
]
:
null
;
flatSchoolingLists
[
i
][
'gradeNo'
]
=
flatSchoolingLists
[
i
].
value
?
flatSchoolingLists
[
i
].
value
.
split
(
'-'
)[
1
]
:
null
;
flatSchoolingLists
[
i
][
'tuition'
]
=
flatSchoolingLists
[
i
].
tuition
?
flatSchoolingLists
[
i
].
tuition
:
null
;
flatSchoolingLists
[
i
][
'text'
]
=
flatSchoolingLists
[
i
][
'parentId'
]
=
flatSchoolingLists
[
i
][
'value'
]
=
undefined
;
}
const
param
=
{
...
this
.
eduPlanParam
,
businessNo
:
uni
.
getStorageSync
(
'businessNo'
),
wechat_openid
:
uni
.
getStorageSync
(
'openId'
)
||
''
,
tuitionAddRate
:(
this
.
eduPlanParam
.
tuitionAddRate
/
100
).
toFixed
(
4
),
investmentRate
:(
this
.
eduPlanParam
.
investmentRate
/
100
).
toFixed
(
4
),
maxGrade
:
this
.
getEducationNo
(
this
.
eduPlanParam
.
maxGrade
),
startPlan
:
this
.
getEducationNo
(
this
.
eduPlanParam
.
startPlan
),
endPlan
:
this
.
getEducationNo
(
this
.
eduPlanParam
.
endPlan
),
educationTuitionInfos
:
flatSchoolingLists
,
initEducationFund
:
this
.
eduPlanParam
.
initEducationFund
*
Math
.
pow
(
10
,
4
),
educationDeposit
:
this
.
eduPlanParam
.
educationDeposit
*
Math
.
pow
(
10
,
4
)
}
api
.
educationEstimate
(
param
).
then
(
res
=>
{
this
.
resultInfo
=
res
[
'data'
];
if
(
res
[
'success'
]){
this
.
currentYearExpenditure
=
[];
this
.
accountBalanceEnd
=
[];
this
.
xAxisLists
=
[];
const
result
=
this
.
resultInfo
.
educationEstimateResInfos
;
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
){
this
.
currentYearExpenditure
.
push
(
Math
.
abs
(
result
[
i
][
'currentYearExpenditure'
]));
this
.
accountBalanceEnd
.
push
(
result
[
i
][
'accountBalanceEnd'
]);
this
.
xAxisLists
.
push
(
result
[
i
][
'planyear'
])
}
setTimeout
(()
=>
{
this
.
drawLine
()},
0
)
}
else
{
this
.
currentYearExpenditure
=
[];
this
.
accountBalanceEnd
=
[];
this
.
xAxisLists
=
[];
}
})
},
resetData
(){
this
.
eduPlanParam
=
{
name
:
''
,
age
:
null
,
ngoLearn
:
null
,
maxGrade
:
null
,
startPlan
:
null
,
endPlan
:
null
,
initEducationFund
:
null
,
educationDeposit
:
null
,
tuitionAddRate
:
0.021
,
investmentRate
:
0.0374
,
incomeAddRate
:
0
,
decimal
:
5
}
}
}
},
},
mounted
()
{
mounted
()
{
this
.
drawLine
();
this
.
dataTree
=
JSON
.
parse
(
JSON
.
stringify
(
eduGradeLists
));
this
.
flatEduGradeLists
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
objFlat
(
this
.
schoolingLists
)))
this
.
flatEduGradeLists
.
map
((
val
,
idx
)
=>
{
val
[
'educationNo'
]
=
idx
+
1
;
});
console
.
log
(
this
.
flatEduGradeLists
)
},
},
components
:{
components
:{
follow
,
follow
,
...
...
util/mock-data.ts
View file @
9ef23f3d
...
@@ -3,73 +3,101 @@ const eduGradeLists=[
...
@@ -3,73 +3,101 @@ const eduGradeLists=[
text
:
"幼儿园"
,
text
:
"幼儿园"
,
value
:
"1"
,
value
:
"1"
,
commonYears
:
3
,
commonYears
:
3
,
minAge
:
3
,
maxAge
:
5
,
publicTuition
:
9016
,
privateTuition
:
11475
,
children
:
[
children
:
[
{
text
:
"1年级"
,
value
:
"1-1"
},
{
text
:
"1年级"
,
value
:
"1-1"
,
tuition
:
9016
},
{
text
:
"2年级"
,
value
:
"1-2"
},
{
text
:
"2年级"
,
value
:
"1-2"
,
tuition
:
null
},
{
text
:
"3年级"
,
value
:
"1-3"
}
{
text
:
"3年级"
,
value
:
"1-3"
,
tuition
:
null
}
]
]
},
},
{
{
text
:
"小学"
,
text
:
"小学"
,
value
:
"2"
,
value
:
"2"
,
commonYears
:
6
,
commonYears
:
6
,
minAge
:
6
,
maxAge
:
12
,
publicTuition
:
4034
,
privateTuition
:
5738
,
children
:
[
children
:
[
{
text
:
"1年级"
,
value
:
"2-1"
},
{
text
:
"1年级"
,
value
:
"2-1"
,
tuition
:
4034
},
{
text
:
"2年级"
,
value
:
"2-2"
},
{
text
:
"2年级"
,
value
:
"2-2"
,
tuition
:
null
},
{
text
:
"3年级"
,
value
:
"2-3"
},
{
text
:
"3年级"
,
value
:
"2-3"
,
tuition
:
null
},
{
text
:
"4年级"
,
value
:
"2-4"
},
{
text
:
"4年级"
,
value
:
"2-4"
,
tuition
:
null
},
{
text
:
"5年级"
,
value
:
"2-5"
},
{
text
:
"5年级"
,
value
:
"2-5"
,
tuition
:
null
},
{
text
:
"6年级"
,
value
:
"2-6"
},
{
text
:
"6年级"
,
value
:
"2-6"
,
tuition
:
null
},
]
]
},
},
{
{
text
:
"初中"
,
text
:
"初中"
,
value
:
"3"
,
value
:
"3"
,
commonYears
:
3
,
commonYears
:
3
,
minAge
:
13
,
maxAge
:
18
,
publicTuition
:
6095
,
privateTuition
:
10444
,
children
:
[
children
:
[
{
text
:
"1年级"
,
value
:
"3-1"
},
{
text
:
"1年级"
,
value
:
"3-1"
,
tuition
:
6095
},
{
text
:
"2年级"
,
value
:
"3-2"
},
{
text
:
"2年级"
,
value
:
"3-2"
,
tuition
:
null
},
{
text
:
"3年级"
,
value
:
"3-3"
},
{
text
:
"3年级"
,
value
:
"3-3"
,
tuition
:
null
},
]
]
},
},
{
{
text
:
"高中"
,
text
:
"高中"
,
value
:
"4"
,
value
:
"4"
,
commonYears
:
3
,
commonYears
:
3
,
minAge
:
19
,
maxAge
:
22
,
publicTuition
:
7976
,
privateTuition
:
15952
,
children
:
[
children
:
[
{
text
:
"1年级"
,
value
:
"4-1"
},
{
text
:
"1年级"
,
value
:
"4-1"
,
tuition
:
7976
},
{
text
:
"2年级"
,
value
:
"4-2"
},
{
text
:
"2年级"
,
value
:
"4-2"
,
tuition
:
null
},
{
text
:
"3年级"
,
value
:
"4-3"
},
{
text
:
"3年级"
,
value
:
"4-3"
,
tuition
:
null
},
]
]
},
},
{
{
text
:
"大学"
,
text
:
"大学"
,
value
:
"5"
,
value
:
"5"
,
commonYears
:
4
,
commonYears
:
4
,
minAge
:
23
,
maxAge
:
27
,
publicTuition
:
11960
,
privateTuition
:
17940
,
children
:
[
children
:
[
{
text
:
"1年级"
,
value
:
"5-1"
},
{
text
:
"1年级"
,
value
:
"5-1"
,
tuition
:
11960
},
{
text
:
"2年级"
,
value
:
"5-2"
},
{
text
:
"2年级"
,
value
:
"5-2"
,
tuition
:
null
},
{
text
:
"3年级"
,
value
:
"5-3"
},
{
text
:
"3年级"
,
value
:
"5-3"
,
tuition
:
null
},
{
text
:
"4年级"
,
value
:
"5-4"
},
{
text
:
"4年级"
,
value
:
"5-4"
,
tuition
:
null
},
]
]
},
},
{
{
text
:
"硕士"
,
text
:
"硕士"
,
value
:
"6"
,
value
:
"6"
,
commonYears
:
2
,
commonYears
:
2
,
minAge
:
28
,
maxAge
:
30
,
publicTuition
:
11960
,
privateTuition
:
17940
,
children
:
[
children
:
[
{
text
:
"1年级"
,
value
:
"6-1"
},
{
text
:
"1年级"
,
value
:
"6-1"
,
tuition
:
11960
},
{
text
:
"2年级"
,
value
:
"6-2"
}
{
text
:
"2年级"
,
value
:
"6-2"
,
tuition
:
null
}
]
]
},
},
{
{
text
:
"博士"
,
text
:
"博士"
,
value
:
"7"
,
value
:
"7"
,
commonYears
:
3
,
commonYears
:
3
,
minAge
:
31
,
maxAge
:
34
,
publicTuition
:
11960
,
privateTuition
:
17940
,
children
:
[
children
:
[
{
text
:
"1年级"
,
value
:
"7-1"
},
{
text
:
"1年级"
,
value
:
"7-1"
,
tuition
:
11960
},
{
text
:
"2年级"
,
value
:
"7-2"
},
{
text
:
"2年级"
,
value
:
"7-2"
,
tuition
:
null
},
{
text
:
"3年级"
,
value
:
"7-3"
}
{
text
:
"3年级"
,
value
:
"7-3"
,
tuition
:
null
}
]
]
}
}
]
]
...
...
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