diff --git a/frontend/src/pages/SocialInsurance.tsx b/frontend/src/pages/SocialInsurance.tsx index 670176c..c3e3eae 100644 --- a/frontend/src/pages/SocialInsurance.tsx +++ b/frontend/src/pages/SocialInsurance.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react' import { useSearchParams } from 'react-router-dom' import { toast } from 'sonner' import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' -import { Calculator, Check, Plus, Download, AlertCircle, Clock } from 'lucide-react' +import { Calculator, Check, Plus, Download, AlertCircle, Clock, ChevronDown, ChevronRight, Shield, Home } from 'lucide-react' import { InlineAlert } from '../components/ui/InlineAlert' import PageGuide from '../components/ui/PageGuide' import { socialInsuranceApi, socialAccountApi } from '../lib/api-services' @@ -460,14 +460,40 @@ export default function SocialInsurance() { const sTable = renderSocialTable(city) const hTable = renderHousingTable(city) if (!sTable && !hTable) return null + const sAddCity = sAdd.filter((i: any) => i.city === city) + const sSubCity = sSub.filter((i: any) => i.city === city) + const sNormalCity = sNormal.filter((i: any) => i.city === city) + const hAddCity = hAdd.filter((i: any) => i.city === city) + const hSubCity = hSub.filter((i: any) => i.city === city) + const hNormalCity = hNormal.filter((i: any) => i.city === city) + const sTotal = [...sAddCity, ...sNormalCity].reduce((s: number, i: any) => s + (i.detail?.total || 0), 0) + const hTotal = [...hAddCity, ...hNormalCity].reduce((s: number, i: any) => s + (i.detail?.total || 0), 0) return ( -
-

- {city} - 向{city}社保/公积金经办机构申报 -

- {sTable &&

社保

{sTable}
} - {hTable &&

公积金

{hTable}
} +
+
+
+ {city} + 向{city}社保/公积金经办机构申报 +
+
+
+ } + summary={`${sAddCity.length + sSubCity.length + sNormalCity.length} 人 | 企业 ¥${fmt([...sAddCity, ...sNormalCity].reduce((s: number, i: any) => s + (i.detail?.totalOrg || 0), 0))} + 个人 ¥${fmt([...sAddCity, ...sNormalCity].reduce((s: number, i: any) => s + (i.detail?.totalEmp || 0), 0))} = ¥${fmt(sTotal)}`} + defaultOpen={true} + > + {sTable} + + } + summary={`${hAddCity.length + hSubCity.length + hNormalCity.length} 人 | 企业 ¥${fmt([...hAddCity, ...hNormalCity].reduce((s: number, i: any) => s + (i.detail?.orgAmount || 0), 0))} + 个人 ¥${fmt([...hAddCity, ...hNormalCity].reduce((s: number, i: any) => s + (i.detail?.empAmount || 0), 0))} = ¥${fmt(hTotal)}`} + defaultOpen={true} + > + {hTable} + +
) })} @@ -492,3 +518,22 @@ export default function SocialInsurance() { ) } +function CollapsibleSection({ title, icon, summary, defaultOpen = false, children }: { title: string; icon: React.ReactNode; summary?: string; defaultOpen?: boolean; children: React.ReactNode }) { + const [open, setOpen] = useState(defaultOpen) + return ( +
+ + {open &&
{children}
} +
+ ) +}