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
@@ -13,7 +13,10 @@ type Row = {
id: number;
customerName: string | null;
contacts: string | null;
phone: string | null;
contactsPhone: string | null;
balanceUser: string | null;
balanceUserPhone: string | null;
phone: string | null; // 旧公共电话,仅作新字段为空时的回退
salesman: string | null;
reportDate: Date | null;
birthday: Date | null;
@@ -52,6 +55,9 @@ export default async function BirthdayPage({
id,
customer_name AS customerName,
contacts,
contacts_phone AS contactsPhone,
balance_user AS balanceUser,
balance_user_phone AS balanceUserPhone,
phone,
salesman,
report_date AS reportDate,
@@ -82,8 +88,7 @@ export default async function BirthdayPage({
<THead>
<tr>
<TH>商户名称</TH>
<TH>联系人</TH>
<TH>联系电话</TH>
<TH>归属人</TH>
<TH>业务员</TH>
<TH>生日</TH>
<TH>历法</TH>
@@ -93,16 +98,25 @@ export default async function BirthdayPage({
<tbody>
{rows.length === 0 && (
<tr>
<TD colSpan={7} className="py-14 text-center text-[var(--color-muted-foreground)]">
<TD colSpan={6} className="py-14 text-center text-[var(--color-muted-foreground)]">
该时段暂无生日商户
</TD>
</tr>
)}
{rows.map((c) => (
{rows.map((c) => {
// 生日归属人的姓名和手机号;新手机号为空时回退旧公共 phone(历史数据)
const ownerName = c.birthdayOwner === 1 ? c.balanceUser : c.contacts;
const ownerPhone =
(c.birthdayOwner === 1 ? c.balanceUserPhone : c.contactsPhone) || c.phone;
return (
<TR key={c.id}>
<TD className="font-medium">{c.customerName}</TD>
<TD>{c.contacts}</TD>
<TD className="tabular-nums">{superAdmin ? c.phone : maskPhone(c.phone)}</TD>
<TD>
<div>{ownerName}</div>
<div className="text-xs tabular-nums text-[var(--color-muted-foreground)]">
{superAdmin ? ownerPhone : maskPhone(ownerPhone)}
</div>
</TD>
<TD>{c.salesman}</TD>
<TD className="tabular-nums">{fmtDate(c.birthday)}</TD>
<TD>
@@ -112,7 +126,8 @@ export default async function BirthdayPage({
</TD>
<TD>{c.birthdayOwner === 1 ? "结算人" : "联系人"}</TD>
</TR>
))}
);
})}
</tbody>
</Table>
</Card>