feat(customers): 联系人/结算人各自独立手机号

- customers 表新增 contacts_phone / balance_user_phone 两列(sql/add-contact-phones.sql)
- 新增表单拆出"联系人信息/结算人信息"分区,手机号必填并校验 11 位;编辑选填
- 列表联系人/结算人列改为姓名+手机号两行展示,沿用业务员脱敏规则
- 查看弹窗同步分区并在服务端预脱敏,旧公共 phone 不再下发客户端
- 生日提醒页按生日归属展示对应人姓名+手机号,空值回退旧 phone
- 导入模板/导出增加两个新列,保留"联系电话"表头兼容旧导入文件
- 旧 phone 列保留历史数据,界面不再录入/展示

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 23:45:20 +08:00
co-authored by Claude Fable 5
parent c54ec4355d
commit d00de04c27
10 changed files with 138 additions and 44 deletions
+27 -8
View File
@@ -66,7 +66,6 @@ export default async function CustomersPage({
<TH>商户名称</TH>
<TH>联系人</TH>
<TH>结算人</TH>
<TH>联系电话</TH>
<TH>产品明细</TH>
<TH>押金</TH>
<TH>买断</TH>
@@ -80,17 +79,29 @@ export default async function CustomersPage({
<tbody>
{rows.length === 0 && (
<tr>
<TD colSpan={12} className="py-14 text-center text-[var(--color-muted-foreground)]">
<TD colSpan={11} className="py-14 text-center text-[var(--color-muted-foreground)]">
暂无数据
</TD>
</tr>
)}
{rows.map((c) => (
{rows.map((c) => {
// 旧公共 phone 已停用,不随序列化下发到客户端
const { phone: _legacyPhone, ...rest } = c;
return (
<TR key={c.id}>
<TD className="font-medium">{c.customerName}</TD>
<TD>{c.contacts}</TD>
<TD>{c.balanceUser}</TD>
<TD className="tabular-nums">{superAdmin ? c.phone : maskPhone(c.phone)}</TD>
<TD>
<div>{c.contacts}</div>
<div className="text-xs tabular-nums text-[var(--color-muted-foreground)]">
{superAdmin ? c.contactsPhone : maskPhone(c.contactsPhone)}
</div>
</TD>
<TD>
<div>{c.balanceUser}</div>
<div className="text-xs tabular-nums text-[var(--color-muted-foreground)]">
{superAdmin ? c.balanceUserPhone : maskPhone(c.balanceUserPhone)}
</div>
</TD>
<TD className="max-w-[280px] whitespace-normal break-words">{c.detail}</TD>
<TD>{c.deposit}</TD>
<TD>{c.buy}</TD>
@@ -112,7 +123,14 @@ export default async function CustomersPage({
<TD className="max-w-[280px] whitespace-normal break-words">{c.remark}</TD>
<TD>
<div className="flex justify-end gap-1.5">
<CustomerView customer={c} />
{/* 弹窗展示用的手机号在服务端预脱敏,业务员拿不到明文 */}
<CustomerView
customer={{
...rest,
contactsPhone: superAdmin ? c.contactsPhone : maskPhone(c.contactsPhone),
balanceUserPhone: superAdmin ? c.balanceUserPhone : maskPhone(c.balanceUserPhone),
}}
/>
<Link href={`/customers/${c.id}/edit`}>
<Button variant="outline" size="sm">编辑</Button>
</Link>
@@ -120,7 +138,8 @@ export default async function CustomersPage({
</div>
</TD>
</TR>
))}
);
})}
</tbody>
</Table>
</Card>