From cb9eeec0baa75abb9c5e961aeb8e0c519a951f64 Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Tue, 16 Jul 2024 10:18:32 +0800
Subject: [PATCH] 123

---
 src/page/trading/buy.vue |   56 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/src/page/trading/buy.vue b/src/page/trading/buy.vue
index 4194a3c..dbc81ee 100644
--- a/src/page/trading/buy.vue
+++ b/src/page/trading/buy.vue
@@ -69,7 +69,7 @@
               <input type="Number" v-model="nums" />
             </div>
             <div class="right_sw flexJy" style="width: auto">
-              <!-- <div class="addorj" @click="gdJian">
+              <div class="addorj" @click="gdJian">
                 <img src="@/assets/img/ic_number_jian.png" alt />
               </div>
               <div class="addorj"></div>
@@ -82,7 +82,7 @@
                 "
               >
                 <img src="@/assets/img/ic_number_add.png" />
-              </div> -->
+              </div>
             </div>
           </div>
           <div class="num">
@@ -97,13 +97,13 @@
               />
             </div>
             <div class="right_sw flexJy" style="width: auto">
-              <!-- <div class="addorj" @click="jyslJian">
+              <div class="addorj" @click="jyslJian">
                 <img src="@/assets/img/ic_number_jian.png" />
               </div>
               <div class="addorj"></div>
               <div class="addorj" @click="jjjisua">
                 <img src="@/assets/img/ic_number_add.png" />
-              </div> -->
+              </div>
             </div>
           </div>
           <!-- <div class="tr_rs gg" @click="showGg = true">
@@ -125,7 +125,7 @@
             <div class="bottom_bzz">
               <span v-if="priceTabsCurrentIndex == 0">
                 {{
-                  (nums * selectCycle.replace("X", "") * num)
+                  (nowPrice * selectCycle.replace("X", "") * num)
                     | _toLocaleString
                 }}
               </span>
@@ -244,8 +244,10 @@
 </template>
 
 <script>
+import { ActionSheet } from "vant";
 import * as api from "@/axios/api";
 import { mapActions } from "vuex";
+import { Notify } from "vant";
 
 export default {
   name: "trBuy",
@@ -417,21 +419,22 @@
       this.priceTabsCurrentIndex = index;
     },
     jjjisua() {
-      let numbs = Math.floor(
-        this.moneyData.availableBalance /
-          this.nowPrice /
-          this.selectCycle.replace("X", "")
-      );
+      // 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;
-      }
+      // console.log(this.num, numbs);
+      // if (this.num >= numbs) {
+      //   this.num = numbs;
+      // }
     },
     jyslJian() {
+      console.log(this.num);
       if (typeof this.num === "string") {
         this.num = 1;
       } else {
@@ -514,11 +517,31 @@
     },
     async checkcheckStockVip() {
       // this.$refs.closeDialog.show = true;
-      let data = await api.checkStockVip({ stockCode: this.code });
+      const opts = {
+        stockId: this.id,
+        buyNum: this.num,
+        lever: this.selectLever,
+      }
+      if (this.checkedZs) {
+        opts.stopLoss = this.zhisun;
+      }
+      if (this.checkedZy) {
+        opts.profitTarget = this.profitTarget;
+      }
+      if (this.tabsCurrentIndex == 0) {
+        opts.buyType = 1;
+      } else {
+        opts.buyType = 0;
+      }
+      let data = await api.checkStockVip(opts);
       console.log(data, "data");
-      if (!data.data) {
+      if (data.data == 0) {
         this.password = "";
         this.setBuy();
+      } else if (data.data == 1) {
+        this.password = "";
+        Notify({ type: "success", message: this.$t("购买申请成功") });
+        this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
       } else {
         this.show = true;
       }
@@ -749,6 +772,7 @@
       }
     },
   },
+  components: { ActionSheet, [Notify.Component.name]: Notify.Component },
 };
 </script>
 

--
Gitblit v1.9.3