import { useState } from "react" import { useNavigate } from "react-router-dom" import { toast } from "sonner" import { useMutation, useQueryClient } from "@tanstack/react-query" import { socialInsuranceApi } from '../../lib/api-services' import Card from "../../components/ui/Card" import Button from "../../components/ui/Button" import { Input, Label, Select } from "../../components/ui/Input" import Modal from "../../components/ui/Modal" import { fmt } from "./shared" import { ExternalLink } from "lucide-react" /** 薪酬社保合并组件(工资条 / 缴纳记录) */ export default function PayslipSocialInfo({ payslips, monthlyProcessRecords, employeeId }: { payslips: any[]; socialInsRecords: any[]; housingFundRecords: any[]; monthlyProcessRecords: any[]; employeeId?: string }) { const [subTab, setSubTab] = useState<'payslip' | 'monthly'>('payslip') const navigate = useNavigate() return (
| 月份 | 基本工资 | 加班费 | 津贴 | 扣款 | 应发合计 | 确认状态 |
|---|---|---|---|---|---|---|
| {p.month} | ¥{fmt(p.baseSalary)} | {p.overtimePay > 0 ? `¥${fmt(p.overtimePay)}` : '-'} | {p.allowance > 0 ? `¥${fmt(p.allowance)}` : '-'} | {p.deduction > 0 ? `-¥${fmt(p.deduction)}` : '-'} | ¥{fmt(p.totalPay)} | {p.confirmedAt ? ( 已确认 ) : ( 未确认 )} |
| 合计 | ¥{fmt(payslips.reduce((s, p) => s + (p.baseSalary || 0), 0))} | {payslips.reduce((s, p) => s + (p.overtimePay || 0), 0) > 0 ? `¥${fmt(payslips.reduce((s, p) => s + (p.overtimePay || 0), 0))}` : '-'} | {payslips.reduce((s, p) => s + (p.allowance || 0), 0) > 0 ? `¥${fmt(payslips.reduce((s, p) => s + (p.allowance || 0), 0))}` : '-'} | {payslips.reduce((s, p) => s + (p.deduction || 0), 0) > 0 ? `-¥${fmt(payslips.reduce((s, p) => s + (p.deduction || 0), 0))}` : '-'} | ¥{fmt(payslips.reduce((s, p) => s + (p.totalPay || 0), 0))} |
| 办理月份 | 类型 | 城市 | 状态 | 缴费基数 | 企业部分 | 个人部分 | 合计 | 变动 | 办理时间 |
|---|---|---|---|---|---|---|---|---|---|
| {r.month} | {isSocial ? '社保' : '公积金'} | {r.city || '-'} | 已缴纳 | ¥{fmt(r.base)} | {orgAmt != null ? `¥${fmt(orgAmt)}` : '-'} | {empAmt != null ? `¥${fmt(empAmt)}` : '-'} | {total != null ? `¥${fmt(total)}` : '-'} | {r.changeType} | {new Date(r.processedAt).toLocaleString('zh-CN')} |
| 开始年月 | 截止年月 | 类型 | 参保城市 | 缴费基数 | 变动类型 | 备注 | 操作 |
|---|---|---|---|---|---|---|---|
| {r.startMonth} | {r.endMonth || '至今'} | {r.cat} | {r.city || '-'} | ¥{fmt(r.base)} | {changeTypeMap[r.changeType] || r.changeType} | {r.remark || '-'} |