Merge branch 'dev1023' into dev
解决 9 个冲突文件,并修复合并后遗留问题: - 大厅候选集:采用 FIFO 窗口 + 全部置顶单 UNION(列表与抢单/拼单复核同源) - 拼单份额:采用多次参与模型(每次参与 INSERT 新份额、requestId 幂等), 取消后可重新参与;移除 HEAD 已废弃的单行 rejoin 逻辑与对应测试 - 工单迁移与成本中心 103–108 编号撞车:合并重写为 109_work_order_share_participation / 110_work_order_hall_and_shop_indexes; 临时库全量执行与重跑幂等验证通过(10 列、唯一键已删、7 个索引) - 实时补丁:保留个性化字段、置顶重排、分页总数同步;补回 orderTimelineVisible 类型 - 打手大厅:保留 memo 组件化,移植「再拼一次」多份额按钮逻辑 - 全项目表格统一 PercentTable:WorkerOrderShareTable 改造 验证:backend typecheck/lint/check:sql/test(833 pass)、 frontend typecheck/lint/test(172 pass)/build 全绿。
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ReloadOutlined } from '@ant-design/icons'
|
||||
import { ReloadOutlined, VideoCameraOutlined } from '@ant-design/icons'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import {
|
||||
App,
|
||||
@@ -26,8 +26,14 @@ import {
|
||||
repayAdminAfterSalesCaseDebt,
|
||||
resolveAdminAfterSalesCase,
|
||||
} from '@/services/admin'
|
||||
import type { UploadedFile, WorkerAfterSalesCase, WorkOrder } from '@/types/worker-platform'
|
||||
import type {
|
||||
UploadedFile,
|
||||
WorkerAcceptanceVideo,
|
||||
WorkerAfterSalesCase,
|
||||
WorkOrder,
|
||||
} from '@/types/worker-platform'
|
||||
import { ADMIN_DEFAULT_PAGE_SIZE, buildAdminTablePagination } from '@/utils/admin-pagination'
|
||||
import { normalizeSearchText } from '@/utils/admin-realtime-work-orders'
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
import { uniqueUploadedFiles } from '@/utils/image-identity'
|
||||
import { asRecord, formatMoney } from './shared'
|
||||
@@ -49,6 +55,14 @@ type AfterSalesRepayFormValues = {
|
||||
note?: string
|
||||
}
|
||||
|
||||
/** 售后单状态筛选(与列表标签同一套文案)。 */
|
||||
const AFTER_SALES_STATUS_OPTIONS = [
|
||||
{ value: 'awaiting_worker_response', label: '待打手说明' },
|
||||
{ value: 'under_review', label: '客服处理中' },
|
||||
{ value: 'recovery_pending', label: '追缴中' },
|
||||
{ value: 'closed', label: '已关闭' },
|
||||
]
|
||||
|
||||
export type AfterSalesPanelHandle = {
|
||||
openCreateModal: (row: WorkOrder) => void
|
||||
}
|
||||
@@ -62,6 +76,10 @@ const AfterSalesPanel = forwardRef<AfterSalesPanelHandle>(function AfterSalesPan
|
||||
const [afterSalesFiles, setAfterSalesFiles] = useState<UploadedFile[]>([])
|
||||
const [afterSalesPage, setAfterSalesPage] = useState(1)
|
||||
const [afterSalesPageSize, setAfterSalesPageSize] = useState(ADMIN_DEFAULT_PAGE_SIZE)
|
||||
/** 搜索框输入值;点搜索/回车后才写入 afterSalesKeyword,避免每敲一个字就请求。 */
|
||||
const [afterSalesKeywordInput, setAfterSalesKeywordInput] = useState('')
|
||||
const [afterSalesKeyword, setAfterSalesKeyword] = useState('')
|
||||
const [afterSalesStatus, setAfterSalesStatus] = useState('')
|
||||
const [afterSalesCreateForm] = Form.useForm<AfterSalesCreateFormValues>()
|
||||
const [afterSalesResolutionForm] = Form.useForm<AfterSalesResolutionFormValues>()
|
||||
const [afterSalesRepayForm] = Form.useForm<AfterSalesRepayFormValues>()
|
||||
@@ -72,9 +90,20 @@ const AfterSalesPanel = forwardRef<AfterSalesPanelHandle>(function AfterSalesPan
|
||||
enabled: Boolean(afterSalesOrder?.sharing?.enabled),
|
||||
})
|
||||
const afterSalesCasesQuery = useQuery({
|
||||
queryKey: ['admin-worker-platform-after-sales-cases', afterSalesPage, afterSalesPageSize],
|
||||
queryKey: [
|
||||
'admin-worker-platform-after-sales-cases',
|
||||
afterSalesPage,
|
||||
afterSalesPageSize,
|
||||
afterSalesKeyword,
|
||||
afterSalesStatus,
|
||||
],
|
||||
queryFn: () =>
|
||||
fetchAdminAfterSalesCases({ page: afterSalesPage, pageSize: afterSalesPageSize }),
|
||||
fetchAdminAfterSalesCases({
|
||||
page: afterSalesPage,
|
||||
pageSize: afterSalesPageSize,
|
||||
...(afterSalesKeyword ? { keyword: afterSalesKeyword } : {}),
|
||||
...(afterSalesStatus ? { status: afterSalesStatus } : {}),
|
||||
}),
|
||||
})
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
@@ -195,6 +224,41 @@ const AfterSalesPanel = forwardRef<AfterSalesPanelHandle>(function AfterSalesPan
|
||||
}
|
||||
bordered={false}
|
||||
>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Space wrap>
|
||||
<Input.Search
|
||||
allowClear
|
||||
value={afterSalesKeywordInput}
|
||||
placeholder="售后单号 / 工单号 / 平台号 / 责任打手"
|
||||
style={{ width: 340 }}
|
||||
onChange={(event) => {
|
||||
const nextValue = event.target.value
|
||||
setAfterSalesKeywordInput(nextValue)
|
||||
// 清空输入立即恢复全量,不用再点一次搜索。
|
||||
if (!nextValue.trim()) {
|
||||
setAfterSalesKeyword('')
|
||||
setAfterSalesPage(1)
|
||||
}
|
||||
}}
|
||||
onSearch={(value) => {
|
||||
// 归一化(全角→半角、去零宽字符):粘贴来的单号常夹带不可见字符。
|
||||
setAfterSalesKeyword(normalizeSearchText(value))
|
||||
setAfterSalesPage(1)
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
allowClear
|
||||
value={afterSalesStatus || undefined}
|
||||
placeholder="全部状态"
|
||||
style={{ width: 160 }}
|
||||
options={AFTER_SALES_STATUS_OPTIONS}
|
||||
onChange={(value) => {
|
||||
setAfterSalesStatus(String(value || ''))
|
||||
setAfterSalesPage(1)
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
<PercentTable<WorkerAfterSalesCase>
|
||||
rowKey="caseId"
|
||||
loading={afterSalesCasesQuery.isLoading}
|
||||
@@ -259,6 +323,15 @@ const AfterSalesPanel = forwardRef<AfterSalesPanelHandle>(function AfterSalesPan
|
||||
/>
|
||||
</Space>
|
||||
) : null}
|
||||
{getAfterSalesSnapshotVideo(item) ? (
|
||||
<a
|
||||
href={getAfterSalesSnapshotVideo(item)?.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<VideoCameraOutlined /> 查看固化验收视频
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
@@ -570,4 +643,21 @@ function getAfterSalesSnapshotFiles(item: WorkerAfterSalesCase): UploadedFile[]
|
||||
)
|
||||
}
|
||||
|
||||
/** 售后固化快照里的验收视频(有则给出可点击链接)。 */
|
||||
function getAfterSalesSnapshotVideo(item: WorkerAfterSalesCase): WorkerAcceptanceVideo | null {
|
||||
const snapshot = asRecord(item.acceptanceSnapshot)
|
||||
const acceptance = asRecord(snapshot.acceptance)
|
||||
const video = asRecord(acceptance.video)
|
||||
const url = String(video.url || '').trim()
|
||||
if (!url) return null
|
||||
return {
|
||||
objectKey: String(video.objectKey || video.object_key || ''),
|
||||
url,
|
||||
filename: String(video.filename || ''),
|
||||
contentType: String(video.contentType || video.content_type || ''),
|
||||
size: Number(video.size || 0),
|
||||
durationSeconds: Number(video.durationSeconds || video.duration_seconds || 0),
|
||||
}
|
||||
}
|
||||
|
||||
export default AfterSalesPanel
|
||||
|
||||
@@ -226,7 +226,7 @@ function AnnouncementCard() {
|
||||
name="content"
|
||||
label="公告内容"
|
||||
rules={[{ required: true, whitespace: true, message: '请填写公告内容' }]}
|
||||
extra="公告会显示在打手端各页面顶部并横向滚动。"
|
||||
extra="公告会显示在打手端各页面顶部并横向滚动;正文一改动,打手端下次进入会弹出公告弹窗,需点「我已知晓」才关闭。"
|
||||
>
|
||||
<Input.TextArea rows={4} maxLength={300} showCount placeholder="请输入打手端公告内容" />
|
||||
</Form.Item>
|
||||
|
||||
@@ -24,6 +24,11 @@ const notificationEventRows: NotificationEventRow[] = [
|
||||
{ key: 'recharge_requested', name: '充值申请', description: '打手提交新的充值申请' },
|
||||
{ key: 'acceptance_submitted', name: '提交验收', description: '打手提交订单验收资料' },
|
||||
{ key: 'acceptance_reminded', name: '催验收', description: '打手在验收后催促处理' },
|
||||
{
|
||||
key: 'order_accepted',
|
||||
name: '整单验收完成',
|
||||
description: '全部份额验收完成(含拼单统一验收)',
|
||||
},
|
||||
{ key: 'material_required', name: '待补资料工单', description: '新工单等待后台补充资料' },
|
||||
{
|
||||
key: 'cancel_requested',
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
UserAddOutlined,
|
||||
WarningOutlined,
|
||||
RollbackOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import {
|
||||
@@ -28,6 +29,7 @@ import {
|
||||
Input,
|
||||
InputNumber,
|
||||
Modal,
|
||||
Popover,
|
||||
Radio,
|
||||
Select,
|
||||
Space,
|
||||
@@ -45,6 +47,7 @@ import JsonPreview from '@/components/admin/JsonPreview'
|
||||
import WorkOrderEventTimeline from '@/components/WorkOrderEventTimeline'
|
||||
import ImageUpload from '@/components/files/ImageUpload'
|
||||
import ImagePreviewList from '@/components/files/ImagePreviewList'
|
||||
import VideoPreview, { formatAcceptanceVideoDuration } from '@/components/files/VideoPreview'
|
||||
import {
|
||||
acceptAdminWorkOrder,
|
||||
acceptAdminWorkOrderShare,
|
||||
@@ -57,6 +60,7 @@ import {
|
||||
confirmAdminWorkOrderFriend,
|
||||
deductAdminWorkOrderPendingDeposit,
|
||||
deleteAdminWorkOrder,
|
||||
disposeAdminWorkOrderShareProblem,
|
||||
fetchAdminWorkCategories,
|
||||
fetchAdminSession,
|
||||
fetchAdminWorkOrderSharing,
|
||||
@@ -65,8 +69,10 @@ import {
|
||||
fetchAdminWorkerUsers,
|
||||
fetchAdminWorkOrders,
|
||||
markAdminWorkOrderProblem,
|
||||
markAdminWorkOrderShareProblem,
|
||||
pinAdminWorkOrder,
|
||||
publishAdminWorkOrder,
|
||||
reduceAdminWorkOrderShareQuantity,
|
||||
reopenAdminCancelledWorkOrder,
|
||||
resetAdminWorkOrderGiftMaterial,
|
||||
resolveAdminProblemWorkOrder,
|
||||
@@ -114,6 +120,7 @@ import {
|
||||
asRecord,
|
||||
formatMoney,
|
||||
formatSharingShareStatus,
|
||||
formatSharingShareCancelledReason,
|
||||
formatStatus,
|
||||
resolveGiftPhaseColor,
|
||||
resolveSharingShareStatusColor,
|
||||
@@ -240,6 +247,9 @@ export default function WorkOrdersPanel() {
|
||||
const canCancelShare = sessionPermissions
|
||||
? sessionPermissions.includes('worker_order.cancel_share')
|
||||
: hasAdminPermission('worker_order.cancel_share')
|
||||
const canManageShareProblem = sessionPermissions
|
||||
? sessionPermissions.includes('worker_order.manage_problem')
|
||||
: hasAdminPermission('worker_order.manage_problem')
|
||||
const canEditOrder = sessionPermissions
|
||||
? sessionPermissions.includes('worker_order.edit')
|
||||
: hasAdminPermission('worker_order.edit')
|
||||
@@ -297,6 +307,9 @@ export default function WorkOrdersPanel() {
|
||||
const [materialPasteText, setMaterialPasteText] = useState('')
|
||||
const [sharingOrder, setSharingOrder] = useState<WorkOrder | null>(null)
|
||||
const [cancelShare, setCancelShare] = useState<WorkOrderShare | null>(null)
|
||||
const [reduceShare, setReduceShare] = useState<WorkOrderShare | null>(null)
|
||||
const [problemShare, setProblemShare] = useState<WorkOrderShare | null>(null)
|
||||
const [disposeShare, setDisposeShare] = useState<WorkOrderShare | null>(null)
|
||||
const [cancelSharingOrder, setCancelSharingOrder] = useState<WorkOrder | null>(null)
|
||||
const [assignOrder, setAssignOrder] = useState<WorkOrder | null>(null)
|
||||
const [assignWorkerId, setAssignWorkerId] = useState<number | undefined>(undefined)
|
||||
@@ -309,6 +322,12 @@ export default function WorkOrdersPanel() {
|
||||
const [materialForm] = Form.useForm<MaterialFormValues>()
|
||||
const [cancelForm] = Form.useForm<CancelOrderFormValues>()
|
||||
const [cancelShareForm] = Form.useForm<CancelShareFormValues>()
|
||||
const [reduceShareForm] = Form.useForm<{ reduceQuantity?: number; note?: string }>()
|
||||
const [problemShareForm] = Form.useForm<{ note?: string }>()
|
||||
const [disposeShareForm] = Form.useForm<{
|
||||
action?: 'return_to_worker' | 'reopen' | 'cancel_release' | 'cancel_deduct'
|
||||
note?: string
|
||||
}>()
|
||||
const [cancelSharingForm] = Form.useForm<CancelSharingFormValues>()
|
||||
const [deductForm] = Form.useForm<{ amount?: number; note?: string }>()
|
||||
const [editForm] = Form.useForm<{
|
||||
@@ -699,7 +718,7 @@ export default function WorkOrdersPanel() {
|
||||
cancelAdminWorkOrderShare(workOrderId, cancelShare.shareId, {
|
||||
reason: String(values.reason || '').trim(),
|
||||
}),
|
||||
'该参与者已撤单,押金和拼单份数已恢复',
|
||||
'该参与者已撤单,押金已退还,母单状态未变更',
|
||||
)
|
||||
if (!succeeded) return
|
||||
await queryClient.invalidateQueries({
|
||||
@@ -709,6 +728,77 @@ export default function WorkOrdersPanel() {
|
||||
cancelShareForm.resetFields()
|
||||
}
|
||||
|
||||
/** 按份数撤销部分份额:减少的份数回到大厅,押金保持冻结。 */
|
||||
async function submitReduceShare(values: { reduceQuantity?: number; note?: string }) {
|
||||
if (!sharingOrder || !reduceShare) return
|
||||
const workOrderId = sharingOrder.workOrderId
|
||||
const reduceQuantity = Math.floor(Number(values.reduceQuantity || 0))
|
||||
if (!Number.isFinite(reduceQuantity) || reduceQuantity <= 0) {
|
||||
message.warning('请填写要撤掉的份数')
|
||||
return
|
||||
}
|
||||
const keepQuantity = Math.max(0, reduceShare.quantity - reduceQuantity)
|
||||
const succeeded = await runAction(
|
||||
() =>
|
||||
reduceAdminWorkOrderShareQuantity(workOrderId, reduceShare.shareId, {
|
||||
reduceQuantity,
|
||||
note: String(values.note || '').trim(),
|
||||
}),
|
||||
`已撤掉 ${reduceQuantity} 份,保留 ${keepQuantity} 份继续履约`,
|
||||
)
|
||||
if (!succeeded) return
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ['admin-worker-platform-order-sharing', workOrderId],
|
||||
})
|
||||
setReduceShare(null)
|
||||
reduceShareForm.resetFields()
|
||||
}
|
||||
|
||||
/** 按份额标记问题单:只影响该打手,母单状态不变。备注选填。 */
|
||||
async function submitProblemShare(values: { note?: string }) {
|
||||
if (!sharingOrder || !problemShare) return
|
||||
const workOrderId = sharingOrder.workOrderId
|
||||
const succeeded = await runAction(
|
||||
() =>
|
||||
markAdminWorkOrderShareProblem(
|
||||
workOrderId,
|
||||
problemShare.shareId,
|
||||
String(values.note || '').trim(),
|
||||
),
|
||||
'该份额已标记为问题单,仅影响该打手',
|
||||
)
|
||||
if (!succeeded) return
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ['admin-worker-platform-order-sharing', workOrderId],
|
||||
})
|
||||
setProblemShare(null)
|
||||
problemShareForm.resetFields()
|
||||
}
|
||||
|
||||
/** 处置份额问题单:方式与母单处置一致,但只作用于这一份,母单状态不变。 */
|
||||
async function submitShareDisposal(values: {
|
||||
action?: 'return_to_worker' | 'reopen' | 'cancel_release' | 'cancel_deduct'
|
||||
note?: string
|
||||
}) {
|
||||
if (!sharingOrder || !disposeShare || !values.action) return
|
||||
const workOrderId = sharingOrder.workOrderId
|
||||
const action = values.action
|
||||
const succeeded = await runAction(
|
||||
() =>
|
||||
disposeAdminWorkOrderShareProblem(workOrderId, disposeShare.shareId, {
|
||||
action,
|
||||
note: String(values.note || '').trim(),
|
||||
}),
|
||||
'该份额问题单已处置',
|
||||
)
|
||||
if (!succeeded) return
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ['admin-worker-platform-order-sharing', workOrderId],
|
||||
})
|
||||
setDisposeShare(null)
|
||||
disposeShareForm.resetFields()
|
||||
}
|
||||
|
||||
async function submitCancelSharing(values: CancelSharingFormValues) {
|
||||
if (!cancelSharingOrder || !values.action) return
|
||||
const action = values.action
|
||||
@@ -2545,6 +2635,11 @@ export default function WorkOrdersPanel() {
|
||||
{getAcceptanceFiles(detailOrder).length +
|
||||
getAcceptanceImageUrls(detailOrder).length || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="验收视频">
|
||||
{detailOrder.acceptance?.video
|
||||
? formatAcceptanceVideoDuration(detailOrder.acceptance.video.durationSeconds)
|
||||
: '未上传'}
|
||||
</Descriptions.Item>
|
||||
{detailOrder.acceptance?.reviewMode === 'vip_auto' ? (
|
||||
<Descriptions.Item label="VIP 补图">
|
||||
{detailOrder.acceptance.evidenceStatus === 'pending'
|
||||
@@ -2568,6 +2663,11 @@ export default function WorkOrdersPanel() {
|
||||
) : (
|
||||
<Typography.Text type="secondary">暂无验收图</Typography.Text>
|
||||
)}
|
||||
<VideoPreview
|
||||
video={detailOrder.acceptance?.video ?? null}
|
||||
maxHeight={200}
|
||||
emptyText="暂无验收视频(选填)"
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@@ -3012,9 +3112,11 @@ export default function WorkOrdersPanel() {
|
||||
onCancel={() => {
|
||||
setSharingOrder(null)
|
||||
setCancelShare(null)
|
||||
setReduceShare(null)
|
||||
setCancelSharingOrder(null)
|
||||
sharingForm.resetFields()
|
||||
cancelShareForm.resetFields()
|
||||
reduceShareForm.resetFields()
|
||||
cancelSharingForm.resetFields()
|
||||
}}
|
||||
onOk={() => sharingForm.submit()}
|
||||
@@ -3022,13 +3124,14 @@ export default function WorkOrdersPanel() {
|
||||
sharingOrder?.capabilities?.canConfigureSharing && canConfigureSharing ? undefined : null
|
||||
}
|
||||
destroyOnHidden
|
||||
width={720}
|
||||
width={1360}
|
||||
>
|
||||
{sharingOrder ? (
|
||||
<Space direction="vertical" size={16} className="full-width">
|
||||
<Form
|
||||
form={sharingForm}
|
||||
layout="vertical"
|
||||
style={{ maxWidth: 760 }}
|
||||
initialValues={{
|
||||
enabled: false,
|
||||
totalQuantity: 1,
|
||||
@@ -3145,33 +3248,103 @@ export default function WorkOrdersPanel() {
|
||||
dataSource={sharingShares}
|
||||
loading={sharingQuery.isFetching}
|
||||
pagination={false}
|
||||
tableLayout="fixed"
|
||||
scroll={{ x: 1914 }}
|
||||
rowClassName={(share) =>
|
||||
share.problemMarked
|
||||
? 'admin-share-row-problem'
|
||||
: share.status === 'cancelled'
|
||||
? 'admin-share-row-cancelled'
|
||||
: ''
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
title: '打手',
|
||||
width: 132,
|
||||
fixed: 'left',
|
||||
render: (_, share) =>
|
||||
share.worker?.displayName || share.worker?.username || '-',
|
||||
},
|
||||
{ title: '数量', dataIndex: 'quantity' },
|
||||
{ title: '数量', dataIndex: 'quantity', width: 64, align: 'center' },
|
||||
{
|
||||
title: '份额报酬',
|
||||
width: 96,
|
||||
align: 'right',
|
||||
render: (_, share) => formatMoney(share.shareReward),
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
width: 104,
|
||||
render: (_, share) => (
|
||||
<Tag color={resolveSharingShareStatusColor(share.status)}>
|
||||
{formatSharingShareStatus(share.status)}
|
||||
</Tag>
|
||||
<Space size={4} wrap>
|
||||
<Tag color={resolveSharingShareStatusColor(share.status)}>
|
||||
{formatSharingShareStatus(share.status)}
|
||||
</Tag>
|
||||
{share.status === 'cancelled' && share.cancelledReason ? (
|
||||
<Tag>{formatSharingShareCancelledReason(share.cancelledReason)}</Tag>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '问题',
|
||||
width: 120,
|
||||
render: (_, share) =>
|
||||
share.problemMarked ? (
|
||||
<Space direction="vertical" size={2}>
|
||||
<Tag color="red">问题单</Tag>
|
||||
{String(share.problemNote || '').trim() ? (
|
||||
<Typography.Text
|
||||
type="danger"
|
||||
style={{ fontSize: 12 }}
|
||||
ellipsis={{ tooltip: share.problemNote }}
|
||||
>
|
||||
{share.problemNote}
|
||||
</Typography.Text>
|
||||
) : (
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
未填备注
|
||||
</Typography.Text>
|
||||
)}
|
||||
</Space>
|
||||
) : (
|
||||
<Typography.Text type="secondary">-</Typography.Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '参与时间',
|
||||
width: 128,
|
||||
render: (_, share) =>
|
||||
share.createdAt ? formatAdminDateTime(share.createdAt) : '-',
|
||||
},
|
||||
{
|
||||
title: '截止时间',
|
||||
width: 150,
|
||||
render: (_, share) =>
|
||||
share.deadlineAt ? (
|
||||
<span>
|
||||
{formatAdminDateTime(share.deadlineAt)}
|
||||
{share.timeoutMinutes ? ` · ${share.timeoutMinutes} 分钟` : null}
|
||||
</span>
|
||||
) : (
|
||||
<Typography.Text type="secondary">不限时</Typography.Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '超时策略',
|
||||
width: 90,
|
||||
render: (_, share) =>
|
||||
share.timeoutPolicy ? formatTimeoutPolicyLabel(share.timeoutPolicy) : '-',
|
||||
},
|
||||
{
|
||||
title: '提交时间',
|
||||
width: 128,
|
||||
render: (_, share) =>
|
||||
share.submittedAt ? formatAdminDateTime(share.submittedAt) : '-',
|
||||
},
|
||||
{
|
||||
title: '验收图',
|
||||
width: 150,
|
||||
width: 96,
|
||||
render: (_, share) => (
|
||||
<ImagePreviewList
|
||||
files={
|
||||
@@ -3182,23 +3355,111 @@ export default function WorkOrdersPanel() {
|
||||
? share.acceptance.imageUrls
|
||||
: []
|
||||
}
|
||||
size={44}
|
||||
size={36}
|
||||
maxVisible={2}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '验收视频',
|
||||
width: 96,
|
||||
render: (_, share) => {
|
||||
const video = share.acceptance?.video
|
||||
if (!video?.url) return '-'
|
||||
return (
|
||||
<Popover
|
||||
trigger="click"
|
||||
placement="left"
|
||||
title="验收视频"
|
||||
content={<VideoPreview video={video} maxHeight={240} showMeta />}
|
||||
>
|
||||
<Button size="small" icon={<VideoCameraOutlined />}>
|
||||
查看
|
||||
</Button>
|
||||
</Popover>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
render: (_, share) => String(share.acceptance?.note || '').trim() || '-',
|
||||
width: 120,
|
||||
render: (_, share) => {
|
||||
const note = String(share.acceptance?.note || '').trim()
|
||||
return note ? (
|
||||
<Typography.Text style={{ fontSize: 12 }} ellipsis={{ tooltip: note }}>
|
||||
{note}
|
||||
</Typography.Text>
|
||||
) : (
|
||||
'-'
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '撤单记录',
|
||||
width: 170,
|
||||
render: (_, share) => {
|
||||
// 份数前缀由展示层拼接:接口只给结构化的份数与原因文本
|
||||
const cancelledQuantity = Math.max(
|
||||
0,
|
||||
Math.floor(Number(share.cancelQuantity || 0)),
|
||||
)
|
||||
const note = String(share.cancelNote || '').trim()
|
||||
if (!cancelledQuantity && !note) return '-'
|
||||
const text = cancelledQuantity
|
||||
? `撤 ${cancelledQuantity} 份${note ? ` · ${note}` : ''}`
|
||||
: note
|
||||
return (
|
||||
<Typography.Text style={{ fontSize: 12 }} ellipsis={{ tooltip: text }}>
|
||||
{text}
|
||||
</Typography.Text>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 190,
|
||||
width: 420,
|
||||
fixed: 'right',
|
||||
render: (_, share) => {
|
||||
if (share.status === 'accepted') return <Tag color="green">已验收</Tag>
|
||||
if (share.status === 'cancelled') return <Tag>已撤单</Tag>
|
||||
if (share.status === 'accepted') return <Tag color="green">已验收</Tag>
|
||||
|
||||
// 份额级问题单:标记只影响该打手;已标记时按母单同一套方式处置。
|
||||
// 已验收份额的报酬/押金已结算,不能处置,因此也不提供标记入口。
|
||||
const disposableShare =
|
||||
share.status === 'joined' || share.status === 'submitted'
|
||||
const problemAction =
|
||||
canManageShareProblem && disposableShare ? (
|
||||
share.problemMarked ? (
|
||||
<Button
|
||||
size="small"
|
||||
onClick={() => {
|
||||
setDisposeShare(share)
|
||||
disposeShareForm.setFieldsValue({
|
||||
action: 'return_to_worker',
|
||||
note: '',
|
||||
})
|
||||
}}
|
||||
>
|
||||
处置问题单
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
icon={<WarningOutlined />}
|
||||
title="只标记该参与者的份额;母单状态与其他打手不受影响"
|
||||
onClick={() => {
|
||||
setProblemShare(share)
|
||||
problemShareForm.setFieldsValue({ note: '' })
|
||||
}}
|
||||
>
|
||||
标记问题单
|
||||
</Button>
|
||||
)
|
||||
) : null
|
||||
|
||||
return (
|
||||
<Space size={6}>
|
||||
<Space size={6} className="admin-share-actions">
|
||||
{share.status === 'submitted' ? (
|
||||
<Button
|
||||
type="primary"
|
||||
@@ -3242,6 +3503,25 @@ export default function WorkOrdersPanel() {
|
||||
单人撤单
|
||||
</Button>
|
||||
) : null}
|
||||
{(share.status === 'joined' || share.status === 'submitted') &&
|
||||
share.quantity >= 2 ? (
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
icon={<UndoOutlined />}
|
||||
title="按份数撤销部分份额:减少的份数立即回到大厅,押金保持冻结,验收资料保留"
|
||||
onClick={() => {
|
||||
setReduceShare(share)
|
||||
reduceShareForm.setFieldsValue({
|
||||
reduceQuantity: 1,
|
||||
note: '',
|
||||
})
|
||||
}}
|
||||
>
|
||||
撤份额
|
||||
</Button>
|
||||
) : null}
|
||||
{problemAction}
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
@@ -3276,7 +3556,7 @@ export default function WorkOrdersPanel() {
|
||||
showIcon
|
||||
type="warning"
|
||||
message={`将撤销该打手承接的 ${cancelShare.quantity} 份拼单`}
|
||||
description="撤单后会退还该份额冻结的押金,空出的份数重新回到接单大厅;已提交的验收资料会保留在后台记录中。"
|
||||
description="撤单只释放这一份份额并退还该份额冻结的押金,母单状态保持不变(待验收/进行中的单不会被踢回大厅);已提交的验收资料会保留在后台记录中。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Form.Item label="撤单原因" name="reason">
|
||||
@@ -3286,6 +3566,162 @@ export default function WorkOrdersPanel() {
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={`撤份额 · ${reduceShare?.worker?.displayName || reduceShare?.worker?.username || ''}`}
|
||||
open={Boolean(reduceShare)}
|
||||
okText="确认撤销"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
onCancel={() => {
|
||||
setReduceShare(null)
|
||||
reduceShareForm.resetFields()
|
||||
}}
|
||||
onOk={() => reduceShareForm.submit()}
|
||||
destroyOnHidden
|
||||
>
|
||||
{reduceShare ? (
|
||||
<Form
|
||||
form={reduceShareForm}
|
||||
layout="vertical"
|
||||
initialValues={{ reduceQuantity: 1 }}
|
||||
onFinish={submitReduceShare}
|
||||
>
|
||||
<Alert
|
||||
showIcon
|
||||
type="warning"
|
||||
message={`将从该打手的 ${reduceShare.quantity} 份中撤掉指定份数`}
|
||||
description="撤掉的份数会立刻回到抢单大厅;押金保持原冻结额不退还;验收资料保留,之后仍可单独验收剩余份数。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Form.Item
|
||||
label={`撤掉份数(1 ~ ${Math.max(1, reduceShare.quantity - 1)} 份)`}
|
||||
name="reduceQuantity"
|
||||
rules={[{ required: true, message: '请填写要撤掉的份数' }]}
|
||||
>
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={Math.max(1, reduceShare.quantity - 1)}
|
||||
precision={0}
|
||||
addonAfter="份"
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{() => {
|
||||
const reduceQuantity = Math.floor(
|
||||
Number(reduceShareForm.getFieldValue('reduceQuantity') || 0),
|
||||
)
|
||||
const boundedReduce = Math.max(
|
||||
0,
|
||||
Math.min(Math.max(0, reduceShare.quantity - 1), reduceQuantity),
|
||||
)
|
||||
const keepQuantity = Math.max(0, reduceShare.quantity - boundedReduce)
|
||||
return (
|
||||
<Typography.Text type="secondary">
|
||||
调整后保留 {keepQuantity} 份,回到大厅 {boundedReduce} 份;剩余份额报酬{' '}
|
||||
{formatMoney(keepQuantity * Number(reduceShare.unitReward || 0))}
|
||||
</Typography.Text>
|
||||
)
|
||||
}}
|
||||
</Form.Item>
|
||||
<Form.Item label="撤销原因(选填)" name="note">
|
||||
<Input.TextArea
|
||||
rows={3}
|
||||
maxLength={200}
|
||||
placeholder="如:打手账号实际只能赠送 5 份"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={`标记份额问题单 · ${
|
||||
problemShare?.worker?.displayName || problemShare?.worker?.username || ''
|
||||
}`}
|
||||
open={Boolean(problemShare)}
|
||||
okText="确认标记"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
onCancel={() => {
|
||||
setProblemShare(null)
|
||||
problemShareForm.resetFields()
|
||||
}}
|
||||
onOk={() => problemShareForm.submit()}
|
||||
destroyOnHidden
|
||||
>
|
||||
{problemShare ? (
|
||||
<Form form={problemShareForm} layout="vertical" onFinish={submitProblemShare}>
|
||||
<Alert
|
||||
showIcon
|
||||
type="warning"
|
||||
message={`将标记该打手承接的 ${problemShare.quantity} 份拼单为问题单`}
|
||||
description="只有该份额持有人会在「我的订单」里看到问题单与备注;同工单其他打手、母单状态与份额状态都不受影响。整单问题单仍可在订单详情里操作。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Form.Item label="问题备注" name="note">
|
||||
<Input.TextArea rows={3} placeholder="选填,仅该份额持有人可见" maxLength={500} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={`处置份额问题单 · ${
|
||||
disposeShare?.worker?.displayName || disposeShare?.worker?.username || ''
|
||||
}`}
|
||||
open={Boolean(disposeShare)}
|
||||
okText="确认处置"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
onCancel={() => {
|
||||
setDisposeShare(null)
|
||||
disposeShareForm.resetFields()
|
||||
}}
|
||||
onOk={() => disposeShareForm.submit()}
|
||||
destroyOnHidden
|
||||
>
|
||||
{disposeShare ? (
|
||||
<Form
|
||||
form={disposeShareForm}
|
||||
layout="vertical"
|
||||
initialValues={{ action: 'return_to_worker', note: '' }}
|
||||
onFinish={submitShareDisposal}
|
||||
>
|
||||
<Alert
|
||||
showIcon
|
||||
type="warning"
|
||||
message={`只处置「${
|
||||
disposeShare.worker?.displayName || disposeShare.worker?.username || '该打手'
|
||||
}」的 ${disposeShare.quantity} 份份额`}
|
||||
description="处置方式与母单一致,但只作用于这一份:母单状态、其他打手都不受影响。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Form.Item
|
||||
label="处置方式"
|
||||
name="action"
|
||||
rules={[{ required: true, message: '请选择处置方式' }]}
|
||||
>
|
||||
<Select
|
||||
options={[
|
||||
{ value: 'return_to_worker', label: '退回打手继续代练' },
|
||||
{ value: 'reopen', label: '释放押金并重新放回大厅' },
|
||||
{ value: 'cancel_release', label: '取消该份额并退还押金' },
|
||||
{ value: 'cancel_deduct', label: '取消该份额并扣除押金' },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="处置备注"
|
||||
name="note"
|
||||
rules={[{ required: true, message: '请填写处置备注' }]}
|
||||
>
|
||||
<Input.TextArea rows={4} placeholder="如:验收图片与要求不符,退回继续代练" />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={`拼单撤单处理 · ${getDisplayOrderNo(cancelSharingOrder)}`}
|
||||
open={Boolean(cancelSharingOrder)}
|
||||
|
||||
@@ -252,6 +252,17 @@ export function formatSharingShareStatus(status: string) {
|
||||
return labels[status] || status
|
||||
}
|
||||
|
||||
/** 撤单原因:份额级独立撤单后,后台需要一眼看出是谁撤的。 */
|
||||
export function formatSharingShareCancelledReason(reason: string) {
|
||||
const labels: Record<string, string> = {
|
||||
timeout: '超时失效',
|
||||
admin: '后台撤单',
|
||||
worker_request: '打手退单',
|
||||
problem: '问题单处置',
|
||||
}
|
||||
return labels[reason] || reason
|
||||
}
|
||||
|
||||
export function formatAcceptanceMode(mode: string) {
|
||||
if (mode === 'friend_gift') return '好友赠送'
|
||||
return '标准验收'
|
||||
|
||||
Reference in New Issue
Block a user