From ef4986b7a9ca0435ed4985373ffffbfb58e95114 Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Tue, 13 Jan 2026 19:13:12 +0800
Subject: [PATCH] 1
---
src/page/trading/TradeNew.vue | 51 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/src/page/trading/TradeNew.vue b/src/page/trading/TradeNew.vue
index b859b78..7285ee5 100644
--- a/src/page/trading/TradeNew.vue
+++ b/src/page/trading/TradeNew.vue
@@ -41,7 +41,7 @@
<span class="i_hint">{{ i.stockName }}</span>
</div>
<div class="i_name">
- {{ (i.buyNum * i.nowPrice).toFixed(2) }}
+ {{ (i.buyNum * i.targetPrice).toFixed(2) }}
</div>
</van-col>
<van-col span="3" class="item_n">
@@ -125,7 +125,7 @@
<img src="@/assets/img/zhaobudao2.png" alt="" />
</div>
- <n-pagination :pageNo.sync="pageNum" :pageSize="pageSize" :total="total" v-if="active != 'GaDan'"></n-pagination>
+ <n-pagination :pageNo.sync="pageNum" :pageSize="pageSize" :total="currentTotal" v-if="active != 'GaDan'"></n-pagination>
</div>
</template>
@@ -146,7 +146,20 @@
pageNum: 1,
pageSize: 15,
total: 1,
- list: [],
+ // 为每个tab使用独立的list变量
+ lists: {
+ '': [], // 默认tab
+ 'US': [], // 美股指数
+ 'JP': [], // 日股指数
+ 'GaDan': [] // 挂单
+ },
+ // 为每个tab使用独立的total变量
+ totals: {
+ '': 1,
+ 'US': 1,
+ 'JP': 1,
+ 'GaDan': 0
+ },
active: "",
types: {
0: this.$t("日内"),
@@ -158,6 +171,16 @@
showPopover: false,
};
},
+ computed: {
+ // 当前tab对应的list
+ list() {
+ return this.lists[this.active] || [];
+ },
+ // 当前tab对应的total
+ currentTotal() {
+ return this.totals[this.active] || 0;
+ }
+ },
watch: {
pageNum() {
this.getList();
@@ -165,7 +188,10 @@
},
active(val) {
this.pageNum = 1;
- this.list = []
+ // 清空当前tab的数据
+ if (this.lists[val]) {
+ this.lists[val] = [];
+ }
if (val == 'GaDan') {
this.stopTimer()
this.getList2();
@@ -186,24 +212,33 @@
methods: {
// 获取持仓数据
async getList() {
+ const currentActive = this.active;
let data = await api.getchicang({
state: 0,
- stockType: this.active,
+ stockType: currentActive,
pageNum: this.pageNum,
pageSize: this.pageSize
});
if (data.status === 0) {
- this.list = data.data.list;
- this.total = data.data.total;
+ // 只有当active没有变化时才更新数据,防止数据错乱
+ if (this.active === currentActive) {
+ this.lists[currentActive] = data.data.list || [];
+ this.totals[currentActive] = data.data.total || 0;
+ this.total = data.data.total || 0;
+ }
}
},
// 获取挂单数据
async getList2() {
+ const currentActive = this.active;
let data = await api.getGdOrderList();
if (data.status === 0) {
- this.list = data.data;
+ // 只有当active没有变化时才更新数据,防止数据错乱
+ if (this.active === currentActive && currentActive === 'GaDan') {
+ this.lists['GaDan'] = data.data || [];
+ }
}
},
// 跳转详情
--
Gitblit v1.9.3