feat: toggle ledger display currency
This commit is contained in:
parent
45ecb39359
commit
1b52de229f
|
|
@ -92,11 +92,44 @@ input:focus-visible {
|
||||||
|
|
||||||
.top-actions {
|
.top-actions {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 56px 1fr 40px;
|
grid-template-columns: 56px minmax(0, 1fr) auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
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 {
|
.participant-avatars {
|
||||||
width: 56px;
|
width: 56px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ const store = useEntryStore();
|
||||||
const ledgerStore = useLedgerStore();
|
const ledgerStore = useLedgerStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const moreMenuOpen = ref(false);
|
const moreMenuOpen = ref(false);
|
||||||
|
const showBaseCurrency = ref(true);
|
||||||
const participantOpen = ref(false);
|
const participantOpen = ref(false);
|
||||||
const shareOpen = ref(false);
|
const shareOpen = ref(false);
|
||||||
const shareFeedback = ref("");
|
const shareFeedback = ref("");
|
||||||
|
|
@ -435,10 +436,16 @@ async function shareLedger() {
|
||||||
<span>{{ ledgerStore.currentLedger?.name ?? "选择账本" }}</span>
|
<span>{{ ledgerStore.currentLedger?.name ?? "选择账本" }}</span>
|
||||||
<ChevronDown :size="16" />
|
<ChevronDown :size="16" />
|
||||||
</button>
|
</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">
|
<button v-if="ledgerStore.currentRole === 'owner'" class="icon-button header-icon" type="button" aria-label="更多" title="更多" @click.stop="moreMenuOpen = true">
|
||||||
<MoreHorizontal :size="21" />
|
<MoreHorizontal :size="21" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Transition name="more-menu">
|
<Transition name="more-menu">
|
||||||
<div v-if="moreMenuOpen" class="ledger-more-layer">
|
<div v-if="moreMenuOpen" class="ledger-more-layer">
|
||||||
|
|
@ -554,13 +561,11 @@ async function shareLedger() {
|
||||||
</div>
|
</div>
|
||||||
<div class="entry-value">
|
<div class="entry-value">
|
||||||
<strong :class="entry.type">
|
<strong :class="entry.type">
|
||||||
{{ entry.type === "expense" ? "−" : "+" }}{{ entry.baseAmount === null
|
{{ entry.type === "expense" ? "−" : "+" }}{{ showBaseCurrency && entry.baseAmount !== null
|
||||||
? formatCurrencyAmount(entry.amount, entry.currency)
|
? `¥${formatMoney(entry.baseAmount)}`
|
||||||
: `¥${formatMoney(entry.baseAmount)}` }}
|
: formatCurrencyAmount(entry.amount, entry.currency) }}
|
||||||
</strong>
|
</strong>
|
||||||
<span>{{ entry.currency === "CNY" || entry.baseAmount === null
|
<span>{{ formatTime(entry.occurredAt) }}</span>
|
||||||
? formatTime(entry.occurredAt)
|
|
||||||
: formatCurrencyAmount(entry.amount, entry.currency) }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue