/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
import React, { useMemo } from 'react';
import {
Button,
Empty,
Input,
Select,
Table,
Tag,
Typography,
} from '@douyinfe/semi-ui';
import { Download, Search, Table2, UserCog } from 'lucide-react';
import { ChangeText, OrgNameCell, SectionCard } from './shared';
import {
ALERT_LEVELS,
ORG_STATUS,
changeRate,
daysSince,
downloadCsv,
formatCny,
formatCst,
orgDisplayName,
quotaToCny,
SEGMENTS,
TIERS,
} from './utils';
const { Text } = Typography;
// ─── 跟进人视图 ───────────────────────────────────────────────────
export const SalesRepTable = ({ reps, cny, onSelect, t }) => {
const m = (v) => {formatCny(v, cny)};
const count = (color) => (v) =>
v > 0 ? (
{v}
) : (
0
);
const columns = [
{
title: t('跟进人'),
dataIndex: 'sales_rep',
width: 120,
fixed: 'left',
render: (v) => (
),
},
{ title: t('企业数'), dataIndex: 'orgs', width: 80, align: 'right' },
{ title: t('活跃企业'), dataIndex: 'active', width: 90, align: 'right' },
{
title: t('本期消耗'),
dataIndex: 'quota',
width: 130,
align: 'right',
render: m,
sorter: (a, b) => a.quota - b.quota,
},
{
title: t('变化'),
dataIndex: 'change',
width: 90,
align: 'right',
render: (_, r) => ,
sorter: (a, b) =>
(changeRate(a.quota, a.prev_quota) ?? -Infinity) -
(changeRate(b.quota, b.prev_quota) ?? -Infinity),
},
{
title: t('企业余额'),
dataIndex: 'balance',
width: 130,
align: 'right',
render: m,
},
{
title: t('续费跟进'),
dataIndex: 'renewal',
width: 90,
align: 'center',
render: count('red'),
sorter: (a, b) => a.renewal - b.renewal,
},
{
title: t('流失挽回'),
dataIndex: 'retention',
width: 90,
align: 'center',
render: count('orange'),
sorter: (a, b) => a.retention - b.retention,
},
{
title: t('增长机会'),
dataIndex: 'growth',
width: 90,
align: 'center',
render: count('green'),
sorter: (a, b) => a.growth - b.growth,
},
];
return (
}
extra={
{t('点击跟进人筛选下方企业明细')}
}
>