1
PC-20250623MANY\Administrator
2025-07-22 9ec3bd6e8d7357927533d8966f882cb5d28b3e0f
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<template>
    <div class="repayment">
        <assets-head :title="$t('还款')"></assets-head>
        <div class="contentBox">
            <div class="content mt-24 box-shad tabBackground">
                <div class="mb-38">
                    <div class="font-32 textColor">{{$t('还款')}}</div>
                    <div class="flex mt-20 h-96 pr-34 items-center inputBox inputBackground1 textColor">
                        <input class="h-full pl-22 inputBackground1" type="text" v-model="repayAmount" @input="changeMount"
                            :placeholder="$t('请输入还款数量')">
                        <div class="right h-62 flex items-center pl-26 box-border relative font-30">
                            <span>USDT</span>
                            <span class="skyColor ml-28" @click="repayAll">ALL</span>
                        </div>
                    </div>
                    <div class="flex items-center font-24 mt-24 text-grey">
                        {{$t('可用余额')}}:<span class="mr-14">{{volume || '--'}}&nbsp;USDT</span><img
                            @click="$router.push('/exchange/exchangePage')" src="../../assets/image/exchangeIcon.png" class="w-28 h-28"
                            alt="" />
                    </div>
                    <p class="mt-84 text-grey font-28 flex justify-between">
                        <span>{{$t('总负债')}}</span>
                        <span class="textColor">{{debtAmount || '--'}}&nbsp;USDT</span>
                    </p>
                    <p class="mt-36 text-grey font-28 flex justify-between">
                        <span>{{$t('利息')}}</span>
                        <span class="textColor">{{interestAmount!==''?interestAmount:'--'}}&nbsp;USDT</span>
                    </p>
                    <p class="mt-36 text-grey font-28 flex justify-between">
                        <span>{{$t('本金还款')}}</span>
                        <span class="textColor">{{loanAmount || '--'}}&nbsp;USDT</span>
                    </p>
                    <p class="mt-36 font-32 text-grey flex justify-between">
                        <span>{{$t('还款后质押率')}}</span>
                        <span class="textColor">{{pledgeRate!==''?(pledgeRate*10000/100).toFixed(2):'--'}}%</span>
                    </p>
                    <div class="h-96 lh-96 rounded-lg text-center font-34 mt-84" :class="repayAmount? 'btnMain text-black ':'bgDark text-grey'" @click="submit">
                        {{$t('确认还款')}}
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script>
import assetsHead from "@/components/assets-head";
import Axios from "@/API/pledgeLoan.js";
import { debounce } from '@/utils/utis'
import { _getAllWallet } from "@/API/fund.api";
    export default {
        props: {
 
        },
        components: {
            assetsHead
        },
        data(){
            return {
                id:'',
                debtAmount:'',//总负债
                interestAmount:'',
                loanAmount:'',
                repayAmount: '',
                volume:'',
                pledgeRate: '',
            }
        },
        mounted(){
            this.id = this.$route.query.id
            this.debtAmount = this.$route.query.debtAmount
            this.interestAmount = this.$route.query.interestAmount
            this.loanAmount = this.$route.query.loanAmount
            this.getList();
        },
        methods: {
            changeMount(){
                if (this.repayAmount !== '') {
                    this.debounceFn()
                }else{
                    this.pledgeRate = ''
                }
            },
            debounceFn: debounce(function () {
                this.getLoanParam()
            }, 500),
            getLoanParam() {
                Axios.getLoanParam({
                    repayAmount: this.repayAmount,
                    loanOrderId: this.id,
                }).then(res => {
                    this.pledgeRate = res.data.pledgeRate
                }).catch(error => {
                    if(error.code === 'ECONNABORTED'){this.$toast(this.$t('网络超时!'));}
                    else if(error.msg !== undefined){this.$toast(this.$t(error.msg));}      
                })
            },
            getList() {
                _getAllWallet().then((res) => {
                    let walletList = res.extends;
                    let initObj = walletList.find(item => {
                        return item.symbol.toLowerCase() == 'usdt'
                    })
                    this.volume = initObj.volume
                });
            },
            repayAll(){
                this.repayAmount = this.debtAmount
                this.getLoanParam();
            },
            submit(){
                Axios.repayOrder({
                    repayAmount: this.repayAmount,
                    loanOrderId: this.id,
                }).then(res => {
                    this.$toast(this.$t('还款成功'));
                    this.$router.push('/pledgeLoanOrder')
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
.repayment{
    box-sizing: border-box;
    width: 100%;
}
.contentBox {
    padding: 0 32px;
    position: relative;
    overflow: auto;
}
.content {
    border-radius: 8px;
    padding: 36px 30px 36px 34px;
    position: relative;
 
    .inputBox {
        input {
            flex: 1;
            border: none;
        }
    }
 
}
.skyColor {
    color: #13D3EB;
}
</style>