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,