Figma 企業級賬單與發票管理系統(Billing, Invoicing & Subscription Receipt Architecture)元件架構實戰:從歷史發票明細表格(Invoice Table)、電子憑證滑出抽屜(Receipt Drawer)、稅號與對賬抬頭編輯到 Variables 狀態機與 Dev Mode 前端 Stripe 交付
引言:SaaS 商業變現的信任基石——賬單與發票中心(Billing & Invoices)
在以按月訂閱(Monthly Subscription)、按席位計費(Per-Seat Pricing)或用量計量(Usage-Based Metering)為核心商業模式的 B2B SaaS、雲基礎設施(如 AWS / Vercel)及數字化產品中,賬單與發票系統(Billing & Invoicing System) 是連線平臺與企業財務採購團隊(Finance & Procurement)的唯一官方履約介面。企業級客戶不僅關心產品功能,更將稅務合規(Tax Compliance)、增值稅專用發票(VAT / GST Invoices)、自動扣款對賬單以及歷史憑據追溯視為系統採購與續約的核心准入條件。
然而,在日常產品設計與研發交接中,賬單與發票模組往往被當成“簡單的流水錶格”,從而暴露出大量危及商業信譽的體驗盲區:
- 財務狀態標識混亂:將“已出賬但未扣款(Draft / Finalized)”、“扣款失敗(Payment Failed)”與“已登出失效(Void)”簡單混同,導致使用者無法判斷是否即將遭遇系統停服;
- 缺乏即時電子憑證預覽與直接列印能力:使用者每次需要報銷都必須等待漫長的 PDF 生成並下載到本機,無法直接在網頁中調出符合國際財務標準的電子對賬憑證(Receipt / Invoice Sheet)進行核對;
- 企業開票抬頭與稅號治理缺失:企業更名、跨國分公司增值稅號(Tax Identification Number / EU VAT ID)變更後,設計未界定“存量歷史發票防篡改唯讀”與“未來新發票應用新抬頭”的法律邊界;
- 扣款失敗還原鏈路中斷:遭遇信用卡過期或銀行反欺詐攔截時,介面僅展示冰冷的錯誤提示,缺少欠費寬限期(Grace Period)倒計時與一鍵換卡重扣互動通道;
- 設計變數與前端元件斷層:設計稿中的金額未採用等寬數字(Tabular Figures)對齊,缺乏在 Dev Mode 開發者模式 下基於 Stripe / Paddle 的企業級資料模型定義。
本文將深入拆解如何在 Figma 中搭建一套達到跨國金融合規標準的賬單與發票管理系統,從流水錶格、憑證抽屜、稅號配置到前端 React + TypeScript 生產級程式碼全鏈路交付。
賬單管理系統三層資訊架構:帳戶用量看板 vs 流水錶格 vs 憑據抽屜
為兼顧普通運維管理者與專職財務核算人員的差異化訴求,工業級賬單系統通常由三層資訊空間構成:
| 架構層級 | 核心承載元件 | 核心目標使用者與心智 | 關鍵資訊密度 |
|---|---|---|---|
| 頂部用量概覽(Summary Layer) | 當前週期用量卡片、扣款方式繫結塢 | 專案負責人 / 團隊管理員:瞭解當月花了多少、下次扣款日期 | 中密度,強調進度條與到期預警 |
| 流水歷史(Ledger Layer) | 歷史發票資料表格(Invoice Data Table) | 財務會計 / 審計:按月對賬,批次匯出與狀態過濾 | 高密度,嚴格等寬數字對齊,按賬期倒序 |
| 憑據穿透(Receipt Detail Layer) | 電子發票滑出抽屜(Receipt Drawer) | 報銷員工 / 審計員:核對單一賬單的拆細項與稅費公式 | 結構化憑據,標準票據排版與防偽指紋 |
┌─────────────────────────────────────────────────────────────────────────┐
│ Billing & Invoices Management Console │
├─────────────────────────────────────────────────────────────────────────┤
│ ┌───────────────────────────┐ ┌───────────────────────────────────────┐ │
│ │ Next Billing: Dec 01, 2026│ │ Payment Method: Visa •••• 4242 │ │
│ │ Estimated: $1,280.00 │ │ Status: [Auto-Pay Enabled] [Update] │ │
│ └───────────────────────────┘ └───────────────────────────────────────┘ │
│ │
│ [Invoices History Table] [Filter: All / Paid / Failed] │
│ ┌──────────────┬──────────────┬──────────┬──────────┬─────────────────┐ │
│ │ Invoice ID │ Billing Date │ Amount │ Status │ Actions │ │
│ ├──────────────┼──────────────┼──────────┼──────────┼─────────────────┤ │
│ │ INV-2026-011 │ Nov 01, 2026 │ $1,250.00│ [Paid] │ [PDF] [View] ───┼─┐
│ │ INV-2026-010 │ Oct 01, 2026 │ $1,180.00│ [Paid] │ [PDF] [View] │ │
│ │ INV-2026-009 │ Sep 01, 2026 │ $1,180.00│ [Refund] │ [PDF] [View] │ │
│ └──────────────┴──────────────┴──────────┴──────────┴─────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
│
▼ (Slides in from right side)
┌─────────────────────────────────────────────────────────────────────────┐
│ Receipt Detail Drawer (INV-2026-011) [Close] │
├─────────────────────────────────────────────────────────────────────────┤
│ Acme Cloud Technologies, Inc. INVOICE: INV-2026-011 │
│ 100 Enterprise Way, Suite 400 Issued: Nov 01, 2026 │
│ Tax ID: US-EIN-987654321 Status: [Paid via Stripe] │
│ │
│ Billed To: Global Media Group Tax ID / VAT: GB123456789 │
│ ───────────────────────────────────────────────────────────────────── │
│ Line Items: │
│ 1. Enterprise Platform (Annual) Qty: 1 $1,000.00 │
│ 2. Additional Developer Seats Qty: 10 $200.00 │
│ 3. Compute Overage (1,200 GB-hrs) $50.00 │
│ ───────────────────────────────────────────────────────────────────── │
│ Subtotal: $1,250.00 │
│ Tax (0% Reverse Charge B2B): $0.00 │
│ Total Amount Paid: $1,250.00 │
│ │
│ [Download Signed PDF] [Print Receipt] [Send to Accounting Email] │
└─────────────────────────────────────────────────────────────────────────┘
核心原子元件拆解與 Auto Layout 彈性排版
依託 Figma 的 自動佈局 Auto Layout 與 元件與變體 Variants,我們為賬單系統打造高度彈性的模組基座。
1. 發票狀態微徽標元件集(Invoice Status Badges)
發票具有嚴格的法律與結算生命週期狀態,色彩感知必須符合 設計令牌手冊 中的狀態矩陣:
- 已支付(Paid):底色淡翡翠綠(
emerald-50),文字高對比度綠(emerald-700),實心小圓點; - 待處理 / 結算中(Pending / Processing):底色冰藍(
sky-50),文字深藍(sky-700),輕微時鐘圖示; - 扣款失敗 / 逾期(Failed / Past Due):底色淺珊瑚紅(
rose-50),文字警示紅(rose-700),告警感嘆號,高亮呼應; - 已全額/部分退款(Refunded):底色淡紫灰(
purple-50),文字紫灰(purple-700),折返弧線箭頭; - 已作廢(Void / Cancelled):底色淺灰(
slate-100),文字中灰(slate-500),斜槓禁止圖元。
2. 財務表格行與等寬金額排版(Invoice Row with Tabular Figures)
在排版包含多行貨幣數值的表格時,普通字型的數字寬度參差不齊(例如數字 1 明顯比 8 窄),會導致小數點無法豎向對齊,造成嚴重視覺混亂:
- OpenType Tabular Figures 變數開啟:在 Figma 文字屬性中展開
Type settings,開啟Number spacing: Tabular (monospaced),確保所有阿拉伯數字擁有相同的像素寬度; - 表格列 Auto Layout 設定:
- 發票編號:
140px固定寬度,等寬粗體; - 賬單結算週期:
Fill Container彈性分配; - 金額列:
120px固定寬度,文字必須靠右對齊(Right-Aligned); - 狀態膠囊:
90px固定寬度居中; - 操作按鈕塢:
110px水平右對齊,包含小巧的 PDF 純圖示按鈕與詳情連結。
- 發票編號:
3. 電子發票憑據抽屜(Receipt Detail Drawer)
- 抽屜外殼:固定寬度
640px,Auto Layout 垂直流,內邊距32px,右側固定滑出投影(x: -8px, blur: 24px, color: rgba(0,0,0,0.12)); - 憑證抬頭部(Letterhead):雙列 Space-Between 佈局,左側放置開票公司 Logo 與註冊地址,右側居中展示大號“INVOICE”字號與發票編號;
- 費用拆細明細表(Line Items Breakdown):頂部帶
1px淺灰分隔線,每項包含“服務描述、數量、單價、小計”,支援純 Auto Layout 垂直堆疊自適應; - 底部對賬印章與操作欄:包含防偽 SHA-256 交易指紋號,底部固化“下載 PDF”、“呼叫系統列印”、“一鍵轉發生效至財務電子郵件”三個關鍵動作。
異常扣款與欠費寬限期互動防禦機制
財務系統最致命的互動斷點在於“扣款失敗(Payment Failed)”。若系統直接封禁帳號,會立即引發高價值企業客戶的強烈不滿:
1. 欠費寬限期橫幅(Grace Period Banner)
噹噹期賬單自動扣款被銀行拒付時,頁面頂部必須動態啟用警告橫幅:
- 資訊層級:琥珀紅色高警示背景,左側帶動態警示圖示;
- 核心要素:“我們嘗試從 Visa •••• 4242 扣收 $1,250.00 失敗(原因:卡片餘額不足或反欺詐保護)。您的帳戶享有 7 天寬限期(剩餘 3 天),寬限期結束後系統將轉為唯讀模式。”
- 直通通道:行內直接內嵌“立即更換支付方式並補釦”主按鈕,引導使用者 30 秒內閉環修復。
2. 歷史發票的不可變性(Immutability Guard)
許多初級設計師會在發票詳情中放置“編輯”按鈕。在財務審計中,已結算發票屬於法律憑據,嚴禁直接修改金額或專案:
- 在發票抽屜中,對於已完成扣款的單據,所有欄位強制鎖定唯讀;
- 若使用者需要修改企業名稱或稅號,只允許在“開票設定(Billing Information)”中儲存為“自下一期賬單起生效”,並在提示中明確註明“歷史已開具發票不受影響”。
Figma Variables 變數繫結與多維度模式切換
藉助 變數 Variables 的多模式(Modes)能力,我們可以將整套財務結算系統標準化為跨平臺設計令牌:
{
"billing-tokens": {
"color": {
"paid-bg": { "Light": "#ECFDF5", "Dark": "#064E3B" },
"paid-text": { "Light": "#047857", "Dark": "#34D399" },
"failed-bg": { "Light": "#FFF1F2", "Dark": "#881337" },
"failed-text": { "Light": "#E11D48", "Dark": "#FDA4AF" },
"table-stripe": { "Light": "#F8FAFC", "Dark": "#0F172A" },
"currency-text": { "Light": "#0F172A", "Dark": "#F8FAFC" }
},
"dimension": {
"drawer-width": 640,
"table-row-height": 48,
"badge-radius": 4
}
}
}
通過將元件的文字樣式、填充顏色與邊框半徑與變數集合繫結,可以在 Dev Mode 開發者模式 中直接匯出與前端 Tailwind / CSS Variables 完全同構的程式碼片段。
Dev Mode 開發者模式與前端工程化交付(React + TypeScript)
以下為在 Dev Mode 開發者模式 下與前端交付的完整 React + TypeScript 賬單與發票管理元件規範,完全支援國際化貨幣格式化與電子憑據抽屜互動:
import React, { useState } from 'react';
// 发票生命周期状态
export type InvoiceStatus = 'paid' | 'pending' | 'failed' | 'refunded' | 'void';
export interface InvoiceLineItem {
id: string;
description: string;
quantity: number;
unitPrice: number;
total: number;
}
export interface Invoice {
id: string;
invoiceNumber: string;
issueDate: string;
dueDate: string;
amount: number;
currency: string;
status: InvoiceStatus;
customerName: string;
customerTaxId: string;
lineItems: InvoiceLineItem[];
pdfDownloadUrl: string;
}
// 发票状态徽标组件
export const InvoiceStatusBadge: React.FC<{ status: InvoiceStatus }> = ({ status }) => {
const statusMap: Record<InvoiceStatus, { label: string; className: string }> = {
paid: { label: '已支付', className: 'bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300' },
pending: { label: '待处理', className: 'bg-sky-50 text-sky-700 border-sky-200 dark:bg-sky-950 dark:text-sky-300' },
failed: { label: '扣款失败', className: 'bg-rose-50 text-rose-700 border-rose-200 dark:bg-rose-950 dark:text-rose-300' },
refunded: { label: '已退款', className: 'bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950 dark:text-purple-300' },
void: { label: '已作废', className: 'bg-slate-100 text-slate-600 border-slate-200 dark:bg-slate-800 dark:text-slate-400' }
};
const current = statusMap[status];
return (
<span className={`inline-flex items-center px-2.5 py-0.5 rounded text-xs font-medium border ${current.className}`}>
{current.label}
</span>
);
};
// 格式化金额辅助函数(等宽字体 Tabular Numbers)
export const formatCurrency = (amount: number, currency: string = 'USD'): string => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency,
minimumFractionDigits: 2
}).format(amount);
};
// 账单与发票管理表格主组件
export const BillingInvoicesTable: React.FC<{ invoices: Invoice[] }> = ({ invoices }) => {
const [selectedInvoice, setSelectedInvoice] = useState<Invoice | null>(null);
return (
<div className="w-full bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-xl overflow-hidden shadow-sm">
{/* 头部标题与筛选 */}
<div className="p-5 border-b border-slate-200 dark:border-slate-800 flex items-center justify-between">
<div>
<h2 className="text-base font-semibold text-slate-900 dark:text-white">开票与账单流水</h2>
<p className="text-xs text-slate-500 mt-0.5">查看以往所有周期的订阅费用、扣款对账单与官方发票凭证</p>
</div>
<button className="text-xs font-medium px-3 py-1.5 rounded-lg border border-slate-300 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-800 text-slate-700 dark:text-slate-200">
导出全量 CSV
</button>
</div>
{/* 历史发票数据表格 */}
<div className="overflow-x-auto">
<table className="w-full text-left text-xs">
<thead className="bg-slate-50 dark:bg-slate-800/50 text-slate-600 dark:text-slate-400 border-b border-slate-200 dark:border-slate-800">
<tr>
<th className="py-3 px-5 font-semibold">发票单号</th>
<th className="py-3 px-5 font-semibold">出账日期</th>
<th className="py-3 px-5 font-semibold text-right">金额 (含税)</th>
<th className="py-3 px-5 font-semibold text-center">状态</th>
<th className="py-3 px-5 font-semibold text-right">操作</th>
</tr>
</thead>
<tbody className="divide-y divide-slate-100 dark:divide-slate-800">
{invoices.map((inv) => (
<tr key={inv.id} className="hover:bg-slate-50/80 dark:hover:bg-slate-800/40 transition-colors">
<td className="py-3.5 px-5 font-mono font-medium text-slate-800 dark:text-slate-200">
{inv.invoiceNumber}
</td>
<td className="py-3.5 px-5 text-slate-600 dark:text-slate-400">
{inv.issueDate}
</td>
<td className="py-3.5 px-5 font-mono font-semibold text-slate-900 dark:text-white text-right tabular-nums">
{formatCurrency(inv.amount, inv.currency)}
</td>
<td className="py-3.5 px-5 text-center">
<InvoiceStatusBadge status={inv.status} />
</td>
<td className="py-3.5 px-5 text-right space-x-2">
<button
onClick={() => setSelectedInvoice(inv)}
className="font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400"
>
查看凭据
</button>
<a
href={inv.pdfDownloadUrl}
className="font-medium text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"
>
PDF
</a>
</td>
</tr>
))}
</tbody>
</table>
</div>
{/* 电子发票凭据滑出抽屉 */}
{selectedInvoice && (
<div className="fixed inset-y-0 right-0 w-[640px] max-w-full bg-white dark:bg-slate-900 border-l border-slate-200 dark:border-slate-800 shadow-2xl z-50 flex flex-col p-8 overflow-y-auto">
<div className="flex items-center justify-between pb-6 border-b border-slate-200 dark:border-slate-800">
<div>
<span className="text-xs uppercase tracking-wider font-semibold text-primary-600">电子账单收据</span>
<h3 className="text-xl font-bold font-mono text-slate-900 dark:text-white mt-1">
{selectedInvoice.invoiceNumber}
</h3>
</div>
<button
onClick={() => setSelectedInvoice(null)}
className="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 text-lg"
>
✕
</button>
</div>
<div className="py-6 space-y-6 flex-1 text-xs">
{/* 开票主体与客户信息 */}
<div className="grid grid-cols-2 gap-6 bg-slate-50 dark:bg-slate-800/40 p-4 rounded-lg">
<div>
<span className="text-slate-400 block mb-1">开票主体 (Issuer)</span>
<p className="font-semibold text-slate-800 dark:text-slate-200">Acme Cloud Platform Inc.</p>
<p className="text-slate-500">100 Tech Blvd, Suite 300</p>
<p className="text-slate-500 font-mono">Tax ID: US-EIN-987654321</p>
</div>
<div>
<span className="text-slate-400 block mb-1">付款客户 (Billed To)</span>
<p className="font-semibold text-slate-800 dark:text-slate-200">{selectedInvoice.customerName}</p>
<p className="text-slate-500 font-mono">VAT/Tax ID: {selectedInvoice.customerTaxId}</p>
<p className="text-slate-500">出账日期: {selectedInvoice.issueDate}</p>
</div>
</div>
{/* 费用明细列表 */}
<div>
<h4 className="font-semibold text-slate-800 dark:text-slate-200 mb-3">计费细项 (Line Items)</h4>
<div className="border border-slate-200 dark:border-slate-800 rounded-lg overflow-hidden">
<table className="w-full text-left">
<thead className="bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400">
<tr>
<th className="py-2.5 px-4 font-medium">项目描述</th>
<th className="py-2.5 px-4 font-medium text-center">数量</th>
<th className="py-2.5 px-4 font-medium text-right">单价</th>
<th className="py-2.5 px-4 font-medium text-right">小计</th>
</tr>
</thead>
<tbody className="divide-y divide-slate-100 dark:divide-slate-800 font-mono">
{selectedInvoice.lineItems.map((item) => (
<tr key={item.id}>
<td className="py-2.5 px-4 font-sans text-slate-800 dark:text-slate-200">{item.description}</td>
<td className="py-2.5 px-4 text-center text-slate-600 dark:text-slate-400">{item.quantity}</td>
<td className="py-2.5 px-4 text-right tabular-nums">{formatCurrency(item.unitPrice)}</td>
<td className="py-2.5 px-4 text-right font-semibold text-slate-900 dark:text-white tabular-nums">
{formatCurrency(item.total)}
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
{/* 总计结算栏 */}
<div className="flex justify-end pt-4">
<div className="w-64 space-y-2 text-right">
<div className="flex justify-between text-slate-500">
<span>小计金额:</span>
<span className="font-mono tabular-nums">{formatCurrency(selectedInvoice.amount)}</span>
</div>
<div className="flex justify-between text-slate-500">
<span>税费 (VAT 0% 反向征收):</span>
<span className="font-mono tabular-nums">$0.00</span>
</div>
<div className="flex justify-between text-sm font-bold text-slate-900 dark:text-white border-t border-slate-200 dark:border-slate-800 pt-2">
<span>总计实付:</span>
<span className="font-mono tabular-nums">{formatCurrency(selectedInvoice.amount)}</span>
</div>
</div>
</div>
</div>
{/* 底部动作工具栏 */}
<div className="pt-6 border-t border-slate-200 dark:border-slate-800 flex justify-between gap-3">
<button
onClick={() => window.print()}
className="px-4 py-2 rounded-lg border border-slate-300 dark:border-slate-700 text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-800 text-xs font-medium"
>
打印凭证
</button>
<div className="flex gap-2">
<a
href={selectedInvoice.pdfDownloadUrl}
download
className="px-5 py-2 rounded-lg bg-primary-600 text-white hover:bg-primary-700 text-xs font-medium flex items-center gap-1.5"
>
下载正式发票 PDF
</a>
</div>
</div>
</div>
)}
</div>
);
};
總結與企業級交付自檢清單(Checklist)
在將發票與賬單元件合併入企業設計資產庫時,請確保完整通過以下八項合規驗收標準:
- Tabular Figures 等寬數字:所有金額、稅率、發票單號均已開啟 OpenType
tnum屬性,垂直排列無抖動; - 全生命週期狀態覆蓋:完整定義已支付(Paid)、待處理(Pending)、失敗(Failed)、退款(Refunded)與作廢(Void)五種財務變體;
- 財務防篡改唯讀性:歷史已開具憑據強制鎖定為唯讀狀態,抬頭編輯僅影響下一結算週期;
- 寬限期告警防線:扣款失敗提供顯目的寬限期倒計時橫幅與換卡重試通道;
- 跨國貨幣格式化自適應:容器預留充足寬度,杜絕多幣種符號(如
€、£、¥)換行溢位; - Tokens 與暗黑模式:所有元件色值均已與語義化 Design Tokens 繫結;
- 雙向內鏈關聯:深入學習賬單管理與工程化設計規範,請參考 帳戶管理與賬單設定、設計令牌手冊、自動佈局 Auto Layout 實戰、元件變體與例項 以及 Dev Mode 開發者模式。
核心手冊與速查工具
高頻手冊與實用生產力工具直達常見問題與答疑 (FAQ)
高頻疑難解析與避坑指南完全不需要。绝大多数核心功能在免费 Starter 计划中均可完整体验与实操练习,无需额外付费购买付费团队版。
建议从理解弹性盒子模型(Flexbox)开始,熟练运用 Hug(适应内容)、Fill(填充容器)与 Fixed(固定尺寸),再结合绝对定位和负间距完成复杂响应式组件构建。
在 Figma 画布中按快捷键 Shift + I 打开 Resources 资源弹窗,切换到「Plugins」选项卡,即可直接搜索并一键运行海量社区优质插件。
Figma Variables 支持颜色、数值、字符串和布尔值等多种类型,可建立轻暗色模式切换、多平台间距规范等,配合 Dev Mode 可无缝导出为前端生产代码。