From f989b0f6b7c1190a719d22a2aeec0e8914c2db07 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Fri, 26 Apr 2024 11:49:39 +0800
Subject: [PATCH] first

---
 config/index.js          |    2 +-
 src/page/trading/buy.vue |   57 +++++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/config/index.js b/config/index.js
index 4b2579c..9de6093 100644
--- a/config/index.js
+++ b/config/index.js
@@ -40,7 +40,7 @@
     },
 
     // Various Dev Server settings
-    host: "127.0.0.1", // can be overwritten by process.env.HOST
+    host: "192.168.0.101", // can be overwritten by process.env.HOST
     port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: true,
     errorOverlay: true,
diff --git a/src/page/trading/buy.vue b/src/page/trading/buy.vue
index 4bab248..4f8914c 100644
--- a/src/page/trading/buy.vue
+++ b/src/page/trading/buy.vue
@@ -94,6 +94,7 @@
                 type="number"
                 onkeyup="value=value.replace(/[^\d]/g,'')"
                 v-model="num"
+                @input="numInput"
               />
             </div>
             <div class="right_sw flexJy" style="width: auto">
@@ -101,14 +102,7 @@
                 <img src="@/assets/img/ic_number_jian.png" />
               </div>
               <div class="addorj"></div>
-              <div
-                class="addorj"
-                @click="
-                  typeof num == 'string'
-                    ? (num = Number(Number(num) + 1))
-                    : (num = Number(Number(num) + 1))
-                "
-              >
+              <div class="addorj" @click="jjjisua">
                 <img src="@/assets/img/ic_number_add.png" />
               </div>
             </div>
@@ -130,10 +124,13 @@
             </div>
 
             <div class="bottom_bzz">
-              <span>{{ ((nowPrice / selectCycle) * num) | _toLocaleString }}</span>
+              <span>
+                {{
+                  ((nowPrice / selectCycle.replace("X", "")) * num)
+                    | _toLocaleString
+                }}
+              </span>
               <span style="white-space: nowarp">
-                <!-- moneyData.symbol + " " + -->
-
                 {{ moneyData.availableBalance | _toLocaleString }}
               </span>
             </div>
@@ -196,14 +193,6 @@
             </div>
           </div>
         </div>
-        <!-- <div class="zy">
-            <div class="left_zy">
-              <span>追踪止损</span>
-            </div>
-            <div class="right_sw">
-              <van-switch v-model="profitArr[2].checked" />
-            </div>
-          </div> -->
       </div>
       <div class="btn_buy" @click="gdOrSetBuy()">
         <div :class="tabsCurrentIndex == 0 ? 'maichu' : ''">
@@ -337,7 +326,20 @@
   },
   methods: {
     ...mapActions(["setUseInfo"]),
-
+    numInput(e) {
+      // this.nowPrice / this.selectCycle.replace("X", "")
+      // this.moneyData.availableBalance
+      let numbs = Math.floor(
+        this.moneyData.availableBalance /
+          this.nowPrice /
+          this.selectCycle.replace("X", "")
+      );
+      if (e.target.value >= numbs) {
+        this.num = numbs;
+      }
+      // if()
+      console.log(e.target.value);
+    },
     async getMoneyData() {
       let data = await api.getMoney();
       let type = this.bayType === "SZHB" ? "US" : this.bayType;
@@ -359,6 +361,21 @@
     handleTabsClick(item, index) {
       this.priceTabsCurrentIndex = index;
     },
+    jjjisua() {
+      let numbs = Math.floor(
+        this.moneyData.availableBalance /
+          this.nowPrice /
+          this.selectCycle.replace("X", "")
+      );
+      typeof this.num == "string"
+        ? (this.num = Number(Number(this.num) + 1))
+        : (this.num = Number(Number(this.num) + 1));
+
+      console.log(this.num, numbs);
+      if (this.num >= numbs) {
+        this.num = numbs;
+      }
+    },
     jyslJian() {
       if (typeof this.num === "string") {
         this.num = 1;

--
Gitblit v1.9.3