1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<template>
<div>
<div class="card" :model="test2">
<div class="d-flex" style="margin-top: 6%;margin-left: 5%">贷款金额(元)<van-field v-model="test2.loanAmt" placeholder="请输入贷款金额" style="width: 50%;margin-top: -4%;margin-left: auto;"></van-field></div>
<div class="d-flex" style="margin-top: 6%;margin-left: 5%">贷款期限(月)<van-field v-model="test2.loanTime" placeholder="请输入贷款期限" style="width: 50%;margin-top: -4%;margin-left: auto"></van-field></div>
<div class="d-flex" style="margin-top: 6%;margin-left: 5%">计划月还款(元)<van-field v-model="test2.planMonthRepay" placeholder="请输入计划月还款" style="width: 50%;margin-top: -4%;margin-left: auto"></van-field></div>
<div class="d-flex" style="margin-top: 6%;margin-left: 5%">贷款利率(%)<van-field v-model="test2.loanRate" placeholder="请输入贷款利率" style="width: 50%;margin-top: -4%;margin-left: auto;"></van-field></div>
<div class="d-flex" style="margin-top: 6%;margin-left: 5%">贷款种类
<a-select v-model:value="test2.loanType" :options="loanTypes" placeholder="请选择贷款种类" style="width: 50%;margin-top: -2%;margin-left: auto">
</a-select>
</div>
<div class="d-flex" style="margin-top: 6%;margin-left: 5%;margin-bottom: 6%">还款方式<a-select :v-model="test2.repayType" @change="handleChoiceChange" placeholder="请选择还款方式" style="width: 50%;margin-top: -2%;margin-left: auto">
<a-select-option v-for="(item, index) in choices" :key="index" :value="item">
{{item}}
</a-select-option>
</a-select></div>
</div>
<div>
<van-button style="width: 90%;margin-left: 5%;background-color: #1890ff;position: absolute;margin-top: 86%;height: 6%;border-radius: 5px;" type="primary" @click="countB">计算</van-button>
<van-button style="width: 90%;margin-left: 5%;position: absolute;margin-top: 102%;height: 6%;border-radius: 5px;border-color: #1890ff"><span style="color: #1890ff">清除</span></van-button>
</div>
</div>
</template>
<script lang="ts">
import {Component, Vue} from "vue-property-decorator";
@Component({
name: "LoanTrial"
})
export default class LoanTrial extends Vue {
choices: string[] = ["利随本清","等额本金","等额本息"];
test2: any = {
loanAmt: "",
loanTime: "",
planMonthRepay : "",
loanRate: "",
loanType: undefined,
repayType: "",
};
loanTypes: any[] = [
{
value : "有抵押",
label : "有抵押",
},{
value : "无抵押",
label : "无抵押",
}
];
handleChoiceChange(value:any) {
this.test2.repayType = value;
}
countB() {
let result = 0;
result = parseInt(this.test2.loanAmt)*parseInt(this.test2.loanRate)/100*parseInt(this.test2.loanTime)/12;
this.$router.push({
name: "CountResult",
params: {
loanAmt: this.test2.loanAmt,
loanTime: this.test2.loanTime,
planMonthRepay: this.test2.planMonthRepay,
loanRate: this.test2.loanRate,
loanType: this.test2.loanType,
repayType: this.test2.repayType,
result: result.toString(),
}
})
}
}
</script>
<style scoped lang="scss">
.card{
position: absolute;
background-color: #ffffff;
width: 90%;
margin-left: 5%;
margin-top: -30%;
}
</style>