From 3003b7486ddeffd169f2b2f564fc0ff8c2c58bb3 Mon Sep 17 00:00:00 2001
From: PC-20250623MANY\Administrator <344137771@qq.com>
Date: Tue, 22 Jul 2025 09:56:04 +0800
Subject: [PATCH] 1

---
 src/page/user/Warehouse/Stockdetail.vue |  184 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 165 insertions(+), 19 deletions(-)

diff --git a/src/page/user/Warehouse/Stockdetail.vue b/src/page/user/Warehouse/Stockdetail.vue
index 370f989..688d90b 100644
--- a/src/page/user/Warehouse/Stockdetail.vue
+++ b/src/page/user/Warehouse/Stockdetail.vue
@@ -12,37 +12,62 @@
     </van-nav-bar>
 
     <div class="bottomIfr">
-      <div class="pagebox">
-        <div class="pagebox_left">{{ $t("盈虧") }} ({{ pages.stockGid }})</div>
-        <div class="pagebox_right">{{ pages.profitAndLose | _toString }}</div>
+      <div class="pagebox" @click="toDetails">
+        <div class="pagebox_left">
+          <span class="i_icon">{{ pages.stockGid }}</span>
+          <span class="i_hint">{{ pages.stockSpell }}</span>
+        </div>
+        <div class="pagebox_right">
+          <van-icon name="arrow" size="1.2em" />
+        </div>
       </div>
       <div class="pagebox">
-        <div class="pagebox_left">{{ $t("hj141") }} ({{ pages.stockGid }})</div>
-        <div class="pagebox_right">{{ pages.profitAndLoseParent }}</div>
+        <div class="pagebox_left">{{ $t("盈虧") }}</div>
+        <div class="pagebox_right">
+          {{ pages.stockGid | currencySymbol }}
+          {{ pages.profitAndLose | _toString }}
+        </div>
+      </div>
+      <div class="pagebox">
+        <div class="pagebox_left">{{ $t("hj141") }}</div>
+        <div class="pagebox_right">
+          {{ pages.stockGid | currencySymbol }} {{ pages.profitAndLoseParent }}
+        </div>
       </div>
       <div class="pagebox">
         <div class="pagebox_left">{{ $t("倉位(股)") }}</div>
         <div class="pagebox_right">{{ pages.orderNum }}</div>
       </div>
       <div class="pagebox" v-if="pages.now_price">
-        <div class="pagebox_left">{{ $t("hj40") }}({{ pages.stockGid }})</div>
-        <div class="pagebox_right">{{ pages.now_price | _toString }}</div>
+        <div class="pagebox_left">{{ $t("hj40") }}</div>
+        <div class="pagebox_right">
+          {{ pages.stockGid | currencySymbol }}
+          {{ pages.now_price | _toString }}
+        </div>
       </div>
       <div class="pagebox">
         <div class="pagebox_left">
-          {{ $t("持倉價") }} ({{ pages.stockGid }})
+          {{ $t("持倉價") }}
         </div>
-        <div class="pagebox_right">{{ pages.buyOrderPrice | _toString }}</div>
+        <div class="pagebox_right">
+          {{ pages.stockGid | currencySymbol }}
+          {{ pages.buyOrderPrice | _toString }}
+        </div>
       </div>
       <div class="pagebox">
         <div class="pagebox_left">
-          {{ $t("訂單金額") }} ({{ pages.stockGid }})
+          {{ $t("訂單金額") }}
         </div>
-        <div class="pagebox_right">{{ pages.orderTotalPrice | _toString }}</div>
+        <div class="pagebox_right">
+          {{ pages.stockGid | currencySymbol }}
+          {{ pages.orderTotalPrice | _toString }}
+        </div>
       </div>
       <div class="pagebox">
-        <div class="pagebox_left">{{ $t("hj44") }} ({{ pages.stockGid }})</div>
-        <div class="pagebox_right">{{ pages.orderFee | _toString }}</div>
+        <div class="pagebox_left">{{ $t("hj44") }}</div>
+        <div class="pagebox_right">
+          {{ pages.stockGid | currencySymbol }} {{ pages.orderFee | _toString }}
+        </div>
       </div>
       <div class="pagebox">
         <div class="pagebox_left">
@@ -50,7 +75,6 @@
         </div>
         <div class="pagebox_right">{{ pages.buyOrderId }}</div>
       </div>
-
       <div class="pagebox" v-if="pages.buyOrderTime">
         <div class="pagebox_left">{{ $t("持倉時間") }}</div>
         <div class="pagebox_right">
@@ -63,16 +87,52 @@
           {{ $moment(pages.sellOrderTime).format("DD-MM-YYYY hh:mm:ss A") }}
         </div>
       </div>
+      <div class="buttonbox flex-center" v-show="!pages.sellOrderTime">
+        <van-button type="primary" @click="close"> {{ $t("平仓") }}</van-button>
+      </div>
+
+      <Dialog ref="closeDialog" :title="$t('确认平仓')" :confirm="confirm">
+        <template v-slot:center>
+          <div>
+            <div class="hang">
+              <div class="left">{{ $t("hj39") }}</div>
+              <div class="right">{{ pages.stockName }}</div>
+            </div>
+            <div class="hang">
+              <div class="left">{{ $t("買漲/買跌") }}</div>
+              <div class="right">{{ $t(pages.orderDirection) }}</div>
+            </div>
+            <div class="hang">
+              <div class="left">{{ $t("倉位(股)") }}</div>
+              <input
+                class="input_box"
+                type="number"
+                :max="pages.orderNum"
+                :placeholder="$t('hj262')"
+                v-model="ordernum"
+              />
+            </div>
+            <div class="hang">
+              <div class="left">{{ $t("類型") }}</div>
+              <div class="right">{{ $t("市價") }}</div>
+            </div>
+          </div>
+        </template>
+      </Dialog>
     </div>
   </div>
 </template>
 
 <script>
+import Dialog from "@/components/Dialog";
 import * as api from "@/axios/api";
+import { Notify } from "vant";
 export default {
+  components: { Dialog },
   data() {
     return {
       pages: {},
+      ordernum: ""
     };
   },
   // 生命周期 - 创建完成(访问当前this实例)
@@ -88,17 +148,55 @@
     },
     async getInfoSite() {
       var res = {
-        positionSn: this.$route.query.codes,
+        positionSn: this.$route.query.codes
       };
       let data = await api.findByPostionSn(res);
       if (data.status === 0) {
         this.pages = data.data;
       }
     },
-  },
+    // 点击进入详情
+    toDetails() {
+      const obj = {
+        pid: this.pages.stockCode || "",
+        type: this.pages.stockGid || ""
+      };
+      window.localStorage.setItem("kLine", JSON.stringify(obj));
+
+      this.$router.push({
+        path: "/kline",
+        query: {
+          code: this.pages.stockCode,
+          type: this.pages.stockGid
+        }
+      });
+    },
+    // 打开平仓弹窗
+    close() {
+      this.$refs.closeDialog.show = true;
+      this.ordernum = "";
+    },
+    // 平仓
+    async confirm() {
+      this.$refs.closeDialog.show = false;
+      const res = await api.sell({
+        positionSn: this.pages.positionSn,
+        number: this.ordernum
+      });
+      if (res.status === 0) {
+        this.finished = false;
+        Notify({ type: "success", message: res.msg });
+        this.$router.go(-1);
+      } else {
+        Notify({ type: "danger", message: res.msg });
+      }
+    }
+  }
 };
 </script>
-<style scoped lang='less'>
+<style scoped lang="less">
+@dark_green: #07c160;
+@green: #c4d600;
 /deep/ .van-nav-bar__content {
   height: 65px;
 }
@@ -124,14 +222,62 @@
   height: calc(100% - 65px);
   // height:;
   background-color: #fff !important;
+  font-size: 10vw;
+
+  .buttonbox {
+    padding-top: 1.2em;
+
+    /deep/ .van-button--primary {
+      background-color: @green;
+      border-color: @green;
+      font-size: 0.4em;
+    }
+  }
 }
 .pagebox {
-  margin: 0 15px;
-  height: 60px;
+  margin: 0 0.6em;
+  height: 3.2em;
+  font-size: 0.4em;
   display: flex;
   justify-content: space-between;
   align-items: center;
   border-bottom: 1px solid #ddd;
+
+  .i_icon {
+    border-radius: 0 26em 26em 0;
+    background: @dark_green;
+    color: #fff;
+    padding: 0.1em 0.5em 0.1em 0.4em;
+    margin-right: 0.3em;
+    font-size: 0.8em;
+  }
+
+  .i_name {
+    margin-top: 0.2em;
+    // color: #777777;
+    font-size: 0.9em;
+  }
+  .pagebox_right {
+    color: #969799;
+  }
+}
+
+.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;
+    font-size: 0.34667rem;
+    color: #14181f;
+    text-align: right;
+  }
 }
 .conentIfr {
   width: 100%;

--
Gitblit v1.9.3