feat: toggle ledger display currency

This commit is contained in:
openclaw 2026-07-25 01:57:45 +08:00
parent 45ecb39359
commit 1b52de229f
2 changed files with 48 additions and 10 deletions

View File

@ -92,11 +92,44 @@ input:focus-visible {
.top-actions {
display: grid;
grid-template-columns: 56px 1fr 40px;
grid-template-columns: 56px minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
}
.header-right-actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 6px;
}
.currency-display-toggle {
height: 32px;
display: inline-flex;
align-items: stretch;
border: 1px solid rgba(255, 255, 255, 0.28);
border-radius: 7px;
padding: 2px;
background: rgba(0, 0, 0, 0.12);
}
.currency-display-toggle button {
min-width: 32px;
border: 0;
border-radius: 5px;
padding: 0 6px;
background: transparent;
color: rgba(255, 255, 255, 0.72);
font-size: 11px;
font-weight: 700;
}
.currency-display-toggle button.active {
background: rgba(255, 255, 255, 0.92);
color: #24766d;
}
.participant-avatars {
width: 56px;
height: 40px;

View File

@ -32,6 +32,7 @@ const store = useEntryStore();
const ledgerStore = useLedgerStore();
const router = useRouter();
const moreMenuOpen = ref(false);
const showBaseCurrency = ref(true);
const participantOpen = ref(false);
const shareOpen = ref(false);
const shareFeedback = ref("");
@ -435,9 +436,15 @@ async function shareLedger() {
<span>{{ ledgerStore.currentLedger?.name ?? "选择账本" }}</span>
<ChevronDown :size="16" />
</button>
<button v-if="ledgerStore.currentRole === 'owner'" class="icon-button header-icon" type="button" aria-label="更多" title="更多" @click.stop="moreMenuOpen = true">
<MoreHorizontal :size="21" />
</button>
<div class="header-right-actions">
<div class="currency-display-toggle" role="group" aria-label="流水金额显示方式">
<button type="button" :class="{ active: showBaseCurrency }" :aria-pressed="showBaseCurrency" @click="showBaseCurrency = true">本币</button>
<button type="button" :class="{ active: !showBaseCurrency }" :aria-pressed="!showBaseCurrency" @click="showBaseCurrency = false">原币</button>
</div>
<button v-if="ledgerStore.currentRole === 'owner'" class="icon-button header-icon" type="button" aria-label="更多" title="更多" @click.stop="moreMenuOpen = true">
<MoreHorizontal :size="21" />
</button>
</div>
</div>
<Transition name="more-menu">
@ -554,13 +561,11 @@ async function shareLedger() {
</div>
<div class="entry-value">
<strong :class="entry.type">
{{ entry.type === "expense" ? "" : "+" }}{{ entry.baseAmount === null
? formatCurrencyAmount(entry.amount, entry.currency)
: `¥${formatMoney(entry.baseAmount)}` }}
{{ entry.type === "expense" ? "" : "+" }}{{ showBaseCurrency && entry.baseAmount !== null
? `¥${formatMoney(entry.baseAmount)}`
: formatCurrencyAmount(entry.amount, entry.currency) }}
</strong>
<span>{{ entry.currency === "CNY" || entry.baseAmount === null
? formatTime(entry.occurredAt)
: formatCurrencyAmount(entry.amount, entry.currency) }}</span>
<span>{{ formatTime(entry.occurredAt) }}</span>
</div>
</RouterLink>
</section>