Commit ad85629f by kyle

购房能力测算问题修改

parent f3fd25a5
...@@ -39,16 +39,18 @@ export default { ...@@ -39,16 +39,18 @@ export default {
/* /*
num:源数据 num:源数据
digitNum:保留几位小数 digitNum:保留几位小数
type:向上(1)取还是向下(2)取 type:向上(1)取
*/ */
formatFloat(num,digitNum=2,type=1){ formatFloat(num,digitNum=2,type=1){
if(num){ if(num){
if(type===1){ 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{ }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;
} }
} }
......
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
<view class="inputItem"> <view class="inputItem">
<text>预购城市:</text> <text>预购城市:</text>
<uni-data-picker placeholder="请选择地区" popup-title="请选择所在地区" :localdata="provinceList" <uni-data-picker placeholder="请选择地区" popup-title="请选择所在地区" :localdata="provinceList"
@change="onchange" @nodeclick="onnodeclick" v-model="housePurchaseInfo.cityId"> @change="onchange" @nodeclick="onnodeclick" v-model="housePurchaseInfo.cityId">
</uni-data-picker> </uni-data-picker>
</view> </view>
<view class="inputItem"> <view class="inputItem">
<text>预购面积:</text> <text>预购面积:</text>
<view class="inputContent"> <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()" v-model="housePurchaseInfo.preOrderSize" @blur="queryCommercialHousingPrice()"
/><label for=""></label> /><label for=""></label>
</view> </view>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<text>预购房产现在市场单价:</text> <text>预购房产现在市场单价:</text>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="digit" placeholder="请输入" <input class="uni-input" type="digit" placeholder="请输入"
v-model="housePurchaseInfo.targetPrice" v-model="housePurchaseInfo.targetPrice" maxlength="12"
/><label for="">m²/元</label> /><label for="">m²/元</label>
</view> </view>
</view> </view>
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<text>已备首付:</text> <text>已备首付:</text>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="digit" placeholder="请输入" <input class="uni-input" type="digit" placeholder="请输入"
v-model.trim="housePurchaseInfo.firstHouseAmount" v-model.trim="housePurchaseInfo.firstHouseAmount" maxlength="8"
/><label for="">万元</label> /><label for="">万元</label>
</view> </view>
</view> </view>
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
</view> </view>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="digit" placeholder="请输入" <input class="uni-input" type="digit" placeholder="请输入"
v-model="housePurchaseInfo.repaymentSpecial" v-model="housePurchaseInfo.repaymentSpecial" maxlength="8"
/><label for="">万元/年</label> /><label for="">万元/年</label>
</view> </view>
</view> </view>
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
<text>经过测算,</text> <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)}}已超出目标值{{Math.abs(formatFloat(houseItem.fvPriceRealization/10000)-formatFloat((houseItem.fvPriceDesired/10000))).toFixed(2)}}万元,</text>
<text v-if="houseItem.fvDifference == 0">您的{{getResultTitle(houseItem.priceType)}}</text> <text v-if="houseItem.fvDifference == 0">您的{{getResultTitle(houseItem.priceType)}}</text>
<text>{{resultInfos.nyear}}年后可以达成您的目标.</text> <text>{{resultInfos.nyear}}年后{{getResultTitle(houseItem.priceType)}}可以满足您的需求.</text>
</view> </view>
<view class="line_bottom fail" v-show="houseItem.fvDifference > 0"> <view class="line_bottom fail" v-show="houseItem.fvDifference > 0">
<strong style="font-size: 36rpx;">很遗憾!</strong> <strong style="font-size: 36rpx;">很遗憾!</strong>
...@@ -356,10 +356,13 @@ ...@@ -356,10 +356,13 @@
this.isNeedOfficialAccountQrcode= ref(e); this.isNeedOfficialAccountQrcode= ref(e);
}, },
getPlanParams(e){ getPlanParams(e){
console.log('规划参数子组件传过来的====',e) // console.log('规划参数子组件传过来的====',e)
this.planningParams = e; this.planningParams = e;
this.housePurchaseInfo.downPaymentMin = this.planningParams['downPaymentMin']; 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() this.closeBtn()
}, },
...@@ -401,7 +404,7 @@ ...@@ -401,7 +404,7 @@
list1 = this.housePurchasePrices.filter((item)=>{ list1 = this.housePurchasePrices.filter((item)=>{
return item.priceType == type return item.priceType == type
})[0]; })[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'}}) {value:this.formatFloat(Math.abs(list1.pvDifference)/10000),itemStyle:{color:'#ff0000'}})
} }
} }
...@@ -444,14 +447,24 @@ ...@@ -444,14 +447,24 @@
if(!this.housePurchaseInfo.nyear){ if(!this.housePurchaseInfo.nyear){
common.errorDialog(1,'请填写几年后购房') common.errorDialog(1,'请填写几年后购房')
return false; return false;
}else{
if(this.housePurchaseInfo.nyear <= 0 || this.housePurchaseInfo.nyear >30){
common.errorDialog(1,'购房测算建议预估购房年数不超过30')
return false;
}
} }
if(!this.housePurchaseInfo.provinceName || !this.housePurchaseInfo.provinceCode || !this.housePurchaseInfo.cityCode || !this.housePurchaseInfo.cityName){ if(!this.housePurchaseInfo.provinceCode || !this.housePurchaseInfo.cityCode){
common.errorDialog(1,'请选择预购城市') common.errorDialog(1,'请选择预购城市')
return false; return false;
} }
if(!this.housePurchaseInfo.preOrderSize){ if(!this.housePurchaseInfo.preOrderSize){
common.errorDialog(1,'请填写预购面积') common.errorDialog(1,'请填写预购面积')
return false; return false;
}else{
if(this.housePurchaseInfo.preOrderSize>1000){
common.errorDialog(1,'住房面积一般不会超过1000㎡')
return false;
}
} }
if(!this.housePurchaseInfo.targetPrice){ if(!this.housePurchaseInfo.targetPrice){
common.errorDialog(1,'请填写预购房产现在市场单价') common.errorDialog(1,'请填写预购房产现在市场单价')
...@@ -460,19 +473,29 @@ ...@@ -460,19 +473,29 @@
if(!this.housePurchaseInfo.downPaymentMin){ if(!this.housePurchaseInfo.downPaymentMin){
common.errorDialog(1,'请填写首付款最低成数') common.errorDialog(1,'请填写首付款最低成数')
return false; return false;
}else{
if(this.housePurchaseInfo.downPaymentMin>100 || this.housePurchaseInfo.downPaymentMin < 0){
common.errorDialog(1,'首付款最低成数不应超过100%,且不应少于0')
return false;
}
} }
if(!this.housePurchaseInfo.newLoanYear){ if(!this.housePurchaseInfo.newLoanYear){
common.errorDialog(1,'请填写新房贷款年限') common.errorDialog(1,'请填写新房贷款年限')
return false; return false;
}else { }else {
if(this.housePurchaseInfo.newLoanYear<=0){ if(this.housePurchaseInfo.newLoanYear<0 || this.housePurchaseInfo.newLoanYear>30){
common.errorDialog(2,'新房贷款年限必须大于0') common.errorDialog(2,'新房贷款年限最长不超过30年')
return false; return false;
} }
} }
if(!this.housePurchaseInfo.interestRate){ if(!this.housePurchaseInfo.interestRate){
common.errorDialog(1,'请填写新房贷款年利率') common.errorDialog(1,'请填写新房贷款年利率')
return false; return false;
}else{
if(this.housePurchaseInfo.interestRate > 24){
common.errorDialog(1,'新房贷款年利率不应超过24%')
return false;
}
} }
if(!this.housePurchaseInfo.housePurchaseType){ if(!this.housePurchaseInfo.housePurchaseType){
common.errorDialog(1,'请填写购房用途') common.errorDialog(1,'请填写购房用途')
...@@ -483,7 +506,7 @@ ...@@ -483,7 +506,7 @@
return false; return false;
} }
if(!this.housePurchaseInfo.repaymentSpecial){ if(!this.housePurchaseInfo.repaymentSpecial){
common.errorDialog(1,'请填写年预备还房贷资金总额') common.errorDialog(1,'请填写年末预备投入房产资金')
return false; return false;
} }
// 规划参数默认值 // 规划参数默认值
......
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
...this.cityInfo, ...this.cityInfo,
cityId: node.value, cityId: node.value,
provinceId:node.parent_value ? node.parent_value : null, 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() this.queryCommercialHousingPrice()
}, },
...@@ -91,6 +93,16 @@ ...@@ -91,6 +93,16 @@
}) })
}, },
confirmParams(){ 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 = { const params = {
housePriceGrowthRate:(this.editParamLists.filter(item=>item.alias==='housePriceGrowthRate')[0].value / 100).toFixed(4),//房价增长率 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),//房屋折旧率 houseDepreciationRate:(this.editParamLists.filter(item=>item.alias==='houseDepreciationRate')[0].value / 100).toFixed(4),//房屋折旧率
...@@ -98,7 +110,10 @@ ...@@ -98,7 +110,10 @@
tnvestmentRate:(this.editParamLists.filter(item=>item.alias==='tnvestmentRate')[0].value / 100).toFixed(4),//投资回报率 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),//收入增长率 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),//可接受本金损失率, 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) this.sendData(params)
}, },
...@@ -116,9 +131,8 @@ ...@@ -116,9 +131,8 @@
if(!(JSON.stringify(this.planningParams) == '{}')){ if(!(JSON.stringify(this.planningParams) == '{}')){
const result = this.planningParams; const result = this.planningParams;
this.editParamLists.map(item=>{ this.editParamLists.map(item=>{
if(result[item.alias]){ if(result[item.alias] && result[item.value]){
item.value = result['downPaymentMin'].value; item.value = result['downPaymentMin'].value;
console.log(item.value)
// 首付成数不需要换算 // 首付成数不需要换算
if(item.alias !== 'downPaymentMin'){ if(item.alias !== 'downPaymentMin'){
if(result[item.alias].value){ if(result[item.alias].value){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment