From f437ecdf2306e105340777b7233e147782f78d87 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Mon, 28 Apr 2025 14:38:01 +0800
Subject: [PATCH] feat:新加挂单,撤销挂单
---
src/page/user/Warehouse/data.list.vue | 262 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 256 insertions(+), 6 deletions(-)
diff --git a/src/page/user/Warehouse/data.list.vue b/src/page/user/Warehouse/data.list.vue
index b2d5086..a0fb607 100644
--- a/src/page/user/Warehouse/data.list.vue
+++ b/src/page/user/Warehouse/data.list.vue
@@ -329,6 +329,193 @@
<!-- <div class="but buts">止盈止损</div> -->
</div>
</div>
+
+ <van-popover
+ v-if="actives === 2"
+ v-model="pendingShow"
+ trigger="click"
+ :actions="pendingOptions"
+ @select="handleStatusChange"
+ >
+ <template #reference>
+ <van-button type="primary">{{
+ pendingOptions[pendingStatus].text
+ }}</van-button>
+ </template>
+ </van-popover>
+ <div
+ v-if="actives === 2"
+ 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" style="justify-content: space-between;">
+ <div
+ class="span"
+ :style="item.isListed == false ? 'color:red;' : ''"
+ >
+ {{ item.stockName }}
+ </div>
+ <div
+ class="states"
+ :class="item.orderDirection === '买跌' ? 'states-red' : ''"
+ >
+ {{ $t(item.orderDirection) }}
+ </div>
+ </div>
+ {{ item.stockSpell }}
+ </div>
+ <!-- <van-row> -->
+ <!-- <van-col span="8"> -->
+ <!-- <div style="text-align: left">
+ <div class="sport-content-title2">
+ {{ $t("盈虧") }} ({{ activeObj.symbolCode }})
+ </div>
+ <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
+ {{ item.profitAndLose }}
+ </div> -->
+ <!-- </div> -->
+ <!-- </van-col> -->
+ <!-- <van-col span="8"> -->
+ <!-- <div style="text-align: center"> -->
+ <!-- <div class="sport-content-title2">
+ {{ $t("hj141") }} ({{ activeObj.symbolCode }})
+ </div> -->
+ <!-- <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
+ {{ item.profitAndLoseParent }}
+ </div> -->
+ <!-- </div> -->
+ <!-- </van-col> -->
+ <!-- <van-col span="8">
+ <div style="text-align: right">
+ <div class="sport-content-title2">{{ $t("倉位(股)") }}</div>
+ <div class="sport-content-text2">{{ item.orderNum }}</div>
+ </div></van-col
+ > -->
+ <!-- </van-row> -->
+ <van-row>
+ <van-col span="8">
+ <van-col span="8">
+ <div style="text-align: right">
+ <div class="sport-content-title2">{{ $t("倉位(股)") }}</div>
+ <div class="sport-content-text2">{{ item.orderNum }}</div>
+ </div></van-col
+ >
+ <!-- <div style="text-align: left"> -->
+ <!-- <div class="sport-content-title2">
+ {{ $t("hj40") }}({{ activeObj.symbolCode }})
+ </div> -->
+ <!-- <div class="sport-content-text2">
+ {{ item.now_price }}
+ </div> -->
+ <!-- </div> -->
+ </van-col>
+ <van-col span="8">
+ <div style="text-align: center">
+ <div class="sport-content-title2">
+ {{ $t("持倉價") }} ({{ activeObj.symbolCode }})
+ </div>
+ <div class="sport-content-text2">
+ {{ item.buyOrderPrice }}
+ </div>
+ </div>
+ </van-col>
+ <van-col span="8">
+ <div style="text-align: right">
+ <div class="sport-content-title2">
+ {{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
+ </div>
+ <div class="sport-content-text2">
+ {{ item.orderTotalPrice }}
+ </div>
+ </div>
+ </van-col>
+ </van-row>
+ <van-row>
+ <van-col span="12">
+ <div style="text-align: left">
+ <div class="sport-content-title2">
+ {{ $t("hj44") }} ({{ activeObj.symbolCode }})
+ </div>
+ <div class="sport-content-text2">
+ {{ item.orderFee }}
+ </div>
+ </div>
+ </van-col>
+ <van-col span="12">
+ <div style="text-align: right">
+ <div class="sport-content-title2">
+ {{ $t("待补金额") }} ({{ activeObj.symbolCode }})
+ </div>
+ <div class="sport-content-text2">
+ {{ item.amountToBeCovered }}
+ </div>
+ </div>
+ </van-col>
+ <!-- <van-col span="8">
+ <div style="text-align: center">
+ <div class="sport-content-title2">
+ {{ $t("止損價") }} ({{ activeObj.symbolCode }})
+ </div>
+ <div class="sport-content-text2">
+ {{ item.stopTargetPrice }}
+ </div>
+ </div>
+ </van-col>
+ <van-col span="8">
+ <div style="text-align: right">
+ <div class="sport-content-title2">
+ {{ $t("止盈價") }} ({{ activeObj.symbolCode }})
+ </div>
+ <div class="sport-content-text2">
+ {{ item.profitTargetPrice }}
+ </div>
+ </div>
+ </van-col> -->
+ </van-row>
+ <van-row>
+ <van-col span="12">
+ <div style="text-align: left">
+ <div class="sport-content-title2">{{ $t("持倉時間") }}</div>
+ <div class="sport-content-text2">
+ {{ $moment(item.buyOrderTime).format("DD-MM-YYYY hh:mm:ss A") }}
+ </div>
+ </div>
+ </van-col>
+ <van-col span="12">
+ <div style="text-align: right">
+ <div class="sport-content-title2">{{ $t("訂單編號") }}</div>
+ <div class="sport-content-text2">{{ item.buyOrderId }}</div>
+ </div>
+ </van-col>
+ </van-row>
+
+ <div
+ class="but-box"
+ v-if="actives === 2 && pendingStatus === 1"
+ @click.stop="close(item)"
+ >
+ <div class="but">{{ $t("hj126") }}</div>
+ <!-- <div class="but buts">止盈止损</div> -->
+ </div>
+ </div>
</van-list>
<!-- <van-popup v-model="show" position="top" :style="{ height: '30%' }" /> -->
@@ -369,8 +556,8 @@
<script>
import Dialog from "@/components/Dialog";
-import { getchicang, sell } from "../../../axios/api";
-import { Notify } from "vant";
+import { getchicang, sell, revocation } from "../../../axios/api";
+import { Notify, Dialog as VanDialog } from "vant";
export default {
components: { Dialog },
props: {
@@ -384,6 +571,13 @@
},
data() {
return {
+ pendingShow: false,
+ pendingStatus: 1, // 默认选中挂单中
+ pendingOptions: [
+ { text: "挂单成功", value: 0 },
+ { text: "挂单中", value: 1 },
+ { text: "撤销", value: 2 }
+ ],
pageNum: 1,
pageSize: 150,
loading: true,
@@ -400,10 +594,13 @@
title: this.$t("持倉"),
key: 0
},
-
{
title: this.$t("平倉"),
key: 1
+ },
+ {
+ title: this.$t("hj109"),
+ key: 2
}
]
};
@@ -415,6 +612,13 @@
clearInterval(this.timer); // 在组件销毁前清除定时器
},
methods: {
+ handleStatusChange(value) {
+ // 状态改变时的处理逻辑
+ console.log("当前状态:", value);
+ this.pendingStatus = value.value;
+ // 这里可以添加获取对应状态数据的逻辑
+ this.getList();
+ },
dsq() {
// this.dataList = [];
this.timer = setInterval(() => {
@@ -475,6 +679,7 @@
let opt = {
state: this.actives,
stockType: _laber,
+ pendingStatus: this.pendingStatus, // 1 挂单中 2撤销 0挂单成功
pageNum: 1,
pageSize: 30
};
@@ -504,6 +709,7 @@
let opt = {
state: this.actives,
stockType: _laber,
+ pendingStatus: this.pendingStatus, // 1 挂单中 2撤销 0挂单成功
pageNum: 1,
pageSize: 30
};
@@ -523,9 +729,35 @@
}
},
close(item) {
- this.closeSell = item;
- this.$refs.closeDialog.show = true;
- this.ordernum = "";
+ console.log("item: ", item);
+ if (this.actives == 2) {
+ VanDialog.confirm({
+ title: this.$t("确认撤销"),
+ message: this.$t("确定要撤销此挂单吗?"),
+ confirmButtonText: this.$t("确定"),
+ cancelButtonText: this.$t("取消")
+ })
+ .then(async () => {
+ // 用户点击确认后的逻辑
+ const res = await revocation({
+ id: item.id
+ });
+ if (res.status === 0) {
+ Notify({ type: "success", message: res.msg });
+ this.getList(); // 刷新列表
+ } else {
+ Notify({ type: "danger", message: res.msg });
+ }
+ })
+ .catch(() => {
+ // 用户点击取消
+ console.log("取消撤销");
+ });
+ } else {
+ this.closeSell = item;
+ this.$refs.closeDialog.show = true;
+ this.ordernum = "";
+ }
},
clickTabs(e) {
@@ -535,6 +767,8 @@
this.newdataList = [];
this.dataList = [];
+ if (e.key == 2) {
+ }
if (e.key == 1) {
clearInterval(this.timer); // 在组件销毁前清除定时器
// clearTimeout(this.timer);
@@ -569,6 +803,22 @@
padding: 0 4px;
}
+/deep/ .van-dropdown-menu {
+ width: 120px;
+ margin-right: 10px;
+ .van-dropdown-menu__title--active,
+ .van-dropdown-item__option--active,
+ .van-dropdown-item__option--active .van-dropdown-item__icon,
+ .van-dropdown-item {
+ color: #1989fa !important;
+ }
+
+ .van-dropdown-item--active {
+ color: #1989fa !important;
+ font-weight: bold;
+ }
+}
+
.sport-tabs {
// font-family: PingFang SC;
font-family: "DINPro";
--
Gitblit v1.9.3