增加接单工单筛选统计
This commit is contained in:
@@ -64,7 +64,13 @@ import {
|
||||
updateAdminWorkOrder,
|
||||
updateAdminWorkOrderSharing,
|
||||
} from '@/services/admin'
|
||||
import type { CollectField, UploadedFile, WorkOrder, WorkOrderShare } from '@/types/worker-platform'
|
||||
import type {
|
||||
CollectField,
|
||||
UploadedFile,
|
||||
WorkOrder,
|
||||
WorkOrderShare,
|
||||
WorkOrderStatistics,
|
||||
} from '@/types/worker-platform'
|
||||
import { ADMIN_DEFAULT_PAGE_SIZE, buildAdminTablePagination } from '@/utils/admin-pagination'
|
||||
import { hasAdminRole } from '@/utils/admin-auth'
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
@@ -959,6 +965,7 @@ export default function WorkOrdersPanel() {
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<WorkOrderStatisticsBar statistics={ordersQuery.data?.data.statistics} />
|
||||
<Card
|
||||
title="接单工单"
|
||||
extra={
|
||||
@@ -1690,6 +1697,52 @@ export default function WorkOrdersPanel() {
|
||||
)
|
||||
}
|
||||
|
||||
const WORK_ORDER_STATISTICS_STATUS_ORDER = [
|
||||
'pending_material',
|
||||
'unassigned',
|
||||
'open',
|
||||
'in_progress',
|
||||
'pending_acceptance',
|
||||
'vip_evidence_pending',
|
||||
'problem',
|
||||
'accepted',
|
||||
'cancelled',
|
||||
]
|
||||
|
||||
function WorkOrderStatisticsBar({ statistics }: { statistics?: WorkOrderStatistics }) {
|
||||
if (!statistics) return null
|
||||
const profit = Number(statistics.userPaymentAmount || 0) - Number(statistics.rewardAmount || 0)
|
||||
const statusItems = WORK_ORDER_STATISTICS_STATUS_ORDER.map((status) => ({
|
||||
status,
|
||||
count: Number(statistics.statusCounts?.[status] || 0),
|
||||
}))
|
||||
const otherStatusItems = Object.entries(statistics.statusCounts || {})
|
||||
.filter(([status]) => !WORK_ORDER_STATISTICS_STATUS_ORDER.includes(status))
|
||||
.map(([status, count]) => ({ status, count: Number(count || 0) }))
|
||||
|
||||
return (
|
||||
<Card size="small" bordered={false} className="worker-orders-statistics-card">
|
||||
<div className="worker-orders-statistics-summary">
|
||||
本次筛选统计共 <strong>{statistics.totalCount}</strong> 笔,预计总发单价{' '}
|
||||
<strong>{formatMoney(statistics.rewardAmount)}</strong>(不含销售提成),总接单价{' '}
|
||||
<strong>{formatMoney(statistics.userPaymentAmount)}</strong>,总退款{' '}
|
||||
<strong>{formatMoney(statistics.refundAmount)}</strong>,预计利润{' '}
|
||||
<strong className={profit < 0 ? 'is-negative' : ''}>{formatMoney(profit)}</strong>。
|
||||
</div>
|
||||
<div className="worker-orders-statistics-statuses">
|
||||
其中:
|
||||
{[...statusItems, ...otherStatusItems].map(({ status, count }, index) => (
|
||||
<span key={status}>
|
||||
{index > 0 ? ',' : ''}
|
||||
{formatStatus(status)}
|
||||
{count}笔
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
function shouldSkipPublishConfirm() {
|
||||
try {
|
||||
return localStorage.getItem(SKIP_PUBLISH_CONFIRM_KEY) === '1'
|
||||
|
||||
Reference in New Issue
Block a user