From b4c4556a5eddf6708ec55b07e3edc15b2217842e Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Wed, 30 Apr 2025 18:35:59 +0800
Subject: [PATCH] 0430号修改
---
src/page/user/Warehouse/data.list.vue | 469 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 390 insertions(+), 79 deletions(-)
diff --git a/src/page/user/Warehouse/data.list.vue b/src/page/user/Warehouse/data.list.vue
index 2c5af91..e280ed9 100644
--- a/src/page/user/Warehouse/data.list.vue
+++ b/src/page/user/Warehouse/data.list.vue
@@ -17,16 +17,22 @@
:loading-text="$t('hj430')"
@load="onLoad"
>
- <div v-if="actives === 0"
+ <div
+ v-if="actives === 0"
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}`)" >
+ @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="span"
+ :style="item.isListed == false ? 'color:red;' : ''"
+ >
+ {{ item.stockName }}
+ </div>
<div
class="states"
:class="item.orderDirection === '买跌' ? 'states-red' : ''"
@@ -39,11 +45,18 @@
<van-row>
<van-col span="8">
<div style="text-align: left">
- <div class="sport-content-title2" >
+ <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
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
+ {{ item.profitAndLose }}
</div>
</div>
</van-col>
@@ -52,7 +65,14 @@
<div class="sport-content-title2">
{{ $t("hj141") }} ({{ activeObj.symbolCode }})
</div>
- <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
+ <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
{{ item.profitAndLoseParent }}
</div>
</div>
@@ -71,7 +91,7 @@
{{ $t("hj40") }}({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.now_price }}
+ {{ item.now_price }}
</div>
</div>
</van-col>
@@ -81,7 +101,7 @@
{{ $t("持倉價") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.buyOrderPrice }}
+ {{ item.buyOrderPrice }}
</div>
</div>
</van-col>
@@ -91,19 +111,19 @@
{{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.orderTotalPrice }}
+ {{ item.orderTotalPrice }}
</div>
</div>
</van-col>
</van-row>
- <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 }}
+ {{ item.orderFee }}
</div>
</div>
</van-col>
@@ -113,17 +133,17 @@
{{ $t("待补金额") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.amountToBeCovered }}
+ {{ item.amountToBeCovered }}
</div>
</div>
- </van-col>
- <!-- <van-col span="8">
+ </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 }}
+ {{ item.stopTargetPrice }}
</div>
</div>
</van-col>
@@ -133,11 +153,11 @@
{{ $t("止盈價") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.profitTargetPrice }}
+ {{ item.profitTargetPrice }}
</div>
</div>
</van-col> -->
- </van-row>
+ <!-- </van-row> -->
<van-row>
<van-col span="12">
<div style="text-align: left">
@@ -161,13 +181,14 @@
</div>
</div>
-
- <div v-if="actives === 1"
+ <div
+ v-if="actives === 1"
class="sport-content-li"
:style="actives === 1 ? 'height:5.52rem' : 'height:7.52rem'"
v-for="(item, index) in newdataList"
:key="index"
- @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)" >
+ @click="$router.push(`/Stockdetail?codes=${item.positionSn}`)"
+ >
<div @click.stop="pushRouter(item)">
<div class="title-box" style="justify-content: space-between;">
<div class="span">{{ item.stockName }}</div>
@@ -186,8 +207,15 @@
<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
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
+ {{ item.profitAndLose }}
</div>
</div>
</van-col>
@@ -196,7 +224,14 @@
<div class="sport-content-title2">
{{ $t("hj141") }} ({{ activeObj.symbolCode }})
</div>
- <div class="sport-content-text2" :style="item.profitAndLoseParent.charAt(0)=='-'?'color:#cc1b1b;':'color:#3e9976;'">
+ <div
+ class="sport-content-text2"
+ :style="
+ item.profitAndLoseParent.charAt(0) == '-'
+ ? 'color:#cc1b1b;'
+ : 'color:#3e9976;'
+ "
+ >
{{ item.profitAndLoseParent }}
</div>
</div>
@@ -215,7 +250,7 @@
{{ $t("hj40") }}({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.now_price }}
+ {{ item.now_price }}
</div>
</div>
</van-col>
@@ -225,7 +260,7 @@
{{ $t("持倉價") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.buyOrderPrice }}
+ {{ item.buyOrderPrice }}
</div>
</div>
</van-col>
@@ -235,7 +270,7 @@
{{ $t("訂單金額") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.orderTotalPrice }}
+ {{ item.orderTotalPrice }}
</div>
</div>
</van-col>
@@ -247,17 +282,23 @@
{{ $t("hj44") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.orderFee }}
+ {{ item.orderFee }}
</div>
</div>
</van-col>
- <!-- <van-col span="8">
+ <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-col span="8">
<div style="text-align: center">
<div class="sport-content-title2">
{{ $t("止損價") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.stopTargetPrice }}
+ {{ item.stopTargetPrice }}
</div>
</div>
</van-col>
@@ -267,11 +308,198 @@
{{ $t("止盈價") }} ({{ activeObj.symbolCode }})
</div>
<div class="sport-content-text2">
- {{ item.profitTargetPrice }}
+ {{ 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("hj128") }}</div>
+ <div class="sport-content-text2">
+ {{
+ $moment(item.sellOrderTime).format("DD-MM-YYYY hh:mm:ss A")
+ }}
+ </div>
+ </div>
+ </van-col>
+ </van-row>
+
+ <div class="but-box" v-if="actives === 0" @click.stop="close(item)">
+ <div class="but">{{ $t("平仓") }}</div>
+ <!-- <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.sellOrderPrice || 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">
@@ -289,8 +517,12 @@
</van-col>
</van-row>
- <div class="but-box" v-if="actives === 0" @click.stop="close(item)">
- <div class="but">{{ $t("平仓") }}</div>
+ <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>
@@ -314,7 +546,13 @@
<!-- <div class="right" style="color: rgb(3, 173, 143)">
{{ closeSell.orderNum }}
</div> -->
- <input class="input_box" type="number" :max="closeSell.orderNum" :placeholder="$t('hj262')" v-model="ordernum" />
+ <input
+ class="input_box"
+ type="number"
+ :max="closeSell.orderNum"
+ :placeholder="$t('hj262')"
+ v-model="ordernum"
+ />
</div>
<div class="hang">
<div class="left">{{ $t("類型") }}</div>
@@ -328,21 +566,28 @@
<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: {
activeObj: {
type: Object,
- default: {},
- },
+ default: {}
+ }
},
mounted() {
this.getList();
},
data() {
return {
+ pendingShow: false,
+ pendingStatus: 1, // 默认选中挂单中
+ pendingOptions: [
+ { text: this.$t("挂单成功"), value: 0 },
+ { text: this.$t("挂单中"), value: 1 },
+ { text: this.$t("hj126"), value: 2 }
+ ],
pageNum: 1,
pageSize: 150,
loading: true,
@@ -350,40 +595,50 @@
closeSell: {},
show: false,
actives: 0,
- ordernum:'',
+ ordernum: "",
dataList: [],
- newdataList:[],
+ newdataList: [],
timer: null,
tabsList: [
{
title: this.$t("持倉"),
- key: 0,
+ key: 0
},
-
{
title: this.$t("平倉"),
- key: 1,
+ key: 1
},
- ],
+ {
+ title: this.$t("hj109"),
+ key: 2
+ }
+ ]
};
},
- created(){
- this.dsq()
+ created() {
+ this.dsq();
},
beforeDestroy() {
clearInterval(this.timer); // 在组件销毁前清除定时器
},
methods: {
- dsq(){
+ handleStatusChange(value) {
+ // 状态改变时的处理逻辑
+ console.log("当前状态:", value);
+ this.pendingStatus = value.value;
+ // 这里可以添加获取对应状态数据的逻辑
+ this.getList();
+ },
+ dsq() {
// this.dataList = [];
- // this.timer = setInterval(() => {
+ this.timer = setInterval(() => {
this.getList();
- // }, 1000);
+ }, 1000);
},
pushRouter(item) {
const obj = {
pid: item.stockCode || "",
- type: item.stockGid || "",
+ type: item.stockGid || ""
};
window.localStorage.setItem("kLine", JSON.stringify(obj));
// return;
@@ -398,8 +653,8 @@
if_us: "",
if_zhishu: 0,
sok: "",
- type: item.stockGid,
- },
+ type: item.stockGid
+ }
});
},
onLoad() {
@@ -410,7 +665,7 @@
this.$refs.closeDialog.show = false;
const res = await sell({
positionSn: this.closeSell.positionSn,
- number:this.ordernum
+ number: this.ordernum
});
if (res.status === 0) {
this.dataList = [];
@@ -430,12 +685,19 @@
this.pageNum = 1;
this.finished = false;
}
- const res = await getchicang({
+ const _laber = laber || this.activeObj.laber;
+ let opt = {
state: this.actives,
- stockType: laber || this.activeObj.laber,
+ stockType: _laber,
+ pendingStatus: this.pendingStatus, // 1 挂单中 2撤销 0挂单成功
pageNum: 1,
- pageSize: 30,
- });
+ pageSize: 30
+ };
+ if (_laber === "USD") {
+ opt.stockCode = "HJYY";
+ }
+
+ const res = await getchicang(opt);
this.loading = false;
if (res.status === 0) {
@@ -453,16 +715,22 @@
this.pageNum = 1;
this.finished = false;
}
- const res = await getchicang({
+ const _laber = laber || this.activeObj.laber;
+ let opt = {
state: this.actives,
- stockType: laber || this.activeObj.laber,
+ stockType: _laber,
+ pendingStatus: this.pendingStatus, // 1 挂单中 2撤销 0挂单成功
pageNum: 1,
- pageSize: 30,
- });
+ pageSize: 30
+ };
+ if (_laber === "USD") {
+ opt.stockCode = "HJYY";
+ }
+ const res = await getchicang(opt);
this.loading = false;
if (res.status === 0) {
- this.dataList = []
+ this.dataList = [];
this.dataList = res.data.list;
this.finished = true;
} else {
@@ -471,53 +739,96 @@
}
},
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) {
this.pageNum = 1;
this.finished = false;
this.actives = e.key;
- this.newdataList = []
- this.dataList = []
+ this.newdataList = [];
+ this.dataList = [];
- if(e.key==1){
+ if (e.key == 2) {
+ }
+ if (e.key == 1) {
clearInterval(this.timer); // 在组件销毁前清除定时器
// clearTimeout(this.timer);
// setTimeout(()=>{
// clearInterval(this.timer); // 在组件销毁前清除定时器
// },3000)
- this.getLists()
+ this.getLists();
// this.startPolling();
// this.dsq()
- }else{
+ } else {
clearInterval(this.timer); // 在组件销毁前清除定时器
- this.dsq()
+ this.dsq();
}
this.$forceUpdate(); // 强制Vue重新渲染
// this.getList()
// if(e.key !=this.actives){
-
// }else{
// this.actives = e.key;
// this.dsq()
// }
- },
- },
+ }
+ }
};
</script>
<style lang="less" scoped>
- .input_box{
- text-align: right;
- font-size: 16px;
+.input_box {
+ text-align: right;
+ font-size: 16px;
- padding: 0 4px;
+ 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