From c790779e2c578d892e184932c660023eb4d466aa Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Tue, 26 Mar 2024 23:40:20 +0800
Subject: [PATCH] 注册页面的客服地址错误

---
 src/page/user/ransferIndex.vue |  123 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 106 insertions(+), 17 deletions(-)

diff --git a/src/page/user/ransferIndex.vue b/src/page/user/ransferIndex.vue
index be51638..20cee91 100644
--- a/src/page/user/ransferIndex.vue
+++ b/src/page/user/ransferIndex.vue
@@ -1,18 +1,18 @@
 <template>
-  <div>
+  <div style="height: 100vh">
     <van-nav-bar
       :placeholder="true"
       :safe-area-inset-top="true"
-      title="劃轉"
+      :title="$t('劃轉')"
       left-arrow
       @click-left="onClickLeft"
     />
     <main>
       <div>
         <div class="main-header">
-          <div class="main-li">
+          <div class="main-li" @click="show = true">
             <span class="li-left">從</span
-            ><span class="li-center">馬股賬戶</span>
+            ><span class="li-center">{{ from.name }}</span>
             <div class="img-con">
               <img
                 class="main-li-img"
@@ -21,16 +21,23 @@
               />
             </div>
           </div>
-          <div class="main-img">
+          <van-action-sheet
+            v-model="show"
+            :actions="actions"
+            :cancel-text="$t('hj106')"
+            close-on-click-action
+            @select="fromSelect"
+          />
+          <div class="main-img" @click="zh">
             <img
               class="img"
               src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAjCAYAAAD17ghaAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADASURBVHgB7dZBCgMhDAXQONjuvaaXGHsJr+m+LbQjlEJbdUwxP7PwL1wIwgNNoqFGTj49Svu36Exp3/oU7tEFYmShgdlUa0ZwzgwF/IMYDuAiRAAchBigFyEK6EGIA/YQEEALAQPUEFBACQEHfCMsKeWFwABqwytH5QomYAIm4FAAe/Zp3b6+gZSyXKO7GE1AXjQR7zeghfh4hBqInypAI4pliERU+wAK0WxECMRuJ5RGdLViSUT3LJBCsIaRBOIJOvdIzG7h9ekAAAAASUVORK5CYII="
               alt="转换"
             />
           </div>
-          <div class="main-li">
+          <div class="main-li" @click="toShow = true">
             <span class="li-left">到</span
-            ><span class="li-center">美股賬戶</span>
+            ><span class="li-center">{{ to.name }}</span>
             <div class="img-con">
               <img
                 class="main-li-img"
@@ -39,6 +46,13 @@
               />
             </div>
           </div>
+          <van-action-sheet
+            v-model="toShow"
+            :actions="actions"
+            :cancel-text="$t('hj106')"
+            close-on-click-action
+            @select="toSelect"
+          />
         </div>
         <van-row style="margin-top: 15px; position: relative">
           <van-col span="12">
@@ -49,7 +63,7 @@
                 color: rgb(140, 159, 173);
               "
             >
-              輸入金額
+              {{ $t("輸入金額") }}
             </div>
             <div
               class="van-cell van-field white-input"
@@ -59,11 +73,13 @@
               <div class="van-cell__value van-field__value">
                 <div class="van-field__body">
                   <input
+                    :value="formValue"
                     type="text"
                     inputmode="decimal"
                     id="van-field-47-input"
                     class="van-field__control"
-                    placeholder="請選擇"
+                    :placeholder="$t('請選擇')"
+                    @input="inputValue"
                   /><!----><!---->
                   <div class="van-field__button" style="margin-right: 10px">
                     <span style="color: rgb(79, 82, 87)">MYR</span>
@@ -88,7 +104,7 @@
                 color: rgb(140, 159, 173);
               "
             >
-              轉換得到金額
+              {{ $t("轉換得到金額") }}
             </div>
             <div class="van-cell van-field van-field--disabled white-input">
               <!----><!---->
@@ -99,7 +115,7 @@
                     id="van-field-48-input"
                     class="van-field__control"
                     disabled=""
-                    placeholder="請選擇"
+                    :placeholder="$t('請選擇')"
                     style="padding-left: 10px"
                   /><!----><!---->
                   <div class="van-field__button" style="">
@@ -114,27 +130,100 @@
         </van-row>
 
         <div
-          style="color: rgb(5, 106, 239); text-align: right; font-size: 16px"
+          @click="formValue = from.availableBalanceUSD"
+          style="
+            color: rgb(5, 106, 239);
+            text-align: right;
+            font-size: 16px;
+            margin-top: 5px;
+          "
         >
-          最大
+          {{ $t("最大") }}
         </div>
         <div class="balance">
-          <div>可用餘額</div>
-          <div class="balance-text">22799.0000 MYR</div>
+          <div>{{ $t("可用餘額") }}</div>
+          <div class="balance-text">
+            {{ from.availableBalanceUSD || "0.0000" }} USD
+          </div>
         </div>
       </div>
-      <van-button type="primary" class="but">確認劃轉</van-button>
+      <!-- transfer -->
+      <van-button type="primary" @click="transferIndex" class="but">{{
+        $t("確認劃轉")
+      }}</van-button>
     </main>
   </div>
 </template>
 
 <script>
+import * as api from "@/axios/api";
+import { Notify } from "vant";
+import { login, transfer } from "../../axios/api";
+
 export default {
+  created() {
+    this.getMoneyData();
+  },
   components: {},
   data() {
-    return {};
+    return {
+      formValue: "",
+      from: {},
+      to: {},
+      show: false,
+      actions: [],
+      toShow: false,
+    };
   },
   methods: {
+    inputValue(e) {
+      this.formValue = e.target.value;
+    },
+    async transferIndex() {
+      const res = await transfer({
+        fromType: this.from.accectType,
+        toType: this.to.accectType,
+        amt: this.formValue,
+      });
+      if (res.status === 0) {
+        Notify({ type: "success", message: this.$t("划转成功") });
+        setTimeout(() => {
+          this.$router.push("/user");
+        }, 500);
+      } else {
+        Notify({ type: "warning", message: res.msg });
+      }
+    },
+    zh() {
+      const obj = { ...this.from };
+      this.from = { ...this.to };
+      this.to = { ...obj };
+      this.formValue = "";
+    },
+    fromSelect(e) {
+      if (e.accectType === this.to.accectType) {
+        return Notify({ type: "warning", message: this.$t("不能选择一样的") });
+      }
+      this.from = e;
+      this.formValue = "";
+    },
+    toSelect(e) {
+      if (e.accectType === this.from.accectType) {
+        return Notify({ type: "warning", message: this.$t("不能选择一样的") });
+      }
+      this.to = e;
+      this.formValue = "";
+    },
+    async getMoneyData() {
+      let res = await api.getMoney();
+      if (res.status === 0) {
+        let array = res.data.filter((item) => item.accectType !== "ALL");
+        array.map((item) => {
+          item.name = this.$t(item.accectType);
+        });
+        this.actions = array;
+      }
+    },
     onClickLeft() {
       this.$router.push("/user");
     },

--
Gitblit v1.9.3