Commit c6f3f133 by Chao Sun

旧房贷款余额组件通信

parent 2ebf9aa4
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
const model = { // 把后端返回过来的数据里面的键给替换成我想要的键 const model = { // 把后端返回过来的数据里面的键给替换成我想要的键
source: x, source: x,
text: x.provinceName ? x.provinceName : x.cityName, text: x.provinceName ? x.provinceName : x.cityName,
value: x.cityId ? x.cityId: x.provinceId , value: x.provinceId ? x.provinceId : x.cityId,
}; };
const children = this.action(x.citys); // 子级数据 const children = this.action(x.citys); // 子级数据
if(children){ // 一直往下循环查找有没有children这个键,如果有就直接添加一个子级字段名,这个字段名就是存子级数据 if(children){ // 一直往下循环查找有没有children这个键,如果有就直接添加一个子级字段名,这个字段名就是存子级数据
...@@ -18,5 +18,21 @@ export default { ...@@ -18,5 +18,21 @@ export default {
} }
return model; // 返回这个数据 return model; // 返回这个数据
}); });
},
// 封装报错弹窗
errorDialog(type,content){
// type 1 必填项校验 2 规则校验
uni.showModal({
title: type===1 ? '必填项校验' : '规则校验',
content:content,
showCancel:false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
} }
} }
\ No newline at end of file
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<text>预购面积:</text> <text>预购面积:</text>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="number" placeholder="请输入" <input class="uni-input" type="number" placeholder="请输入"
maxlength="3" v-model="housePurchaseInfo.preOrderSize" v-model="housePurchaseInfo.preOrderSize"
/><label for=""></label> /><label for=""></label>
</view> </view>
</view> </view>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<text>预购房产现在市场单价:</text> <text>预购房产现在市场单价:</text>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="number" placeholder="请输入" <input class="uni-input" type="number" placeholder="请输入"
maxlength="3" v-model="housePurchaseInfo.targetPrice" v-model="housePurchaseInfo.targetPrice"
/><label for="">m²/元</label> /><label for="">m²/元</label>
</view> </view>
</view> </view>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="number" placeholder="请输入" <input class="uni-input" type="number" placeholder="请输入"
maxlength="3" v-model="housePurchaseInfo.downPaymentMin" maxlength="3" v-model="housePurchaseInfo.downPaymentMin"
/><label for=""></label> /><label for="">%</label>
</view> </view>
</view> </view>
<view class="inputItem"> <view class="inputItem">
...@@ -57,21 +57,21 @@ ...@@ -57,21 +57,21 @@
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="number" placeholder="请输入" <input class="uni-input" type="number" placeholder="请输入"
maxlength="3" v-model="housePurchaseInfo.newLoanYear" maxlength="3" v-model="housePurchaseInfo.newLoanYear"
/><label for=""></label> /><label for=""></label>
</view> </view>
</view> </view>
<view class="inputItem"> <view class="inputItem">
<text>新房贷款年利率:</text> <text>新房贷款年利率:</text>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="number" placeholder="请输入" <input class="uni-input" type="number" placeholder="请输入"
maxlength="3" v-model="housePurchaseInfo.housePriceGrowthRate" maxlength="3" v-model="housePurchaseInfo.interestRate"
/><label for=""></label> /><label for="">%</label>
</view> </view>
</view> </view>
<view class="inputItem"> <view class="inputItem">
<text style="flex: 0 0 30%;">购房用途:</text> <text style="flex: 0 0 30%;">购房用途:</text>
<view class="btn_wrapper"> <view class="btn_wrapper">
<view class="btn_item" :class="{ 'selected': housePurchaseType==housePurchaseTypeItem.id }" <view class="btn_item" :class="{ 'selected': housePurchaseInfo.housePurchaseType==housePurchaseTypeItem.id }"
v-for="housePurchaseTypeItem in housePurchaseTypeList" v-for="housePurchaseTypeItem in housePurchaseTypeList"
@click="housePurchase(housePurchaseTypeItem.id)"> @click="housePurchase(housePurchaseTypeItem.id)">
{{housePurchaseTypeItem.name}} {{housePurchaseTypeItem.name}}
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<text>已备首付:</text> <text>已备首付:</text>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="number" placeholder="请输入" <input class="uni-input" type="number" placeholder="请输入"
maxlength="3" v-model="housePurchaseInfo.firstHouseAmount" v-model="housePurchaseInfo.firstHouseAmount"
/><label for="">万元</label> /><label for="">万元</label>
</view> </view>
</view> </view>
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<text>年预备还房贷资金总额:</text> <text>年预备还房贷资金总额:</text>
<view class="inputContent"> <view class="inputContent">
<input class="uni-input" type="number" placeholder="请输入" <input class="uni-input" type="number" placeholder="请输入"
maxlength="3" v-model="housePurchaseInfo.repaymentSpecial" v-model="housePurchaseInfo.repaymentSpecial"
/><label for="">万元</label> /><label for="">万元</label>
</view> </view>
</view> </view>
...@@ -106,9 +106,11 @@ ...@@ -106,9 +106,11 @@
<!--房屋置换--> <!--房屋置换-->
<view class="houseInfo"> <view class="houseInfo">
<view class="title"> <view class="title">
<view class="radioButton" :class="{'selected':!isDisplace }"></view> <view class="radioButton" :class="{'selected':isDisplace }"
<text style="margin-left: 10rpx;">是否置换旧房</text> @click="openLoan()"></view>
<text style="margin-left: 10rpx;">是否置换旧房{{isDisplace}}</text>
</view> </view>
<view class="inputItem"> <view class="inputItem">
<text>旧房贷款余额:</text> <text>旧房贷款余额:</text>
<view class="inputContent"> <view class="inputContent">
...@@ -158,6 +160,8 @@ ...@@ -158,6 +160,8 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!--规划参数--> <!--规划参数-->
<view class="parametersInfo"> <view class="parametersInfo">
...@@ -165,11 +169,10 @@ ...@@ -165,11 +169,10 @@
<view> <view>
规划参数 规划参数
</view> </view>
<view class="view"> <view class="view" @click="isPlan = true">
查看 查看
</view> </view>
</view> </view>
</view> </view>
<!-- 操作 --> <!-- 操作 -->
...@@ -252,14 +255,14 @@ ...@@ -252,14 +255,14 @@
<foot></foot> <foot></foot>
</view> </view>
<!--旧房贷款余额组件--> <!--旧房贷款余额组件-->
<!-- <loanBalance></loanBalance> --> <loanBalance @closeLoan="closeChildLoan" :getChildLoanInfo="getChildLoanInfo" v-show="isLoanSelected"></loanBalance>
<!--规划参数组件--> <!--规划参数组件-->
<planningParameters></planningParameters> <planningParameters></planningParameters>
</template> </template>
<script> <script>
import loanBalance from './loanBalance.vue'; import loanBalance from './loanBalance.vue';
import planningParameters from './loanBalance.vue'; import planningParameters from './planningParameters.vue';
import head from '../header/header.vue'; import head from '../header/header.vue';
import foot from '../footer/footer.vue'; import foot from '../footer/footer.vue';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
...@@ -270,10 +273,11 @@ ...@@ -270,10 +273,11 @@
data(){ data(){
return{ return{
isDisplace:false, isDisplace:false,
isLoanSelected:false,
myChart:null, myChart:null,
provinceList: [],
housePurchaseInfo:{ housePurchaseInfo:{
nyear:null,//几年后购房 nyear:null,//几年后购房
provinceList: [],
provinceCode:null, provinceCode:null,
provinceName:null, provinceName:null,
cityCode:null, cityCode:null,
...@@ -285,6 +289,7 @@ ...@@ -285,6 +289,7 @@
firstHouseAmount:null,//初期购房资金(单位万) firstHouseAmount:null,//初期购房资金(单位万)
housePurchaseType:null,//购房用途 housePurchaseType:null,//购房用途
repaymentSpecial:null,//每年还贷专用款(单位万) repaymentSpecial:null,//每年还贷专用款(单位万)
interestRate:null, //贷款年利率
}, },
housePurchaseTypeList:[{id:1,name:'投资'},{id:2,name:'自住'},{id:3,name:'其他'}] housePurchaseTypeList:[{id:1,name:'投资'},{id:2,name:'自住'},{id:3,name:'其他'}]
} }
...@@ -331,15 +336,53 @@ ...@@ -331,15 +336,53 @@
console.log(res) console.log(res)
if(res['success']){ if(res['success']){
this.provinceList = common.action(res['data']['provinces']); this.provinceList = common.action(res['data']['provinces']);
console.log(this.provinceList)
} }
}) })
}, },
housePurchase(id){ housePurchase(id){
this.housePurchaseType = id; this.housePurchaseInfo.housePurchaseType = id;
}, },
startCount(){ startCount(){
if(!this.housePurchaseInfo.nyear){
common.errorDialog(1,'请填写几年后购房')
return false;
}
if(!this.housePurchaseInfo.provinceName || !this.housePurchaseInfo.provinceCode || !this.housePurchaseInfo.cityCode || !this.housePurchaseInfo.cityName){
common.errorDialog(1,'请选择预购城市')
return false;
}
if(!this.housePurchaseInfo.preOrderSize){
common.errorDialog(1,'请填写预购面积')
return false;
}
if(!this.housePurchaseInfo.targetPrice){
common.errorDialog(1,'请填写预购房产现在市场单价')
return false;
}
if(!this.housePurchaseInfo.downPaymentMin){
common.errorDialog(1,'请填写首付款最低成数')
return false;
}
if(!this.housePurchaseInfo.newLoanYear){
common.errorDialog(1,'请填写新房贷款年限')
return false;
}
if(!this.housePurchaseInfo.interestRate){
common.errorDialog(1,'请填写新房贷款年利率')
return false;
}
if(!this.housePurchaseInfo.housePurchaseType){
common.errorDialog(1,'请填写购房用途')
return false;
}
if(!this.housePurchaseInfo.firstHouseAmount){
common.errorDialog(1,'请填写已备首付')
return false;
}
if(!this.housePurchaseInfo.repaymentSpecial){
common.errorDialog(1,'请填写年预备还房贷资金总额')
return false;
}
const param = { const param = {
...this.housePurchaseInfo, ...this.housePurchaseInfo,
} }
...@@ -349,10 +392,34 @@ ...@@ -349,10 +392,34 @@
}, },
onchange(e) { onchange(e) {
const value = e.detail.value; const value = e.detail.value;
console.log(e) if(value){
this.housePurchaseInfo.provinceName = value[0]['text'];
this.housePurchaseInfo.provinceCode = value[0]['value'];
this.housePurchaseInfo.cityCode = value[1]['value'];
this.housePurchaseInfo.cityName = value[1]['text'];
}else{
this.housePurchaseInfo.provinceName = this.housePurchaseInfo.provinceCode =
this.housePurchaseInfo.cityCode = this.housePurchaseInfo.cityName = null;
}
},
closeChildLoan(){
this.isLoanSelected = false;
},
getChildLoanInfo(houseLoanOldList){
//获取旧房贷款信息
console.log(houseLoanOldList)
this.houseLoanOldList = houseLoanOldList;
}, },
onnodeclick(node) { //打开房屋置换组件
console.log(node) openLoan(){
this.isDisplace = !this.isDisplace;
if(this.isDisplace == false){
this.isLoanSelected = false;
}else{
this.isLoanSelected = true;
}
} }
}, },
mounted(){ mounted(){
......
<template> <template>
<div class="mortgageCalculatorContainer"> <div class="mortgageCalculatorContainer">
<!-- 关闭按钮 --> <!-- 关闭按钮 -->
<div class="closeBtn"> <div class="closeBtn" @click="closeBlan()">
<svg t="1663922894848" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2545" width="26" height="26"><path d="M557.311759 513.248864l265.280473-263.904314c12.54369-12.480043 12.607338-32.704421 0.127295-45.248112-12.512727-12.576374-32.704421-12.607338-45.248112-0.127295L512.127295 467.904421 249.088241 204.063755c-12.447359-12.480043-32.704421-12.54369-45.248112-0.063647-12.512727 12.480043-12.54369 32.735385-0.063647 45.280796l262.975407 263.775299-265.151458 263.744335c-12.54369 12.480043-12.607338 32.704421-0.127295 45.248112 6.239161 6.271845 14.463432 9.440452 22.687703 9.440452 8.160624 0 16.319527-3.103239 22.560409-9.311437l265.216826-263.807983 265.440452 266.240344c6.239161 6.271845 14.432469 9.407768 22.65674 9.407768 8.191587 0 16.352211-3.135923 22.591372-9.34412 12.512727-12.480043 12.54369-32.704421 0.063647-45.248112L557.311759 513.248864z" p-id="2546"></path></svg> <svg t="1663922894848" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2545" width="26" height="26"><path d="M557.311759 513.248864l265.280473-263.904314c12.54369-12.480043 12.607338-32.704421 0.127295-45.248112-12.512727-12.576374-32.704421-12.607338-45.248112-0.127295L512.127295 467.904421 249.088241 204.063755c-12.447359-12.480043-32.704421-12.54369-45.248112-0.063647-12.512727 12.480043-12.54369 32.735385-0.063647 45.280796l262.975407 263.775299-265.151458 263.744335c-12.54369 12.480043-12.607338 32.704421-0.127295 45.248112 6.239161 6.271845 14.463432 9.440452 22.687703 9.440452 8.160624 0 16.319527-3.103239 22.560409-9.311437l265.216826-263.807983 265.440452 266.240344c6.239161 6.271845 14.432469 9.407768 22.65674 9.407768 8.191587 0 16.352211-3.135923 22.591372-9.34412 12.512727-12.480043 12.54369-32.704421 0.063647-45.248112L557.311759 513.248864z" p-id="2546"></path></svg>
</div> </div>
<view class="tabTitle"> <view class="tabTitle">
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
<script> <script>
export default{ export default{
props: ['getChildLoanInfo'],
data(){ data(){
return{ return{
accumulationFundParams:[ accumulationFundParams:[
...@@ -239,8 +240,12 @@ ...@@ -239,8 +240,12 @@
// 旧房贷款信息集合 // 旧房贷款信息集合
console.log(this.houseLoanOldList) console.log(this.houseLoanOldList)
this.getChildLoanInfo(this.houseLoanOldList);
}, },
closeBlan(){
//向父组件发送关闭弹窗
this.$emit('closeLoan')
}
} }
} }
</script> </script>
......
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