From 25b2ba1cf86bc3439e7ad2acf2cd4a9ea7e4b0ed Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Fri, 28 Jun 2024 09:28:04 +0800
Subject: [PATCH] 123

---
 src/page/new-urrency/index.vue |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/page/new-urrency/index.vue b/src/page/new-urrency/index.vue
index 59c57da..d90674b 100644
--- a/src/page/new-urrency/index.vue
+++ b/src/page/new-urrency/index.vue
@@ -121,7 +121,12 @@
             <div>{{ $t("总价") }}</div>
             <div>{{ amt * activeData.issuePrice }} USDT</div>
           </div>
-          <van-button class="okbut" type="info" @click="peishou">
+          <van-button
+            :loading="loading"
+            class="okbut"
+            type="info"
+            @click="peishou"
+          >
             {{ $t("确定") }}
           </van-button>
         </div>
@@ -151,6 +156,7 @@
   },
   data() {
     return {
+      loading: false,
       amt: 0,
       show: false,
       active: 1,
@@ -183,6 +189,10 @@
           id: 2,
         },
         {
+          name: this.$t("中签结果"),
+          id: 3,
+        },
+        {
           name: this.$t("新币预览"),
           id: 0,
         },
@@ -201,23 +211,28 @@
       this.money_data = res.data;
     },
     async peishou() {
+      this.loading = true;
       if (Number(this.amt) <= 0) {
         return Notify({ type: "warning", message: this.$t("请输入数量") });
       }
-      await icoOrderAppAdd({
+      const res = await icoOrderAppAdd({
         icoNewCurrencyId: this.activeData.id,
         orderType: this.activeData.type,
         tokenCode: this.activeData.tokenCode,
         lotteryQuantity: this.amt,
+      }).catch((ree) => {
+        this.loading = false;
       });
-
-      Dialog.alert({
-        title: this.$t("提示"),
-        message: this.$t("配售成功"),
-        confirmButtonText: this.$t("确定"),
-      }).then(() => {
-        this.$router.push(`/list-urrency?type=${this.activeData.type}`);
-      });
+      this.loading = false;
+      if (res.code === "0") {
+        Dialog.alert({
+          title: this.$t("提示"),
+          message: this.$t("配售成功"),
+          confirmButtonText: this.$t("确定"),
+        }).then(() => {
+          this.$router.push(`/list-urrency?type=${this.activeData.type}`);
+        });
+      }
     },
     onClickLeft() {
       this.$router.go(-1);
@@ -240,6 +255,9 @@
     // 获取列表
 
     changeTab(item) {
+      if (item.id === 3) {
+        return this.$router.push("/list-urrency");
+      }
       this.active = item.id;
     },
   },

--
Gitblit v1.9.3