10.10综合交易所原始源码_移动端
admin
2026-01-06 42faef34194c466f03e29d75a63ae502e4213044
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<template>
    <div id="cryptos">
        <div class="pledgeLoanRenew">
            <assets-head :title="$t('续借')"></assets-head>
            <div class="contentBox">
                <div class="content mt-4 box-shad tabBackground">
                    <div class="mb-9">
                        <div class="text-32 textColor">{{ $t('借款') }}</div>
                        <div class="flex mt-5 h-24 items-center inputBox inputBackground1 textColor">
                            <input class="h-full pl-5 inputBackground1 text-24" type="text" v-model="loanAmount"
                                @input="changeMount" :placeholder="$t('请输入借款数量')">
                            <div class="right w-63 h-13 flex items-center pl-7 box-border relative" @click="openSelect">
                                <img src="@/assets/image/USD.png" class="w-12 h-12" alt="">
                                <span class="ml-3 mr-7">USD</span>
                                <img src="@/assets/image/icon-more.png" alt="logo" class="w-6 h-6" />
                                <div class="slectBox" v-show="isShow" @click.stop="isShow = false;">
                                    <div class="h-16 border-b-color">Select</div>
                                    <div class="flex items-center h-20">
                                        <img src="@/assets/image/USD.png" class="w-10 h-10" alt="">
                                        <span class="ml-3 text-24 text-grey">USD</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <p class="mt-6 text-grey text-24 flex justify-between">
                            <span>{{ $t('强平价格') }}({{ pledgeCurrency ? pledgeCurrency.toUpperCase() : '--' }}/USD)</span>
                            <span class="textColor">{{ closeOut || '--' }}</span>
                        </p>
                        <p class="mt-6 text-grey text-24 flex justify-between">
                            <span>{{ $t('质押率') }}</span>
                            <span class="textColor">{{ pledgeRate !== '' ? (pledgeRate * 10000 / 100).toFixed(2) : '--'
                            }}%</span>
                        </p>
                        <p class="mt-6 text-grey text-24 flex justify-between">
                            <span>{{ $t('小时利率') }}</span>
                            <span class="textColor">{{ hourlyRate || '--' }}</span>
                        </p>
                        <p class="mt-6 text-grey text-24 flex justify-between">
                            <span>{{ $t('日利率') }}</span>
                            <span class="textColor">{{ hourlyRate ? hourlyRate * 24 : '--' }}</span>
                        </p>
                        <div class="queIcon mt-8" @click="showMask = true"><img src="@/assets/image/skyQuestion.png"
                                class="w-6 h-6" alt=""></div>
                        <p class="mt-12 text-32 text-grey flex justify-between">
                            <span>{{ $t('总利息') }}</span>
                            <span class="textColor">{{ interestAmount || '--' }}&nbsp;USD</span>
                        </p>
                        <p class="mt-12 text-32 text-grey flex justify-between">
                            <span>{{ $t('预计还款') }}</span>
                            <span class="textColor">{{ debtAmount || '--' }}&nbsp;USD</span>
                        </p>
                        <div class="h-24 pledgeLoan_background rounded-lg text-center text-black text-34 mt-12 flex items-center justify-center"
                            @click="submitRefurbishOrder">{{ $t('借币') }}</div>
                    </div>
                </div>
            </div>
            <rule-mask v-model="showMask"></rule-mask>
        </div>
    </div>
</template>
 
<script>
import assetsHead from "@/components/Transform/assets-head/index.vue";
import ruleMask from "./ruleMask.vue";
import { _getLoanParam, _refurbishOrder } from "@/service/pledgeLoan.js";
import { debounce } from '@/utils/utis'
import { showToast } from "vant";
export default {
    props: {
 
    },
    components: {
        assetsHead,
        ruleMask
    },
    data() {
        return {
            id: '',
            isShow: false,
            showMask: false,
            loanAmount: '',
            closeOut: '',
            debtAmount: '',
            hourlyRate: '',
            interestAmount: '',
            pledgeRate: '',
            pledgeCurrency: ''
        }
    },
    mounted() {
        this.id = this.$route.query.id
        this.pledgeCurrency = this.$route.query.pledgeCurrency
    },
    methods: {
        openSelect() {
            this.isShow = !this.isShow
        },
        changeMount() {
            if (this.loanAmount !== '') {
                this.loanAmount = this.loanAmount.replace(/[^0-9]/g, '')
                this.debounceFn()
            }
        },
        debounceFn: debounce(function () {
            this.getLoanParamFn()
        }, 500),
        getLoanParamFn() {
            _getLoanParam({
                loanAmount: this.loanAmount,
                loanOrderId: this.$route.query.id,
            }).then(res => {
                this.closeOut = res.closeOut
                this.debtAmount = res.debtAmount
                this.hourlyRate = res.hourlyRate
                this.interestAmount = res.interestAmount
                this.pledgeRate = res.pledgeRate
            }).catch(error => {
                if (error.code == 20) {
                    if (error.msg * 1 < 0) {
                        showToast(this.$t('质押数量已达到最大可借额度'))
                    } else {
                        showToast(this.$t('最大可借:') + error.msg)
                    }
 
                } else if (error.code === 'ECONNABORTED') { showToast(this.$t('网络超时!')); }
                else if (error.msg !== undefined) { showToast(this.$t(error.msg)); }
            })
        },
        submitRefurbishOrder() {
            if (this.loanAmount == '') {
                showToast(this.$t('请输入借款数量'))
                return false;
            }
            _refurbishOrder({
                loanOrderId: this.id,
                loanAmount: this.loanAmount
            }).then(res => {
                showToast(this.$t('续借成功'));
                this.$router.push('/cryptos/pledgeLoanOrder')
            }).catch(error => {
                if (error.code === 'ECONNABORTED') { showToast(this.$t('网络超时!')); }
                else if (error.msg !== undefined) { showToast(this.$t(error.msg)); }
            })
        }
    }
}
</script>
 
<style lang="scss" scoped>
#cryptos {
    .pledgeLoanRenew {
        width: 100%;
        box-sizing: border-box;
    }
 
    .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;
            }
 
            .right {
                border-left: 1px solid #B8BCC5;
            }
        }
 
    }
 
    .slectBox {
        position: absolute;
        left: 0;
        top: 114px;
        width: 100%;
 
        background: $main_background;
        border-radius: 4px;
        padding: 0px 20px 76px 20px;
        box-sizing: border-box;
        border: 1px solid $border_color;
        z-index: 2;
    }
}
</style>