1
2026-05-19 0ef335dce6b9f40f094fa46e08b0888a594fd2e1
src/page/user/Warehouse/Stockdetail.vue
@@ -96,13 +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="oneClose"> {{ $t("平仓") }}</van-button>
        <van-popover v-model="showPopover" trigger="click" placement="top" :actions="actions" @select="onSelect">
        <!-- <van-popover v-model="showPopover" trigger="click" placement="top" :actions="actions" @select="onSelect">
          <template #reference>
            <van-button type="primary"> {{ $t("一键平仓") }}</van-button>
            <van-button type="primary"> {{ $t("平仓") }}</van-button>
          </template>
        </van-popover>
        </van-popover> -->
      </div>
      <Dialog ref="closeDialog" :title="$t('确认平仓')" :confirm="confirm">
@@ -142,9 +142,8 @@
    return {
      pages: {},
      ordernum: "",
      actions: [{ text: this.$t('确定'), key: '1' }, { text: this.$t('取消'), key: '2' }],
      showPopover: false,
      // 通过 actions 属性来定义菜单选项
      actions: [{ text: '确定', key: '1' }, { text: '取消', key: '2' }],
    };
  },
  // 生命周期 - 创建完成(访问当前this实例)
@@ -198,26 +197,29 @@
      if (res.status === 0) {
        this.finished = false;
        Notify({ type: "success", message: res.msg });
        this.$router.go(-1);
        // this.$router.go(-1);
        this.$router.push({
          path: "/tradeNew",
        });
      } 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);
        this.$router.push({
          path: "/tradeNew",
        });
      } else {
        Notify({ type: "danger", message: res.msg });
      }
@@ -227,7 +229,7 @@
</script>
<style scoped lang="less">
@dark_green: #07c160;
@green: #c4d600;
@green: #00f0ff;
/deep/ .van-nav-bar__content {
  height: 65px;