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 d8bbbae3
authored
Nov 12, 2026
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v1.0.0' of
http://192.168.3.233:8090/ujia/uj-admin
into v1.0.0
2 parents
19073f69
5710314b
Pipeline
#413
for
d8bbbae3
failed
in 0 seconds
Changes
14
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
686 additions
and
4 deletions
apps/web/subapps/usedcar/src/App.tsx
apps/web/subapps/usedcar/src/api/index.ts
apps/web/subapps/usedcar/src/api/modules/assessment.ts
apps/web/subapps/usedcar/src/api/modules/dashboard.ts
apps/web/subapps/usedcar/src/api/modules/leads.ts
apps/web/subapps/usedcar/src/pages/Assessment/AssessmentDetail.tsx
apps/web/subapps/usedcar/src/pages/Assessment/assessment.css
apps/web/subapps/usedcar/src/pages/Assessment/detailConfig.ts
apps/web/subapps/usedcar/src/pages/Assessment/index.tsx
apps/web/subapps/usedcar/src/pages/Dashboard/index.tsx
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 @
d8bbbae
...
@@ -4,7 +4,9 @@ import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platf
...
@@ -4,7 +4,9 @@ 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 AssessmentDetail from './pages/Assessment/AssessmentDetail';
import Operation from './pages/Operation';
import Operation from './pages/Operation';
import Vehicles from './pages/Vehicles';
import Vehicles from './pages/Vehicles';
import Delivery from './pages/Delivery';
import Delivery from './pages/Delivery';
...
@@ -25,7 +27,9 @@ import { matchRoute } from './routes';
...
@@ -25,7 +27,9 @@ 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: 'assessment/:evalOrderNo', Page: AssessmentDetail },
{ path: 'operation', Page: Operation },
{ path: 'operation', Page: Operation },
{ path: 'vehicles', Page: Vehicles },
{ path: 'vehicles', Page: Vehicles },
{ path: 'delivery', Page: Delivery },
{ path: 'delivery', Page: Delivery },
...
...
apps/web/subapps/usedcar/src/api/index.ts
View file @
d8bbbae
...
@@ -28,3 +28,5 @@ export * from './modules/storeConfig';
...
@@ -28,3 +28,5 @@ export * from './modules/storeConfig';
export
*
from
'./modules/clues'
;
export
*
from
'./modules/clues'
;
export
type
{
UsedcarParams
}
from
'./core/types'
;
export
type
{
UsedcarParams
}
from
'./core/types'
;
export
*
from
'./modules/leads'
;
export
*
from
'./modules/assessment'
;
apps/web/subapps/usedcar/src/api/modules/assessment.ts
0 → 100644
View file @
d8bbbae
import
{
ApiClient
}
from
'../core/client'
;
export
interface
AssessmentRow
{
id
:
string
|
number
;
evalOrderNo
?:
string
;
coverImage
?:
string
;
licensePlate
?:
string
;
vin
?:
string
;
carBrand
?:
string
;
carSeriesName
?:
string
;
carTypeName
?:
string
;
registrationDate
?:
string
;
registrationProvinceName
?:
string
;
registrationCityName
?:
string
;
sellerMerchantName
?:
string
;
sellerName
?:
string
;
conversionName
?:
string
;
buyNewCar
?:
number
;
hasAccident
?:
number
;
status
?:
number
|
string
;
previousOwnerName
?:
string
;
previousOwnerPhone
?:
string
;
evalOrderTime
?:
string
;
evalOperatorName
?:
string
;
source
?:
string
;
contractOrg
?:
string
;
showEvalBtn
?:
boolean
;
showCheckPriceBtn
?:
boolean
;
}
export
interface
AssessmentPage
{
records
:
AssessmentRow
[];
total
:
number
;
}
export
interface
AssessmentDetail
extends
AssessmentRow
{
[
key
:
string
]:
unknown
;
priceHistoryListDTO
?:
Array
<
Record
<
string
,
unknown
>>
;
}
class
AssessmentApi
extends
ApiClient
{
page
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
AssessmentPage
>
(
'/evalOrderManage/getEvalOrderList'
,
params
);
}
detail
(
evalOrderNo
:
string
)
{
return
this
.
post
<
AssessmentDetail
>
(
'/evalOrderManage/getEvalOrderDetail'
,
{
evalOrderNo
});
}
history
(
evalOrderNo
:
string
)
{
return
this
.
post
<
Array
<
Record
<
string
,
unknown
>>>
(
'/evalOrderManage/getEvalOrderPriceHistory'
,
{
evalOrderNo
});
}
exportOrders
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
unknown
>
(
'/evalOrderManage/exportEvalOrderAsync'
,
params
);
}
exportImages
(
evalOrderNo
:
string
)
{
return
this
.
post
<
unknown
>
(
'/evalOrderManage/exportEvalOrderImageZipAsync'
,
{
evalOrderNo
});
}
}
export
const
assessmentApi
=
new
AssessmentApi
();
apps/web/subapps/usedcar/src/api/modules/dashboard.ts
View file @
d8bbbae
...
@@ -6,6 +6,10 @@ class DashboardApi extends ApiClient {
...
@@ -6,6 +6,10 @@ class DashboardApi extends ApiClient {
getdataBoard
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
DashboardStatistics
>
(
'/dataBoard/index'
,
params
);
}
getdataBoard
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
DashboardStatistics
>
(
'/dataBoard/index'
,
params
);
}
getEvaluationData
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
TrendPoint
[]
>
(
'/dataBoard/evaluation'
,
params
);
}
getEvaluationData
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
TrendPoint
[]
>
(
'/dataBoard/evaluation'
,
params
);
}
getDealData
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
TrendPoint
[]
>
(
'/dataBoard/deal'
,
params
);
}
getDealData
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
TrendPoint
[]
>
(
'/dataBoard/deal'
,
params
);
}
getServiceStore
(
params
:
Record
<
string
,
unknown
>
)
{
return
this
.
postRop
<
StoreItem
[]
>
(
'dj.api.scenemerchantref.query4SRefByYqShop'
,
params
);
}
async
getServiceStore
(
params
:
Record
<
string
,
unknown
>
)
{
const
response
=
await
this
.
postRop
<
StoreItem
[]
>
(
'dj.api.scenemerchantref.query4SRefByYqShop'
,
params
);
console
.
log
(
'[usedcar] 门店接口原始返回:'
,
response
);
return
response
;
}
}
}
export
const
dashboardApi
=
new
DashboardApi
();
export
const
dashboardApi
=
new
DashboardApi
();
apps/web/subapps/usedcar/src/api/modules/leads.ts
0 → 100644
View file @
d8bbbae
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/Assessment/AssessmentDetail.tsx
0 → 100644
View file @
d8bbbae
import { useQuery } from '@tanstack/react-query';
import { UAlert, UCard, UEmpty, UForm, UFormItem, UResult } from '@uj/ui';
import { PageShell } from '@/components';
import { useAccess } from '@/access';
import { assessmentApi, type AssessmentDetail as Detail } from '@/api';
import { UC } from '@/permissions/codes';
import type { PageParams } from '@/routes';
import { goTo } from '../Leads/navigate';
import { PRICE_DETAIL_FIELDS, readOnlyValues, VEHICLE_DETAIL_FIELDS } from './detailConfig';
import './assessment.css';
const display = (value: unknown) =>
value === undefined || value === null || value === '' ? '-' : String(value);
const operationName: Record<string, string> = {
'10': '总部定价师估价',
'20': '驻店人员报价反馈',
'30': '驻店人员驳回',
'40': '总部核价',
'50': '总部核价驳回',
};
function files(value: unknown) {
return Array.isArray(value) ? value : [];
}
/** 评估单详情的独立页面:/usedcar/assessment/:evalOrderNo。 */
export default function AssessmentDetail({ params }: { params: PageParams }) {
const { canPoint } = useAccess();
const allowed = canPoint(UC.ASSESS_DETAIL);
const evalOrderNo = params.evalOrderNo;
const detail = useQuery({
queryKey: ['usedcar', 'assessment', evalOrderNo],
queryFn: () => assessmentApi.detail(evalOrderNo),
enabled: allowed && Boolean(evalOrderNo),
});
const history = useQuery({
queryKey: ['usedcar', 'assessment', evalOrderNo, 'history'],
queryFn: () => assessmentApi.history(evalOrderNo),
enabled: allowed && Boolean(evalOrderNo),
});
if (!allowed)
return (
<UResult
status="403"
title="无查看评估单详情的权限"
subTitle="请联系管理员开通“详情”权限。"
/>
);
if (!evalOrderNo)
return <UResult status="404" title="未找到评估单" subTitle="详情地址缺少评估单编号。" />;
const data: Detail = detail.data ?? { id: evalOrderNo, evalOrderNo };
const pricing = Array.isArray(data.priceHistoryListDTO)
? data.priceHistoryListDTO.filter((item) => Number(item.opType) === 10)
: [];
const checks = Array.isArray(data.priceHistoryListDTO)
? data.priceHistoryListDTO.filter((item) => Number(item.opType) === 40)
: [];
return (
<PageShell
title="评估单详情"
description="查看车辆资料、总部估价、核价意见和评估动态。"
onBack={() => goTo('assessment')}
>
{detail.isError ? <UAlert type="error" showIcon title="评估单详情加载失败" /> : null}
<div className="uc-assess-detail">
<UCard>
<h3>车辆信息</h3>
<ReadOnlyForm items={readOnlyValues(VEHICLE_DETAIL_FIELDS, data)} />
</UCard>
<UCard>
<h3>车辆资料</h3>
<div className="uc-assess-files">
{[
['车辆图片', files(data.carImageUrls)],
['证件资料', files(data.documentUrls)],
['车辆视频', files(data.carVideoUrls)],
['检测报告', files(data.carCheckReportUrls)],
['其他图片', files(data.otherImageUrls)],
].map(([label, urls]) => (
<span key={String(label)}>
{String(label)}:
{Array.isArray(urls) && urls.length
? urls.map((url, index) => (
<a key={String(url)} href={String(url)} target="_blank" rel="noreferrer">
文件 {index + 1}{' '}
</a>
))
: '-'}
</span>
))}
</div>
</UCard>
<PriceCard title="总部定价师估价与意见" data={pricing} fallback={data} />
<PriceCard title="核价与意见" data={checks} />
<UCard>
<h3>评估动态</h3>
{history.isError ? (
<UAlert type="error" showIcon title="评估动态加载失败" />
) : history.data?.length ? (
<div className="uc-assess-history">
{history.data.map((item, index) => (
<div
className="uc-assess-history__item"
key={`${String(item.quoteTime ?? '')}-${index}`}
>
<div className="uc-assess-history__head">
<b>
{operationName[String(item.opType)] ?? '评估动态'}:{display(item.createdBy)}
</b>
<span>{display(item.quoteTime)}</span>
</div>
{item.evalPrice !== undefined ? <p>价格:{display(item.evalPrice)} 元</p> : null}
{item.evalOpinion ? <p>意见:{display(item.evalOpinion)}</p> : null}
{item.rejectReason ? <p>驳回原因:{display(item.rejectReason)}</p> : null}
{item.rejectSuggestion ? <p>驳回意见:{display(item.rejectSuggestion)}</p> : null}
{item.customerTargetPrice ? (
<p>意向报价:{display(item.customerTargetPrice)} 元</p>
) : null}
{item.customerTargetPriceFeedback ? (
<p>报价反馈:{display(item.customerTargetPriceFeedback)}</p>
) : null}
</div>
))}
</div>
) : (
<UEmpty description="暂无评估动态" />
)}
</UCard>
</div>
</PageShell>
);
}
function PriceCard({
title,
data,
fallback,
}: {
title: string;
data: Array<Record<string, unknown>>;
fallback?: Detail;
}) {
const items = data.length ? data : fallback ? [fallback] : [];
return (
<UCard>
<h3>{title}</h3>
{items.length ? (
items.map((item, index) => (
<ReadOnlyForm key={index} items={readOnlyValues(PRICE_DETAIL_FIELDS, item)} />
))
) : (
<UEmpty description="暂无信息" />
)}
</UCard>
);
}
function ReadOnlyForm({ items }: { items: Array<[string, string, boolean?]> }) {
return (
<UForm layout="horizontal" colon={false} className="uc-assess-readonly-form">
<div className="uc-assess-readonly-form__grid">
{items.map(([label, value, wide]) => (
<UFormItem
key={label}
label={label}
className={wide ? 'uc-assess-readonly-form__wide' : undefined}
>
<span>{value}</span>
</UFormItem>
))}
</div>
</UForm>
);
}
apps/web/subapps/usedcar/src/pages/Assessment/assessment.css
0 → 100644
View file @
d8bbbae
.uc-assess-cover
{
display
:
block
;
width
:
96px
;
height
:
54px
;
object-fit
:
contain
;
border-radius
:
4px
;
background
:
#f5f5f5
;
}
.uc-assess-detail
{
display
:
grid
;
gap
:
16px
;
}
.uc-assess-detail
h3
{
margin
:
0
0
14px
;
font-size
:
15px
;
}
.uc-assess-history
{
display
:
grid
;
gap
:
12px
;
}
.uc-assess-history__item
{
border-left
:
2px
solid
#1677ff
;
padding-left
:
14px
;
}
.uc-assess-history__head
{
display
:
flex
;
justify-content
:
space-between
;
margin-bottom
:
6px
;
}
.uc-assess-files
{
display
:
flex
;
flex-wrap
:
wrap
;
gap
:
8px
;
}
.uc-assess-files
a
{
color
:
#1677ff
;
}
.uc-assess-readonly-form__grid
{
display
:
grid
;
grid-template-columns
:
repeat
(
2
,
minmax
(
0
,
1
fr
));
column-gap
:
24px
;
}
.uc-assess-readonly-form
.ant-form-item
{
margin-bottom
:
12px
;
}
.uc-assess-readonly-form
.ant-form-item-label
{
min-width
:
132px
;
}
.uc-assess-readonly-form__wide
{
grid-column
:
span
2
;
}
@media
(
max-width
:
760px
)
{
.uc-assess-readonly-form__grid
{
grid-template-columns
:
1
fr
;
}
.uc-assess-readonly-form__wide
{
grid-column
:
auto
;
}
}
apps/web/subapps/usedcar/src/pages/Assessment/detailConfig.ts
0 → 100644
View file @
d8bbbae
import
type
{
AssessmentDetail
}
from
'@/api'
;
export
interface
ReadOnlyField
<
T
>
{
label
:
string
;
wide
?:
boolean
;
value
:
(
data
:
T
)
=>
unknown
;
}
const
empty
=
(
value
:
unknown
):
string
=>
value
===
undefined
||
value
===
null
||
value
===
''
?
'-'
:
String
(
value
);
export
const
VEHICLE_DETAIL_FIELDS
:
ReadOnlyField
<
AssessmentDetail
>
[]
=
[
{
label
:
'车牌号'
,
value
:
(
data
)
=>
data
.
licensePlate
},
{
label
:
'车架号'
,
value
:
(
data
)
=>
data
.
vin
},
{
label
:
'车型'
,
value
:
(
data
)
=>
[
data
.
carBrand
,
data
.
carSeriesName
,
data
.
carTypeName
].
filter
(
Boolean
).
join
(
' '
)
},
{
label
:
'上牌时间'
,
value
:
(
data
)
=>
data
.
registrationDate
},
{
label
:
'上牌城市'
,
value
:
(
data
)
=>
[
data
.
registrationProvinceName
,
data
.
registrationCityName
].
filter
(
Boolean
).
join
(
''
)
},
{
label
:
'表显里程'
,
value
:
(
data
)
=>
data
.
mileageStr
},
{
label
:
'门店'
,
value
:
(
data
)
=>
data
.
sellerMerchantName
},
{
label
:
'销售顾问'
,
value
:
(
data
)
=>
data
.
sellerName
},
{
label
:
'驻店人员'
,
value
:
(
data
)
=>
data
.
conversionName
},
{
label
:
'评估单状态'
,
value
:
(
data
)
=>
data
.
status
},
{
label
:
'车主姓名'
,
value
:
(
data
)
=>
data
.
previousOwnerName
},
{
label
:
'车主联系方式'
,
value
:
(
data
)
=>
data
.
previousOwnerPhone
},
{
label
:
'评估单下单时间'
,
value
:
(
data
)
=>
data
.
evalOrderTime
},
{
label
:
'评估单编号'
,
value
:
(
data
)
=>
data
.
evalOrderNo
},
{
label
:
'综合评价'
,
value
:
(
data
)
=>
({
1
:
'优'
,
2
:
'良'
,
3
:
'中'
,
4
:
'差'
}
as
Record
<
number
,
string
>
)[
Number
(
data
.
overallRating
)]
},
{
label
:
'车况描述'
,
wide
:
true
,
value
:
(
data
)
=>
data
.
conditionDescription
},
];
export
const
PRICE_DETAIL_FIELDS
:
ReadOnlyField
<
Record
<
string
,
unknown
>>
[]
=
[
{
label
:
'评估价'
,
value
:
(
data
)
=>
data
.
evalPrice
===
undefined
?
'-'
:
`
${
String
(
data
.
evalPrice
)}
元`
},
{
label
:
'总部定价师'
,
value
:
(
data
)
=>
data
.
createdBy
},
{
label
:
'评估意见'
,
value
:
(
data
)
=>
data
.
evalOpinion
},
];
export
function
readOnlyValues
<
T
>
(
fields
:
ReadOnlyField
<
T
>
[],
data
:
T
):
Array
<
[
string
,
string
,
boolean
?]
>
{
return
fields
.
map
((
field
)
=>
[
field
.
label
,
empty
(
field
.
value
(
data
)),
field
.
wide
]);
}
apps/web/subapps/usedcar/src/pages/Assessment/index.tsx
View file @
d8bbbae
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, useUMessage } from '@uj/ui';
import {
DataTable,
PageShell,
SearchForm,
type FieldSchema,
type RowActionSchema,
} from '@/components';
import { useAccess } from '@/access';
import { assessmentApi, type AssessmentRow } from '@/api';
import { UC } from '@/permissions/codes';
import { goTo } from '../Leads/navigate';
import './assessment.css';
type Filters = {
licensePlate?: string;
vin?: string;
carTypeName?: string;
registrationDate?: [Dayjs, Dayjs];
registrationCityName?: string;
sellerName?: string;
conversionName?: string;
buyNewCar?: string;
hasAccident?: string;
status?: string;
previousOwnerName?: string;
previousOwnerPhone?: string;
sellerMerchantName?: string;
evalOrderTime?: [Dayjs, Dayjs];
evalOrderNo?: string;
evalOperatorName?: string;
source?: string;
contractOrg?: string;
usageType?: string;
ownerType?: string;
vehicleCategory?: string;
};
const yesNo = [
{ value: '1', label: '是' },
{ value: '0', label: '否' },
];
const statusMap: Record<string, string> = {
'1': '待评估',
'2': '评估中',
'3': '已评估',
'4': '已核价',
'5': '已完成',
};
function filtersToParams(filters: Filters): Record<string, unknown> {
const { registrationDate, evalOrderTime, ...rest } = filters;
return Object.fromEntries(
Object.entries({
...rest,
...(registrationDate
? {
registrationStartDate: registrationDate[0].format('YYYY-MM-DD'),
registrationEndDate: registrationDate[1].format('YYYY-MM-DD'),
}
: {}),
...(evalOrderTime
? {
evalOrderStartTime: evalOrderTime[0].format('YYYY-MM-DD HH:mm:ss'),
evalOrderEndTime: evalOrderTime[1].format('YYYY-MM-DD HH:mm:ss'),
}
: {}),
}).filter(([, value]) => value !== '' && value !== undefined),
);
}
/** menu_code 1002603 · 评估管理 · usedcar:assess:view */
/** menu_code 1002603 · 评估管理 · usedcar:assess:view */
export default function Assessment() {
export default function Assessment() {
return <RoutePlaceholder title="评估管理" route="/usedcar/assessment" />;
const { canPoint } = useAccess();
const message = useUMessage();
const allowed = canPoint(UC.ASSESS_VIEW);
const [filters, setFilters] = useState<Filters>({});
const [page, setPage] = useState({ current: 1, size: 10 });
const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
const params = useMemo(() => filtersToParams(filters), [filters]);
const list = useQuery({
queryKey: ['usedcar', 'assessment', params, page],
queryFn: () =>
assessmentApi.page({ currentPage: page.current, pageSize: page.size, t: params }),
enabled: allowed,
});
const fields: FieldSchema<Filters>[] = [
{ name: 'licensePlate', label: '车牌号', type: 'input', essential: true },
{ name: 'vin', label: '车架号', type: 'input', essential: true },
{ name: 'carTypeName', label: '车型', type: 'input', essential: true },
{ name: 'evalOrderNo', label: '评估单编号', type: 'input', essential: true },
{ name: 'registrationDate', label: '上牌时间', type: 'dateRange' },
{ name: 'registrationCityName', label: '上牌城市', type: 'input' },
{ name: 'sellerMerchantName', label: '门店', type: 'input' },
{ name: 'sellerName', label: '销售顾问', type: 'input' },
{ name: 'conversionName', label: '驻店人员', type: 'input' },
{ name: 'buyNewCar', label: '是否新车下定', type: 'select', options: yesNo },
{ name: 'hasAccident', label: '是否事故', type: 'select', options: yesNo },
{ name: 'status', label: '评估单状态', type: 'input' },
{ name: 'previousOwnerName', label: '车主姓名', type: 'input' },
{ name: 'previousOwnerPhone', label: '车主电话', type: 'input' },
{ name: 'evalOrderTime', label: '下单时间', type: 'dateRange' },
{ name: 'evalOperatorName', label: '总部定价师', type: 'input' },
{ name: 'source', label: '评估单来源', type: 'input' },
{ name: 'contractOrg', label: '内部主体', type: 'input' },
];
if (!allowed)
return (
<UResult status="403" title="无访问评估管理的权限" subTitle="请联系管理员开通访问权限。" />
);
const columns = [
{
title: '车辆照片',
dataIndex: 'coverImage',
width: 120,
render: (url: unknown) =>
typeof url === 'string' ? <img className="uc-assess-cover" src={url} alt="车辆" /> : '-',
},
{ title: '车牌号', dataIndex: 'licensePlate', width: 110, render: text },
{ title: '车架号', dataIndex: 'vin', width: 180, render: text },
{
title: '车型',
key: 'model',
width: 190,
render: (_: unknown, row: AssessmentRow) =>
[row.carBrand, row.carSeriesName, row.carTypeName].filter(Boolean).join(' ') || '-',
},
{ title: '上牌时间', dataIndex: 'registrationDate', width: 120, render: text },
{ title: '评估单编号', dataIndex: 'evalOrderNo', width: 180, render: text },
{
title: '上牌城市',
key: 'city',
width: 130,
render: (_: unknown, row: AssessmentRow) =>
[row.registrationProvinceName, row.registrationCityName].filter(Boolean).join('') || '-',
},
{ title: '门店', dataIndex: 'sellerMerchantName', width: 150, render: text },
{ title: '销售顾问', dataIndex: 'sellerName', width: 120, render: text },
{ title: '驻店人员', dataIndex: 'conversionName', width: 120, render: text },
{
title: '是否新车下定',
dataIndex: 'buyNewCar',
width: 130,
render: (v: unknown) => (Number(v) === 1 ? '是' : '否'),
},
{
title: '是否事故',
dataIndex: 'hasAccident',
width: 100,
render: (v: unknown) => (Number(v) === 1 ? '是' : '否'),
},
{
title: '评估单状态',
dataIndex: 'status',
width: 130,
render: (v: unknown) => <UTag color="blue">{statusMap[String(v)] ?? text(v)}</UTag>,
},
{ title: '车主姓名', dataIndex: 'previousOwnerName', width: 110, render: text },
{ title: '车主电话', dataIndex: 'previousOwnerPhone', width: 130, render: text },
{ title: '评估单下单时间', dataIndex: 'evalOrderTime', width: 180, render: text },
{ title: '总部定价师', dataIndex: 'evalOperatorName', width: 130, render: text },
{ title: '评估单来源', dataIndex: 'source', width: 130, render: text },
{ title: '内部主体', dataIndex: 'contractOrg', width: 130, render: text },
];
const rowActions: RowActionSchema<AssessmentRow>[] = [
{
label: '详情',
permission: UC.ASSESS_DETAIL,
visible: (row) => Boolean(row.evalOrderNo),
onClick: (row) => goTo(`assessment/${encodeURIComponent(String(row.evalOrderNo))}`),
},
{
label: '车辆评估',
permission: UC.ASSESS_EVALUATE,
visible: (row) => Boolean(row.showEvalBtn),
onClick: () => message.info('车辆评估功能将通过评估单详情页接入。'),
},
{
label: '评估核价',
permission: UC.ASSESS_PRICE_AUDIT,
visible: (row) => Boolean(row.showCheckPriceBtn),
onClick: () => message.info('评估核价功能将通过评估单详情页接入。'),
},
{
label: '图片下载',
permission: UC.ASSESS_IMAGE_DOWNLOAD,
visible: (row) => Boolean(row.evalOrderNo),
onClick: (row) =>
void assessmentApi
.exportImages(String(row.evalOrderNo))
.then(() => message.success('图片下载任务已提交')),
},
];
return (
<PageShell
fill
title="评估管理"
description="查询评估单、查看车辆信息与评估进度。"
actions={
canPoint(UC.ASSESS_EXPORT) ? (
<UButton
onClick={() =>
void assessmentApi
.exportOrders({ ...params, idsStr: selectedKeys.join(','), currentPage: 1 })
.then(() => message.success('导出任务已提交'))
}
>
导出
</UButton>
) : null
}
>
<UCard className="uj-filter-card" size="small">
<SearchForm
fields={fields}
initialValues={{}}
onSearch={(values) => {
setFilters(values);
setPage((old) => ({ ...old, current: 1 }));
}}
onReset={() => {
setFilters({});
setPage((old) => ({ ...old, current: 1 }));
}}
/>
</UCard>
{list.isError ? (
<UAlert
type="error"
showIcon
title="评估单列表加载失败"
action={
<UButton type="link" onClick={() => void list.refetch()}>
重试
</UButton>
}
/>
) : null}
<UCard size="small" fill>
<DataTable<AssessmentRow>
rowKey="id"
fillHeight
columns={columns}
dataSource={list.data?.records ?? []}
loading={list.isPending || list.isFetching}
rowSelection={{ selectedRowKeys: selectedKeys, onChange: setSelectedKeys }}
rowActions={rowActions}
actionColumnWidth={250}
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 }),
}}
/>
</UCard>
</PageShell>
);
}
function text(value: unknown): string {
return value === undefined || value === null || value === '' ? '-' : String(value);
}
}
apps/web/subapps/usedcar/src/pages/Dashboard/index.tsx
View file @
d8bbbae
...
@@ -23,6 +23,39 @@ const STATS = [
...
@@ -23,6 +23,39 @@ const STATS = [
['新车交付数(辆)', 'newCarDeliveryCount', 'newCarDeliveryCountChainRatio'],
['新车交付数(辆)', 'newCarDeliveryCount', 'newCarDeliveryCountChainRatio'],
['二手车收购交车数(辆)', 'acquisitionDeliveryCount', 'acquisitionDeliveryCountChainRatio'],
['二手车收购交车数(辆)', 'acquisitionDeliveryCount', 'acquisitionDeliveryCountChainRatio'],
] as const;
] as const;
function storesFromResponse(response: unknown): Array<{ merchantId: string; merchantName: string }> {
function parse(value: unknown): unknown {
if (typeof value !== 'string') return value;
try {
return JSON.parse(value) as unknown;
} catch {
return value;
}
}
function findList(value: unknown, depth = 0): unknown[] | undefined {
const parsed = parse(value);
if (parsed !== value) return findList(parsed, depth + 1);
if (Array.isArray(parsed)) return parsed;
if (!parsed || typeof parsed !== 'object' || depth > 4) return undefined;
const record = parsed as Record<string, unknown>;
for (const key of ['list', 'records', 'content', 'data', 'result']) {
const found = findList(record[key], depth + 1);
if (found) return found;
}
return undefined;
}
const list = findList(response);
if (!Array.isArray(list)) return [];
return list
.map((item) => {
const store = item as Record<string, unknown>;
return {
merchantId: String(store.merchantId ?? store.shopMerchantId ?? store.merchantNo ?? ''),
merchantName: String(store.merchantName ?? store.shopMerchantName ?? store.merchantNo ?? ''),
};
})
.filter((item) => item.merchantId && item.merchantName);
}
function Trend({ title, load }: { title: string; load: (type: number) => Promise<TrendPoint[]> }) {
function Trend({ title, load }: { title: string; load: (type: number) => Promise<TrendPoint[]> }) {
const [type, setType] = useState(1);
const [type, setType] = useState(1);
const query = useQuery({ queryKey: ['trend', title, type], queryFn: () => load(type) });
const query = useQuery({ queryKey: ['trend', title, type], queryFn: () => load(type) });
...
@@ -60,7 +93,11 @@ export default function Dashboard() {
...
@@ -60,7 +93,11 @@ export default function Dashboard() {
const [range, setRange] = useState<[Dayjs, Dayjs] | null>(null);
const [range, setRange] = useState<[Dayjs, Dayjs] | null>(null);
const stores = useQuery({
const stores = useQuery({
queryKey: ['stores'],
queryKey: ['stores'],
queryFn: () => dashboardApi.getServiceStore({ scene: 7 }),
queryFn: async () => {
const response = await dashboardApi.getServiceStore({ scene: 7 });
console.info('[usedcar] 门店接口原始返回:', response);
return storesFromResponse(response);
},
});
});
const params = useMemo(
const params = useMemo(
() => ({
() => ({
...
...
apps/web/subapps/usedcar/src/pages/Leads/LeadDetail.tsx
0 → 100644
View file @
d8bbbae
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 @
d8bbbae
This diff is collapsed.
Click to expand it.
apps/web/subapps/usedcar/src/pages/Leads/leads.css
0 → 100644
View file @
d8bbbae
.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 @
d8bbbae
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