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
ad85629f
Commit
ad85629f
authored
Oct 12, 2022
by
kyle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购房能力测算问题修改
parent
f3fd25a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
21 deletions
+60
-21
common/common.ts
+6
-4
pages/housePurchase/housePurchase.vue
+37
-14
pages/housePurchase/planningParameters.vue
+17
-3
No files found.
common/common.ts
View file @
ad85629f
...
...
@@ -39,16 +39,18 @@ export default {
/*
num:源数据
digitNum:保留几位小数
type:向上(1)取
还是向下(2)取
type:向上(1)取
*/
formatFloat
(
num
,
digitNum
=
2
,
type
=
1
){
if
(
num
){
if
(
type
===
1
){
return
Math
.
ceil
(
num
.
toFixed
(
digitNum
)
*
Math
.
pow
(
10
,
digitNum
))
/
Math
.
pow
(
10
,
digitNum
);
const
dataNum
=
(
num
*
Math
.
pow
(
10
,
digitNum
+
1
)
/
Math
.
pow
(
10
,
digitNum
+
1
)).
toString
();
return
(
Number
(
dataNum
.
slice
(
0
,
dataNum
.
indexOf
(
'.'
)
+
digitNum
+
1
))
+
10
/
Math
.
pow
(
10
,
digitNum
+
1
)).
toFixed
(
digitNum
)
}
else
{
return
Math
.
floor
(
num
.
toFixed
(
digitNum
)
*
Math
.
pow
(
10
,
digitNum
))
/
Math
.
pow
(
10
,
digitNum
)
return
(
num
*
Math
.
pow
(
10
,
digitNum
+
1
)
/
Math
.
pow
(
10
,
digitNum
+
1
)).
toFixed
(
digitNum
)
}
}
else
{
return
num
;
}
}
...
...
pages/housePurchase/housePurchase.vue
View file @
ad85629f
...
...
@@ -27,13 +27,13 @@
<view
class=
"inputItem"
>
<text>
预购城市:
</text>
<uni-data-picker
placeholder=
"请选择地区"
popup-title=
"请选择所在地区"
:localdata=
"provinceList"
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
v-model=
"housePurchaseInfo.cityId"
>
</uni-data-picker>
@
change=
"onchange"
@
nodeclick=
"onnodeclick"
v-model=
"housePurchaseInfo.cityId"
>
</uni-data-picker>
</view>
<view
class=
"inputItem"
>
<text>
预购面积:
</text>
<view
class=
"inputContent"
>
<input
class=
"uni-input"
type=
"digit"
placeholder=
"请输入"
<input
class=
"uni-input"
type=
"digit"
placeholder=
"请输入"
maxlength=
"6"
v-model=
"housePurchaseInfo.preOrderSize"
@
blur=
"queryCommercialHousingPrice()"
/><label
for=
""
>
m²
</label>
</view>
...
...
@@ -42,7 +42,7 @@
<text>
预购房产现在市场单价:
</text>
<view
class=
"inputContent"
>
<input
class=
"uni-input"
type=
"digit"
placeholder=
"请输入"
v-model=
"housePurchaseInfo.targetPrice"
v-model=
"housePurchaseInfo.targetPrice"
maxlength=
"12"
/><label
for=
""
>
m²/元
</label>
</view>
</view>
...
...
@@ -92,7 +92,7 @@
<text>
已备首付:
</text>
<view
class=
"inputContent"
>
<input
class=
"uni-input"
type=
"digit"
placeholder=
"请输入"
v-model
.
trim=
"housePurchaseInfo.firstHouseAmount"
v-model
.
trim=
"housePurchaseInfo.firstHouseAmount"
maxlength=
"8"
/><label
for=
""
>
万元
</label>
</view>
</view>
...
...
@@ -103,7 +103,7 @@
</view>
<view
class=
"inputContent"
>
<input
class=
"uni-input"
type=
"digit"
placeholder=
"请输入"
v-model=
"housePurchaseInfo.repaymentSpecial"
v-model=
"housePurchaseInfo.repaymentSpecial"
maxlength=
"8"
/><label
for=
""
>
万元/年
</label>
</view>
</view>
...
...
@@ -206,7 +206,7 @@
<text>
经过测算,
</text>
<text
v-if=
"houseItem.fvDifference
<
0
"
>
您的
{{
getResultTitle
(
houseItem
.
priceType
)
}}
已超出目标值
{{
Math
.
abs
(
formatFloat
(
houseItem
.
fvPriceRealization
/
10000
)
-
formatFloat
((
houseItem
.
fvPriceDesired
/
10000
))).
toFixed
(
2
)
}}
万元,
</text>
<text
v-if=
"houseItem.fvDifference == 0"
>
您的
{{
getResultTitle
(
houseItem
.
priceType
)
}}
在
</text>
<text>
{{
resultInfos
.
nyear
}}
年后
可以达成您的目标
.
</text>
<text>
{{
resultInfos
.
nyear
}}
年后
{{
getResultTitle
(
houseItem
.
priceType
)
}}
可以满足您的需求
.
</text>
</view>
<view
class=
"line_bottom fail"
v-show=
"houseItem.fvDifference > 0"
>
<strong
style=
"font-size: 36rpx;"
>
很遗憾!
</strong>
...
...
@@ -356,10 +356,13 @@
this
.
isNeedOfficialAccountQrcode
=
ref
(
e
);
},
getPlanParams
(
e
){
console
.
log
(
'规划参数子组件传过来的===='
,
e
)
//
console.log('规划参数子组件传过来的====',e)
this
.
planningParams
=
e
;
this
.
housePurchaseInfo
.
downPaymentMin
=
this
.
planningParams
[
'downPaymentMin'
];
this
.
housePurchaseInfo
.
cityId
=
this
.
planningParams
[
'cityId'
]
this
.
housePurchaseInfo
.
cityCode
=
this
.
housePurchaseInfo
.
cityId
=
this
.
planningParams
[
'cityId'
];
this
.
housePurchaseInfo
.
provinceCode
=
this
.
planningParams
[
'provinceId'
];
this
.
housePurchaseInfo
.
provinceName
=
this
.
planningParams
[
'provinceName'
];
this
.
housePurchaseInfo
.
cityName
=
this
.
planningParams
[
'cityName'
];
// 从规划参数弹窗获取数据
this
.
closeBtn
()
},
...
...
@@ -401,7 +404,7 @@
list1
=
this
.
housePurchasePrices
.
filter
((
item
)
=>
{
return
item
.
priceType
==
type
})[
0
];
showLists
=
[].
concat
(
this
.
formatFloat
(
list1
.
pvPriceRealization
/
10000
),
this
.
formatFloat
(
list1
.
pvPriceDesired
/
10000
),
showLists
=
[].
concat
(
this
.
formatFloat
(
list1
.
pvPriceRealization
/
10000
,
2
,
2
),
this
.
formatFloat
(
list1
.
pvPriceDesired
/
10000
,
2
,
2
),
{
value
:
this
.
formatFloat
(
Math
.
abs
(
list1
.
pvDifference
)
/
10000
),
itemStyle
:{
color
:
'#ff0000'
}})
}
}
...
...
@@ -444,14 +447,24 @@
if
(
!
this
.
housePurchaseInfo
.
nyear
){
common
.
errorDialog
(
1
,
'请填写几年后购房'
)
return
false
;
}
else
{
if
(
this
.
housePurchaseInfo
.
nyear
<=
0
||
this
.
housePurchaseInfo
.
nyear
>
30
){
common
.
errorDialog
(
1
,
'购房测算建议预估购房年数不超过30'
)
return
false
;
}
}
if
(
!
this
.
housePurchaseInfo
.
province
Name
||
!
this
.
housePurchaseInfo
.
provinceCode
||
!
this
.
housePurchaseInfo
.
cityCode
||
!
this
.
housePurchaseInfo
.
cityNam
e
){
if
(
!
this
.
housePurchaseInfo
.
province
Code
||
!
this
.
housePurchaseInfo
.
cityCod
e
){
common
.
errorDialog
(
1
,
'请选择预购城市'
)
return
false
;
}
if
(
!
this
.
housePurchaseInfo
.
preOrderSize
){
common
.
errorDialog
(
1
,
'请填写预购面积'
)
return
false
;
}
else
{
if
(
this
.
housePurchaseInfo
.
preOrderSize
>
1000
){
common
.
errorDialog
(
1
,
'住房面积一般不会超过1000㎡'
)
return
false
;
}
}
if
(
!
this
.
housePurchaseInfo
.
targetPrice
){
common
.
errorDialog
(
1
,
'请填写预购房产现在市场单价'
)
...
...
@@ -460,19 +473,29 @@
if
(
!
this
.
housePurchaseInfo
.
downPaymentMin
){
common
.
errorDialog
(
1
,
'请填写首付款最低成数'
)
return
false
;
}
else
{
if
(
this
.
housePurchaseInfo
.
downPaymentMin
>
100
||
this
.
housePurchaseInfo
.
downPaymentMin
<
0
){
common
.
errorDialog
(
1
,
'首付款最低成数不应超过100%,且不应少于0'
)
return
false
;
}
}
if
(
!
this
.
housePurchaseInfo
.
newLoanYear
){
common
.
errorDialog
(
1
,
'请填写新房贷款年限'
)
return
false
;
}
else
{
if
(
this
.
housePurchaseInfo
.
newLoanYear
<
=
0
){
common
.
errorDialog
(
2
,
'新房贷款年限
必须大于0
'
)
if
(
this
.
housePurchaseInfo
.
newLoanYear
<
0
||
this
.
housePurchaseInfo
.
newLoanYear
>
3
0
){
common
.
errorDialog
(
2
,
'新房贷款年限
最长不超过30年
'
)
return
false
;
}
}
if
(
!
this
.
housePurchaseInfo
.
interestRate
){
common
.
errorDialog
(
1
,
'请填写新房贷款年利率'
)
return
false
;
}
else
{
if
(
this
.
housePurchaseInfo
.
interestRate
>
24
){
common
.
errorDialog
(
1
,
'新房贷款年利率不应超过24%'
)
return
false
;
}
}
if
(
!
this
.
housePurchaseInfo
.
housePurchaseType
){
common
.
errorDialog
(
1
,
'请填写购房用途'
)
...
...
@@ -483,7 +506,7 @@
return
false
;
}
if
(
!
this
.
housePurchaseInfo
.
repaymentSpecial
){
common
.
errorDialog
(
1
,
'请填写年
预备还房贷资金总额
'
)
common
.
errorDialog
(
1
,
'请填写年
末预备投入房产资金
'
)
return
false
;
}
// 规划参数默认值
...
...
pages/housePurchase/planningParameters.vue
View file @
ad85629f
...
...
@@ -77,6 +77,8 @@
...
this
.
cityInfo
,
cityId
:
node
.
value
,
provinceId
:
node
.
parent_value
?
node
.
parent_value
:
null
,
cityName
:
node
.
parent_value
?
node
.
text
:
this
.
cityInfo
.
cityName
,
provinceName
:
node
.
parent_value
?
this
.
cityInfo
.
provinceName
:
node
.
text
,
}
this
.
queryCommercialHousingPrice
()
},
...
...
@@ -91,6 +93,16 @@
})
},
confirmParams
(){
for
(
let
i
=
0
;
i
<
this
.
editParamLists
.
length
;
i
++
){
if
(
this
.
editParamLists
[
i
].
alias
===
'tnvestmentRate'
&&
this
.
editParamLists
[
i
].
value
>
2000
){
common
.
errorDialog
(
1
,
`
${
this
.
editParamLists
[
i
].
name
}
一般最高不超过2000`
)
;
return
false
;
}
if
(
this
.
editParamLists
[
i
].
value
>
100
){
common
.
errorDialog
(
1
,
`
${
this
.
editParamLists
[
i
].
name
}
最高不应超过100`
)
;
return
false
;
}
}
const
params
=
{
housePriceGrowthRate
:(
this
.
editParamLists
.
filter
(
item
=>
item
.
alias
===
'housePriceGrowthRate'
)[
0
].
value
/
100
).
toFixed
(
4
),
//房价增长率
houseDepreciationRate
:(
this
.
editParamLists
.
filter
(
item
=>
item
.
alias
===
'houseDepreciationRate'
)[
0
].
value
/
100
).
toFixed
(
4
),
//房屋折旧率
...
...
@@ -98,7 +110,10 @@
tnvestmentRate
:(
this
.
editParamLists
.
filter
(
item
=>
item
.
alias
===
'tnvestmentRate'
)[
0
].
value
/
100
).
toFixed
(
4
),
//投资回报率
incomeRate
:(
this
.
editParamLists
.
filter
(
item
=>
item
.
alias
===
'incomeRate'
)[
0
].
value
/
100
).
toFixed
(
4
),
//收入增长率
acceptableLossRate
:(
this
.
editParamLists
.
filter
(
item
=>
item
.
alias
===
'acceptableLossRate'
)[
0
].
value
/
100
).
toFixed
(
4
),
//可接受本金损失率,
cityId
:
this
.
cityInfo
.
cityId
cityId
:
this
.
cityInfo
.
cityId
,
provinceId
:
this
.
cityInfo
.
provinceId
,
provinceName
:
this
.
cityInfo
.
provinceName
,
cityName
:
this
.
cityInfo
.
cityName
,
}
this
.
sendData
(
params
)
},
...
...
@@ -116,9 +131,8 @@
if
(
!
(
JSON
.
stringify
(
this
.
planningParams
)
==
'{}'
)){
const
result
=
this
.
planningParams
;
this
.
editParamLists
.
map
(
item
=>
{
if
(
result
[
item
.
alias
]){
if
(
result
[
item
.
alias
]
&&
result
[
item
.
value
]
){
item
.
value
=
result
[
'downPaymentMin'
].
value
;
console
.
log
(
item
.
value
)
// 首付成数不需要换算
if
(
item
.
alias
!==
'downPaymentMin'
){
if
(
result
[
item
.
alias
].
value
){
...
...
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