From 027a0b55a411f642b9d744ee411d09c10dd9ec5a Mon Sep 17 00:00:00 2001 From: luishou Date: Sun, 12 Jul 2026 19:23:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(customer-view):=20=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=88=86=E5=8C=BA=E7=BE=8E=E5=8C=96=EF=BC=88?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC/=E7=94=9F=E6=97=A5/=E4=B8=9A=E5=8A=A1/?= =?UTF-8?q?=E5=A4=87=E6=B3=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 把平铺的 InfoRow 切成 基本/生日/业务/备注 四块,每块带灰色小标题 + 浅灰分隔线 - 生日类型/生日归属/生日 聚到「生日」块 - 新增 Section helper(复用 --color-border / --color-muted-foreground,不新增组件文件) - 空分区整体隐藏;首块无顶部分隔线(first: 变体动态生效) - CardTitle「商户信息」、Esc/遮罩/✕ 关闭、InfoRow、长文本换行 均保留 校验:tsc --noEmit 通过;next build 全路由编译通过。 Co-Authored-By: Claude --- .../(dashboard)/customers/customer-view.tsx | 62 ++++++++++++++----- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/src/app/(dashboard)/customers/customer-view.tsx b/src/app/(dashboard)/customers/customer-view.tsx index 3a53a19..1e02b26 100644 --- a/src/app/(dashboard)/customers/customer-view.tsx +++ b/src/app/(dashboard)/customers/customer-view.tsx @@ -1,6 +1,6 @@ "use client"; -import { useEffect, useState } from "react"; +import { useEffect, useState, type ReactNode } from "react"; import { Eye, X } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; @@ -40,6 +40,10 @@ export function CustomerView({ customer }: CustomerViewProps) { const birthdayLabel = customer.birthdayType === 2 ? "阴历" : "阳历"; const birthdayOwnerLabel = customer.birthdayOwner === 1 ? "结算人" : "联系人"; + // 各分区是否至少有一个字段,用于隐藏整块为空的小标题 + const hasBasic = !!(customer.customerName || customer.contacts || customer.balanceUser || customer.phone || customer.detail); + const hasBusiness = !!(customer.deposit || customer.buy || customer.salesman || customer.reportDate); + return ( <> - - - - - - - - - - - - - - + + {hasBasic && ( +
+ + + + + +
+ )} + {customer.birthday && ( +
+ + + +
+ )} + {hasBusiness && ( +
+ + + + +
+ )} + {customer.remark && ( +
+

{customer.remark}

+
+ )}
@@ -91,6 +111,18 @@ export function CustomerView({ customer }: CustomerViewProps) { ); } +// 分区容器:小标题 + 内容;块间用浅灰分隔线隔开,首块无顶部分隔线 +function Section({ title, children }: { title: string; children: ReactNode }) { + return ( +
+

+ {title} +

+ {children} +
+ ); +} + function InfoRow({ label, value,