<template>
|
<div class="loan">
|
<page-head :title="$t('我的贷款')">
|
<template slot="right">
|
<div class="head_right" @click="$router.push('/loanRecord')">
|
{{ $t("jl") }}
|
</div>
|
</template>
|
</page-head>
|
|
<div class="account_loan flex-between">
|
<van-row style="width:100%">
|
<van-col span="8">
|
<div class="loan_name">{{ $t("待还款金额") }}</div>
|
<div class="loan_num">{{ userInfo.refundAmount || 0 }}</div>
|
</van-col>
|
<van-col span="8">
|
<div class="loan_name">{{ $t("信用分") }}</div>
|
<div class="loan_num">{{ userInfo.creditScore || 0 }}</div>
|
</van-col>
|
<van-col span="8">
|
<div class="loan_name">{{ $t("剩余贷款额度") }}</div>
|
<div class="loan_num">{{ userInfo.loanLimit || 0 }}</div>
|
</van-col>
|
</van-row>
|
</div>
|
|
<div class="flex-center" @click="openUopup">
|
<div class="but flex-center">
|
<span>{{ $t("贷款申请") }}</span>
|
</div>
|
</div>
|
|
<!-- 申请弹窗 -->
|
<van-popup v-model="show" round>
|
<van-form class="buy_popup" @submit="popupSubmit">
|
<div class="popup_title flex-center">
|
<span>{{ $t("贷款申请") }}</span>
|
</div>
|
|
<div class="division"></div>
|
|
<div class="popup_item" style="display: grid;">
|
<p class="flex-start">
|
<span style="color:red">*</span>
|
<span>{{ $t("je") }} (MX$)</span>
|
</p>
|
<van-field
|
v-model="popupPrice"
|
:placeholder="$t('请输入')"
|
type="number"
|
clearable
|
:rules="[{ required: true, message: $t('请输入') }]"
|
/>
|
</div>
|
|
<div class="division"></div>
|
|
<div class="buts flex-between">
|
<p class="flex-center" @click="show = false">
|
<span>{{ $t("qx") }}</span>
|
</p>
|
<p class="flex-center" native-type="submit">
|
<!-- <span>{{ $t("qr") }}</span> -->
|
<van-button native-type="submit">{{ $t("qr") }}</van-button>
|
</p>
|
</div>
|
</van-form>
|
</van-popup>
|
</div>
|
</template>
|
|
<script>
|
import PageHead from "@/components/pageHead.vue";
|
import * as api from "@/axios/api";
|
import { Toast } from "vant";
|
|
export default {
|
components: {
|
PageHead
|
},
|
data() {
|
return {
|
userInfo: {},
|
show: false, // 弹窗控制
|
popupPrice: "" // 申请金额
|
};
|
},
|
created() {
|
this.getUserInfo();
|
},
|
methods: {
|
// 获取用户信息
|
async getUserInfo() {
|
let data = await api.getUserInfodata();
|
if (data.status === 0) {
|
// 判断是否登录
|
this.$store.commit("dialogVisible", false);
|
this.$store.state.userInfo = data.data;
|
this.userInfo = data.data;
|
} else {
|
this.$store.commit("dialogVisible", true);
|
}
|
},
|
// 打开申请弹窗
|
openUopup() {
|
this.popupPrice = "";
|
this.show = true;
|
},
|
// 申请提交
|
async popupSubmit() {
|
let opt = {
|
dkMoney: this.popupPrice
|
};
|
let data = await api.BuyDK(opt);
|
if (data.status === 0) {
|
Toast.success();
|
this.getUserInfo();
|
this.show = false;
|
} else {
|
Toast.fail(data.msg);
|
}
|
}
|
}
|
};
|
</script>
|
|
<style lang="less" scoped>
|
@green: #c4d600;
|
@red: #ee0a24;
|
.loan {
|
font-size: 10vw;
|
width: 100%;
|
min-height: 100vh;
|
padding-bottom: 0.3em;
|
|
.buy_popup {
|
width: 8em;
|
/deep/ .van-cell {
|
padding: 0;
|
font-size: 0.4em;
|
}
|
/deep/ .van-field__body {
|
border: 0.01em solid #f5f5f5;
|
height: 2.5em;
|
padding: 0 0.5em;
|
margin-top: 0.5em;
|
}
|
/deep/ .van-button {
|
border: none;
|
font-size: 1em;
|
color: @green;
|
}
|
.division {
|
width: 100%;
|
height: 0.25em;
|
background-color: #f5f5f5;
|
}
|
.popup_title {
|
width: 100%;
|
min-height: 1.22em;
|
font-weight: bold;
|
padding: 0 0.25em;
|
}
|
.popup_name {
|
color: @green;
|
.popup_icon {
|
background: @green;
|
color: #fff;
|
padding: 0.2em 0.35em;
|
border-radius: 0.15em;
|
margin-right: 0.3em;
|
font-size: 0.3em;
|
}
|
}
|
.popup_item {
|
width: 7.5em;
|
margin: 0 auto;
|
padding: 0.35em 0;
|
border-bottom: #f5f5f5 solid 0.01em;
|
}
|
span {
|
font-size: 0.4em;
|
}
|
.buts {
|
width: 100%;
|
height: 1.22em;
|
p {
|
height: 100%;
|
flex: 1;
|
}
|
& > p:last-child {
|
border-left: #f5f5f5 solid 0.01em;
|
color: @green;
|
}
|
}
|
}
|
.but {
|
width: 9em;
|
height: 1.2em;
|
background-color: @green;
|
color: #fff;
|
border-radius: 0.1em;
|
margin-top: 0.25em;
|
span {
|
font-size: 0.4em;
|
}
|
}
|
.account_loan {
|
height: 2em;
|
background-image: linear-gradient(to right, #e8f3ff, #c3dbf4);
|
box-shadow: 0 0 0.26667rem #0000000d;
|
width: 100%;
|
padding: 0 0.5em;
|
width: 100%;
|
|
.loan_name {
|
font-size: 0.32em;
|
color: #999;
|
margin-bottom: 0.3em;
|
font-weight: 300;
|
}
|
.loan_num {
|
font-size: 0.32em;
|
color: @red;
|
}
|
}
|
|
.head_right {
|
color: @green;
|
font-size: 0.4em;
|
}
|
}
|
</style>
|