|
@@ -1,24 +1,24 @@
|
|
|
<template>
|
|
|
<!-- 公共组件 -->
|
|
|
<div class="info">
|
|
|
- <v-head :title="'Withdraw'" :show_more="true" ></v-head>
|
|
|
+ <v-head :title="'Withdraw'" :show_more="true"></v-head>
|
|
|
<!-- 内容 -->
|
|
|
<div class="content">
|
|
|
<div class="area-input-1">
|
|
|
<div class="token">
|
|
|
<div class="title">Token</div>
|
|
|
<div class="box">
|
|
|
- <img src="" alt="">
|
|
|
- <span>USDT</span>
|
|
|
+ <img :src="withdraw_info.icon_token" alt="">
|
|
|
+ <span>{{ withdraw_info.token }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="net">
|
|
|
<div class="title">NetWork</div>
|
|
|
<div class="box">
|
|
|
- <img src="" alt="">
|
|
|
- <span>BNB Chain</span>
|
|
|
- <img :src="require('@/assets/svg/icon-botton-up.svg')" alt="" class="up">
|
|
|
+ <img :src="withdraw_info.icon_net" alt="">
|
|
|
+ <span>{{ withdraw_info.net }}</span>
|
|
|
+ <!-- <img :src="require('@/assets/svg/icon-botton-up.svg')" alt="" class="up"> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -26,20 +26,20 @@
|
|
|
<div class="area-input-2">
|
|
|
<div class="title">Wallet Address</div>
|
|
|
<div class="box">
|
|
|
- <input type="text" placeholder="Click to enter">
|
|
|
+ <input type="text" placeholder="Click to enter" v-model="state.input_address" @input="inputText">
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="area-input-3">
|
|
|
<div class="title">
|
|
|
<span>Withdrawal Amount</span>
|
|
|
- <span>Balance: 122.51</span>
|
|
|
+ <span>Balance: {{ state.balance || 0 }}</span>
|
|
|
</div>
|
|
|
<div class="box">
|
|
|
- <input type="text" placeholder="0">
|
|
|
- <span>Withdrawal All</span>
|
|
|
+ <input type="number" placeholder="0" @input="inputText" v-model="state.input_amount" :max="state.max_amount">
|
|
|
+ <span @click="clickWithdrawalAll">Withdrawal All</span>
|
|
|
</div>
|
|
|
- <div class="error">最少XXXX,最多XXXX</div>
|
|
|
+ <div class="error">{{ state.error_msg }}</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="tips">
|
|
@@ -51,11 +51,11 @@
|
|
|
<div class="footer">
|
|
|
<div class="left">
|
|
|
<div class="txt">Amount Account</div>
|
|
|
- <div class="money">0</div>
|
|
|
- <div class="txt">Network fee: 0.8 USDT</div>
|
|
|
+ <div class="money">{{ state.amount || 0 }} {{ state.currency_code }}</div>
|
|
|
+ <div class="txt">Network fee: {{ state.fee_amount }}</div>
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
- <div class="btn" @click="clickBtn">Confirm</div>
|
|
|
+ <div class="btn" @click="clickBtn" :class="{ enter: state.is_enter_state }">Confirm</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -65,9 +65,106 @@
|
|
|
<script setup>
|
|
|
import VHead from '@/view/popup/components/head.vue'
|
|
|
import router from "@/router/popup.js";
|
|
|
+import { reactive, onMounted, inject } from 'vue'
|
|
|
+import { getWithdrawConfig } from "@/http/account";
|
|
|
+import { withdrawCalcFee } from "@/http/pay";
|
|
|
+
|
|
|
+let withdraw_info = inject('withdraw_info')
|
|
|
+
|
|
|
+let state = reactive({
|
|
|
+ input_address: '',
|
|
|
+ input_amount: 0,
|
|
|
+ is_enter_state: false,
|
|
|
+ error_msg: 'Wallet Address不能为空'
|
|
|
+})
|
|
|
+
|
|
|
+const inputWithdrawCalcFee = () => {
|
|
|
+ withdrawCalcFee({
|
|
|
+ params: {
|
|
|
+ "amountValue": state.input_amount,
|
|
|
+ "currencyCode": state.currency_code,
|
|
|
+ "withdrawNetwork": 0
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ if (res.data) {
|
|
|
+ state.currency_code = res.data.currencyCode || ''
|
|
|
+ state.fee_amount = res.data.feeAmountValue || 0
|
|
|
+ state.amount = res.data.finalAmountValue || 111
|
|
|
+
|
|
|
+ state.is_enter_state = true
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-function clickBtn(){
|
|
|
- router.push('/withdraw/confirm')
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const inputText = () => {
|
|
|
+ if (state.input_address.trim().length == 0) {
|
|
|
+ state.error_msg = 'Wallet Address不能为空'
|
|
|
+ state.is_enter_state = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (state.input_amount > state.max_amount || state.input_amount < state.min_amount) {
|
|
|
+ state.error_msg = `最小为${state.min_amount},最大${state.max_amount}`
|
|
|
+ state.is_enter_state = false
|
|
|
+ } else {
|
|
|
+ state.error_msg = ''
|
|
|
+ inputWithdrawCalcFee()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const clickBtn = () => {
|
|
|
+ if (state.is_enter_state) {
|
|
|
+ withdraw_info.data = state
|
|
|
+ router.push('/withdraw/confirm')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const initConfig = () => {
|
|
|
+ state.fee_amount = 0.1
|
|
|
+ state.balance = 123
|
|
|
+ // 单次提现最小金额
|
|
|
+ state.min_amount = 11
|
|
|
+ // 单次提现最小金额
|
|
|
+ state.max_amount = 123
|
|
|
+ state.currency_code = 'USD'
|
|
|
+
|
|
|
+ // getWithdrawConfig({
|
|
|
+ // params: {
|
|
|
+ // "currencyCode": "string",
|
|
|
+ // "withdrawNetwork": 0
|
|
|
+ // }
|
|
|
+ // }).then((res) => {
|
|
|
+ // switch (res.code.toString()) {
|
|
|
+ // case '0':
|
|
|
+ // // 关闭提现功能
|
|
|
+ // if (!res.data.withdrawSwitch) {
|
|
|
+ // state.error_msg = '关闭提现功能'
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // state.fee_amount = res.data.withdrawFee
|
|
|
+ // state.min_amount = res.data.withdrawPerMinAmount
|
|
|
+ //
|
|
|
+ // state.max_amount = res.data.withdrawPerMaxAmount
|
|
|
+ // break;
|
|
|
+ // case '0':
|
|
|
+
|
|
|
+ // break;
|
|
|
+
|
|
|
+ // default:
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ initConfig()
|
|
|
+})
|
|
|
+
|
|
|
+const clickWithdrawalAll = () => {
|
|
|
+ state.input_amount = state.max_amount
|
|
|
+ inputText()
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -147,22 +244,32 @@ function clickBtn(){
|
|
|
height: 44px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- padding: 5px 18px;
|
|
|
|
|
|
input {
|
|
|
outline: none;
|
|
|
border: 0;
|
|
|
flex: 1;
|
|
|
- height: 100%;
|
|
|
+ height: 18px;
|
|
|
+ padding: 0 16px;
|
|
|
font-weight: 500;
|
|
|
font-size: 15px;
|
|
|
}
|
|
|
|
|
|
+ input::-webkit-outer-spin-button,
|
|
|
+ input::-webkit-inner-spin-button {
|
|
|
+ -webkit-appearance: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ input[type="number"] {
|
|
|
+ -moz-appearance: textfield;
|
|
|
+ }
|
|
|
+
|
|
|
span {
|
|
|
display: block;
|
|
|
color: #389AFF;
|
|
|
font-size: 13px;
|
|
|
cursor: pointer;
|
|
|
+ margin-right: 16px;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -232,6 +339,10 @@ function clickBtn(){
|
|
|
border-radius: 100px;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ .enter {
|
|
|
+ background: #389AFF;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|