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 计划中均可完整体验与实操练习,无需额外付费购买付费团队版。