Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ujia
/
uj-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0290019e
authored
Nov 12, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增线索详情页面及相关 API,优化线索管理功能
1 parent
f1bacc72
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
515 additions
and
2 deletions
apps/web/subapps/usedcar/src/App.tsx
apps/web/subapps/usedcar/src/api/index.ts
apps/web/subapps/usedcar/src/api/modules/leads.ts
apps/web/subapps/usedcar/src/pages/Leads/LeadDetail.tsx
apps/web/subapps/usedcar/src/pages/Leads/index.tsx
apps/web/subapps/usedcar/src/pages/Leads/leads.css
apps/web/subapps/usedcar/src/pages/Leads/navigate.ts
apps/web/subapps/usedcar/src/App.tsx
View file @
0290019
...
@@ -4,6 +4,7 @@ import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platf
...
@@ -4,6 +4,7 @@ import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platf
import { UEmpty } from '@uj/ui';
import { UEmpty } from '@uj/ui';
import Dashboard from './pages/Dashboard';
import Dashboard from './pages/Dashboard';
import Leads from './pages/Leads';
import Leads from './pages/Leads';
import LeadDetail from './pages/Leads/LeadDetail';
import Assessment from './pages/Assessment';
import Assessment from './pages/Assessment';
import Operation from './pages/Operation';
import Operation from './pages/Operation';
import Vehicles from './pages/Vehicles';
import Vehicles from './pages/Vehicles';
...
@@ -25,6 +26,7 @@ import { matchRoute } from './routes';
...
@@ -25,6 +26,7 @@ import { matchRoute } from './routes';
const ROUTES: RouteDef[] = [
const ROUTES: RouteDef[] = [
{ path: 'dashboard', Page: Dashboard },
{ path: 'dashboard', Page: Dashboard },
{ path: 'leads', Page: Leads },
{ path: 'leads', Page: Leads },
{ path: 'leads/:id', Page: LeadDetail },
{ path: 'assessment', Page: Assessment },
{ path: 'assessment', Page: Assessment },
{ path: 'operation', Page: Operation },
{ path: 'operation', Page: Operation },
{ path: 'vehicles', Page: Vehicles },
{ path: 'vehicles', Page: Vehicles },
...
...
apps/web/subapps/usedcar/src/api/index.ts
View file @
0290019
...
@@ -6,3 +6,4 @@
...
@@ -6,3 +6,4 @@
* 后续接入接口时,按 system / store / points 的写法把模块挂到这里即可。
* 后续接入接口时,按 system / store / points 的写法把模块挂到这里即可。
*/
*/
export
*
from
'./modules/dashboard'
;
export
*
from
'./modules/dashboard'
;
export
*
from
'./modules/leads'
;
apps/web/subapps/usedcar/src/api/modules/leads.ts
0 → 100644
View file @
0290019
import
{
ApiClient
}
from
'../core/client'
;
export
interface
LeadRow
{
id
:
string
|
number
;
cluesNo
?:
string
;
enterTime
?:
string
;
sellerMerchantName
?:
string
;
sellerName
?:
string
;
carOwnerName
?:
string
;
carOwnerPhone
?:
string
;
carBrand
?:
string
;
carChildsBrandName
?:
string
;
carSeriesName
?:
string
;
carTypeName
?:
string
;
customerIntentLevel
?:
string
;
cluesStatus
?:
number
;
followTimeStatus
?:
number
;
followRecordList
?:
Array
<
Record
<
string
,
unknown
>>
;
latestFollowTime
?:
string
;
nextFollowTime
?:
string
;
enterType
?:
number
|
string
;
conversionName
?:
string
;
}
export
interface
LeadPage
{
records
:
LeadRow
[];
total
:
number
;
currentPage
?:
number
;
pageSize
?:
number
;
}
export
interface
LeadSearchParams
extends
Record
<
string
,
unknown
>
{
currentPage
:
number
;
pageSize
:
number
;
}
export
interface
LeadPageRequest
extends
Record
<
string
,
unknown
>
{
currentPage
:
number
;
pageSize
:
number
;
t
:
Record
<
string
,
unknown
>
;
}
export
interface
Merchant
{
sellerMerchantId
:
string
;
sellerMerchantName
:
string
;
}
export
interface
LeadDetail
extends
LeadRow
{
remark
?:
string
;
evaluateBrandModel
?:
string
;
}
export
interface
FollowRecord
extends
Record
<
string
,
unknown
>
{
createdDate
?:
string
;
followRecordType
?:
number
;
followUserName
?:
string
;
followStyle
?:
number
;
followResult
?:
number
;
}
export
interface
OperationLog
{
opTime
?:
string
;
opUserName
?:
string
;
opType
?:
number
;
opContent
?:
string
;
}
class
LeadsApi
extends
ApiClient
{
page
(
params
:
LeadPageRequest
)
{
return
this
.
post
<
LeadPage
>
(
'/clues/page'
,
params
);
}
merchants
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
{
records
:
Merchant
[]
}
>
(
'/clues/merchantPage'
,
params
);
}
statusCount
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
Record
<
string
,
number
>>
(
'/clues/statusCount'
,
params
);
}
followTimeStatusCount
()
{
return
this
.
post
<
{
nearlyExpiredCount
?:
number
;
expiredCount
?:
number
}
>
(
'/clues/followTimeStatusCount'
);
}
detail
(
id
:
string
)
{
return
this
.
post
<
LeadDetail
>
(
'/clues/detail'
,
{
id
});
}
followRecords
(
id
:
string
)
{
return
this
.
post
<
FollowRecord
[]
>
(
'/clues/followRecord/list'
,
{
cluesId
:
id
});
}
operationLogs
(
id
:
string
)
{
return
this
.
post
<
OperationLog
[]
>
(
'/clues/operationLog/list'
,
{
cluesId
:
id
});
}
exportAsync
(
params
:
LeadSearchParams
)
{
return
this
.
post
<
unknown
>
(
'/clues/exportAsync'
,
params
);
}
}
export
const
leadsApi
=
new
LeadsApi
();
apps/web/subapps/usedcar/src/pages/Leads/LeadDetail.tsx
0 → 100644
View file @
0290019
import { useQuery } from '@tanstack/react-query';
import { UAlert, UButton, UCard, UDescriptions, UEmpty, UResult, UTable, UTag } from '@uj/ui';
import { PageShell } from '@/components';
import { useAccess } from '@/access';
import { leadsApi, type FollowRecord, type LeadDetail, type OperationLog } from '@/api';
import { UC } from '@/permissions/codes';
import type { PageParams } from '@/routes';
import { goLeads } from './navigate';
import './leads.css';
const levelDescription: Record<string, string> = { O: '客情回复,确认交车时间', H: '1日内跟进', A: '2日内跟进', B: '5天内跟进', C: '10天跟进', D: '20天跟进' };
const followStyle: Record<number, string> = { 1: '电话', 2: '微信', 3: '到店', 4: '上门', 5: '短信', 6: '其他' };
const followResult: Record<number, string> = { 1: '邀约验车', 2: '客户考虑中', 3: '不卖旧车', 4: '还在考虑收购价', 5: '还没定新车', 6: '成功收车', 7: '其他' };
const displacement: Record<number, string> = { 1: '收车置换', 2: '不收车置换', 3: '未确定' };
const detection: Record<number, string> = { 1: '到店', 2: '远程', 3: '第三方', 4: '上门' };
const failReason: Record<number, string> = { 1: '客户自行处理', 2: '家人不同意', 3: '客户决定增购', 4: '旧车已处置', 5: '其他' };
const operationType: Record<number, string> = { 1: '创建线索', 2: '新增跟进', 3: '状态变更', 4: '意向等级变更' };
const statusText: Record<string, string> = { '1': '待跟进', '2': '跟进中', '3': '暂败', '4': '成功收车' };
function display(value: unknown): string { return value === undefined || value === null || value === '' ? '-' : String(value); }
function model(detail: LeadDetail): string { return [detail.carBrand, detail.carChildsBrandName, detail.carSeriesName, detail.carTypeName].filter(Boolean).join('-') || '-'; }
function FollowItem({ item }: { item: FollowRecord }) {
const result = Number(item.followResult);
const rows: Array<[string, unknown]> = [
['跟进人', item.followUserName], ['跟进方式', followStyle[Number(item.followStyle)]], ['跟进结果', followResult[result]],
...(result === 1 ? [['置换类型', displacement[Number(item.displacementType)]], ['检测方式', detection[Number(item.detectionMode)]]] as Array<[string, unknown]> : []),
...(result === 3 ? [['暂败原因', failReason[Number(item.failReason)]]] as Array<[string, unknown]> : []),
['意向等级', item.customerIntentLevelChange], ['下一次跟进时间', item.nextFollowTime], ['跟进内容', item.followRemark],
];
return <div className="uc-lead-follow__item"><div className="uc-lead-follow__head"><b>{Number(item.followRecordType) === 2 ? '24小时内跟进线索' : '跟进线索'}</b><span>{display(item.createdDate)}</span></div><div className="uc-lead-follow__body">{rows.map(([label, value]) => <span key={label}>{label}:<b>{display(value)}</b></span>)}</div></div>;
}
/** 线索详情为独立路由页面:/usedcar/leads/:id。 */
export default function LeadDetail({ params }: { params: PageParams }) {
const { canPoint } = useAccess();
const allowed = canPoint(UC.LEAD_DETAIL);
const id = params.id;
const detail = useQuery({ queryKey: ['usedcar', 'lead', id], queryFn: () => leadsApi.detail(id), enabled: allowed && Boolean(id) });
const follows = useQuery({ queryKey: ['usedcar', 'lead', id, 'follows'], queryFn: () => leadsApi.followRecords(id), enabled: allowed && Boolean(id) });
const logs = useQuery({ queryKey: ['usedcar', 'lead', id, 'logs'], queryFn: () => leadsApi.operationLogs(id), enabled: allowed && Boolean(id) });
if (!allowed) return <UResult status="403" title="无查看线索详情的权限" subTitle="请联系管理员开通“查看详情”权限。" />;
if (!id) return <UResult status="404" title="未找到线索" subTitle="详情地址缺少线索编号。" />;
const data: LeadDetail = detail.data ?? { id };
const status = String(data.cluesStatus ?? '');
const followStatus = Number(data.followTimeStatus);
return <PageShell title="线索详情" description="查看线索基础信息、跟进记录和操作日志。" onBack={goLeads}>
{detail.isError ? <UAlert type="error" showIcon title="线索详情加载失败" action={<UButton type="link" onClick={() => void detail.refetch()}>重试</UButton>} /> : null}
<div className="uc-lead-detail">
<div className="uc-lead-detail__top">
<UCard><h3 className="uc-lead-detail__title">基础信息 {status ? <UTag color={status === '2' ? 'green' : status === '3' ? 'red' : status === '4' ? 'purple' : 'blue'}>{statusText[status]}</UTag> : null} {followStatus ? <UTag color={followStatus === 1 ? 'orange' : 'red'}>{followStatus === 1 ? '临期' : '已超期'}</UTag> : null}</h3>
<UDescriptions column={2} size="small">
<UDescriptions.Item label="线索 ID">{display(data.cluesNo)}</UDescriptions.Item><UDescriptions.Item label="录入时间">{display(data.enterTime)}</UDescriptions.Item>
<UDescriptions.Item label="线索门店">{display(data.sellerMerchantName)}</UDescriptions.Item><UDescriptions.Item label="推荐销售顾问">{display(data.sellerName)}</UDescriptions.Item>
<UDescriptions.Item label="车主姓名">{display(data.carOwnerName)}</UDescriptions.Item><UDescriptions.Item label="车主电话">{display(data.carOwnerPhone)}</UDescriptions.Item>
<UDescriptions.Item label="评估品牌车型" span={2}>{model(data)}</UDescriptions.Item><UDescriptions.Item label="最近跟进时间">{display(data.latestFollowTime)}</UDescriptions.Item><UDescriptions.Item label="下一次跟进时间">{display(data.nextFollowTime)}</UDescriptions.Item>
</UDescriptions>
</UCard>
<div><UCard><h3 className="uc-lead-detail__title">客户意向等级</h3><p><strong>{display(data.customerIntentLevel)}级</strong>{' '}{levelDescription[String(data.customerIntentLevel)] ?? '-'}</p><p>下一次跟进时间:{display(data.nextFollowTime)}</p></UCard><UCard style={{ marginTop: 16 }}><h3 className="uc-lead-detail__title">备注说明</h3><p>{display(data.remark === undefined ? '暂无备注' : data.remark)}</p></UCard></div>
</div>
<UCard><h3 className="uc-lead-detail__title">跟进记录(共 {follows.data?.length ?? 0} 条,时间倒序)</h3>{follows.isError ? <UAlert type="error" showIcon title="跟进记录加载失败" /> : follows.data?.length ? <div className="uc-lead-follow">{follows.data.map((item, index) => <FollowItem item={item} key={`${item.createdDate ?? ''}-${index}`} />)}</div> : <UEmpty description="暂无跟进记录" />}</UCard>
<UCard><h3 className="uc-lead-detail__title">操作日志</h3>{logs.isError ? <UAlert type="error" showIcon title="操作日志加载失败" /> : <UTable<OperationLog> rowKey={(_, index) => String(index)} pagination={false} dataSource={logs.data ?? []} columns={[{ title: '操作时间', dataIndex: 'opTime', render: display }, { title: '操作人', dataIndex: 'opUserName', render: display }, { title: '操作类型', dataIndex: 'opType', render: (value) => operationType[Number(value)] ?? '-' }, { title: '操作内容', dataIndex: 'opContent', render: display }]} />}</UCard>
</div>
</PageShell>;
}
apps/web/subapps/usedcar/src/pages/Leads/index.tsx
View file @
0290019
import { RoutePlaceholder } from '@/features/shared/RoutePlaceholder';
import { useMemo, useState } from 'react';
import { useQuery } from '@tanstack/react-query';
import type { Dayjs } from 'dayjs';
import { UAlert, UButton, UCard, UResult, UTag, UTabs, tabLabel } from '@uj/ui';
import {
DataTable,
PageShell,
SearchForm,
type FieldSchema,
type RowActionSchema,
} from '@/components';
import { useAccess } from '@/access';
import { leadsApi, type LeadRow, type LeadSearchParams } from '@/api';
import { UC } from '@/permissions/codes';
import { goTo } from './navigate';
import './leads.css';
type Filters = {
cluesNo?: string;
carOwnerName?: string;
carOwnerPhone?: string;
sellerMerchantIdList?: string[];
sellerName?: string;
customerIntentLevelList?: string[];
followTimeStatusList?: string[];
createTimeRange?: [Dayjs, Dayjs];
lastFollowUpTimeRange?: [Dayjs, Dayjs];
conversionName?: string;
enterType?: string;
carModel?: string;
};
const STATUS_TABS = [
{ key: '', label: '全部', countKey: 'totalCount' },
{ key: '1', label: '待跟进', countKey: 'pendingFollowCount' },
{ key: '2', label: '跟进中', countKey: 'followingCount' },
{ key: '3', label: '暂败', countKey: 'tempLostCount' },
{ key: '4', label: '成功收车', countKey: 'successCount' },
] as const;
const LEVELS = ['O', 'H', 'A', 'B', 'C', 'D'].map((value) => ({ value, label: `${value}级` }));
const FOLLOW_STATUS = [
{ value: '1', label: '临期' },
{ value: '2', label: '已超期' },
{ value: '0', label: '正常' },
];
const levelDescription: Record<string, string> = {
O: '客情回复,确认交车时间',
H: '1日内跟进',
A: '2日内跟进',
B: '5天内跟进',
C: '10天内跟进',
D: '20天跟进',
};
const statusText: Record<string, string> = {
'1': '待跟进',
'2': '跟进中',
'3': '暂败',
'4': '成功收车',
};
function omitEmpty(params: Record<string, unknown>): Record<string, unknown> {
return Object.fromEntries(
Object.entries(params).filter(
([, value]) => value !== undefined && value !== '' && (!Array.isArray(value) || value.length),
),
);
}
function toFilters(filters: Filters, status: string): Record<string, unknown> {
const { createTimeRange, lastFollowUpTimeRange, ...rest } = filters;
return {
...omitEmpty(rest),
...(status ? { cluesStatusList: [status] } : {}),
...(createTimeRange
? {
enterTimeStart: createTimeRange[0].format('YYYY-MM-DD 00:00:00'),
enterTimeEnd: createTimeRange[1].format('YYYY-MM-DD 23:59:59'),
}
: {}),
...(lastFollowUpTimeRange
? {
latestFollowTimeStart: lastFollowUpTimeRange[0].format('YYYY-MM-DD 00:00:00'),
latestFollowTimeEnd: lastFollowUpTimeRange[1].format('YYYY-MM-DD 23:59:59'),
}
: {}),
};
}
function toParams(
filters: Filters,
status: string,
currentPage: number,
pageSize: number,
): LeadSearchParams {
return { ...toFilters(filters, status), currentPage, pageSize } as LeadSearchParams;
}
/** menu_code 1002602 · 线索管理 · usedcar:lead:view */
/** menu_code 1002602 · 线索管理 · usedcar:lead:view */
export default function Leads() {
export default function Leads() {
return <RoutePlaceholder title="线索管理" route="/usedcar/leads" />;
const { canPoint } = useAccess();
const allowed = canPoint(UC.LEAD_VIEW);
const [filters, setFilters] = useState<Filters>({});
const [status, setStatus] = useState<string>('');
const [page, setPage] = useState({ current: 1, size: 10 });
const merchants = useQuery({
queryKey: ['usedcar', 'leads', 'merchants'],
queryFn: () => leadsApi.merchants({ currentPage: 1, pageSize: 9999 }),
enabled: allowed,
});
const params = useMemo(
() => toParams(filters, status, page.current, page.size),
[filters, status, page],
);
const list = useQuery({
queryKey: ['usedcar', 'leads', 'page', params],
queryFn: () =>
leadsApi.page({
currentPage: page.current,
pageSize: page.size,
t: toFilters(filters, status),
}),
enabled: allowed,
});
const counts = useQuery({
queryKey: ['usedcar', 'leads', 'counts', filters],
queryFn: () => leadsApi.statusCount(toFilters(filters, '')),
enabled: allowed,
});
const reminders = useQuery({
queryKey: ['usedcar', 'leads', 'reminders'],
queryFn: () => leadsApi.followTimeStatusCount(),
enabled: allowed,
});
const fields = useMemo<FieldSchema<Filters>[]>(
() => [
{
name: 'cluesNo',
label: '线索 ID',
type: 'input',
placeholder: '请输入线索 ID',
essential: true,
},
{
name: 'carOwnerName',
label: '车主姓名',
type: 'input',
placeholder: '请输入车主姓名',
essential: true,
},
{
name: 'carOwnerPhone',
label: '车主电话',
type: 'input',
placeholder: '请输入车主电话',
essential: true,
},
{
name: 'sellerMerchantIdList',
label: '线索门店',
type: 'selectMultiple',
options: (merchants.data?.records ?? []).map((item) => ({
value: item.sellerMerchantId,
label: item.sellerMerchantName,
})),
essential: true,
},
{ name: 'sellerName', label: '销售顾问', type: 'input', placeholder: '请输入推荐销售顾问' },
{
name: 'customerIntentLevelList',
label: '意向等级',
type: 'selectMultiple',
options: LEVELS,
},
{
name: 'followTimeStatusList',
label: '跟进提示',
type: 'selectMultiple',
options: FOLLOW_STATUS,
},
{ name: 'createTimeRange', label: '创建时间', type: 'dateRange' },
{ name: 'lastFollowUpTimeRange', label: '最后跟进时间', type: 'dateRange' },
{ name: 'conversionName', label: '评估师', type: 'input', placeholder: '请输入评估师姓名' },
{
name: 'enterType',
label: '录线索人员',
type: 'select',
options: [
{ value: '1', label: '销售' },
{ value: '2', label: '评估师' },
],
},
{
name: 'carModel',
label: '评估品牌车型',
type: 'input',
placeholder: '请输入品牌车型关键词',
},
],
[merchants.data?.records],
);
if (!allowed)
return (
<UResult status="403" title="无访问线索管理的权限" subTitle="请联系管理员开通访问权限。" />
);
const columns = [
{ title: '线索 ID', dataIndex: 'cluesNo', width: 180, render: (v: unknown) => v || '-' },
{ title: '录入时间', dataIndex: 'enterTime', width: 165, render: (v: unknown) => v || '-' },
{
title: '线索门店',
dataIndex: 'sellerMerchantName',
width: 160,
render: (v: unknown) => v || '-',
},
{
title: '推荐销售顾问',
dataIndex: 'sellerName',
width: 130,
render: (v: unknown) => v || '-',
},
{ title: '车主姓名', dataIndex: 'carOwnerName', width: 110, render: (v: unknown) => v || '-' },
{ title: '车主电话', dataIndex: 'carOwnerPhone', width: 130, render: (v: unknown) => v || '-' },
{
title: '评估品牌车型',
key: 'model',
width: 210,
render: (_: unknown, row: LeadRow) =>
[row.carBrand, row.carChildsBrandName, row.carSeriesName, row.carTypeName]
.filter(Boolean)
.join('-') || '-',
},
{
title: '意向等级',
dataIndex: 'customerIntentLevel',
width: 190,
render: (value: unknown) =>
value ? (
<span className={`uc-lead-level uc-lead-level--${String(value).toLowerCase()}`}>
<b>{String(value)}</b>
{levelDescription[String(value)]}
</span>
) : (
'-'
),
},
{
title: '线索状态',
dataIndex: 'cluesStatus',
width: 110,
render: (value: unknown) => (
<UTag color={value === 2 ? 'green' : value === 3 ? 'red' : value === 4 ? 'purple' : 'blue'}>
{statusText[String(value)] ?? '-'}
</UTag>
),
},
{
title: '跟进状态',
dataIndex: 'followTimeStatus',
width: 110,
render: (value: unknown) =>
value === 1 ? (
<UTag color="orange">临期</UTag>
) : value === 2 ? (
<UTag color="red">已超期</UTag>
) : (
'-'
),
},
{
title: '跟进内容',
dataIndex: 'followRecordList',
width: 220,
line: 2,
render: (value: unknown) => {
const first = Array.isArray(value) ? (value[0] as Record<string, unknown>) : undefined;
return first
? `${followResultText(first.followResult)}${first.followRemark ? `:${String(first.followRemark)}` : ''}`
: '-';
},
},
{
title: '最后跟进时间',
dataIndex: 'latestFollowTime',
width: 165,
render: (v: unknown) => v || '-',
},
{
title: '下一次跟进时间',
dataIndex: 'nextFollowTime',
width: 165,
render: (v: unknown) => v || '-',
},
{
title: '录线索人员',
dataIndex: 'enterType',
width: 120,
render: (v: unknown) => (String(v) === '1' ? '销售' : String(v) === '2' ? '评估师' : '-'),
},
{ title: '评估师', dataIndex: 'conversionName', width: 120, render: (v: unknown) => v || '-' },
];
const rowActions: RowActionSchema<LeadRow>[] = [
{
label: '查看详情',
permission: UC.LEAD_DETAIL,
visible: (row) => Boolean(row.id),
onClick: (row) => goTo(`leads/${encodeURIComponent(String(row.id))}`),
},
];
return (
<PageShell
fill
title="线索管理"
actions={
canPoint(UC.LEAD_EXPORT) ? (
<UButton
onClick={() => void leadsApi.exportAsync(toParams(filters, status, 1, page.size))}
>
导出
</UButton>
) : null
}
>
{reminders.data?.nearlyExpiredCount || reminders.data?.expiredCount ? (
<div className="uc-lead-reminder">
{reminders.data.nearlyExpiredCount ? (
<span> {reminders.data.nearlyExpiredCount} 条临期</span>
) : null}
{reminders.data?.nearlyExpiredCount && reminders.data?.expiredCount ? ' · ' : null}
{reminders.data?.expiredCount ? (
<strong>{reminders.data.expiredCount} 条超期</strong>
) : null}
</div>
) : null}
<UCard className="uj-filter-card" size="small">
<SearchForm
fields={fields}
initialValues={{}}
onSearch={(value) => {
setFilters(value);
setPage((old) => ({ ...old, current: 1 }));
}}
onReset={() => {
setFilters({});
setPage((old) => ({ ...old, current: 1 }));
}}
/>
</UCard>
<UTabs
activeKey={status}
onChange={(key) => {
setStatus(String(key));
setPage((old) => ({ ...old, current: 1 }));
}}
items={STATUS_TABS.map((item) => ({
key: item.key,
label: tabLabel(item.label, {
count: counts.isFetching ? '…' : Number(counts.data?.[item.countKey] ?? 0),
}),
}))}
/>
{list.isError ? (
<UAlert
type="error"
showIcon
title="线索列表加载失败"
action={
<UButton type="link" onClick={() => void list.refetch()}>
重试
</UButton>
}
/>
) : null}
<UCard size="small" fill>
<DataTable<LeadRow>
rowKey="id"
fillHeight
columns={columns}
dataSource={list.data?.records ?? []}
loading={list.isPending || list.isFetching}
rowActions={rowActions}
actionColumnWidth={100}
toolbarTitle={`共 ${list.data?.total ?? 0} 条线索`}
pagination={{
current: page.current,
pageSize: page.size,
total: list.data?.total ?? 0,
onChange: (current, size) =>
setPage({ current: size === page.size ? current : 1, size }),
showTotal: (total) => `共 ${total} 条`,
}}
/>
</UCard>
</PageShell>
);
}
function followResultText(value: unknown): string {
return (
(
{
1: '邀约验车',
2: '客户考虑中',
3: '不卖旧车',
4: '还在考虑收购价',
5: '还没定新车',
6: '成功收车',
7: '其他',
} as Record<number, string>
)[Number(value)] ?? '其他'
);
}
}
apps/web/subapps/usedcar/src/pages/Leads/leads.css
0 → 100644
View file @
0290019
.uc-lead-reminder
{
margin
:
0
0
12px
;
color
:
#d48806
;
}
.uc-lead-reminder
strong
{
color
:
#cf1322
;
font-weight
:
500
;
}
.uc-lead-level
{
display
:
inline-flex
;
align-items
:
center
;
gap
:
7px
;
}
.uc-lead-level
b
{
display
:
inline-grid
;
place-items
:
center
;
width
:
22px
;
height
:
22px
;
border-radius
:
50%
;
color
:
#fff
;
background
:
#8c8c8c
;
}
.uc-lead-level--o
b
{
background
:
#c04dff
;
}
.uc-lead-level--h
b
{
background
:
#f7a900
;
}
.uc-lead-level--a
b
{
background
:
#55b896
;
}
.uc-lead-level--b
b
{
background
:
#5fbdff
;
}
.uc-lead-level--c
b
{
background
:
#54dfff
;
}
.uc-lead-detail
{
display
:
grid
;
gap
:
16px
;
}
.uc-lead-detail__top
{
display
:
grid
;
grid-template-columns
:
minmax
(
0
,
1
fr
)
300px
;
gap
:
16px
;
}
.uc-lead-detail__title
{
margin
:
0
0
14px
;
font-size
:
15px
;
}
.uc-lead-detail__empty
{
padding
:
28px
;
text-align
:
center
;
color
:
var
(
--uj-text-3
);
}
.uc-lead-follow
{
display
:
grid
;
gap
:
12px
;
}
.uc-lead-follow__item
{
border-left
:
2px
solid
#1677ff
;
padding-left
:
14px
;
}
.uc-lead-follow__head
{
display
:
flex
;
justify-content
:
space-between
;
margin-bottom
:
8px
;
}
.uc-lead-follow__body
{
background
:
#f5f7fa
;
padding
:
12px
;
border-radius
:
6px
;
display
:
grid
;
gap
:
6px
;
}
.uc-lead-follow__body
span
{
color
:
var
(
--uj-text-2
);
}
.uc-lead-follow__body
b
{
color
:
var
(
--uj-text-1
);
font-weight
:
400
;
}
@media
(
max-width
:
900px
)
{
.uc-lead-detail__top
{
grid-template-columns
:
1
fr
;
}
}
apps/web/subapps/usedcar/src/pages/Leads/navigate.ts
0 → 100644
View file @
0290019
import
{
shortName
,
subAppProps
}
from
'@uj/platform-sdk'
;
export
function
goTo
(
path
:
string
):
void
{
subAppProps
().
navigate
(
`/
${
shortName
()}
/
${
path
.
replace
(
/^
\/
+|
\/
+$/g
,
''
)}
`
);
}
export
function
goLeads
():
void
{
goTo
(
'leads'
);
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment