From 66d132b96fd30abf1d75bed49ff176a52b4101ee Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Wed, 10 Apr 2024 15:36:11 +0800
Subject: [PATCH] huilv

---
 src/page/user/ransferIndex.vue |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/page/user/ransferIndex.vue b/src/page/user/ransferIndex.vue
index 4e808c7..6be49dd 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)">{{
@@ -181,9 +177,11 @@
       show: false,
       toShow: false,
       // 后端返回的数据列表比较多。在这里前端配置需要展示的
-      filterActions: ["US", "MAS"],
+      filterActions: ["US", "MAS", "HK"],
       // 选择的列表
       actions: [],
+      // 汇率
+      rate: "",
     };
   },
   methods: {
@@ -210,6 +208,7 @@
       this.from = { ...this.to };
       this.to = { ...obj };
       this.formValue = "";
+      this.geCurrencyRate();
     },
     fromSelect(e) {
       if (e.accectType === this.to.accectType) {
@@ -217,6 +216,7 @@
       }
       this.from = e;
       this.formValue = "";
+      this.geCurrencyRate();
     },
     toSelect(e) {
       if (e.accectType === this.from.accectType) {
@@ -225,7 +225,9 @@
 
       this.to = e;
       this.formValue = "";
+      this.geCurrencyRate();
     },
+    // 获取账号余额
     async getMoneyData() {
       let res = await api.getMoney();
       if (res.status === 0) {
@@ -238,6 +240,18 @@
         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;
+        }
+      }
+    },
     onClickLeft() {
       this.$router.push("/user");
     },

--
Gitblit v1.9.3