sync: 同步 monkey-ai@weiyuan(ddc5b9443) 的 web/ 到 ui-optimization

- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等,
  semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi
- 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复
- 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志
- 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求
- 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新
- 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
This commit is contained in:
qiubaishen
2026-11-18 10:22:02 +08:00
parent 737c353d84
commit db3dba1e96
157 changed files with 29960 additions and 1197 deletions
+194
View File
@@ -0,0 +1,194 @@
/*
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 <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React, { useEffect, useState } from 'react';
import { Alert, Button, Descriptions, Drawer, Spin, Table, Tag } from 'antd';
import { useTranslation } from 'react-i18next';
import { commissionActorName, commissionLabel, statusTagColor } from './labels';
import { EvidenceLink } from './operations';
export default function PartnerDetail({
partner,
assignments,
audit,
fetchJSON,
onClose,
onEdit,
}) {
const { t, i18n } = useTranslation();
const [record, setRecord] = useState(null);
const [error, setError] = useState('');
useEffect(() => {
let current = true;
setRecord(null);
setError('');
if (partner)
fetchJSON(`/api/commission/v2/partners/${partner.id}`)
.then((value) => current && setRecord(value))
.catch((err) => current && setError(err.message));
return () => {
current = false;
};
}, [partner, fetchJSON]);
const row = record || partner || {};
const date = (value) =>
value ? new Date(value * 1000).toLocaleDateString(i18n.language) : '—';
const section = (title, fields) => (
<section className='commission-profile-section'>
<h3>{t(title)}</h3>
<Descriptions
size='small'
column={{ xs: 1, md: 2 }}
items={fields.map(([key, value]) => ({
key,
label: t(key),
children: value || '—',
}))}
/>
</section>
);
return (
<Drawer
rootClassName='commission-profile-drawer commission-detail-drawer'
title={
<span>
{row.name}{' '}
<Tag color={statusTagColor(row.status)}>
{commissionLabel(t, 'status', row.status)}
</Tag>
</span>
}
open={!!partner}
placement='right'
size={820}
onClose={onClose}
footer={
<div className='commission-drawer-actions'>
<Button onClick={onClose}>{t('关闭')}</Button>
<Button type='primary' onClick={() => onEdit(partner)}>
{t('编辑伙伴档案')}
</Button>
</div>
}
>
{error && (
<Alert
type='error'
showIcon
className='commission-inline-alert'
title={error}
/>
)}
{!record && !error ? (
<Spin className='commission-drawer-spin' />
) : (
<>
{section('基本信息', [
['伙伴编号', row.partner_code],
['主体类型', commissionLabel(t, 'partnerType', row.type)],
['状态', commissionLabel(t, 'status', row.status)],
['伙伴名称', row.name],
['登录主体', `#${row.user_id}`],
['证件号码', row.identity_no],
['联系人', row.contact_name],
['联系电话', row.contact_phone],
['通知邮箱', row.contact_email],
])}
{section('协议信息', [
['协议编号', row.agreement_no],
[
'协议有效期',
`${date(row.agreement_effective_at)} ~ ${date(row.agreement_expires_at)}`,
],
[
'协议附件',
row.agreement_evidence ? (
<EvidenceLink value={row.agreement_evidence} />
) : null,
],
])}
{section('结算资料', [
['收款账户名', row.receiving_name],
['收款账号', row.receiving_account],
['开户行', row.receiving_bank],
])}
<section className='commission-profile-section'>
<h3>{t('名下客户')}</h3>
<Table
rowKey='id'
size='middle'
scroll={{ x: 'max-content' }}
dataSource={assignments.filter(
(item) => item.partner_id === row.id,
)}
pagination={{ pageSize: 5, size: 'small' }}
columns={[
{
title: t('客户'),
render: (_, item) =>
item.customer_name || `#${item.subject_id}`,
},
{
title: t('类型'),
render: (_, item) =>
commissionLabel(t, 'subjectType', item.subject_type),
},
{
title: t('状态'),
render: (_, item) =>
commissionLabel(t, 'status', item.status),
},
{
title: t('起止时间'),
render: (_, item) =>
`${date(item.started_at)} ~ ${date(item.ended_at)}`,
},
]}
/>
</section>
<section className='commission-profile-section'>
<h3>{t('变更记录')}</h3>
<div className='commission-timeline'>
{audit
.filter(
(item) =>
item.entity_type === 'partner' && item.entity_id === row.id,
)
.map((item) => (
<div key={item.id}>
<strong>
{commissionLabel(t, 'operation', item.action)}
</strong>
<p>
{date(item.created_at)} · {t('操作人')}{' '}
{commissionActorName(t, item)}
</p>
</div>
))}
{!audit.some(
(item) =>
item.entity_type === 'partner' && item.entity_id === row.id,
) && <p className='commission-muted'>{t('暂无操作记录')}</p>}
</div>
</section>
</>
)}
</Drawer>
);
}