diff --git a/backend/src/routes/payroll2.routes.ts b/backend/src/routes/payroll2.routes.ts index 9821d40..78d7956 100644 --- a/backend/src/routes/payroll2.routes.ts +++ b/backend/src/routes/payroll2.routes.ts @@ -377,6 +377,16 @@ router.post('/batches', async (req: AuthRequest, res: Response, next: NextFuncti try { baseSalary = Number(decrypt(emp.monthlySalary)) || 0 } catch { baseSalary = Number(emp.monthlySalary) || 0 } } + // 统一试用期判定(所有模式适用,SEVERANCE 除外) + // 试用期且 probationSalary > 0 → 覆盖 baseSalary 为试用期工资 + if (type !== 'SEVERANCE' && type !== 'TERMINATION') { + const batchMonthEnd = new Date(`${month}-28T23:59:59`) + const latestContract = emp.contracts?.[0] + if (isInProbation(latestContract, batchMonthEnd) && latestContract?.probationSalary > 0) { + baseSalary = latestContract.probationSalary + } + } + // SEVERANCE 批次:从离职记录读取补偿金作为应发金额,不走工资/社保/个税计算 let severanceAmount = 0 let severanceBreakdown: any = null