From cf0f537770db12fb8e50a8932a6325e23018bc8b Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Sun, 07 Jul 2024 10:16:21 +0800
Subject: [PATCH] 7.6号改的东西

---
 src/locales/en.json                   |    6 
 src/locales/zh.json                   |    6 
 config/index.js                       |    2 
 src/main.js                           |    2 
 src/page/list/tradingList/dazy.vue    |    2 
 src/page/user/Warehouse/data.list.vue |  148 +++-
 src/axios/api.js                      |   13 
 src/axios/api.url.js                  |    2 
 src/page/trading/buy.vue              | 1746 ++++++++++++++++++++++++++++------------------------
 src/locales/hi.json                   |    6 
 src/locales/cht.json                  |    3 
 11 files changed, 1,068 insertions(+), 868 deletions(-)

diff --git a/config/index.js b/config/index.js
index 4ba5636..c3fafa2 100644
--- a/config/index.js
+++ b/config/index.js
@@ -39,7 +39,7 @@
       }
     },
     // Various Dev Server settings
-    host: "localhost", // can be overwritten by process.env.HOST
+    host: "192.168.10.8", // 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/axios/api.js b/src/axios/api.js
index 0f99dcb..79cee9a 100644
--- a/src/axios/api.js
+++ b/src/axios/api.js
@@ -86,6 +86,13 @@
   return get("/user/updatePwd.do", options);
 }
 
+//校验vip是否秘钥
+export function checkStockVip(options) {
+  return get("/user/checkStockVip.do", options);
+}
+
+
+
 // 获取验证码  -- 注册
 export function getCode(options) {
   return get("/api/sms/sendRegSms.do", options);
@@ -220,9 +227,9 @@
   return post("/user/delOrder.do", options);
 }
 // 挂单列表
-// export function getorderList (options) {
-//   return post('/user/orderList.do', options)
-// }
+export function getorderList (options) {
+  return post('/user/orderList.do', options)
+}
 
 // 美股详情
 export function getUsDetail(options) {
diff --git a/src/axios/api.url.js b/src/axios/api.url.js
index 6a96ec2..b61d0ad 100644
--- a/src/axios/api.url.js
+++ b/src/axios/api.url.js
@@ -9,7 +9,7 @@
   // 0311
   baseURL: "https://api.apratrade.com/",
   // 本地
-  // baseURL: "http://192.168.0.105:8091/",
+  // baseURL: "http://192.168.10.5:8091/",
   util: {
     image: "/util/image.html" // 图片上传
   }
diff --git a/src/locales/cht.json b/src/locales/cht.json
index 1939727..452db48 100644
--- a/src/locales/cht.json
+++ b/src/locales/cht.json
@@ -569,5 +569,6 @@
   "天": "天",
   "市场": "市場",
   "请选择提现金额": "請選擇提現金額",
-  "hj100": "交易數量(股)"
+  "hj100": "交易數量(股)",
+  "当前委托" : "當前委託"
 }
diff --git a/src/locales/en.json b/src/locales/en.json
index 681a009..11817c3 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -578,5 +578,9 @@
   "请选择提现金额": "Please select the Withdraw amount",
   "hj100": "Trading quantity (shares)",
   "关于我们": "about Us",
-  "贷款": "loan"
+  "贷款": "loan",
+  "当前委托": "Current Commission",
+  "撤销挂单": "Cancel pending order",
+  "立即购买": "Buy it now",
+  "秘钥": "Secret key"
 }
diff --git a/src/locales/hi.json b/src/locales/hi.json
index 5ec5acc..ddf597a 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -577,5 +577,9 @@
   "请选择提现金额": "कृपया निकासी राशि का चयन करें",
   "hj100": "लेन-देन की संख्या (शेयर)",
   "关于我们": "हमारे बारे में",
-  "贷款": "ऋृण"
+  "贷款": "ऋृण",
+  "当前委托": "अभी का ऑर्डर",
+  "撤销挂单": "लंबित आदेश रद्द करें",
+  "立即购买": "इसे अभी खरीदें",
+  "秘钥": "गुप्त कुंजी"
 }
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 534e77e..446b773 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -567,5 +567,9 @@
   "请选择提现金额": "请选择提现金额",
   "关于我们": "关于我们",
   "贷款": "贷款",
-  "hj621": "大宗交易"
+  "hj621": "大宗交易",
+  "当前委托": "当前委托",
+  "撤销挂单": "撤销挂单",
+  "立即购买": "立即购买",
+  "秘钥": "秘钥"
 }
diff --git a/src/main.js b/src/main.js
index 59231ea..3eb2305 100644
--- a/src/main.js
+++ b/src/main.js
@@ -19,7 +19,7 @@
   Tab,
   Tabs,
   Popup,
-  DatetimePicker
+  DatetimePicker 
 } from "vant";
 import "vant/lib/index.css";
 import moment from "moment";
diff --git a/src/page/list/tradingList/dazy.vue b/src/page/list/tradingList/dazy.vue
index eb0d1de..5ac0549 100644
--- a/src/page/list/tradingList/dazy.vue
+++ b/src/page/list/tradingList/dazy.vue
@@ -3,7 +3,7 @@
     <van-popup v-model="show" round position="bottom">
       <div class="boxd">
         <div class="boxh">
-          {{ $t("hj261") }}
+          {{ $t("hj621") }}
           <span @click="show = false"></span>
         </div>
         <h5>{{ $t("hj130") }}</h5>
diff --git a/src/page/trading/buy.vue b/src/page/trading/buy.vue
index c3cb513..4194a3c 100644
--- a/src/page/trading/buy.vue
+++ b/src/page/trading/buy.vue
@@ -27,11 +27,19 @@
             </div>
             <div class="rights">
               <div class="ese">
-                <div class="mc" @click="handleTradingClick(0)" :class="tabsCurrentIndex === 0 ? 'actives' : ''">
+                <div
+                  class="mc"
+                  @click="handleTradingClick(0)"
+                  :class="tabsCurrentIndex === 0 ? 'actives' : ''"
+                >
                   <span>{{ $t("hj84") }}</span>
                 </div>
 
-                <div class="mr" @click="handleTradingClick(1)" :class="tabsCurrentIndex === 1 ? 'active' : ''">
+                <div
+                  class="mr"
+                  @click="handleTradingClick(1)"
+                  :class="tabsCurrentIndex === 1 ? 'active' : ''"
+                >
                   <span>{{ $t("hj85") }}</span>
                 </div>
               </div>
@@ -42,8 +50,13 @@
 
       <div class="price_tabs">
         <div class="tabs">
-          <div class="tab_item" v-for="(item, index) in priceTabs" :key="index" @click="handleTabsClick(item, index)"
-            :class="priceTabsCurrentIndex === index ? 'active' : ''">
+          <div
+            class="tab_item"
+            v-for="(item, index) in priceTabs"
+            :key="index"
+            @click="handleTabsClick(item, index)"
+            :class="priceTabsCurrentIndex === index ? 'active' : ''"
+          >
             <span>{{ item }}</span>
           </div>
         </div>
@@ -56,17 +69,20 @@
               <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>
-              <div class="addorj" @click="
+              <div
+                class="addorj"
+                @click="
                   typeof nums == 'string'
                     ? (nums = Number(Number(nums) + 1).toFixed(2))
                     : (nums = (Number(nums) + 1).toFixed(2))
-                ">
+                "
+              >
                 <img src="@/assets/img/ic_number_add.png" />
-              </div>
+              </div> -->
             </div>
           </div>
           <div class="num">
@@ -74,16 +90,20 @@
           </div>
           <div class="tr_es flexJy">
             <div class="top_input">
-              <input type="number" onkeyup="value=value.replace(/[^\d]/g,'')" v-model="num" @input="numInput" />
+              <input
+                type="number"
+                v-model="num"
+                @input="numInput"
+              />
             </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">
@@ -103,9 +123,15 @@
             </div>
 
             <div class="bottom_bzz">
-              <span>
+              <span v-if="priceTabsCurrentIndex == 0">
                 {{
-                  ((nowPrice * selectCycle.replace("X", "")) * num)
+                  (nums * selectCycle.replace("X", "") * num)
+                    | _toLocaleString
+                }}
+              </span>
+              <span v-else>
+                {{
+                  (nums * selectCycle.replace("X", "") * num)
                     | _toLocaleString
                 }}
               </span>
@@ -116,7 +142,7 @@
           </div>
         </div>
       </div>
-      <!-- <div class="switchs">
+      <div class="switchs">
         <div class="zy">
           <div class="left_zy">
             <span>{{ $t("hj104") }}</span>
@@ -126,17 +152,30 @@
           </div>
         </div>
         <div class="zy" v-show="checkedZy">
-          <div class="left_zy">
+          <!-- <div class="left_zy">
             <input v-model="profitTarget" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
               @input="zyInt" />
+          </div> -->
+          <div class="left_zy">
+            <input
+              v-model.number="profitTarget"
+              inputmode="numeric"
+              @input="zyInt"
+            />
           </div>
           <div class="right_sw" style="width: auto">
             <div class="addorj" @click="zYjian">
               <img src="@/assets/img/ic_number_jian.png" />
             </div>
             <div class="addorj"></div>
-            <div class="addorj"
-              @click="tabsCurrentIndex==0?profitTarget = (Number(profitTarget) + 1).toFixed(2):profitTarget = (Number(profitTarget) + 1).toFixed(2)">
+            <div
+              class="addorj"
+              @click="
+                tabsCurrentIndex == 0
+                  ? (profitTarget = (Number(profitTarget) + 1).toFixed(2))
+                  : (profitTarget = (Number(profitTarget) + 1).toFixed(2))
+              "
+            >
               <img src="@/assets/img/ic_number_add.png" />
             </div>
           </div>
@@ -150,12 +189,14 @@
           </div>
         </div>
         <div class="zy" v-show="checkedZs">
-          <div class="left_zy">
+          <!-- <div class="left_zy">
             <input v-model="zhisun" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" @input="zsInt" />
+          </div> -->
+          <div class="left_zy">
+            <input inputmode="numeric" v-model.number="zhisun" @input="zsInt" />
           </div>
           <div class="right_sw" style="width: auto">
-            <div class="addorj"
-              @click="zSjian">
+            <div class="addorj" @click="zSjian">
               <img src="@/assets/img/ic_number_jian.png" />
             </div>
             <div class="addorj"></div>
@@ -164,928 +205,1015 @@
             </div>
           </div>
         </div>
-      </div> -->
+      </div>
       <div class="btn_buy" @click="gdOrSetBuy()">
         <div :class="tabsCurrentIndex == 0 ? 'maichu' : ''">
           <span>{{ tabsCurrentIndex == 0 ? $t("hj84") : $t("hj85") }}</span>
         </div>
       </div>
     </div>
-    <van-action-sheet v-model="showGg" :actions="siteLeverList" :cancel-text="$t('hj106')" :description="$t('hj107')"
-      close-on-click-action @select="onSelect" />
+    <van-action-sheet
+      v-model="showGg"
+      :actions="siteLeverList"
+      :cancel-text="$t('hj106')"
+      :description="$t('hj107')"
+      close-on-click-action
+      @select="onSelect"
+    />
+    <van-popup
+      v-model="show"
+      :style="{
+        minHeight: '20%',
+        borderTopLeftRadius: '10px',
+        borderTopRightRadius: '10px',
+      }"
+      position="bottom"
+    >
+      <div class="popup-box">
+        <div class="input-box">
+          <div class="laber">{{ $t("秘钥") }}:</div>
+          <input type="text" :maxlength="9" v-model="password" />
+        </div>
+
+        <van-button class="but" type="info" @click="setBuy">
+          {{ $t("立即购买") }}
+        </van-button>
+      </div>
+    </van-popup>
   </div>
 </template>
 
 <script>
-  import * as api from "@/axios/api";
-  import {
-    mapActions
-  } from "vuex";
+import * as api from "@/axios/api";
+import { mapActions } from "vuex";
 
-  export default {
-    name: "trBuy",
-    created() {
-      if (this.$route.query.t) {
-        this.tabsCurrentIndex = Number(this.$route.query.t);
-        console.log(this.tabsCurrentIndex);
-      }
-      if (this.$route.query.m) {
-        this.nowPrice = Number(this.$route.query.m);
-        this.profitTarget = Number(this.$route.query.m);
-        this.zhisun = Number(this.$route.query.m);
-        this.nums = Number(this.$route.query.m);
-      }
-      if (this.$route.query.id) {
-        this.id = this.$route.query.id;
-      }
-      if (this.$route.query.code) {
-        this.code = this.$route.query.code;
-      }
-      if (this.$route.query.name) {
-        this.name = this.$route.query.name;
-      }
-      if (this.$route.query.spell) {
-        this.spell = this.$route.query.spell;
-      }
-      if (this.$route.query.type) {
-        this.type = this.$route.query.type;
-      }
-      if (this.$route.query.if_us) {
-        this.if_us = this.$route.query.if_us;
-      }
-    },
-    data() {
-      return {
-        tradingArr: [this.$t("hj84"), this.$t("hj85")],
-        tabsCurrentIndex: 0,
-        // priceTabs: [this.$t("hj108"), this.$t("hj109")],
-        priceTabs: [this.$t("hj108")],
-        priceTabsCurrentIndex: 0,
-        num: 1,
-        nums: 1,
-        profit: false,
-        nowPrice: 0,
-        type: 0,
-        code: "",
-        name: "",
-        spell: "",
-        settingInfo: [],
-        selectCycle: "1X",
-        selectLever: 1,
-        siteLeverList: [],
-        checkedZy: false,
-        checkedZs: false,
-        buying: false,
-        zhisun: 0,
-        showGg: false,
-        profitTarget: 0,
-        if_us: 0,
-        bayType: "",
-        id: "",
-        actions: [{
-            name: "100X",
-            subname: this.$t("hj102")
-          },
-          {
-            name: "200X",
-            subname: this.$t("hj102")
-          },
-          {
-            name: "300X",
-            subname: this.$t("hj102")
-          },
-        ],
-        profitArr: [{
-            name: this.$t("hj104"),
-            checked: false,
-          },
-          {
-            name: this.$t("hj105"),
-            checked: false,
-          },
-          {
-            name: this.$t("hj110"),
-            checked: false,
-          },
-        ],
-        moneyData: {},
-        gid: "",
-      };
-    },
+export default {
+  name: "trBuy",
+  created() {
+    if (this.$route.query.t) {
+      this.tabsCurrentIndex = Number(this.$route.query.t);
+      console.log(this.tabsCurrentIndex);
+    }
+    if (this.$route.query.m) {
+      this.nowPrice = Number(this.$route.query.m);
+      this.profitTarget = Number(this.$route.query.m);
+      this.zhisun = Number(this.$route.query.m);
+      this.nums = Number(this.$route.query.m);
+    }
+    if (this.$route.query.id) {
+      this.id = this.$route.query.id;
+    }
+    if (this.$route.query.code) {
+      this.code = this.$route.query.code;
+    }
+    if (this.$route.query.name) {
+      this.name = this.$route.query.name;
+    }
+    if (this.$route.query.spell) {
+      this.spell = this.$route.query.spell;
+    }
+    if (this.$route.query.type) {
+      this.type = this.$route.query.type;
+    }
+    if (this.$route.query.if_us) {
+      this.if_us = this.$route.query.if_us;
+    }
+  },
+  data() {
+    return {
+      password: "",
+      show: false,
+      tradingArr: [this.$t("hj84"), this.$t("hj85")],
+      tabsCurrentIndex: 0,
+      priceTabs: [this.$t("hj108"), this.$t("hj109")],
+      // priceTabs: [this.$t("hj108")],
+      priceTabsCurrentIndex: 0,
+      num: 1,
+      nums: 1,
+      profit: false,
+      nowPrice: 0,
+      type: 0,
+      code: "",
+      name: "",
+      spell: "",
+      settingInfo: [],
+      selectCycle: "1X",
+      selectLever: 1,
+      siteLeverList: [],
+      checkedZy: false,
+      checkedZs: false,
+      buying: false,
+      zhisun: 0,
+      showGg: false,
+      profitTarget: 0,
+      if_us: 0,
+      bayType: "",
+      id: "",
+      actions: [
+        {
+          name: "100X",
+          subname: this.$t("hj102"),
+        },
+        {
+          name: "200X",
+          subname: this.$t("hj102"),
+        },
+        {
+          name: "300X",
+          subname: this.$t("hj102"),
+        },
+      ],
+      profitArr: [
+        {
+          name: this.$t("hj104"),
+          checked: false,
+        },
+        {
+          name: this.$t("hj105"),
+          checked: false,
+        },
+        {
+          name: this.$t("hj110"),
+          checked: false,
+        },
+      ],
+      moneyData: {},
+      gid: "",
+    };
+  },
 
-    mounted() {
-      this.bayType = this.$route.query.bayType;
-      this.gid = this.$route.query.gid;
-      if (this.bayType == "in") {
-        this.priceTabs = [this.$t("hj108"), this.$t("hj109")];
-      } else if (this.bayType == "qh") {
-        this.priceTabs = [this.$t("hj108")];
+  mounted() {
+    this.bayType = this.$route.query.bayType;
+    this.gid = this.$route.query.gid;
+    if (this.bayType == "in") {
+      this.priceTabs = [this.$t("hj108"), this.$t("hj109")];
+    } else if (this.bayType == "qh") {
+      this.priceTabs = [this.$t("hj108")];
+    }
+    this.setUseInfo();
+    this.getMoneyData();
+    this.getSettingInfo();
+  },
+  watch: {
+    checkedZy(val) {
+      if (navigator.vibrate) {
+        // 支持
+        navigator.vibrate([55]);
       }
-      this.setUseInfo();
-      this.getMoneyData();
-      this.getSettingInfo();
     },
-    watch: {
-      checkedZy(val) {
-        if (navigator.vibrate) {
-          // 支持
-          navigator.vibrate([55]);
-        }
-      },
-      checkedZs(val) {
-        if (navigator.vibrate) {
-          // 支持
-          navigator.vibrate([55]);
-        }
-      },
+    checkedZs(val) {
+      if (navigator.vibrate) {
+        // 支持
+        navigator.vibrate([55]);
+      }
     },
-    methods: {
-      zSjian(){
-        var newzishu = (Number(this.zhisun)-1).toFixed(2)
-        if(Number(newzishu)<1){
+  },
+  methods: {
+    zSjian() {
+      var newzishu = (Number(this.zhisun) - 1).toFixed(2);
+      if (Number(newzishu) < 1) {
+      } else {
+        this.zhisun = newzishu;
+      }
+    },
+    ...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);
+    },
+    handleDoubleClick(event) {
+      console.log(1);
+      // console.log('Input field was double-clicked', event);
+    },
+    async getMoneyData() {
+      let data = await api.getMoney();
+      let type = this.bayType === "SZHB" ? "US" : this.bayType;
+      if (data.status === 0) {
+        const newArr = data.data.filter((item) => item.accectType === type);
 
-        }else{
-          this.zhisun = newzishu
-        }
-      },
-      ...mapActions(["setUseInfo"]),
-      numInput(e) {
-        // this.nowPrice / this.selectCycle.replace("X", "")
-        // this.moneyData.availableBalance
-        let numbs = Math.floor(
-          this.moneyData.availableBalance /
+        this.moneyData = newArr[0] || {};
+        // console.log(this.bayType, newArr);
+        // 判断是否登录
+        // this.moneyList = data.data;
+      }
+    },
+    handleBack() {
+      this.$router.go(-1);
+    },
+    handleTradingClick(index) {
+      this.tabsCurrentIndex = index;
+    },
+    handleTabsClick(item, index) {
+      this.priceTabsCurrentIndex = index;
+    },
+    jjjisua() {
+      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);
-      },
-      handleDoubleClick(event) {
-        console.log(1);
-        // console.log('Input field was double-clicked', event);
-      },
-      async getMoneyData() {
-        let data = await api.getMoney();
-        let type = this.bayType === "SZHB" ? "US" : this.bayType;
-        if (data.status === 0) {
-          const newArr = data.data.filter((item) => item.accectType === type);
+      );
+      typeof this.num == "string"
+        ? (this.num = Number(Number(this.num) + 1))
+        : (this.num = Number(Number(this.num) + 1));
 
-          this.moneyData = newArr[0] || {};
-          // console.log(this.bayType, newArr);
-          // 判断是否登录
-          // this.moneyList = data.data;
-        }
-      },
-      handleBack() {
-        this.$router.go(-1);
-      },
-      handleTradingClick(index) {
-        this.tabsCurrentIndex = index;
-      },
-      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") {
+      console.log(this.num, numbs);
+      if (this.num >= numbs) {
+        this.num = numbs;
+      }
+    },
+    jyslJian() {
+      if (typeof this.num === "string") {
+        this.num = 1;
+      } else {
+        if (this.num > 1) {
+          if (typeof this.num === "string") {
+            this.num = Number(this.num - 1);
+          } else {
+            this.num = Number(this.num - 1);
+          }
+        } else {
           this.num = 1;
-        } else {
-          if (this.num > 1) {
-            if (typeof this.num === "string") {
-              this.num = Number(this.num - 1);
-            } else {
-              this.num = Number(this.num - 1);
-            }
-          } else {
-            this.num = 1;
-          }
         }
-      },
-      gdJian() {
-        if (this.nums > 1) {
-          if (typeof this.nums === "string") {
-            this.nums = Number(Number(this.nums) - 1).toFixed(2);
-          } else {
-            this.nums = Number(Number(this.nums) - 1).toFixed(2);
-          }
-        } else {
-          this.nums = this.nowPrice;
-        }
-      },
-      zYjian() {
-      var newzishu = (Number(this.profitTarget)-1).toFixed(2)
-      if(Number(newzishu)<1){
-
-      }else{
-        this.profitTarget = newzishu
       }
-        // this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
-        // if(this.tabsCurrentIndex==0){
-        //   console.log( this.nowPrice);
-        //   if ((Number(this.profitTarget) - 1).toFixed(2) < this.nowPrice) {
-        //     this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
-        //   } else {
-        //     this.profitTarget = this.nowPrice;
-        //   }
-        // }else{
-        //   console.log(123);
-        //   if ((Number(this.profitTarget) - 1).toFixed(2) < this.nowPrice) {
-        //     this.profitTarget = this.nowPrice;
-        //   } else {
-        //     this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
-        //   }
-        // }
-
-
-      },
-      zSjia() {
-        this.zhisun++;
-        // if ((Number(this.zhisun) + 1).toFixed(2) > this.nowPrice) {
-        //   this.zhisun = this.nowPrice;
-        // } else {
-        //   this.zhisun++;
-        // }
-      },
-      zsInt(e) {
-        if (typeof e.target.value === "string") {
-          this.zhisun = this.nowPrice;
+    },
+    gdJian() {
+      if (this.nums > 1) {
+        if (typeof this.nums === "string") {
+          this.nums = Number(Number(this.nums) - 1).toFixed(2);
         } else {
-          if (Number(e.target.value) > this.nowPrice) {
-            this.zhisun = this.nowPrice;
-          }
+          this.nums = Number(Number(this.nums) - 1).toFixed(2);
         }
-      },
-      zyInt(e) {
-        if (typeof e.target.value === "string") {
-          this.profitTarget = this.nowPrice;
-        } else {
-          if (Number(e.target.value) < Number(this.nowPrice)) {
-            this.profitTarget = Number(this.nowPrice);
-          }
-        }
-      },
-      onSelect(val) {
-        this.selectCycle = val.name;
-        this.selectLever = val.label;
-      },
-      gdOrSetBuy() {
-        if (this.priceTabsCurrentIndex == 0) {
+      } else {
+        this.nums = this.nowPrice;
+      }
+    },
+    zYjian() {
+      var newzishu = (Number(this.profitTarget) - 1).toFixed(2);
+      if (Number(newzishu) < 1) {
+      } else {
+        this.profitTarget = newzishu;
+      }
+      // this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
+      // if(this.tabsCurrentIndex==0){
+      //   console.log( this.nowPrice);
+      //   if ((Number(this.profitTarget) - 1).toFixed(2) < this.nowPrice) {
+      //     this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
+      //   } else {
+      //     this.profitTarget = this.nowPrice;
+      //   }
+      // }else{
+      //   console.log(123);
+      //   if ((Number(this.profitTarget) - 1).toFixed(2) < this.nowPrice) {
+      //     this.profitTarget = this.nowPrice;
+      //   } else {
+      //     this.profitTarget = (Number(this.profitTarget) - 1).toFixed(2);
+      //   }
+      // }
+    },
+    zSjia() {
+      this.zhisun++;
+      // if ((Number(this.zhisun) + 1).toFixed(2) > this.nowPrice) {
+      //   this.zhisun = this.nowPrice;
+      // } else {
+      //   this.zhisun++;
+      // }
+    },
+    zsInt(e) {
+      console.log(e);
+      // if (typeof e.target.value === "string") {
+      //   this.zhisun = this.nowPrice;
+      // } else {
+      //   if (Number(e.target.value) > this.nowPrice) {
+      //     this.zhisun = this.nowPrice;
+      //   }
+      // }
+    },
+    zyInt(e) {
+      console.log(e);
+      // if (typeof e.target.value === "string") {
+      //   this.profitTarget = this.nowPrice;
+      // } else {
+      //   if (Number(e.target.value) < Number(this.nowPrice)) {
+      //     this.profitTarget = Number(this.nowPrice);
+      //   }
+      // }
+    },
+    onSelect(val) {
+      this.selectCycle = val.name;
+      this.selectLever = val.label;
+    },
+    async checkcheckStockVip() {
+      // this.$refs.closeDialog.show = true;
+      let data = await api.checkStockVip({ stockCode: this.code });
+      console.log(data, "data");
+      if (!data.data) {
+        this.password = "";
+        this.setBuy();
+      } else {
+        this.show = true;
+      }
+    },
+    gdOrSetBuy() {
+      if (this.priceTabsCurrentIndex == 0) {
+        this.checkcheckStockVip();
+      } else {
+        this.gdBuy();
+      }
+      if (navigator.vibrate) {
+        // 支持
+        navigator.vibrate([55]);
+      }
+    },
+    // 挂单
+    async gdBuy() {
+      if (this.buying) {
+        return;
+      }
+      this.buying = true;
+      let opts = {
+        stockId: this.code,
+        buyNum: this.num,
+        lever: this.selectLever,
+        targetPrice: this.nums,
+      };
+      console.log(this.selectLever, "this.selectLever ");
 
-          this.setBuy();
-        } else {
+      if (this.tabsCurrentIndex == 0) {
+        opts.buyType = 1;
+      } else {
+        opts.buyType = 0;
+      }
+      if (this.checkedZy) {
+        // opts.profitTarget = this.profitTarget.substring(0,this.profitTarget.indexOf(".")+3)
+        opts.profitTarget = this.profitTarget;
+      }
+      if (this.checkedZs) {
+        opts.stopTarget = this.zhisun;
+      }
+      let data = await api.guadan(opts);
+      this.buying = false;
+      if (data.status === 0) {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: data.msg,
+          elAlertType: "success",
+        });
+        this.getUserInfo();
+        this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
+      } else {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: data.msg,
+        });
+      }
+    },
+    // 买卖
+    setBuy() {
+      if (this.$store.state.userInfo.isActive !== 2) {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: this.$t("hj111"),
+        });
+        this.$router.push("/authentications");
+        return;
+      }
 
-          this.gdBuy();
-        }
-        if (navigator.vibrate) {
-          // 支持
-          navigator.vibrate([55]);
-        }
-      },
-      // 挂单
-      async gdBuy() {
-        if (this.buying) {
-          return;
-        }
-        this.buying = true;
-        let opts = {
-          stockId: this.code,
-          buyNum: this.num,
-          lever: this.selectLever,
-          targetPrice: this.nums,
-        };
-        console.log(this.selectLever, "this.selectLever ");
+      if (this.buying) {
+        return;
+      }
+      this.buying = true;
+      let opts = {};
+      opts = {
+        // stockId: this.detail.id,
+        // buyNum: this.selectNumber ? this.selectNumber * 100 : 0, // 单位为手
+        // buyType: this.selectType,
+        // lever: this.selectCycle ? this.selectCycle : 0,
+        // subaccountNumber:this.subaccountNumber
 
+        // 买入是买涨buyType:0, 卖出是买跌buyType:1,卖出的状态是0,买入的状态是1
+        buyNum: this.num, // 单位为手
+        // buyNum: (this.num.match(/\d+/g))[0] * 100, // 单位为手
+        lever: this.selectLever,
+      };
+      console.log(this.selectLever, "this.selectLever ");
+      if (this.tabsCurrentIndex == 0) {
+        opts.buyType = 1;
+      } else {
+        opts.buyType = 0;
+      }
+      if (this.checkedZy) {
+        // opts.profitTarget = this.profitTarget.substring(0,this.profitTarget.indexOf(".")+3)
+        opts.profitTarget = this.profitTarget;
+      }
+      if (this.checkedZs) {
+        opts.stopLoss = this.zhisun;
+      }
+      if (this.type == 0) {
+        // 股票
+        this.gpBuy(opts);
+        //   opts.stockId= this.code,
+        //  data = await api.buy(opts)
+      } else {
+        // 指数
+        this.zsBuy(opts);
+        //   opts.indexId= this.code,
+        //  data = await api.indexBuy(opts)
+      }
+    },
+    // 股票买入
+    async gpBuy(opts) {
+      opts.stockId = this.id;
+      opts.password = this.password;
+      let data = await api.buy(opts);
+      this.buying = false;
+      if (data.status === 0) {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: data.msg,
+          elAlertType: "success",
+        });
+        this.getUserInfo();
+        var buyType = "";
         if (this.tabsCurrentIndex == 0) {
-          opts.buyType = 1;
+          buyType = 1;
         } else {
-          opts.buyType = 0;
+          buyType = 0;
         }
-        if (this.checkedZy) {
-          // opts.profitTarget = this.profitTarget.substring(0,this.profitTarget.indexOf(".")+3)
-          opts.profitTarget = this.profitTarget;
-        }
-        if (this.checkedZs) {
-          opts.stopTarget = this.zhisun;
-        }
-        let data = await api.guadan(opts);
-        this.buying = false;
-        if (data.status === 0) {
+        this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
+      } else {
+        if (data.msg.indexOf("不在交易时段内") > -1) {
           this.$store.commit("elAlertShow", {
             elAlertShow: true,
-            elAlertText: data.msg,
-            elAlertType: "success",
+            elAlertText: this.$t("hj113"),
           });
-          this.getUserInfo();
-          this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
         } else {
           this.$store.commit("elAlertShow", {
             elAlertShow: true,
             elAlertText: data.msg,
           });
         }
-      },
-      // 买卖
-      setBuy() {
-        if (this.$store.state.userInfo.isActive !== 2) {
-          this.$store.commit("elAlertShow", {
-            elAlertShow: true,
-            elAlertText: this.$t("hj111"),
-          });
-          this.$router.push("/authentications");
-          return;
-        }
+      }
+    },
+    // 指数买入
+    async zsBuy(opts) {
+      opts.indexId = this.id;
+      let data = await api.indexBuy(opts);
+      this.buying = false;
+      if (data.status === 0) {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: data.msg,
+          elAlertType: "success",
+        });
+        this.getUserInfo();
+        this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
+      } else {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: data.msg,
+        });
+      }
+    },
+    async getUserInfo() {
+      // 获取用户信息
+      //   let showcookie = this.getCookie('USER_TOKEN');
+      let data = await api.getUserInfo();
+      if (data.status === 0) {
+        // this.getProductSetting()
+        this.$store.state.userInfo = data.data;
+      } else {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: data.msg,
+        });
+      }
+      this.$store.state.user = this.user;
+    },
+    async getSettingInfo() {
+      // 网站设置信息
+      let data = await api.getSetting();
+      if (data.status === 0) {
+        // 成功
+        this.settingInfo = data.data;
+        // 杠杆倍数
+        // data.data.siteLever根据/分割成数组
+        // this.siteLeverList = data.data.siteLever.split('/')
 
-        if (this.buying) {
-          return;
-        }
-        this.buying = true;
-        let opts = {};
-        opts = {
-          // stockId: this.detail.id,
-          // buyNum: this.selectNumber ? this.selectNumber * 100 : 0, // 单位为手
-          // buyType: this.selectType,
-          // lever: this.selectCycle ? this.selectCycle : 0,
-          // subaccountNumber:this.subaccountNumber
+        if (
+          this.$store.state.userInfo !== undefined &&
+          this.$store.state.userInfo !== null &&
+          this.$store.state.userInfo.siteLever != null
+        ) {
+          this.selectCycle =
+            this.$store.state.userInfo.siteLever.split("/")[0] + "X";
 
-          // 买入是买涨buyType:0, 卖出是买跌buyType:1,卖出的状态是0,买入的状态是1
-          buyNum: this.num, // 单位为手
-          // buyNum: (this.num.match(/\d+/g))[0] * 100, // 单位为手
-          lever: this.selectLever,
-        };
-        console.log(this.selectLever, "this.selectLever ");
-        if (this.tabsCurrentIndex == 0) {
-          opts.buyType = 1;
-        } else {
-          opts.buyType = 0;
-        }
-        if (this.checkedZy) {
-          // opts.profitTarget = this.profitTarget.substring(0,this.profitTarget.indexOf(".")+3)
-          opts.profitTarget = this.profitTarget;
-        }
-        if (this.checkedZs) {
-          opts.stopLoss = this.zhisun;
-        }
-        if (this.type == 0) {
-          // 股票
-          this.gpBuy(opts);
-          //   opts.stockId= this.code,
-          //  data = await api.buy(opts)
-        } else {
-          // 指数
-          this.zsBuy(opts);
-          //   opts.indexId= this.code,
-          //  data = await api.indexBuy(opts)
-        }
-      },
-      // 股票买入
-      async gpBuy(opts) {
-        opts.stockId = this.id;
-        let data = await api.buy(opts);
-        this.buying = false;
-        if (data.status === 0) {
-          this.$store.commit("elAlertShow", {
-            elAlertShow: true,
-            elAlertText: data.msg,
-            elAlertType: "success",
-          });
-          this.getUserInfo();
-          var buyType = "";
-          if (this.tabsCurrentIndex == 0) {
-            buyType = 1;
-          } else {
-            buyType = 0;
-          }
-          this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
-        } else {
-          if (data.msg.indexOf("不在交易时段内") > -1) {
-            this.$store.commit("elAlertShow", {
-              elAlertShow: true,
-              elAlertText: this.$t("hj113"),
-            });
-          } else {
-            this.$store.commit("elAlertShow", {
-              elAlertShow: true,
-              elAlertText: data.msg,
-            });
-          }
-        }
-      },
-      // 指数买入
-      async zsBuy(opts) {
-        opts.indexId = this.id;
-        let data = await api.indexBuy(opts);
-        this.buying = false;
-        if (data.status === 0) {
-          this.$store.commit("elAlertShow", {
-            elAlertShow: true,
-            elAlertText: data.msg,
-            elAlertType: "success",
-          });
-          this.getUserInfo();
-          this.$router.push("/warehouse?index=1&buyType=" + this.bayType);
-        } else {
-          this.$store.commit("elAlertShow", {
-            elAlertShow: true,
-            elAlertText: data.msg,
-          });
-        }
-      },
-      async getUserInfo() {
-        // 获取用户信息
-        //   let showcookie = this.getCookie('USER_TOKEN');
-        let data = await api.getUserInfo();
-        if (data.status === 0) {
-          // this.getProductSetting()
-          this.$store.state.userInfo = data.data;
-        } else {
-          this.$store.commit("elAlertShow", {
-            elAlertShow: true,
-            elAlertText: data.msg,
-          });
-        }
-        this.$store.state.user = this.user;
-      },
-      async getSettingInfo() {
-        // 网站设置信息
-        let data = await api.getSetting();
-        if (data.status === 0) {
-          // 成功
-          this.settingInfo = data.data;
-          // 杠杆倍数
-          // data.data.siteLever根据/分割成数组
-          // this.siteLeverList = data.data.siteLever.split('/')
-
-          if (
-            this.$store.state.userInfo !== undefined &&
-            this.$store.state.userInfo !== null &&
-            this.$store.state.userInfo.siteLever != null
+          this.siteLeverList = [];
+          for (
+            let i = 0;
+            i < this.$store.state.userInfo.siteLever.split("/").length;
+            i++
           ) {
-            this.selectCycle =
-              this.$store.state.userInfo.siteLever.split("/")[0] + "X";
-
-            this.siteLeverList = [];
-            for (
-              let i = 0; i < this.$store.state.userInfo.siteLever.split("/").length; i++
-            ) {
-              let val = this.$store.state.userInfo.siteLever.split("/")[i];
-              let item = {
-                label: val,
-                name: val + "X"
-              };
-              this.siteLeverList.push(item);
-            }
-            console.log(this.siteLeverList, " this.selectCycle");
+            let val = this.$store.state.userInfo.siteLever.split("/")[i];
+            let item = {
+              label: val,
+              name: val + "X",
+            };
+            this.siteLeverList.push(item);
           }
-        } else {
-          this.$store.commit("elAlertShow", {
-            elAlertShow: true,
-            elAlertText: data.msg,
-          });
+          console.log(this.siteLeverList, " this.selectCycle");
         }
-      },
+      } else {
+        this.$store.commit("elAlertShow", {
+          elAlertShow: true,
+          elAlertText: data.msg,
+        });
+      }
     },
-    filters: {
-      getName(name) {
-        if (name.length > 15) {
-          return name;
-        } else {
-          return name;
-        }
-      },
+  },
+  filters: {
+    getName(name) {
+      if (name.length > 15) {
+        return name;
+      } else {
+        return name;
+      }
     },
-  };
+  },
+};
 </script>
 
 <style scoped lang="less">
-  .buy_page {
-    width: 100%;
-    min-height: 100vh;
-    background-color: #fff;
+.buy_page {
+  width: 100%;
+  min-height: 100vh;
+  background-color: #fff;
 
-    >.content {
-      width: 100%;
-      height: calc(100% - 1.6rem);
-      position: relative;
-      background-color: rgb(241, 242, 246);
-    }
+  > .content {
+    width: 100%;
+    height: calc(100% - 1.6rem);
+    position: relative;
+    background-color: rgb(241, 242, 246);
   }
+}
 
-  .top_cny {
+.top_cny {
+  width: 100%;
+  height: 3.5385rem;
+
+  .top_back {
     width: 100%;
-    height: 3.5385rem;
+    height: 1.2rem;
+    display: flex;
+    align-items: center;
+    padding: 0 0.1rem;
 
-    .top_back {
-      width: 100%;
-      height: 1.2rem;
+    .left_back {
+      width: 0.8rem;
+      height: 80%;
       display: flex;
       align-items: center;
-      padding: 0 0.1rem;
 
-      .left_back {
-        width: 0.8rem;
-        height: 80%;
+      > img {
+        margin-top: 0.2rem;
+        width: 0.6rem;
+        height: 0.6rem;
+      }
+    }
+
+    .right_title {
+      width: 3rem;
+      height: 80%;
+
+      .t_t {
+        width: 100%;
+        height: 70%;
         display: flex;
         align-items: center;
+        font-size: 0.4615rem;
 
-        >img {
-          margin-top: 0.2rem;
-          width: 0.6rem;
-          height: 0.6rem;
+        span {
+          font-weight: 600;
         }
       }
 
-      .right_title {
-        width: 3rem;
-        height: 80%;
+      .b_t {
+        width: 100%;
+        height: 30%;
+        font-size: 0.3615rem;
+        display: flex;
+        align-items: flex-start;
+        color: #8c8c8c;
+      }
+    }
+  }
 
-        .t_t {
+  .bottom_buy_price {
+    width: 100%;
+    height: 2rem;
+    display: flex;
+    align-items: center;
+    padding: 0 0.8rem;
+    margin-top: 0.3rem;
+
+    .cot {
+      width: 100%;
+      height: 1.2rem;
+      display: flex;
+
+      .lefts {
+        width: 40%;
+        height: 100%;
+
+        .top_new {
           width: 100%;
-          height: 70%;
-          display: flex;
-          align-items: center;
-          font-size: 0.4615rem;
+          height: 60%;
+          font-size: 0.5615rem;
+          color: rgb(232, 55, 70);
 
           span {
             font-weight: 600;
           }
         }
 
-        .b_t {
+        .bottom_es {
           width: 100%;
-          height: 30%;
-          font-size: 0.3615rem;
-          display: flex;
-          align-items: flex-start;
-          color: #8c8c8c;
+          height: 40%;
+          color: rgb(173, 173, 173);
         }
       }
-    }
 
-    .bottom_buy_price {
-      width: 100%;
-      height: 2rem;
-      display: flex;
-      align-items: center;
-      padding: 0 0.8rem;
-      margin-top: 0.3rem;
-
-      .cot {
-        width: 100%;
-        height: 1.2rem;
+      .rights {
+        width: 60%;
+        height: 100%;
         display: flex;
+        align-items: center;
+        justify-content: flex-end;
 
-        .lefts {
-          width: 40%;
-          height: 100%;
+        > div {
+          width: 65%;
+          height: 80%;
+          display: flex;
+          justify-content: center;
 
-          .top_new {
-            width: 100%;
-            height: 60%;
-            font-size: 0.5615rem;
-            color: rgb(232, 55, 70);
+          > div {
+            width: 45%;
+            height: 70%;
+            background: rgb(236, 236, 236);
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            border-radius: 0.1rem;
+            color: rgb(173, 173, 173);
+          }
+
+          .active {
+            background: #fff;
+            color: rgb(110, 169, 118);
 
             span {
               font-weight: 600;
             }
           }
 
-          .bottom_es {
-            width: 100%;
-            height: 40%;
-            color: rgb(173, 173, 173);
-          }
-        }
+          .actives {
+            background: #fff;
+            color: rgb(212, 71, 78);
 
-        .rights {
-          width: 60%;
-          height: 100%;
-          display: flex;
-          align-items: center;
-          justify-content: flex-end;
-
-          >div {
-            width: 65%;
-            height: 80%;
-            display: flex;
-            justify-content: center;
-
-            >div {
-              width: 45%;
-              height: 70%;
-              background: rgb(236, 236, 236);
-              display: flex;
-              justify-content: center;
-              align-items: center;
-              border-radius: 0.1rem;
-              color: rgb(173, 173, 173);
-            }
-
-            .active {
-              background: #fff;
-              color: rgb(110, 169, 118);
-
-              span {
-                font-weight: 600;
-              }
-            }
-
-            .actives {
-              background: #fff;
-              color: rgb(212, 71, 78);
-
-              span {
-                font-weight: 600;
-              }
+            span {
+              font-weight: 600;
             }
           }
         }
       }
     }
   }
+}
 
-  .price_tabs {
+.price_tabs {
+  width: 100%;
+  height: auto;
+  padding: 0.2rem 0.8rem;
+  background: #fff;
+  margin-top: 0.1rem;
+  border-radius: 0.3rem;
+
+  .tabs {
     width: 100%;
-    height: auto;
-    padding: 0.2rem 0.8rem;
-    background: #fff;
-    margin-top: 0.1rem;
-    border-radius: 0.3rem;
+    height: 0.8205rem;
+    background: rgb(247, 247, 247);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    border-radius: 0.15rem;
 
-    .tabs {
-      width: 100%;
-      height: 0.8205rem;
-      background: rgb(247, 247, 247);
-      display: flex;
-      align-items: center;
-      justify-content: center;
+    > div {
+      width: 49%;
+      height: 80%;
       border-radius: 0.15rem;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+    }
 
-      >div {
-        width: 49%;
-        height: 80%;
-        border-radius: 0.15rem;
-        display: flex;
-        justify-content: center;
-        align-items: center;
+    .active {
+      background: #fff;
+
+      span {
+        font-weight: 600;
       }
+    }
+  }
 
-      .active {
-        background: #fff;
+  .tabs_content {
+    width: 100%;
+    margin-top: 0.3rem;
 
-        span {
+    .num {
+      width: 100%;
+      height: 0.5rem;
+      line-height: 0.5rem;
+      position: relative;
+      top: 0.2rem;
+    }
+
+    .tr_es {
+      width: 100%;
+      height: 1.3rem;
+      margin-top: 0.15rem;
+      border-bottom: 0.05rem solid rgb(236, 236, 236);
+
+      .top_input {
+        width: 70%;
+        height: 70%;
+        font-size: 0.6615rem;
+
+        input {
           font-weight: 600;
         }
       }
     }
 
-    .tabs_content {
+    .tr_rs {
       width: 100%;
-      margin-top: 0.3rem;
+      height: 1.3rem;
+      margin-top: 0.4rem;
 
-      .num {
+      > div {
         width: 100%;
-        height: 0.5rem;
-        line-height: 0.5rem;
-        position: relative;
-        top: 0.2rem;
-      }
-
-      .tr_es {
-        width: 100%;
-        height: 1.3rem;
-        margin-top: 0.15rem;
-        border-bottom: 0.05rem solid rgb(236, 236, 236);
-
-        .top_input {
-          width: 70%;
-          height: 70%;
-          font-size: 0.6615rem;
-
-          input {
-            font-weight: 600;
-          }
-        }
-      }
-
-      .tr_rs {
-        width: 100%;
-        height: 1.3rem;
-        margin-top: 0.4rem;
-
-        >div {
-          width: 100%;
-          height: 50%;
-          color: rgb(160, 160, 160);
-          display: flex;
-          justify-content: space-between;
-
-          span {
-            font-weight: 600;
-          }
-        }
-
-        .bottom_bzz {
-          color: #000;
-          font-size: 0.3846rem;
-
-          span {
-            font-weight: 600;
-          }
-        }
-
-        .top_bzz {
-          align-items: center;
-        }
-      }
-
-      .gg {
-        margin-top: 0 !important;
-        height: 1.8rem;
+        height: 50%;
+        color: rgb(160, 160, 160);
         display: flex;
-        align-items: center;
-        font-size: 0.3803rem;
-        border-bottom: 0.05rem solid rgb(236, 236, 236);
+        justify-content: space-between;
 
-        >div {
-          color: #000;
+        span {
+          font-weight: 600;
         }
+      }
+
+      .bottom_bzz {
+        color: #000;
+        font-size: 0.3846rem;
+
+        span {
+          font-weight: 600;
+        }
+      }
+
+      .top_bzz {
+        align-items: center;
       }
     }
-  }
 
-  .switchs {
-    width: 100%;
-    height: auto;
-    padding: 0 0.8rem;
-    background: #fff;
-    margin-top: 0.3rem;
-    border-radius: 0.3rem 0.3rem 0 0;
-    transition: all 0.5s;
-
-    .zy {
-      transition: all 0.5s;
-      width: 100%;
+    .gg {
+      margin-top: 0 !important;
       height: 1.8rem;
       display: flex;
-      justify-content: space-between;
       align-items: center;
+      font-size: 0.3803rem;
       border-bottom: 0.05rem solid rgb(236, 236, 236);
 
-      >div {
-        // width: 20%;
-        height: 50%;
-        display: flex;
-        align-items: center;
-        font-size: 0.3346rem;
-      }
-
-      .right_sw {
-        justify-content: flex-end;
+      > div {
+        color: #000;
       }
     }
   }
+}
 
-  .btn_buy {
+.switchs {
+  width: 100%;
+  height: auto;
+  padding: 0 0.8rem;
+  background: #fff;
+  margin-top: 0.3rem;
+  border-radius: 0.3rem 0.3rem 0 0;
+  transition: all 0.5s;
+
+  .zy {
+    transition: all 0.5s;
     width: 100%;
-    height: auto;
-    bottom: 0;
-    background: #fff;
-    padding: 0.8rem 0.8rem;
-    display: flex;
-    align-items: flex-end;
-    // padding-top: 0.8rem;
-
-    >div {
-      width: 100%;
-      height: 1.2821rem;
-      display: flex;
-      justify-content: center;
-      align-items: center;
-      background: rgb(68, 155, 84);
-      color: #fff;
-      font-size: 0.3846rem;
-      border-radius: 0.15rem;
-    }
-  }
-
-  /deep/.van-action-sheet__name {
-    font-size: 0.3846rem;
-    color: #000;
-  }
-
-  /deep/.van-action-sheet__gap {
-    height: 0.25rem;
-  }
-
-  /deep/.van-action-sheet__cancel {
-    font-size: 0.4246rem;
-    height: 1.3rem;
-    color: #000;
-  }
-
-  /deep/.van-action-sheet__description {
-    font-size: 0.3846rem;
-    height: 1.45rem;
-    line-height: 0.7rem;
-  }
-
-  .left_zy input {
-    font-size: 0.48rem;
-    font-weight: 500;
-  }
-
-  .addorj {
-    width: 0.7rem;
-    height: 0.7rem;
-    color: #000;
-    font-weight: 500;
-    cursor: pointer;
-  }
-
-  .addorj img {
-    width: 100%;
-    height: 100%;
-    cursor: pointer;
-  }
-
-  .flexJy {
+    height: 1.8rem;
     display: flex;
     justify-content: space-between;
     align-items: center;
-  }
+    border-bottom: 0.05rem solid rgb(236, 236, 236);
 
-  .top_input input {
+    > div {
+      // width: 20%;
+      height: 50%;
+      display: flex;
+      align-items: center;
+      font-size: 0.3346rem;
+    }
+
+    .right_sw {
+      justify-content: flex-end;
+    }
+  }
+}
+
+.btn_buy {
+  width: 100%;
+  height: auto;
+  bottom: 0;
+  background: #fff;
+  padding: 0.8rem 0.8rem;
+  display: flex;
+  align-items: flex-end;
+  // padding-top: 0.8rem;
+
+  > div {
     width: 100%;
+    height: 1.2821rem;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    background: rgb(68, 155, 84);
+    color: #fff;
+    font-size: 0.3846rem;
+    border-radius: 0.15rem;
   }
+}
 
-  .maichu {
-    background-color: rgb(225, 59, 69) !important;
+/deep/.van-action-sheet__name {
+  font-size: 0.3846rem;
+  color: #000;
+}
+
+/deep/.van-action-sheet__gap {
+  height: 0.25rem;
+}
+
+/deep/.van-action-sheet__cancel {
+  font-size: 0.4246rem;
+  height: 1.3rem;
+  color: #000;
+}
+
+/deep/.van-action-sheet__description {
+  font-size: 0.3846rem;
+  height: 1.45rem;
+  line-height: 0.7rem;
+}
+
+.left_zy input {
+  font-size: 0.48rem;
+  font-weight: 500;
+}
+
+.addorj {
+  width: 0.7rem;
+  height: 0.7rem;
+  color: #000;
+  font-weight: 500;
+  cursor: pointer;
+}
+
+.addorj img {
+  width: 100%;
+  height: 100%;
+  cursor: pointer;
+}
+
+.flexJy {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.top_input input {
+  width: 100%;
+}
+
+.maichu {
+  background-color: rgb(225, 59, 69) !important;
+}
+
+.mr {
+  position: relative;
+
+  &::after {
+    content: " ";
+    position: absolute;
+    display: block;
+    width: 100%;
+    height: 100%;
+    top: 0;
+    left: -0.1rem;
+    z-index: 10000;
+    background: rgba(255, 255, 255, 0);
+    border-left: 0.12rem solid rgb(241, 242, 246);
+    transform-origin: bottom right;
+    -ms-transform: skew(-10deg, 0deg);
+    -webkit-transform: skew(-10deg, 0deg);
+    transform: skew(-10deg, 0deg);
   }
+}
 
-  .mr {
-    position: relative;
+.mc {
+  position: relative;
 
-    &::after {
-      content: " ";
-      position: absolute;
-      display: block;
-      width: 100%;
-      height: 100%;
-      top: 0;
-      left: -0.1rem;
-      z-index: 10000;
-      background: rgba(255, 255, 255, 0);
-      border-left: 0.12rem solid rgb(241, 242, 246);
-      transform-origin: bottom right;
-      -ms-transform: skew(-10deg, 0deg);
-      -webkit-transform: skew(-10deg, 0deg);
-      transform: skew(-10deg, 0deg);
+  &::after {
+    content: " ";
+    position: absolute;
+    display: block;
+    width: 100%;
+    height: 100%;
+    top: 0;
+    left: 0;
+    z-index: 10000;
+    background: rgba(255, 255, 255, 0);
+    border-right: 0.1rem solid rgb(241, 242, 246);
+    transform-origin: bottom left;
+    -ms-transform: skew(-10deg, 0deg);
+    -webkit-transform: skew(-10deg, 0deg);
+    transform: skew(-10deg, 0deg);
+  }
+}
+
+/deep/.van-overlay {
+  z-index: 10000 !important;
+}
+
+/deep/.van-popup {
+  z-index: 10001 !important;
+}
+
+.popup-box {
+  padding: 30px 20px;
+  .input-box {
+    height: 1.3rem;
+    background: #f3f3f3;
+    border-radius: 0.15rem;
+
+    line-height: 1.3rem;
+    padding-left: 10px;
+    display: flex;
+    padding-left: 0.2rem;
+    font-size: 0.3975rem;
+    .laber {
+      margin-right: 10px;
+    }
+    // margin-top: 0.8rem;
+  }
+  .but {
+    width: 100%;
+    height: 1.3rem;
+    border-radius: 0.15rem;
+    background: #5c288c;
+    color: #fff;
+    font-size: 0.4615rem;
+    margin-top: 0.5rem;
+  }
+  .shijian {
+    width: 100%;
+    margin-top: 0.5rem;
+    margin-bottom: 0.5rem;
+    .xgsj {
+      margin-top: 10px;
+      font-size: 0.3875rem;
+      // font-weight: 600;
+      display: -webkit-box;
+      display: -ms-flexbox;
+      display: flex;
+      height: 50%;
+      -webkit-box-align: center;
+      -ms-flex-align: center;
+      align-items: center;
+      .sjtlt {
+        width: 33%;
+        margin-left: 0.4rem;
+      }
     }
   }
-
-  .mc {
-    position: relative;
-
-    &::after {
-      content: " ";
-      position: absolute;
-      display: block;
-      width: 100%;
-      height: 100%;
-      top: 0;
-      left: 0;
-      z-index: 10000;
-      background: rgba(255, 255, 255, 0);
-      border-right: 0.1rem solid rgb(241, 242, 246);
-      transform-origin: bottom left;
-      -ms-transform: skew(-10deg, 0deg);
-      -webkit-transform: skew(-10deg, 0deg);
-      transform: skew(-10deg, 0deg);
-    }
-  }
-
-  /deep/.van-overlay {
-    z-index: 10000 !important;
-  }
-
-  /deep/.van-popup {
-    z-index: 10001 !important;
-  }
+}
 </style>
diff --git a/src/page/user/Warehouse/data.list.vue b/src/page/user/Warehouse/data.list.vue
index 38952e3..8ffa8c3 100644
--- a/src/page/user/Warehouse/data.list.vue
+++ b/src/page/user/Warehouse/data.list.vue
@@ -1,49 +1,31 @@
 <template>
   <div>
     <ul class="sport-tabs">
-      <li
-        :class="actives === item.key && 'active'"
-        v-for="item in tabsList"
-        :key="item.key"
-        @click="clickTabs(item)"
-      >
+      <li :class="actives === item.key && 'active'" v-for="item in tabsList" :key="item.key" @click="clickTabs(item)">
         {{ item.title }}
       </li>
     </ul>
-    <van-list
-      v-model="loading"
-      :finished="finished"
-      :finished-text="$t('hj43')"
-      :loading-text="$t('hj430')"
-      @load="onLoad"
-    >
-      <div
-        class="sport-content-li"
-        :style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
-        v-for="(item, index) in dataList"
-        :key="index"
-        @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"
-      >
+    <van-list v-model="loading" :finished="finished" :finished-text="$t('hj43')" :loading-text="$t('hj430')"
+      @load="onLoad">
+      <div class="sport-content-li" :style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
+        v-for="(item, index) in dataList" :key="index" @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)">
         <div @click.stop="pushRouter(item)">
           <div class="title-box">
             <div class="span">{{ item.stockName }}</div>
-            <div
-              class="states"
-              :class="item.orderDirection === '买跌' ? 'states-red' : ''"
-            >
+            <div class="states" :class="item.orderDirection === '买跌' ? 'states-red' : ''">
               {{ $t(item.orderDirection) }}
             </div>
           </div>
           {{ item.stockSpell }}
         </div>
         <!-- <div @click="$router.push('/Stockdetail')"></div> -->
-        <van-row>
+        <van-row v-if="actives != 2">
           <van-col span="8">
             <div style="text-align: left">
               <div class="sport-content-title2">
                 {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
               </div>
-              <div class="sport-content-text" >
+              <div class="sport-content-text">
                 {{ item.profitAndLose | _toLocaleString }}
               </div>
             </div>
@@ -62,8 +44,8 @@
             <div style="text-align: right">
               <div class="sport-content-title2">{{ $t("倉位(股)") }}</div>
               <div class="sport-content-text">{{ item.orderNum }}</div>
-            </div></van-col
-          >
+            </div>
+          </van-col>
         </van-row>
         <van-row>
           <van-col span="8">
@@ -72,7 +54,7 @@
                 {{ $t("hj40") }}({{ activeObj.symbolCode }})
               </div>
               <div class="sport-content-text2">
-                {{ item.now_price | _toLocaleString }}
+                {{ item.nowPrice | _toLocaleString }}
               </div>
             </div>
           </van-col>
@@ -92,7 +74,7 @@
                 {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
               </div>
               <div class="sport-content-text2">
-                {{ item.orderTotalPrice | _toLocaleString }}
+                {{ item.targetPrice | _toLocaleString }}
               </div>
             </div>
           </van-col>
@@ -108,7 +90,13 @@
               </div>
             </div>
           </van-col>
-         <!-- <van-col span="8">
+          <van-col span="8" style="height: 100%;display: flex;align-items: center;justify-content: center;">
+            <div v-if="actives == 2">
+              <van-button type="primary" @click.stop="cancelPending(item.id)"> {{ $t("撤销挂单")
+                }}</van-button>
+            </div>
+          </van-col>
+          <!-- <van-col span="8">
             <div style="text-align: center">
               <div class="sport-content-title2">
                 {{ $t("止損價") }} ({{ activeObj.symbolCode }})
@@ -133,8 +121,11 @@
           <van-col span="12">
             <div style="text-align: left">
               <div class="sport-content-title2">{{ $t("持倉時間") }}</div>
-              <div class="sport-content-text2">
+              <div class="sport-content-text2" v-if="actives != 2">
                 {{ $moment(item.buyOrderTime).format("DD-MM-YYYY hh:mm:ss A") }}
+              </div>
+              <div class="sport-content-text2" v-else>
+                {{ $moment(item.addTime).format("DD-MM-YYYY hh:mm:ss A") }}
               </div>
             </div>
           </van-col>
@@ -168,9 +159,10 @@
           </div>
           <div class="hang">
             <div class="left">{{ $t("倉位(股)") }}</div>
-            <div class="right" style="color: rgb(3, 173, 143)">
+            <input class="right" inputmode="numeric" style="color: rgb(3, 173, 143);width: 1.1rem;" v-model.number="closeNumber"  @input="handleInput">
+            <!-- <div class="right" style="color: rgb(3, 173, 143)">
               {{ closeSell.orderNum }}
-            </div>
+            </div> -->
           </div>
           <div class="hang">
             <div class="left">{{ $t("類型") }}</div>
@@ -179,12 +171,14 @@
         </div>
       </template>
     </Dialog>
+    <Dialog ref="closeOrder" :title="$t('撤销挂单')" :confirm="cancelPendingOrder">    
+    </Dialog>  
   </div>
 </template>
 
 <script>
 import Dialog from "@/components/Dialog";
-import { getchicang, sell } from "../../../axios/api";
+import { getchicang, sell, getorderList, delGuaDan } from "../../../axios/api";
 import { Notify } from "vant";
 export default {
   components: { Dialog },
@@ -203,7 +197,9 @@
       pageSize: 150,
       loading: true,
       finished: false,
-      closeSell: {},
+      closeSell: {
+        orderNum: 0
+      },
       show: false,
       actives: 0,
       dataList: [],
@@ -213,15 +209,20 @@
           title: this.$t("持倉"),
           key: 0,
         },
-
         {
           title: this.$t("平倉"),
           key: 1,
         },
+        {
+          title: this.$t('当前委托'),
+          key: 2,
+        }
       ],
+      id: '',
+      closeNumber: 0
     };
   },
-  created(){
+  created() {
     this.timer = setInterval(() => {
       this.getList();
     }, 1000);
@@ -230,6 +231,13 @@
     clearInterval(this.timer); // 在组件销毁前清除定时器
   },
   methods: {
+    handleInput(){
+      if (this.closeNumber > this.closeSell.orderNum) {
+          this.closeNumber = this.closeSell.orderNum; // 如果超过100则设置为100
+        } else if (this.closeNumber < 1) {
+          this.closeNumber = 1; // 如果小于0则设置为0,如果不需要小于0,可以删除这个部分
+        }
+    },
     pushRouter(item) {
       const obj = {
         pid: item.stockCode || "",
@@ -259,6 +267,7 @@
     async confirm() {
       const res = await sell({
         positionSn: this.closeSell.positionSn,
+        closeNumber: this.closeNumber
       });
       if (res.status === 0) {
         this.$refs.closeDialog.show = false;
@@ -278,16 +287,28 @@
         this.pageNum = 1;
         this.finished = false;
       }
-      const res = await getchicang({
-        state: this.actives,
-        stockType: laber || this.activeObj.laber,
-        pageNum: 1,
-        pageSize: 100,
-      });
-
+      let res;
+      if (this.actives == 0 || this.actives == 1) {
+        res = await getchicang({
+          state: this.actives,
+          stockType: laber || this.activeObj.laber,
+          pageNum: 1,
+          pageSize: 100,
+        });
+      } else {
+        res = await getorderList({
+          stockType: laber || this.activeObj.laber,
+          pageNum: 1,
+          pageSize: 100,
+        });
+      }
       this.loading = false;
       if (res.status === 0) {
-        this.dataList = res.data.list;
+        if (res.data.list) {
+          this.dataList = res.data.list;
+        } else {
+          this.dataList = res.data;
+        }
         this.$forceUpdate(); // 强制Vue重新渲染
         // if (res.data.total <= this.dataList.length) {
         this.finished = true;
@@ -300,6 +321,7 @@
     close(item) {
       this.closeSell = item;
       this.$refs.closeDialog.show = true;
+      this.closeNumber = this.closeSell.orderNum;
     },
     clickTabs(e) {
       this.dataList = [];
@@ -308,6 +330,25 @@
       this.actives = e.key;
       this.getList();
     },
+    cancelPending(id){
+       this.id = id
+       this.$refs.closeOrder.show  = true
+    },
+    async cancelPendingOrder() {
+      const res = await delGuaDan({
+        id : this.id
+      });
+      if (res.status === 1) {
+        this.$refs.closeOrder.show  = false
+        Notify({ type: "success", message: res.msg });
+        this.dataList = [];
+        this.pageNum = 1;
+        this.finished = false;
+        this.getList();
+      } else {
+        Notify({ type: "danger", message: res.msg });
+      }
+    }
   },
 };
 </script>
@@ -328,6 +369,7 @@
   top: 0;
   z-index: 99;
   background-color: #fff;
+
   li {
     height: 0.90667rem;
     line-height: 0.90667rem;
@@ -338,11 +380,13 @@
     color: #14181f;
     box-sizing: border-box;
   }
+
   .active {
     color: #0066ed;
     border-bottom: 0.08rem solid #0066ed;
   }
 }
+
 .sport-content-li {
   width: 100%;
   height: 7.52rem;
@@ -353,6 +397,7 @@
   border-bottom: 0.02667rem solid #f0f2f3;
   box-sizing: border-box;
 }
+
 .title-box {
   display: flex;
   font-style: normal;
@@ -362,8 +407,8 @@
   display: flex;
   align-items: center;
 
-  .span {
-  }
+  .span {}
+
   .states {
     display: inline-flex;
     justify-content: center;
@@ -395,6 +440,7 @@
   color: #8c9fad;
   // text-align: left;
 }
+
 .sport-content-text {
   margin-top: 5px;
   font-style: normal;
@@ -405,6 +451,7 @@
   // line-height: 18px;
   // text-align: right;
 }
+
 .sport-content-text2 {
   margin-top: 5px;
   // font-family: "PingFang SC";
@@ -419,6 +466,7 @@
 .but-box {
   display: flex;
   justify-content: space-around;
+
   .but {
     text-align: center;
 
@@ -434,6 +482,7 @@
     color: #0067ed;
     border: none;
   }
+
   .buts {
     min-width: 2.13333rem;
     height: 0.69333rem;
@@ -448,15 +497,18 @@
     color: #14181f;
   }
 }
+
 .hang {
   display: flex;
   justify-content: space-between;
+
   .left {
     font-style: normal;
     font-weight: 500;
     font-size: 0.34667rem;
     color: #8c9fad;
   }
+
   .right {
     font-style: normal;
     font-weight: 500;

--
Gitblit v1.9.3