From b8f6f514b675fa6a006dfafbc99303b3c5c8ba85 Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Fri, 17 May 2024 10:52:12 +0800
Subject: [PATCH] 一鍵平倉增加英文多语言,IFSC改成Select recharge account

---
 src/page/user/ransferIndex.vue |   41 +++++++++++++++++++++++++++++++++--------
 1 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/src/page/user/ransferIndex.vue b/src/page/user/ransferIndex.vue
index 52a09c8..47019bd 100644
--- a/src/page/user/ransferIndex.vue
+++ b/src/page/user/ransferIndex.vue
@@ -117,11 +117,7 @@
               <div class="van-cell__value van-field__value">
                 <div class="van-field__body">
                   <div class="van-field__control" style="padding-left: 10px">
-                    {{
-                      from.accectType !== "US"
-                        ? (formValue / exchangeRate).toFixed(2)
-                        : (formValue * exchangeRate).toFixed(2)
-                    }}
+                    {{ (formValue * rate).toFixed(2) }}
                   </div>
                   <div class="van-field__button" style="">
                     <span style="color: rgb(79, 82, 87)">{{
@@ -172,13 +168,20 @@
   components: {},
   data() {
     return {
+      // 马股和美元的汇率
       exchangeRate: 4.59,
+      // 划转的金额
       formValue: "",
       from: {},
       to: {},
       show: false,
-      actions: [],
       toShow: false,
+      // 后端返回的数据列表比较多。在这里前端配置需要展示的
+      filterActions: ["US", "IN"],
+      // 选择的列表
+      actions: [],
+      // 汇率
+      rate: "",
     };
   },
   methods: {
@@ -205,6 +208,7 @@
       this.from = { ...this.to };
       this.to = { ...obj };
       this.formValue = "";
+      this.geCurrencyRate();
     },
     fromSelect(e) {
       if (e.accectType === this.to.accectType) {
@@ -212,6 +216,7 @@
       }
       this.from = e;
       this.formValue = "";
+      this.geCurrencyRate();
     },
     toSelect(e) {
       if (e.accectType === this.from.accectType) {
@@ -220,15 +225,35 @@
 
       this.to = e;
       this.formValue = "";
+      this.geCurrencyRate();
     },
+    // 获取账号余额
     async getMoneyData() {
       let res = await api.getMoney();
       if (res.status === 0) {
-        let array = res.data.filter((item) => item.accectType !== "ALL");
+        let array = res.data.filter(
+          (item) => this.filterActions.indexOf(item.accectType) !== -1
+        );
         array.map((item) => {
           item.name = this.$t(item.accectType);
         });
+        console.log("array",array)
         this.actions = array;
+      }
+    },
+    // 获取汇率
+    async geCurrencyRate() {
+      if (this.from.accectType && this.to.accectType) {
+        let res = await api.currencyRate({
+          fromType: this.from.accectType,
+          toType: this.to.accectType,
+        });
+        if (res.status === 0) {
+          this.rate = res.data;
+          if (this.from.accectType == 'US'&&this.to.accectType=='IN'){
+            this.rate = 83.5
+          }
+        }
       }
     },
     onClickLeft() {
@@ -384,4 +409,4 @@
     font-size: 20px;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3