diff --git a/frontend/src/components/account/AccountTable.vue b/frontend/src/components/account/AccountTable.vue index 23b96c3..bcaeace 100644 --- a/frontend/src/components/account/AccountTable.vue +++ b/frontend/src/components/account/AccountTable.vue @@ -6,6 +6,7 @@ import { useProducts } from '@/composables/useProducts' import type { Product } from '@/composables/useProducts' import { useActivity } from '@/composables/useActivity' import { useToast } from '@/composables/useToast' +import { formatExchangeTime, formatShortExchangeTime } from '@/utils/formatTime' import { ExportLatestXiaodianReport, QueryExchangeRecords, @@ -242,23 +243,10 @@ const recordSummary = (accountName: string) => { if (!records.length) return '' const latest = records[0] const name = latest.commodityName || latest.commodityId || '-' - const time = formatShortTime(latest.time || latest.buyTime || '') + const time = formatShortExchangeTime(latest.time || latest.buyTime || '') return time ? `${name} · ${time}` : name } -const formatShortTime = (value: string) => { - if (!value) return '' - const text = String(value) - const match = text.match(/(\d{2})[-/](\d{2})\s+(\d{2}:\d{2})/) - if (match) return `${match[1]}-${match[2]} ${match[3]}` - const numeric = Number(text) - if (Number.isFinite(numeric) && numeric > 0) { - const date = new Date(numeric < 10_000_000_000 ? numeric * 1000 : numeric) - return `${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}` - } - return text.replace('T', ' ').slice(0, 16) -} - const getLookupResult = (accountName: string) => exchangeLookup.value?.results[accountName] const getMatchedRecord = (accountName: string) => { @@ -304,8 +292,6 @@ const getResultMessage = (name: string) => { return msg.length > 46 ? msg.slice(0, 46) + '...' : msg } -const formatTime = (value: string) => value ? value.replace('T', ' ') : '-' - const orderStatus = (status: string) => { const labels: Record = { '0': { text: '待支付', cls: 'order-pending' }, @@ -619,7 +605,7 @@ const closeExchangeRecords = () => {
{{ record.showName }}
×{{ record.exchangeNum || 1 }} - {{ formatTime(record.time) }} + {{ formatExchangeTime(record.time) }} {{ record.score || '-' }} {{ record.nickName || '-' }} @@ -632,8 +618,8 @@ const closeExchangeRecords = () => {
{{ record.commodityName || record.commodityId }}
数量 ×{{ record.quantity }}
- {{ formatTime(record.buyTime) }} - {{ formatTime(record.payTime) }} + {{ formatExchangeTime(record.buyTime) }} + {{ formatExchangeTime(record.payTime) }} {{ record.price }} {{ orderStatus(record.status).text }} {{ record.roleName || '-' }} diff --git a/frontend/src/components/console/ControlStrip.vue b/frontend/src/components/console/ControlStrip.vue index f5ab22e..e276b42 100644 --- a/frontend/src/components/console/ControlStrip.vue +++ b/frontend/src/components/console/ControlStrip.vue @@ -400,7 +400,7 @@ onUnmounted(() => { -
+
@@ -469,8 +469,8 @@ onUnmounted(() => {
- -
+ +
{ } } -const formatTime = (value: string) => { - if (!value) return '-' - const numeric = Number(value) - if (Number.isFinite(numeric) && numeric > 0) { - return new Date(numeric < 10_000_000_000 ? numeric * 1000 : numeric).toLocaleString('zh-CN') - } - return value.replace('T', ' ') -} - watch(selectedProductId, () => { queryResult.value = null }) @@ -133,7 +125,7 @@ watch(selectedProductId, () => {
{{ record.commodityName || record.commodityId }} ×{{ record.quantity || 1 }} - {{ formatTime(record.buyTime) }} + {{ formatExchangeTime(record.buyTime) }} 状态 {{ record.status || '-' }}
diff --git a/frontend/src/components/layout/RightConsole.vue b/frontend/src/components/layout/RightConsole.vue index 217e6ed..dd3d127 100644 --- a/frontend/src/components/layout/RightConsole.vue +++ b/frontend/src/components/layout/RightConsole.vue @@ -1,7 +1,8 @@