Browse Source

feat: 增加eth到usdt的换算

million 1 year ago
parent
commit
b3cff98aef

+ 2 - 2
front/admin-front/src/views/autoplay/index.vue

@@ -950,7 +950,7 @@ export default {
       optionsTaskType: [
         {
           value: 'BRIDGE',
-          label: 'Bridge'
+          label: 'bridge'
         },
         {
           value: 'NFT',
@@ -958,7 +958,7 @@ export default {
         },
         {
           value: 'SWAP',
-          label: 'MuteSwap'
+          label: 'swap'
         }
       ],
       optionsAddress: [],

+ 21 - 7
front/admin-front/src/views/dashboard/index.vue

@@ -4,7 +4,7 @@
       <div class="left">
         <div class="item">
           <div class="number">
-            {{ countFee.expendGas }}
+            {{ getRoundedNumber(countFee.expendGas) }} ETH
           </div>
           <div class="title">
             支出/气体
@@ -13,7 +13,7 @@
         <div class="verticalLine"/>
         <div class="item">
           <div class="number">
-            {{countFee.principalBalance}}
+            {{ getRoundedNumber(countFee.principalBalance) }} ETH
           </div>
           <div class="title">
             剩余本金
@@ -22,7 +22,7 @@
         <div class="verticalLine"/>
         <div class="item">
           <div class="number">
-            {{countFee.predictTotalCost}}
+            {{ getRoundedNumber(countFee.predictTotalCost * ethToUsdt) }} USDT
           </div>
           <div class="title">
             预计支出总费用
@@ -90,14 +90,15 @@
                 预期投入
               </div>
               <div class="amount">
-                888232
+                {{ getRoundedNumber(countFee.predictTotalCost * ethToUsdt) }}
               </div>
             </div>
             <div class="info">
               共{{echartsInputData.totalCount}}项
             </div>
             <div class="info">
-              总支出:{{echartsInputData.totalCost}}
+<!--              总支出:{{echartsInputData.totalCost}}-->
+              {{ getRoundedNumber(countFee.expendGas * ethToUsdt) }}
             </div>
             <div class="progress">
               <div class="progress">
@@ -369,10 +370,12 @@ export default {
       },
       timer:null,
       gas:{},
-      loading:false
+      loading:false,
+      ethToUsdt:0,
     };
   },
   mounted() {
+    this.getEthToUsdt()
     this.getExpectedInput()
     this.getCountFee()
     this.getDailyCost()
@@ -647,8 +650,19 @@ export default {
             this.loading = false
           })
         })
-
     },
+    getEthToUsdt(){
+      fetch('https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd')
+        .then( response =>{
+          let res = response.json()
+          res.then(result =>{
+            this.ethToUsdt = result.ethereum.usd
+          })
+        })
+    },
+    getRoundedNumber(number){
+      return parseFloat(number.toFixed(4))
+    }
 
   },
 };