From 03043192ddf00f9a36b7454799a9152cd1b50a0b Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Tue, 06 Jan 2026 11:13:45 +0800
Subject: [PATCH] 1
---
src/views/trade/index.vue | 157 +++++++++++++++++++++++++++++++--------------------
1 files changed, 95 insertions(+), 62 deletions(-)
diff --git a/src/views/trade/index.vue b/src/views/trade/index.vue
index 3f901bd..0d890b4 100644
--- a/src/views/trade/index.vue
+++ b/src/views/trade/index.vue
@@ -6,10 +6,13 @@
<div class="flex-l">
<span class="title">{{ t("trade") }}</span>
</div>
+ <div class="flex-r">
+ <van-icon name="service-o" size="26" @click="$router.push('/customerService')" />
+ </div>
</header>
<section class="trade-tab-container">
<van-tabs v-model:active="tabActive" shrink @click-tab="onClickTab">
- <van-tab v-for="(item, index) in listTab" :key="item.tabIndex" :name="item.tabIndex" :title="item.title">
+ <van-tab v-for="(item) in listTab" :key="item.tabIndex" :name="item.tabIndex" :title="item.title">
<div class="content-container">
<div class="user-info px-4 mt-4">
<div class="mt-8 flex">
@@ -48,8 +51,8 @@
}}
{{
assetsObj.totalAssets
- ? (assetsObj.totalAssets * (currency.rate ?? 0)).toFixed(2)
- : "0"
+ ? formatNumberWithComma(assetsObj.totalAssets * (currency.rate ?? 0))
+ : "0"
}}
</p>
</div>
@@ -73,8 +76,8 @@
}}
{{
assetsObj.profit
- ? (assetsObj.profit * (currency.rate ?? 0)).toFixed(2)
- : "0"
+ ? formatNumberWithComma(assetsObj.profit * (currency.rate ?? 0))
+ : "0"
}}
</p>
</div>
@@ -100,8 +103,8 @@
}}
{{
assetsObj.usdtBalance
- ? (assetsObj.usdtBalance * (currency.rate ?? 0)).toFixed(2)
- : "0"
+ ? formatNumberWithComma(assetsObj.usdtBalance * (currency.rate ?? 0))
+ : "0"
}}
</p>
</div>
@@ -125,8 +128,8 @@
}}
{{
assetsObj.profitToday
- ? (assetsObj.profitToday * (currency.rate ?? 0)).toFixed(2)
- : "0"
+ ? formatNumberWithComma(assetsObj.profitToday * (currency.rate ?? 0))
+ : "0"
}}
</p>
</div>
@@ -137,7 +140,7 @@
</van-tabs>
</section>
<section class="content-container">
- <ex-nav :symbolType="symbolType" />
+ <ex-nav :symbolType="symbolType" v-if="tabActive != 3" />
<div class="quickly">
<div class="quickBox chongbi" :class="[thStore.theme == 'dark' ? 'dark' : 'white']"
@click="$router.push('/exchange/channel-in')">
@@ -274,14 +277,14 @@
</div>
<div class="flex-r">
<div class="flex-r-item">
- <p :class="item.profitLoss < 1 ? 'text-up' : 'text-down'">
+ <p :class="item.profitLoss < 0 ? 'text-down' : 'text-up'">
{{ item.profitLoss }}
</p>
- <p :class="item.profitLossPercentage < 1 ? 'text-up' : 'text-down'">
+ <p :class="item.profitLossPercentage < 0 ? 'text-down' : 'text-up'">
{{
item.profitLossPercentage && item.profitLossPercentage !== 0
- ? `${item.profitLossPercentage}%`
- : 0
+ ? `${item.profitLossPercentage}%`
+ : 0
}}
</p>
</div>
@@ -294,10 +297,10 @@
</p>
</div>
<div class="flex-r-item">
- <p :class="item.close < 1 ? 'text-up' : 'text-down'">
+ <p :class="item.profitLoss < 0 ? 'text-down' : 'text-up'">
{{ item.price }}
</p>
- <p :class="item.close < 1 ? 'text-up' : 'text-down'">
+ <p :class="item.profitLoss < 0 ? 'text-down' : 'text-up'">
{{ item.currentPrice }}
</p>
</div>
@@ -309,14 +312,14 @@
<p class="gray-text">
<span class="tip-text" :class="item.offset === 'close' ? 'text-down' : 'text-up'">{{
item.offset ===
- "open" ? t("买") : t("卖")
+ "open" ? t("买") : t("卖")
}}</span>
{{
item.create_time_ts
- ? dayjs(item.create_time_ts * 1000)
- .format("YYYY-MM-DD HH:mm:ss")
- .slice(11)
- : "--"
+ ? dayjs(item.create_time_ts * 1000)
+ .format("YYYY-MM-DD HH:mm:ss")
+ .slice(11)
+ : "--"
}}
</p>
</div>
@@ -336,11 +339,15 @@
</div>
<div class="flex-r-item">
<p>
- {{ item.state === "created" ? t("createdNew") : t(item.state) }}
+ {{ item.state === "created" ? t("委托完成") : t(item.state) }}
</p>
</div>
- <div class="flex-r-item operate-btn" @click="cancelSingle(item.order_no)">
+ <div class="flex-r-item operate-btn" @click="cancelSingle(item.order_no)"
+ v-if="item.state == 'submitted'">
<span>{{ t("撤单") }}</span>
+ </div>
+ <div class="flex-r-item" v-else>
+ <span></span>
</div>
</div>
</template>
@@ -350,14 +357,14 @@
<p class="gray-text">
<span class="tip-text" :class="item.offset === 'close' ? 'text-down' : 'text-up'">{{
item.offset ===
- "open" ? t("买") : t("卖")
+ "open" ? t("买") : t("卖")
}}</span>
{{
item.create_time_ts
- ? dayjs(item.create_time_ts * 1000)
- .format("YYYY-MM-DD HH:mm:ss")
- .slice(11)
- : "--"
+ ? dayjs(item.create_time_ts * 1000)
+ .format("YYYY-MM-DD HH:mm:ss")
+ .slice(11)
+ : "--"
}}
</p>
</div>
@@ -394,10 +401,10 @@
<p :class="item.changeRatio < 1 ? 'text-up' : 'text-down'">
{{
item.changeRatio === 0
- ? 0
- : item.changeRatio
- ? item.changeRatio + "%"
- : "--"
+ ? 0
+ : item.changeRatio
+ ? item.changeRatio + "%"
+ : "--"
}}
</p>
</div>
@@ -405,10 +412,10 @@
<p>
{{
item.turnoverRate === 0
- ? 0
- : item.turnoverRate
- ? item.turnoverRate + "%"
- : "--"
+ ? 0
+ : item.turnoverRate
+ ? item.turnoverRate + "%"
+ : "--"
}}
</p>
</div>
@@ -416,10 +423,10 @@
<p>
{{
item.volumeRatio === 0
- ? 0
- : item.volumeRatio
- ? item.volumeRatio + "%"
- : "--"
+ ? 0
+ : item.volumeRatio
+ ? item.volumeRatio + "%"
+ : "--"
}}
</p>
</div>
@@ -539,6 +546,7 @@
import dayjs from "dayjs";
import { themeStore } from "@/store/theme";
import { useStore } from 'vuex';
+import { formatNumberWithComma } from '@/utils/utis';
const thStore = themeStore();
const store = useStore()
@@ -546,7 +554,7 @@
const { toClipboard } = useClipboard();
const router = useRouter();
const route = useRoute();
-const defaultTabActive = +route.query.tabActive || 0;
+const defaultTabActive = +route.query.tabActive || 3;
const tabActive = ref(defaultTabActive);
const navActive = ref(0);
const userStore = useUserStore();
@@ -557,6 +565,16 @@
const isLoading = ref(false);
const assetsObj = ref({})
const assets = ref({})
+const navTabV0 = ref([
+ {
+ text: t("持仓"),
+ index: 0,
+ },
+ {
+ text: t("entrust"),
+ index: 1,
+ },
+]);
const navTabV1 = ref([
{
text: t("持仓"),
@@ -593,11 +611,11 @@
const listTab = ref([
{
- title: 'ETF',
- type: 'Etf',
- urlMatch: 'etf',
- symbolType: 'indices',
- tabIndex: 0
+ title: t('UsStocks'),
+ type: 'UsStock',
+ urlMatch: 'stock',
+ symbolType: 'US-stocks',
+ tabIndex: 3
},
{
title: t('加密货币'),
@@ -606,6 +624,14 @@
symbolType: 'cryptos',
tabIndex: 1
},
+ {
+ title: 'ETF',
+ type: 'Etf',
+ urlMatch: 'etf',
+ symbolType: 'indices',
+ tabIndex: 0
+ },
+
{
title: t('外汇'),
type: 'Foreign',
@@ -627,20 +653,14 @@
// symbolType: 'INDIA-stocks',
// tabIndex: 8
// },
- {
- title: t('UsStocks'),
- type: 'UsStock',
- urlMatch: 'stock',
- symbolType: 'US-stocks',
- tabIndex: 3
- },
- {
- title: t('港股'),
- type: 'HkStock',
- urlMatch: 'HK-stocks',
- symbolType: 'HK-stocks',
- tabIndex: 4
- },
+
+ // {
+ // title: t('港股'),
+ // type: 'HkStock',
+ // urlMatch: 'HK-stocks',
+ // symbolType: 'HK-stocks',
+ // tabIndex: 4
+ // },
// {
// title: t('台股'),
// type: 'TWStock',
@@ -693,7 +713,7 @@
])
const navTabList = computed(() => {
- return [1, 2].includes(tabActive.value) ? navTabV2.value : navTabV1.value;
+ return [1, 2].includes(tabActive.value) ? navTabV2.value : (tabActive.value == '3' ? navTabV0.value : navTabV1.value);
});
const getCurrency = async () => {
@@ -958,8 +978,20 @@
);
break;
case "US-stocks":
+ // 跳转到对应的查询列表
+ // if (item.state == 'submitted') {
+ // router.push(
+ // `/quotes/openTrade?tabActive=4&symbol=${item.symbol}&from=trade&type=US-stocks&tradeTabActive=3&navActive=1`
+ // );
+ // } else {
+ // router.push(
+ // `/quotes/openTrade?tabActive=4&symbol=${item.symbol}&from=trade&type=US-stocks&tradeTabActive=3&navActive=1&invalidState=1`
+ // );
+ // }
+
+ // 直接跳转到详情,不再跳列表
router.push(
- `/quotes/openTrade?tabActive=4&symbol=${item.symbol}&from=trade&type=US-stocks&tradeTabActive=3&navActive=1`
+ `/cryptos/symbolOrderDetail?order_no=${item.order_no}`
);
break;
case 'HK-stocks':
@@ -1083,6 +1115,7 @@
const itemClickSecondOrFourth = (item) => {
// 加密货币
if (tabActive.value === 1) {
+
switch (navActive.value) {
case 0:
router.push(
--
Gitblit v1.9.3