10.10综合交易所原始源码_移动端
1
admin
2026-02-10 c547081aa61be5c7b6d4c12853c675954c2156eb
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<template>
    <div id="cryptos">
        <div class="repayment">
            <assets-head :title="$t('还款')"></assets-head>
            <div class="contentBox">
                <div class="content mt-6 box-shad tabBackground">
                    <div class="mb-10">
                        <div class="text-32 textColor">{{ $t('还款') }}</div>
                        <div class="flex mt-5 h-20 pr-8 items-center inputBox inputBackground1 textColor">
                            <input class="h-full pl-5 inputBackground1 text-28" type="number" v-model="repayAmount"
                                @input="changeMount" :placeholder="$t('请输入还款数量')">
                            <div class="right h-16 flex items-center pl-6 box-border relative text-30">
                                <span>USD</span>
                                <span class="skyColor ml-7" @click="repayAll">ALL</span>
                            </div>
                        </div>
                        <div class="flex items-center text-24 mt-6 text-grey">
                            {{ $t('可用余额') }}:<span class="mr-3">{{ volume || '--' }}&nbsp;USD</span><img
                                @click="$router.push('/cryptos/exchangePage')" src="@/assets/image/exchangeIcon.png"
                                class="w-7 h-7" alt="" />
                        </div>
                        <p class="mt-20 text-grey text-28 flex justify-between">
                            <span>{{ $t('总负债') }}</span>
                            <span class="textColor">{{ debtAmount || '--' }}&nbsp;USD</span>
                        </p>
                        <p class="mt-9 text-grey text-28 flex justify-between">
                            <span>{{ $t('利息') }}</span>
                            <span class="textColor">{{ interestAmount !== '' ? interestAmount : '--' }}&nbsp;USD</span>
                        </p>
                        <p class="mt-9 text-grey text-28 flex justify-between">
                            <span>{{ $t('本金还款') }}</span>
                            <span class="textColor">{{ loanAmount || '--' }}&nbsp;USD</span>
                        </p>
                        <p class="mt-9 text-32 text-grey flex justify-between">
                            <span>{{ $t('还款后质押率') }}</span>
                            <span class="textColor">{{ pledgeRate !== '' ? (pledgeRate * 10000 / 100).toFixed(2) : '--'
                            }}%</span>
                        </p>
                        <div class="h-20 lh-20 rounded-lg text-center text-34 mt-20 flex justify-center items-center"
                            :class="repayAmount ? 'pledgeLoan_background text-black ' : 'bgDark text-grey'" @click="submit">
                            {{ $t('确认还款') }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script>
import assetsHead from "@/components/Transform/assets-head/index.vue";
import { _getLoanParam, _repayOrder } from "@/service/pledgeLoan.js";
import { debounce } from '@/utils/utis'
import { _getAllWallet } from '@/service/fund.api';
import { showToast } from "vant";
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 !== '') {
                if (this.repayAmount >= this.debtAmount) {
                    this.repayAmount = this.debtAmount
                }
                this.debounceFn()
            } else {
                this.pledgeRate = ''
            }
        },
        debounceFn: debounce(function () {
            this.getLoanParamFn()
        }, 500),
        getLoanParamFn() {
            _getLoanParam({
                repayAmount: this.repayAmount,
                loanOrderId: this.id,
            }).then(res => {
                this.pledgeRate = res.pledgeRate
            }).catch(error => {
                if (error.code === 'ECONNABORTED') { showToast(this.$t('网络超时!')); }
                else if (error.msg !== undefined) { showToast(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.getLoanParamFn();
        },
        submit() {
            if (this.repayAmount == 0) {
                showToast(this.$t('还款金额不能为0'));
                return false
            }
            _repayOrder({
                repayAmount: this.repayAmount,
                loanOrderId: this.id,
            }).then(res => {
                showToast(this.$t('还款成功'));
                this.$router.push('/cryptos/pledgeLoanOrder')
            })
        }
    }
}
</script>
 
<style lang="scss" scoped>
#cryptos {
    .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>