From 3ed2cb78a690b64c3b2646d35e1500081186dfa3 Mon Sep 17 00:00:00 2001
From: huzheng12 <52150713+huzheng12@users.noreply.github.com>
Date: Mon, 06 May 2024 00:21:32 +0800
Subject: [PATCH] first commit

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

diff --git a/src/page/new-urrency/index.vue b/src/page/new-urrency/index.vue
index 84ce58a..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,
@@ -205,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);

--
Gitblit v1.9.3