From 15988a01f1b838822a8f8227059b88fd64ac61fb Mon Sep 17 00:00:00 2001
From: PC-20250623MANY\Administrator <344137771@qq.com>
Date: Sun, 28 Sep 2025 14:25:23 +0800
Subject: [PATCH] 1

---
 src/page/user/Warehouse/Stockdetail.vue |   61 +++++++++++++++++++++---------
 1 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/src/page/user/Warehouse/Stockdetail.vue b/src/page/user/Warehouse/Stockdetail.vue
index 78ee5c9..acf44a8 100644
--- a/src/page/user/Warehouse/Stockdetail.vue
+++ b/src/page/user/Warehouse/Stockdetail.vue
@@ -1,14 +1,8 @@
 <!--  -->
 <template>
   <div style="height: 100%">
-    <van-nav-bar
-      :placeholder="true"
-      :safe-area-inset-top="true"
-      :title="$t('订单详情')"
-      left-arrow
-      :fixed="true"
-      @click-left="handleBack"
-    >
+    <van-nav-bar :placeholder="true" :safe-area-inset-top="true" :title="$t('订单详情')" left-arrow :fixed="true"
+      @click-left="handleBack">
     </van-nav-bar>
 
     <div class="bottomIfr">
@@ -102,7 +96,13 @@
         </div>
       </div>
       <div class="buttonbox flex-center" v-show="!pages.sellOrderTime">
-        <van-button type="primary" @click="close"> {{ $t("平仓") }}</van-button>
+        <!-- <van-button type="primary" @click="close"> {{ $t("平仓") }}</van-button> -->
+
+        <van-popover v-model="showPopover" trigger="click" placement="top" :actions="actions" @select="onSelect">
+          <template #reference>
+            <van-button type="primary"> {{ $t("一键平仓") }}</van-button>
+          </template>
+        </van-popover>
       </div>
 
       <Dialog ref="closeDialog" :title="$t('确认平仓')" :confirm="confirm">
@@ -118,13 +118,8 @@
             </div>
             <div class="hang">
               <div class="left">{{ $t("倉位(股)") }}</div>
-              <input
-                class="input_box"
-                type="number"
-                :max="pages.orderNum"
-                :placeholder="$t('hj262')"
-                v-model="ordernum"
-              />
+              <input class="input_box" type="number" :max="pages.orderNum" :placeholder="$t('hj262')"
+                v-model="ordernum" />
             </div>
             <div class="hang">
               <div class="left">{{ $t("類型") }}</div>
@@ -146,7 +141,10 @@
   data() {
     return {
       pages: {},
-      ordernum: ""
+      ordernum: "",
+      showPopover: false,
+      // 通过 actions 属性来定义菜单选项
+      actions: [{ text: '确定', key: '1' }, { text: '取消', key: '2' }],
     };
   },
   // 生命周期 - 创建完成(访问当前this实例)
@@ -154,7 +152,7 @@
     this.getInfoSite();
   },
   // 生命周期 - 挂载完成(访问DOM元素)
-  mounted() {},
+  mounted() { },
   methods: {
     handleBack() {
       // 点击返回/
@@ -204,6 +202,25 @@
       } else {
         Notify({ type: "danger", message: res.msg });
       }
+    },
+    // 一键平仓确认弹框
+    onSelect(action) {
+      console.log(action.key);
+      if (action.key == 1) this.oneClose();
+    },
+    // 一键平仓
+    async oneClose() {
+      const res = await api.sell({
+        positionSn: this.pages.positionSn,
+        number: this.pages.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 });
+      }
     }
   }
 };
@@ -211,9 +228,11 @@
 <style scoped lang="less">
 @dark_green: #07c160;
 @green: #c4d600;
+
 /deep/ .van-nav-bar__content {
   height: 65px;
 }
+
 /deep/ .van-nav-bar__title {
   font-family: "DINPro";
   width: 100%;
@@ -226,6 +245,7 @@
   font-size: 0.48rem;
   color: #14181f;
 }
+
 .bottomIfr {
   // position: absolute;
   // top: 1.5rem;
@@ -249,6 +269,7 @@
     }
   }
 }
+
 .pagebox {
   margin: 0 0.6em;
   height: 3.2em;
@@ -272,6 +293,7 @@
     // color: #777777;
     font-size: 0.9em;
   }
+
   .pagebox_right {
     color: #969799;
   }
@@ -280,12 +302,14 @@
 .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;
@@ -294,6 +318,7 @@
     text-align: right;
   }
 }
+
 .conentIfr {
   width: 100%;
   height: 90%;

--
Gitblit v1.9.3