From 517b4a398d9ca06788366f2c4b94d5d8831af5fc Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Mon, 22 Sep 2025 18:29:30 +0800
Subject: [PATCH] 1
---
src/views/cryptos/Withdraw/withdrawPage.vue | 653 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 334 insertions(+), 319 deletions(-)
diff --git a/src/views/cryptos/Withdraw/withdrawPage.vue b/src/views/cryptos/Withdraw/withdrawPage.vue
index 07f458e..8fe9396 100644
--- a/src/views/cryptos/Withdraw/withdrawPage.vue
+++ b/src/views/cryptos/Withdraw/withdrawPage.vue
@@ -60,9 +60,16 @@
<span class="font-32 ml-5 text-grey">{{ value }}</span>
</div>
<p class="text-grey mt-22 font-28">{{ $t('提现费用') }}:{{ fee || '0.00' }} {{ value }}</p>
- <p class="text-white mt-46 textColor font-28">{{ $t('提币说明') }}:
+ <p class="text-grey mt-10 textColor font-28">{{ $t('提币说明') }}:
</p>
- <div class="text-grey mt-10 font-28" v-html="tip"></div>
+ <div class="text-grey mt-20 font-28" v-html="tip"></div>
+
+ <p class="font-35 mt-2 textColor">{{ $t('fundsPassword') }}</p>
+ <div class="inputBackground flex items-center justify-between h-96 rounded mt-22">
+ <input :placeholder="$t('fundsPasswordContTips')" maxlength="6"
+ class="h-full flex-1 border-none bg-none px-16 font-22 textColor" v-model="safeword" />
+ </div>
+
<van-button
class="w-768 h-100 rounded flex justify-center items-center mt-56 text-white btnMain border-none"
@click="showDetail">
@@ -124,344 +131,352 @@
</template>
<script>
- import {
- Popup,
- ActionSheet,
- showToast
- } from "vant"
- import Axios from "@/service/recharge.js"
- import {
- _withdrawFee,
- _withdrawApply
- } from "@/service/withdraw.api.js"
- import assetsHead from "@/components/Transform/assets-head/index.vue";
- import BarScan from '@/components/Transform/scan/scan.vue';
- import {
- _getAllWallet
- } from "@/service/fund.api";
- export default {
- name: "withdrawPage",
- components: {
- assetsHead,
- [Popup.name]: Popup,
- [ActionSheet.name]: ActionSheet,
- BarScan
+import {
+ Popup,
+ ActionSheet,
+ showToast
+} from "vant"
+import Axios from "@/service/recharge.js"
+import {
+ _withdrawFee,
+ _withdrawApply
+} from "@/service/withdraw.api.js"
+import assetsHead from "@/components/Transform/assets-head/index.vue";
+import BarScan from '@/components/Transform/scan/scan.vue';
+import {
+ _getAllWallet
+} from "@/service/fund.api";
+import { throttle } from "@/utils/index.js";
+export default {
+ name: "withdrawPage",
+ components: {
+ assetsHead,
+ [Popup.name]: Popup,
+ [ActionSheet.name]: ActionSheet,
+ BarScan
+ },
+ data() {
+ return {
+ tip: '',
+ value: 'USDT', //选中的币种
+ show: false,
+ showSymbol: false,
+ actions: [{
+ name: 'USDT'
+ }, {
+ name: 'BTC'
+ }, {
+ name: 'ETH'
+ }, {
+ name: 'USDC'
+ }],
+ blockList: [],
+ blockchainIndex: "",
+ usdtBalance: "", //余额
+ amount: "", //提现金额
+ fee: "", //手续费
+ volume_last: "", //到账金额
+ blockName: "", //当前链名称
+ address: "", // 二维码扫描结果
+ scancode: false, //控制是否使用扫一扫功能
+ withdraw_fee_type: '',
+ percent: 0,
+ numLenth: 3,
+ safeword: '' //资金密码
+ }
+ },
+ created() {
+ this.getBlock(this.value);
+ this.getAvailable(this.actions[0].name);
+
+
+ Axios.getRechargeTips({
+ language: this.$i18n.locale,
+ token: this.$store.state.user.userInfo.token,
+ content_code: '003',
+ }).then(res => {
+ this.tip = res.content
+ }).catch(err => {
+ if (err.code === 'ECONNABORTED') {
+ showToast(this.$t('网络超时!'));
+ } else if (err.msg !== undefined) {
+ showToast(this.$t(err.msg));
+ }
+ })
+ _withdrawFee({
+ amount: 1,
+ channel: this.value + '_' + this.blockName
+ }).then((res) => {
+ this.withdraw_fee_type = res.withdraw_fee_type
+ if (this.withdraw_fee_type == 'rate') {
+ this.percent = res.fee
+ } else {
+ this.fee = res.fee;
+ }
+ });
+ },
+ methods: {
+ getwei(value, numLenth) {
+ console.log(numLenth)
+ let str = value.toString();
+ let strIndex = str.indexOf('.');
+ if (strIndex === -1) return str;
+ str = str.substring(0, strIndex + numLenth);
+ console.log(str, numLenth)
+ return str;
},
- data() {
- return {
- tip: '',
- value: 'USDT', //选中的币种
- show: false,
- showSymbol: false,
- actions: [{
- name: 'USDT'
- }, {
- name: 'BTC'
- }, {
- name: 'ETH'
- }, {
- name: 'USDC'
- }],
- blockList: [],
- blockchainIndex: "",
- usdtBalance: "", //余额
- amount: "", //提现金额
- fee: "", //手续费
- volume_last: "", //到账金额
- blockName: "", //当前链名称
- address: "", // 二维码扫描结果
- scancode: false, //控制是否使用扫一扫功能
- withdraw_fee_type: '',
- percent: 0,
- numLenth: 3
+ // 打开相机
+ clickCode() {
+ this.scancode = true;
+ },
+ //返回扫描结果并关闭摄像头
+ getResult(result) {
+ this.address = result;
+ if (result !== "") {
+ this.scancode = false;
}
},
- created() {
- this.getBlock(this.value);
- this.getAvailable(this.actions[0].name);
-
-
- Axios.getRechargeTips({
- language: this.$i18n.locale,
- token: this.$store.state.user.userInfo.token,
- content_code: '003',
- }).then(res => {
- this.tip = res.content
- }).catch(err => {
- if (err.code === 'ECONNABORTED') {
- showToast(this.$t('网络超时!'));
- } else if (err.msg !== undefined) {
- showToast(this.$t(err.msg));
- }
- })
- _withdrawFee({
- amount: 1,
- channel: this.value + '_' + this.blockName
- }).then((res) => {
- this.withdraw_fee_type = res.withdraw_fee_type
- if (this.withdraw_fee_type == 'rate') {
- this.percent = res.fee
- } else {
- this.fee = res.fee;
+ showDetail() {
+ if (this.address.length > 63 || this.address.length == 0) {
+ showToast(this.$t('提现地址格式错误'))
+ return
+ }
+ if (!this.amount) {
+ showToast(this.$t('请输入正确数量'))
+ return
+ }
+ if (this.amount / 1 > this.usdtBalance / 1) {
+ showToast(this.$t('金额不足'))
+ return
+ }
+ this.show = true;
+ },
+ goRouter(params) {
+ this.$router.push({
+ path: params,
+ query: {
+ type: '2',
+ back: "1"
}
});
},
- methods: {
- getwei(value, numLenth) {
- console.log(numLenth)
- let str = value.toString();
- let strIndex = str.indexOf('.');
- if (strIndex === -1) return str;
- str = str.substring(0, strIndex + numLenth);
- console.log(str, numLenth)
- return str;
- },
- // 打开相机
- clickCode() {
- this.scancode = true;
- },
- //返回扫描结果并关闭摄像头
- getResult(result) {
- this.address = result;
- if (result !== "") {
- this.scancode = false;
- }
- },
- showDetail() {
- if (this.address.length > 63 || this.address.length == 0) {
- showToast(this.$t('提现地址格式错误'))
- return
- }
- if (!this.amount) {
- showToast(this.$t('请输入正确数量'))
- return
- }
- if (this.amount / 1 > this.usdtBalance / 1) {
- showToast(this.$t('金额不足'))
- return
- }
- this.show = true;
- },
- goRouter(params) {
- this.$router.push({
- path: params,
- query: {
- type: '2',
- back: "1"
- }
- });
- },
- // onConfirm() {
- // this.$router.push('/withdraw/withdrawSumbit')
- // },
- //选中币种
- onSelect(item) {
- this.amount = ''
- this.volume_last = ''
- this.fee = ''
- this.showSymbol = false;
- this.value = item.name;
- this.withdraw_fee_type = ''
- this.getBlock(item.name);
- this.getAvailable(item.name)
- if (item.name == 'BTC' || item.name == 'ETH') {
- this.numLenth = 7
- _withdrawFee({
- amount: 1,
- channel: this.value + '_' + this.blockName
- }).then((res) => {
- this.withdraw_fee_type = res.withdraw_fee_type
- if (this.withdraw_fee_type == 'fixed') {
- this.fee = res.fee;
- } else {
- this.percent = res.fee
- }
- });
- } else {
- this.numLenth = 3
- }
- },
- //根据币种获取链地址
- getBlock(symbol) {
- Axios.getBlock({
- coin: symbol
+ // onConfirm() {
+ // this.$router.push('/withdraw/withdrawSumbit')
+ // },
+ //选中币种
+ onSelect(item) {
+ this.amount = ''
+ this.volume_last = ''
+ this.fee = ''
+ this.showSymbol = false;
+ this.value = item.name;
+ this.withdraw_fee_type = ''
+ this.getBlock(item.name);
+ this.getAvailable(item.name)
+ if (item.name == 'BTC' || item.name == 'ETH') {
+ this.numLenth = 7
+ _withdrawFee({
+ amount: 1,
+ channel: this.value + '_' + this.blockName
}).then((res) => {
- this.blockList = res;
- this.blockName = res[0].blockchain_name;
- });
- },
- //选中链名称
- changeBlockchain(item, index) {
- this.blockchainIndex = index;
- this.blockName = item.blockchain_name;
- },
- //获取钱包余额
- getAvailable(symbol) {
- _getAllWallet().then((res) => {
- let walletList = res.extends;
- let initObj = walletList.find(item => {
- return item.symbol_data.toLowerCase() == symbol.toLowerCase()
- })
- this.usdtBalance = initObj.volume
- });
- },
- //点全部
- allBtn() {
- this.amount = this.getwei(this.usdtBalance, this.numLenth);
- this.changeInput()
- },
- //输入改变
- changeInput() {
- if (this.amount === '') {
- this.volume_last = '0.00'
- return
- }
- if (this.amount.length > 11) {
- this.amount = this.amount.slice(0, 11)
- }
-
- if (this.withdraw_fee_type == 'part') {
- _withdrawFee({
- amount: this.amount,
- channel: this.value + '_' + this.blockName
- }).then((res) => {
- console.log(res)
+ this.withdraw_fee_type = res.withdraw_fee_type
+ if (this.withdraw_fee_type == 'fixed') {
this.fee = res.fee;
- this.volume_last = res.volume_last;
- });
- } else if (this.withdraw_fee_type == 'rate') {
- if (this.amount == '') {
- this.volume_last = 0
} else {
- this.fee = this.getwei(this.percent * this.amount, this.numLenth)
- this.volume_last = this.getwei(this.amount * 1 - this.percent * this.amount, this.numLenth)
+ this.percent = res.fee
}
- } else {
- if (this.amount * 1 < this.fee * 1) {
- console.log('a')
- this.volume_last = 0
- } else {
- this.volume_last = this.getwei(this.amount * 1 - this.fee * 1, this.numLenth)
- }
- }
-
- },
- //提币提交
- onConfirm() {
- if (!this.amount) {
- showToast(this.$t('请输入数量'));
- return;
- }
-
- let numReg = /^[0-9]+([.]{1}[0-9]+){0,1}$/;
- if (!numReg.test(this.amount)) {
- showToast(this.$t('请输入数字'));
- return;
- }
-
- if (!this.address) {
- showToast(this.$t('请输入提现地址'));
- return;
- }
-
- if (this.amount && this.address) {
- // this.$router.push({
- // path: '/cryptos/withdraw/securityVerification',
- // query: {
- // amount: this.amount,
- // from: this.address,
- // channel: this.value + '_' + this.blockName
- // }
- // })
- // _withdrawApply({
- // session_token:this.sessionToken,
- // amount:this.amount,
- // from:this.address,
- // channel:this.value+'_'+ this.blockName
- // }).then((res)=> {
- // if(res.code==0) {
- // this.$router.push({
- // path:"/withdraw/withdrawSumbit"
- // });
- // }else{
- // showToast(this.$t(res.msg));
- // }
- // });
- _withdrawApply({
- session_token:this.sessionToken,
- amount:this.amount,
- from:this.address,
- channel:this.value+'_'+ this.blockName
- }).then((res) => {
-
- this.$router.push({
- path: "/cryptos/withdraw/withdrawSumbit"
- });
-
- }).catch(err => {
- //console.log(err)
- if (err.code == 105) {
- showToast(this.$t('当前还需交易%s,才可提币', {
- 'MONEY': err.msg
- }));
- } else if (err.code === 'ECONNABORTED') {
- showToast(this.$t('网络超时!'))
- } else if (err.msg !== undefined) {
- showToast(this.$t(err.msg))
- }
- // this.getToken()
- })
- } else {
- showToast(this.$t('请输入提币数量'));
- }
- },
- async pastCont() {
- this.address = await navigator.clipboard.readText();
+ });
+ } else {
+ this.numLenth = 3
}
+ },
+ //根据币种获取链地址
+ getBlock(symbol) {
+ Axios.getBlock({
+ coin: symbol
+ }).then((res) => {
+ this.blockList = res;
+ this.blockName = res[0].blockchain_name;
+ });
+ },
+ //选中链名称
+ changeBlockchain(item, index) {
+ this.blockchainIndex = index;
+ this.blockName = item.blockchain_name;
+ },
+ //获取钱包余额
+ getAvailable(symbol) {
+ _getAllWallet().then((res) => {
+ let walletList = res.extends;
+ let initObj = walletList.find(item => {
+ return item.symbol_data.toLowerCase() == symbol.toLowerCase()
+ })
+ this.usdtBalance = initObj.volume
+ });
+ },
+ //点全部
+ allBtn() {
+ this.amount = this.getwei(this.usdtBalance, this.numLenth);
+ this.changeInput()
+ },
+ //输入改变
+ changeInput() {
+ if (this.amount === '') {
+ this.volume_last = '0.00'
+ return
+ }
+ if (this.amount.length > 11) {
+ this.amount = this.amount.slice(0, 11)
+ }
+
+ if (this.withdraw_fee_type == 'part') {
+ _withdrawFee({
+ amount: this.amount,
+ channel: this.value + '_' + this.blockName
+ }).then((res) => {
+ console.log(res)
+ this.fee = res.fee;
+ this.volume_last = res.volume_last;
+ });
+ } else if (this.withdraw_fee_type == 'rate') {
+ if (this.amount == '') {
+ this.volume_last = 0
+ } else {
+ this.fee = this.getwei(this.percent * this.amount, this.numLenth)
+ this.volume_last = this.getwei(this.amount * 1 - this.percent * this.amount, this.numLenth)
+ }
+ } else {
+ if (this.amount * 1 < this.fee * 1) {
+ console.log('a')
+ this.volume_last = 0
+ } else {
+ this.volume_last = this.getwei(this.amount * 1 - this.fee * 1, this.numLenth)
+ }
+ }
+
+ },
+ //提币提交
+ onConfirm: throttle(function () {
+ if (!this.amount) {
+ showToast(this.$t('请输入数量'));
+ return;
+ }
+
+ let numReg = /^[0-9]+([.]{1}[0-9]+){0,1}$/;
+ if (!numReg.test(this.amount)) {
+ showToast(this.$t('请输入数字'));
+ return;
+ }
+
+ if (!this.address) {
+ showToast(this.$t('请输入提现地址'));
+ return;
+ }
+
+ if (!this.safeword) {
+ showToast(this.$t('fundsPasswordContTips'));
+ return;
+ }
+
+ if (this.amount && this.address) {
+ // this.$router.push({
+ // path: '/cryptos/withdraw/securityVerification',
+ // query: {
+ // amount: this.amount,
+ // from: this.address,
+ // channel: this.value + '_' + this.blockName
+ // }
+ // })
+ // _withdrawApply({
+ // session_token:this.sessionToken,
+ // amount:this.amount,
+ // from:this.address,
+ // channel:this.value+'_'+ this.blockName
+ // }).then((res)=> {
+ // if(res.code==0) {
+ // this.$router.push({
+ // path:"/withdraw/withdrawSumbit"
+ // });
+ // }else{
+ // showToast(this.$t(res.msg));
+ // }
+ // });
+ _withdrawApply({
+ session_token: this.sessionToken,
+ amount: this.amount,
+ safeword: this.safeword,
+ from: this.address,
+ channel: this.value + '_' + this.blockName
+ }).then((res) => {
+
+ this.$router.push({
+ path: "/cryptos/withdraw/withdrawSumbit"
+ });
+
+ }).catch(err => {
+ //console.log(err)
+ if (err.code == 105) {
+ showToast(this.$t('当前还需交易%s,才可提币', {
+ 'MONEY': err.msg
+ }));
+ } else if (err.code === 'ECONNABORTED') {
+ showToast(this.$t('网络超时!'))
+ } else if (err.msg !== undefined) {
+ showToast(this.$t(err.msg))
+ }
+ // this.getToken()
+ })
+ } else {
+ showToast(this.$t('请输入提币数量'));
+ }
+ }, 1000),
+ async pastCont() {
+ this.address = await navigator.clipboard.readText();
}
}
+}
</script>
<style lang="scss" scoped>
- @import "@/assets/init.scss";
+@import "@/assets/init.scss";
- #cryptos {
- .withdrawl-page {
- width: 100%;
- box-sizing: border-box;
- font-size: 26px;
- }
+#cryptos {
+ .withdrawl-page {
+ width: 100%;
+ box-sizing: border-box;
+ font-size: 26px;
+ }
- .van-popup.van-popup--bottom {
- border-top-left-radius: 30px;
- border-top-right-radius: 30px;
- }
+ .van-popup.van-popup--bottom {
+ border-top-left-radius: 30px;
+ border-top-right-radius: 30px;
+ }
- .pop-box {
- border-top-left-radius: 30px;
- border-top-right-radius: 30px;
- }
+ .pop-box {
+ border-top-left-radius: 30px;
+ border-top-right-radius: 30px;
+ }
- .color-blue {
- color: $btn_main;
- }
+ .color-blue {
+ color: $btn_main;
+ }
- .bg-grey-light {
- background: $light-grey;
- }
+ .bg-grey-light {
+ background: $light-grey;
+ }
- li {
- &.active {
- border-color: $color_main;
- color: $color_main;
- }
- }
-
- .van-button--default {
- color: $text_color;
- }
-
- .btnMain {
- background: $btn_main;
+ li {
+ &.active {
+ border-color: $color_main;
+ color: $color_main;
}
}
+
+ .van-button--default {
+ color: $text_color;
+ }
+
+ .btnMain {
+ background: $btn_main;
+ }
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3