From 42faef34194c466f03e29d75a63ae502e4213044 Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Tue, 06 Jan 2026 10:38:46 +0800
Subject: [PATCH] 上一版是10.10的, 这版才是原始源码
---
src/views/trade/index.vue | 157 ++++++++++++++++++++-------------------------------
1 files changed, 62 insertions(+), 95 deletions(-)
diff --git a/src/views/trade/index.vue b/src/views/trade/index.vue
index 0d890b4..3f901bd 100644
--- a/src/views/trade/index.vue
+++ b/src/views/trade/index.vue
@@ -6,13 +6,10 @@
<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) in listTab" :key="item.tabIndex" :name="item.tabIndex" :title="item.title">
+ <van-tab v-for="(item, index) 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">
@@ -51,8 +48,8 @@
}}
{{
assetsObj.totalAssets
- ? formatNumberWithComma(assetsObj.totalAssets * (currency.rate ?? 0))
- : "0"
+ ? (assetsObj.totalAssets * (currency.rate ?? 0)).toFixed(2)
+ : "0"
}}
</p>
</div>
@@ -76,8 +73,8 @@
}}
{{
assetsObj.profit
- ? formatNumberWithComma(assetsObj.profit * (currency.rate ?? 0))
- : "0"
+ ? (assetsObj.profit * (currency.rate ?? 0)).toFixed(2)
+ : "0"
}}
</p>
</div>
@@ -103,8 +100,8 @@
}}
{{
assetsObj.usdtBalance
- ? formatNumberWithComma(assetsObj.usdtBalance * (currency.rate ?? 0))
- : "0"
+ ? (assetsObj.usdtBalance * (currency.rate ?? 0)).toFixed(2)
+ : "0"
}}
</p>
</div>
@@ -128,8 +125,8 @@
}}
{{
assetsObj.profitToday
- ? formatNumberWithComma(assetsObj.profitToday * (currency.rate ?? 0))
- : "0"
+ ? (assetsObj.profitToday * (currency.rate ?? 0)).toFixed(2)
+ : "0"
}}
</p>
</div>
@@ -140,7 +137,7 @@
</van-tabs>
</section>
<section class="content-container">
- <ex-nav :symbolType="symbolType" v-if="tabActive != 3" />
+ <ex-nav :symbolType="symbolType" />
<div class="quickly">
<div class="quickBox chongbi" :class="[thStore.theme == 'dark' ? 'dark' : 'white']"
@click="$router.push('/exchange/channel-in')">
@@ -277,14 +274,14 @@
</div>
<div class="flex-r">
<div class="flex-r-item">
- <p :class="item.profitLoss < 0 ? 'text-down' : 'text-up'">
+ <p :class="item.profitLoss < 1 ? 'text-up' : 'text-down'">
{{ item.profitLoss }}
</p>
- <p :class="item.profitLossPercentage < 0 ? 'text-down' : 'text-up'">
+ <p :class="item.profitLossPercentage < 1 ? 'text-up' : 'text-down'">
{{
item.profitLossPercentage && item.profitLossPercentage !== 0
- ? `${item.profitLossPercentage}%`
- : 0
+ ? `${item.profitLossPercentage}%`
+ : 0
}}
</p>
</div>
@@ -297,10 +294,10 @@
</p>
</div>
<div class="flex-r-item">
- <p :class="item.profitLoss < 0 ? 'text-down' : 'text-up'">
+ <p :class="item.close < 1 ? 'text-up' : 'text-down'">
{{ item.price }}
</p>
- <p :class="item.profitLoss < 0 ? 'text-down' : 'text-up'">
+ <p :class="item.close < 1 ? 'text-up' : 'text-down'">
{{ item.currentPrice }}
</p>
</div>
@@ -312,14 +309,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>
@@ -339,15 +336,11 @@
</div>
<div class="flex-r-item">
<p>
- {{ item.state === "created" ? t("委托完成") : t(item.state) }}
+ {{ item.state === "created" ? t("createdNew") : t(item.state) }}
</p>
</div>
- <div class="flex-r-item operate-btn" @click="cancelSingle(item.order_no)"
- v-if="item.state == 'submitted'">
+ <div class="flex-r-item operate-btn" @click="cancelSingle(item.order_no)">
<span>{{ t("撤单") }}</span>
- </div>
- <div class="flex-r-item" v-else>
- <span></span>
</div>
</div>
</template>
@@ -357,14 +350,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>
@@ -401,10 +394,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>
@@ -412,10 +405,10 @@
<p>
{{
item.turnoverRate === 0
- ? 0
- : item.turnoverRate
- ? item.turnoverRate + "%"
- : "--"
+ ? 0
+ : item.turnoverRate
+ ? item.turnoverRate + "%"
+ : "--"
}}
</p>
</div>
@@ -423,10 +416,10 @@
<p>
{{
item.volumeRatio === 0
- ? 0
- : item.volumeRatio
- ? item.volumeRatio + "%"
- : "--"
+ ? 0
+ : item.volumeRatio
+ ? item.volumeRatio + "%"
+ : "--"
}}
</p>
</div>
@@ -546,7 +539,6 @@
import dayjs from "dayjs";
import { themeStore } from "@/store/theme";
import { useStore } from 'vuex';
-import { formatNumberWithComma } from '@/utils/utis';
const thStore = themeStore();
const store = useStore()
@@ -554,7 +546,7 @@
const { toClipboard } = useClipboard();
const router = useRouter();
const route = useRoute();
-const defaultTabActive = +route.query.tabActive || 3;
+const defaultTabActive = +route.query.tabActive || 0;
const tabActive = ref(defaultTabActive);
const navActive = ref(0);
const userStore = useUserStore();
@@ -565,16 +557,6 @@
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("持仓"),
@@ -611,11 +593,11 @@
const listTab = ref([
{
- title: t('UsStocks'),
- type: 'UsStock',
- urlMatch: 'stock',
- symbolType: 'US-stocks',
- tabIndex: 3
+ title: 'ETF',
+ type: 'Etf',
+ urlMatch: 'etf',
+ symbolType: 'indices',
+ tabIndex: 0
},
{
title: t('加密货币'),
@@ -624,14 +606,6 @@
symbolType: 'cryptos',
tabIndex: 1
},
- {
- title: 'ETF',
- type: 'Etf',
- urlMatch: 'etf',
- symbolType: 'indices',
- tabIndex: 0
- },
-
{
title: t('外汇'),
type: 'Foreign',
@@ -653,14 +627,20 @@
// symbolType: 'INDIA-stocks',
// tabIndex: 8
// },
-
- // {
- // title: t('港股'),
- // type: 'HkStock',
- // urlMatch: 'HK-stocks',
- // symbolType: 'HK-stocks',
- // tabIndex: 4
- // },
+ {
+ 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: 'TWStock',
@@ -713,7 +693,7 @@
])
const navTabList = computed(() => {
- return [1, 2].includes(tabActive.value) ? navTabV2.value : (tabActive.value == '3' ? navTabV0.value : navTabV1.value);
+ return [1, 2].includes(tabActive.value) ? navTabV2.value : navTabV1.value;
});
const getCurrency = async () => {
@@ -978,20 +958,8 @@
);
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(
- `/cryptos/symbolOrderDetail?order_no=${item.order_no}`
+ `/quotes/openTrade?tabActive=4&symbol=${item.symbol}&from=trade&type=US-stocks&tradeTabActive=3&navActive=1`
);
break;
case 'HK-stocks':
@@ -1115,7 +1083,6 @@
const itemClickSecondOrFourth = (item) => {
// 加密货币
if (tabActive.value === 1) {
-
switch (navActive.value) {
case 0:
router.push(
--
Gitblit v1.9.3