feat(fulfillment): 接收并展示 order_site 客户主页截图

- 履约任务新增客户角色/平台/系统/主页截图/更新时间字段
- 迁移 0131
- order_site contractVersion=3 快照自动落客户资料
- 增加客户资料 integration 写入接口
- 工作台详情展示客户资料、平台角色比对和截图
- 补充客户资料保存/快照解析测试与对接文档
This commit is contained in:
yml
2026-11-24 21:25:14 +08:00
parent 06a226f51f
commit 6ec8248068
14 changed files with 531 additions and 2 deletions
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import { Alert, Button, Card, Col, DatePicker, Descriptions, Drawer, Empty, Input, InputNumber, Modal, QRCode, Row, Segmented, Select, Space, Switch, Table, Tag, Timeline, Typography } from 'antd';
import { Alert, Button, Card, Col, DatePicker, Descriptions, Drawer, Empty, Image, Input, InputNumber, Modal, QRCode, Row, Segmented, Select, Space, Switch, Table, Tag, Timeline, Typography } from 'antd';
import { CheckCircleOutlined, CopyOutlined, CreditCardOutlined, DownloadOutlined, GiftOutlined, LinkOutlined, QrcodeOutlined, ReloadOutlined, SettingOutlined, ShoppingOutlined, SyncOutlined, UndoOutlined, UserSwitchOutlined } from '@ant-design/icons';
import type { ColumnsType } from 'antd/es/table';
import { douyuApi, platformFulfillmentApi } from '../api/modules';
@@ -18,6 +18,22 @@ import { usePermissions } from '../hooks/usePermissions';
const { Text, Title } = Typography;
const CUSTOMER_PLATFORM_LABELS: Record<string, string> = {
wechat: '微信',
qq: 'QQ',
};
const CUSTOMER_SYSTEM_LABELS: Record<string, string> = {
ios: '苹果',
android: '安卓',
};
function customerMatchTone(profile: NonNullable<PlatformFulfillmentTask['customerProfile']>) {
if (profile.roleMatched === false || profile.channelMatched === false) return 'red';
if (profile.roleMatched === true && profile.channelMatched === true) return 'green';
return 'gold';
}
const STATUS_OPTIONS = [
{ value: '', label: '全部' },
{ value: 'pending_mapping', label: '待映射' },
@@ -1798,6 +1814,65 @@ export default function PlatformFulfillmentPage() {
</Descriptions>
</Card>
<Card size="small" title="用户资料(order_site)">
{selected.customerProfile ? (
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Descriptions bordered size="small" column={2}>
<Descriptions.Item label="客户角色" span={2}>
{selected.customerProfile.roleName || '未填写'}
</Descriptions.Item>
<Descriptions.Item label="登录方式">
{CUSTOMER_PLATFORM_LABELS[selected.customerProfile.platform] || selected.customerProfile.platform || '-'}
</Descriptions.Item>
<Descriptions.Item label="系统">
{CUSTOMER_SYSTEM_LABELS[selected.customerProfile.system] || selected.customerProfile.system || '-'}
</Descriptions.Item>
<Descriptions.Item label="平台当前角色">
{selected.customerProfile.platformRoleName || '未识别'}
</Descriptions.Item>
<Descriptions.Item label="平台渠道">
{selected.customerProfile.platformChannel || '-'}
</Descriptions.Item>
<Descriptions.Item label="绑定比对" span={2}>
<Space wrap size={6}>
<Tag color={customerMatchTone(selected.customerProfile)}>
{selected.customerProfile.message}
</Tag>
{selected.customerProfile.updatedAt ? (
<Text type="secondary">更新 {formatTime(selected.customerProfile.updatedAt)}</Text>
) : null}
</Space>
</Descriptions.Item>
</Descriptions>
{selected.customerProfile.homeImages.length ? (
<Image.PreviewGroup
items={selected.customerProfile.homeImages.map((item) => item.url)}
>
<Space wrap size={8}>
{selected.customerProfile.homeImages.map((item, index) => (
<Image
key={`${item.objectKey || item.url}-${index}`}
src={item.thumbnailUrl || item.url}
width={96}
height={96}
style={{ objectFit: 'cover', borderRadius: 6 }}
alt={`客户主页截图 ${index + 1}`}
/>
))}
</Space>
</Image.PreviewGroup>
) : (
<Text type="secondary">没有主页截图</Text>
)}
</Space>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="客户尚未同步资料和主页截图"
/>
)}
</Card>
<Card size="small" title="账号实时状态">
{selected.account ? (
<Descriptions bordered size="small" column={2}>