fix: 优化交易记录时间格式
- 今天的交易只显示时间 (16:15) - 非今天的交易显示月-日 时间 (03-24 16:15) - 缩短时间字符串,避免布局变形
This commit is contained in:
parent
b9f9c8c9f6
commit
23641d2629
@ -266,7 +266,7 @@
|
||||
<view v-else class="timeline-box">
|
||||
<view class="timeline-item" v-for="(log, k) in logs" :key="k">
|
||||
<view class="tl-left">
|
||||
<text class="tl-datetime">{{ log.date }} {{ log.time || '' }}</text>
|
||||
<text class="tl-datetime">{{ formatLogTime(log.date, log.time) }}</text>
|
||||
</view>
|
||||
|
||||
<view class="tl-line">
|
||||
@ -577,6 +577,21 @@ const getCurrencySymbol = (currency?: string): string => {
|
||||
return symbols[currency || 'CNY'] || '¥';
|
||||
};
|
||||
|
||||
const formatLogTime = (date?: string, time?: string): string => {
|
||||
if (!date) return '';
|
||||
const today = new Date();
|
||||
const todayStr = today.toISOString().split('T')[0];
|
||||
const isToday = date === todayStr;
|
||||
|
||||
const datePart = isToday ? '' : date.slice(5);
|
||||
const timePart = time ? time.slice(0, 5) : '';
|
||||
|
||||
if (isToday) {
|
||||
return timePart || '今天';
|
||||
}
|
||||
return datePart + (timePart ? ' ' + timePart : '');
|
||||
};
|
||||
|
||||
const portfolioId = ref<string>('');
|
||||
const portfolioData = ref<any>({
|
||||
id: '',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user