From 6042c78e568b280dae7b5b617b59bbfff38ee515 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Tue, 29 Mar 2022 14:22:55 +0800
Subject: [PATCH] gx
---
src/pages/index/account.vue | 89 ++++++++++++++++++++++++++++----------------
1 files changed, 56 insertions(+), 33 deletions(-)
diff --git a/src/pages/index/account.vue b/src/pages/index/account.vue
index 97568ae..9952c23 100644
--- a/src/pages/index/account.vue
+++ b/src/pages/index/account.vue
@@ -59,7 +59,7 @@
<span>USDT</span>
</div>
<input placeholder="0.000" type="number" v-model.number="usdtAmount"/>
- <span class="all">{{$t("message.WithdrawalAmount")}}</span>
+ <span class="all" style="color: #3D8AF2" @click="allWithdraw">{{$t("message.WithdrawalAll")}}</span>
</div>
<div class="item flex-1 flex align-end flex-v">
<div>
@@ -116,7 +116,7 @@
<div class="list-row flex align-center justify-between" v-for="item in miningList">
<span>{{item.createTime}}</span>
<span>{{$t("message.Mining")}}</span>
- <span>{{item.amount}}</span>
+ <span>{{item.amount}} ETH</span>
</div>
</van-tab>
</van-tabs>
@@ -132,7 +132,11 @@
import { ref, reactive, onMounted, getCurrentInstance, defineComponent, computed} from 'vue';
export default defineComponent({
name: 'account',
- setup() {
+ props: [
+ 'simulateData'
+ ],
+ setup(props, context) {
+ console.log(props)
const activeNames = ref(['1'])
const { proxy } = getCurrentInstance();
let exchangeList = ref([])
@@ -149,6 +153,21 @@
}
return (ethAmount.value * proxy.info.newPrice).toFixed(4)
})
+
+ function initData () {
+ if(props.simulateData) {
+ const {walletInfoVo: myAccountInfo,changes: exchangeList,withdraws: withdrawList,mines: miningList} = props.simulateData || {};
+ proxy.myAccountInfo = myAccountInfo || {};
+ proxy.exchangeList = exchangeList || [];
+ proxy.withdrawList = withdrawList || [];
+ proxy.miningList = miningList || [];
+ } else {
+ getWalletInfo()
+ getRecordList(1)
+ getRecordList(2)
+ getRecordList(3)
+ }
+ }
function getWalletInfo(){
proxy.$axios({
url: '/dapi/member/walletInfo',
@@ -156,6 +175,28 @@
}).then((res) => {
if(res.code == 200) {
proxy.myAccountInfo = res.data;
+ }
+ })
+ }
+ function getRecordList (type) {
+ proxy.$axios({
+ url: '/dapi/member/recordInPage',
+ method: 'post',
+ data: {
+ pageNum: 1,
+ pageSize: 100,
+ type: type
+ }
+ }).then((res) => {
+ if(res.code == 200) {
+ let result = res.data;
+ if (type == 1) {
+ proxy.exchangeList = result;
+ } else if (type == 2) {
+ proxy.withdrawList = result;
+ } else {
+ proxy.miningList = result;
+ }
}
})
}
@@ -194,6 +235,12 @@
proxy.isRequesting = false;
})
}
+ function allWithdraw () {
+ if(!proxy.myAccountInfo.availableWallet) {
+ return;
+ }
+ usdtAmount.value = proxy.myAccountInfo.availableWallet
+ }
function submitWithdraw () {
if(Number(usdtAmount.value) < 100) {
this.$toast(this.$t('message.MinWithdrawCount') + '100USDT');
@@ -226,28 +273,7 @@
proxy.isRequesting = false;
})
}
- function getRecordList (type) {
- proxy.$axios({
- url: '/dapi/member/recordInPage',
- method: 'post',
- data: {
- pageNum: 1,
- pageSize: 100,
- type: type
- }
- }).then((res) => {
- if(res.code == 200) {
- let result = res.data;
- if (type == 1) {
- proxy.exchangeList = result;
- } else if (type == 2) {
- proxy.withdrawList = result;
- } else {
- proxy.miningList = result;
- }
- }
- })
- }
+
function onClickTab (item) {
if(item.name === 2) {
getRecordList(1)
@@ -256,11 +282,8 @@
}
}
onMounted(() => {
- getWalletInfo()
- proxy.initData()
- getRecordList(1)
- getRecordList(2)
- getRecordList(3)
+ proxy.initglobalSetData()
+ initData()
})
return {
activeNames,
@@ -275,13 +298,14 @@
getWalletInfo,
allExchange,
submitExchange,
+ allWithdraw,
submitWithdraw,
onClickTab,
isRequesting
};
},
methods: {
- initData () {
+ initglobalSetData () {
this.$axios({
url: '/dapi/common/globalSetting',
method: 'get'
@@ -290,8 +314,7 @@
this.info = res.data;
}
})
- },
-
+ }
}
})
</script>
--
Gitblit v1.9.1