From c3bc7b593bf9067bfdaa8bd7def32dd19844ad75 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Mon, 18 Apr 2022 11:37:49 +0800
Subject: [PATCH] gx

---
 src/pages/index/account.vue |  119 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 83 insertions(+), 36 deletions(-)

diff --git a/src/pages/index/account.vue b/src/pages/index/account.vue
index 97568ae..4e4af7e 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>
@@ -108,15 +108,27 @@
                                     </div>
                                 </van-tab>
                                 <van-tab :title='$t("message.Mining")'>
-                                    <div class="list-row flex align-center justify-between">
+                                    <div class="list-row list-row2 flex align-center justify-between">
                                         <span class="name">{{$t("message.Time")}}</span>
                                         <span class="name">{{$t("message.Type")}}</span>
                                         <span class="name">{{$t("message.Output")}}</span>
                                     </div>
-                                    <div class="list-row flex align-center justify-between" v-for="item in miningList">
+                                    <div class="list-row list-row2 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-tab :title='$t("message.Reward")'>
+                                    <div class="list-row list-row2 flex align-center justify-between">
+                                        <span class="name">{{$t("message.Time")}}</span>
+                                        <span class="name">{{$t("message.Type")}}</span>
+                                        <span class="name">{{$t("message.Output")}}</span>
+                                    </div>
+                                    <div class="list-row list-row2 flex align-center justify-between" v-for="item in rewardList">
+                                        <span>{{item.createTime}}</span>
+                                        <span>{{$t("message.Reward")}}</span>
+                                        <span>{{item.amount}} ETH</span>
                                     </div>
                                 </van-tab>
                             </van-tabs>
@@ -132,12 +144,17 @@
 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([])
     let withdrawList = ref([])
     let miningList = ref([])
+    let rewardList = ref([]);
     let myAccountInfo = ref({});
     let info = ref({});
     let ethAmount = ref();
@@ -149,6 +166,22 @@
         }
         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)
+            getRecordList(4)
+        }
+    }
     function getWalletInfo(){
         proxy.$axios({
           url: '/dapi/member/walletInfo',
@@ -156,6 +189,30 @@
         }).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 if (type == 3) {
+                proxy.miningList = result;
+              } else {
+                proxy.rewardList = result;
+              }
           }
         })
     }
@@ -194,6 +251,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,41 +289,18 @@
             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)
             getRecordList(2)
             getRecordList(3)
+            getRecordList(4)
         }
     }
     onMounted(() => {
-        getWalletInfo()
-        proxy.initData()
-        getRecordList(1)
-        getRecordList(2)
-        getRecordList(3)
+        proxy.initglobalSetData()
+        initData()
     })
     return { 
         activeNames,
@@ -268,6 +308,7 @@
         exchangeList,
         withdrawList,
         miningList,
+        rewardList,
         info,
         ethAmount,
         ethToUsdtAmount,
@@ -275,13 +316,14 @@
         getWalletInfo,
         allExchange,
         submitExchange,
+        allWithdraw,
         submitWithdraw,
         onClickTab,
         isRequesting
     };
   },
   methods: {
-    initData () {
+    initglobalSetData () {
         this.$axios({
           url: '/dapi/common/globalSetting',
           method: 'get'
@@ -290,8 +332,7 @@
               this.info = res.data;
           }
         })
-    },
-    
+    }
   }
 })
 </script>
@@ -420,7 +461,7 @@
         width: 45%
     }
     .list-row span:nth-child(3){
-        text-align: center;
+        text-align: right;
         width: 15%
     }
     .list-row:not(:last-child){
@@ -429,4 +470,10 @@
     .list-row:nth-child(1){
         margin: 30px 0;
     }
+    .list-row2 span:nth-child(2){
+        width: 22%
+    }
+    .list-row2 span:nth-child(3){
+        width: 38%
+    }
 </style>
\ No newline at end of file

--
Gitblit v1.9.1