提成交接预览
灵感:能力工具箱 commission-handover(近月个人确认业绩行映射)。
> 小四原创:原始业绩行 → 统一预览行(month / 确认态 / 展示名 / 金额别名)。
> 拉取接口与审批流留给业务侧;本包只管展示层规范化。
> 文案用「交接预览 / 资料汇总」,避免胁迫式离职话术。
何时使用
- 人员交接页展示近月已确认提成
- 导出/打印前对齐字段名
- Demo 工具箱样例行
硬约束
- 输入可为任意业绩行;输出必含:
idmonthnamestatusLabelcommission(及amount别名)。 isConfirm为1/'1'→「已确认」,否则「待确认」。- 月份序列:有入职日则从入职到本月;否则默认近 12 个月;倒序(近月在前)。
- 缺公司名/部门/昵称时用
-,勿抛异常。 - 实现要点注释标 小四原创。
- 不在本 Skill 内调用私有 archive/审批 API;过滤「仅已确认」由接入层决定。
推荐实现
export type HandoverRow = {
id: string
month: string
companyName: string
deptName: string
userNickname: string
signingPerformance?: number
collectionPerformance?: number
commission?: number
amount?: number
name: string
statusLabel: string
}
// 小四原创:确认态文案
export function confirmLabel(isConfirm: unknown): string {
return isConfirm == 1 || isConfirm === '1' ? '已确认' : '待确认'
}
/** YYYY-MM 列表,倒序;无 entryDate 则近 12 个月 */
export function monthsFromEntry(entryDate?: string, now = new Date()): string[] {
const end = new Date(now.getFullYear(), now.getMonth(), 1)
let start = new Date(end.getFullYear(), end.getMonth() - 11, 1)
if (entryDate) {
const d = new Date(entryDate)
if (!Number.isNaN(d.getTime())) start = new Date(d.getFullYear(), d.getMonth(), 1)
}
const months: string[] = []
const cur = new Date(start)
while (cur <= end) {
months.push(`${cur.getFullYear()}-${String(cur.getMonth() + 1).padStart(2, '0')}`)
cur.setMonth(cur.getMonth() + 1)
}
return months.reverse()
}
// 小四原创:业绩行 → 交接预览行
export function normalizeHandoverRow(
row: Record<string, any>,
month: string,
isConfirm: unknown,
index: number,
): HandoverRow {
const m = row.month || month
const company = row.companyName || '-'
return {
...row,
id: String(row.id ?? `${m}-${row.userId ?? 'u'}-${index}`),
month: m,
companyName: company,
deptName: row.deptName || '-',
userNickname: row.userNickname || '-',
signingPerformance: row.signingPerformance,
collectionPerformance: row.collectionPerformance,
commission: row.commission,
amount: row.commission,
name: `${m} · ${company === '-' ? '个人业绩' : company}`,
statusLabel: confirmLabel(isConfirm),
}
}
Agent 步骤
- 业务侧按月拉取业绩;仅保留已确认行(规则自定)。
- 每行
normalizeHandoverRow;列表按monthsFromEntry顺序展示。 - UI 标题用「提成交接预览」,副文案「便于资料核对」。
- 自测:无入职日 12 个月、有入职日跨年、待确认/已确认标签。
不要做
- 在本 Skill 内硬编码私有业绩/审批接口路径。
- 用威胁、扣款恐吓等文案描述交接场景。
附加
- README.md · reference.md · templates/usage.md