优化打手订单与界面
This commit is contained in:
@@ -51,13 +51,13 @@ import { getImageIdentity } from '@/utils/image-identity'
|
||||
import { useIsMobile } from '@/utils/use-is-mobile'
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
{ value: '', label: '全部订单' },
|
||||
{ value: 'in_progress', label: '代练中' },
|
||||
{ value: 'pending_acceptance', label: '待验收' },
|
||||
{ value: 'problem', label: '问题单' },
|
||||
{ value: 'open', label: '已超时' },
|
||||
{ value: 'accepted', label: '已验收' },
|
||||
{ value: 'cancelled', label: '已取消' },
|
||||
{ value: '', label: '全部订单' },
|
||||
] as const
|
||||
|
||||
type AcceptanceFormValues = {
|
||||
@@ -68,6 +68,97 @@ type WorkerNoteFormValues = {
|
||||
note?: string
|
||||
}
|
||||
|
||||
type NoteTheme = 'success' | 'processing' | 'danger' | 'warning' | 'purple' | 'default'
|
||||
|
||||
const PRESET_NOTE_TAGS: Array<{ label: string; theme: NoteTheme }> = [
|
||||
{ label: '已安排', theme: 'success' },
|
||||
{ label: '打单中', theme: 'processing' },
|
||||
{ label: '账号问题', theme: 'danger' },
|
||||
{ label: '排队中', theme: 'purple' },
|
||||
{ label: '未安排', theme: 'warning' },
|
||||
{ label: '暂缓做单', theme: 'warning' },
|
||||
]
|
||||
|
||||
function resolveNoteTheme(note?: string): NoteTheme {
|
||||
const text = String(note || '').trim().toLowerCase()
|
||||
if (!text) return 'default'
|
||||
|
||||
// 1. 危险 / 异常 / 问题类 (Red)
|
||||
if (
|
||||
text.includes('问题') ||
|
||||
text.includes('异常') ||
|
||||
text.includes('密码') ||
|
||||
text.includes('封号') ||
|
||||
text.includes('错误') ||
|
||||
text.includes('无法') ||
|
||||
text.includes('投诉') ||
|
||||
text.includes('退') ||
|
||||
text.includes('失败') ||
|
||||
text.includes('被挤')
|
||||
) {
|
||||
return 'danger'
|
||||
}
|
||||
|
||||
// 2. 暂缓 / 未安排 / 延后 / 暂停类 (Orange)
|
||||
if (
|
||||
text.includes('未安排') ||
|
||||
text.includes('未') ||
|
||||
text.includes('暂缓') ||
|
||||
text.includes('暂停') ||
|
||||
text.includes('稍后') ||
|
||||
text.includes('延后') ||
|
||||
text.includes('挂起') ||
|
||||
text.includes('待定')
|
||||
) {
|
||||
return 'warning'
|
||||
}
|
||||
|
||||
// 3. 排队 / 等待类 (Purple)
|
||||
if (
|
||||
text.includes('排队') ||
|
||||
text.includes('等待') ||
|
||||
text.includes('等买家') ||
|
||||
text.includes('等扫码') ||
|
||||
text.includes('等验证') ||
|
||||
text.includes('待扫')
|
||||
) {
|
||||
return 'purple'
|
||||
}
|
||||
|
||||
// 4. 进行中 / 打单中 / 上号 (Blue)
|
||||
if (
|
||||
text.includes('打单') ||
|
||||
text.includes('做单') ||
|
||||
text.includes('进行') ||
|
||||
text.includes('处理') ||
|
||||
text.includes('上号') ||
|
||||
text.includes('练级') ||
|
||||
text.includes('正在') ||
|
||||
text.includes('开打') ||
|
||||
text.includes('肝')
|
||||
) {
|
||||
return 'processing'
|
||||
}
|
||||
|
||||
// 5. 已安排 / 已就绪 / 完成 / 正常 (Green)
|
||||
if (
|
||||
text.includes('已安排') ||
|
||||
text.includes('安排') ||
|
||||
text.includes('已就绪') ||
|
||||
text.includes('就绪') ||
|
||||
text.includes('已联系') ||
|
||||
text.includes('完成') ||
|
||||
text.includes('已好') ||
|
||||
text.includes('搞定') ||
|
||||
text.includes('正常') ||
|
||||
text.includes('ok')
|
||||
) {
|
||||
return 'success'
|
||||
}
|
||||
|
||||
return 'default'
|
||||
}
|
||||
|
||||
type DetailFieldItem = {
|
||||
key: string
|
||||
label: string
|
||||
@@ -79,7 +170,7 @@ export default function WorkerOrdersPage() {
|
||||
const isMobile = useIsMobile()
|
||||
const { message } = App.useApp()
|
||||
const queryClient = useQueryClient()
|
||||
const [status, setStatus] = useState('')
|
||||
const [status, setStatus] = useState('in_progress')
|
||||
const [keywordInput, setKeywordInput] = useState('')
|
||||
const [keyword, setKeyword] = useState('')
|
||||
const [page, setPage] = useState(1)
|
||||
@@ -401,10 +492,14 @@ export default function WorkerOrdersPage() {
|
||||
width: 180,
|
||||
render: (_, row) => {
|
||||
const note = String(row.workerNote || '').trim()
|
||||
const theme = resolveNoteTheme(note)
|
||||
return (
|
||||
<div className="worker-note-cell">
|
||||
{note ? (
|
||||
<div className="worker-note-badge" onClick={() => openNoteModal(row)}>
|
||||
<div
|
||||
className={`worker-note-badge theme-${theme}`}
|
||||
onClick={() => openNoteModal(row)}
|
||||
>
|
||||
<span className="worker-note-text" title={note}>
|
||||
{note}
|
||||
</span>
|
||||
@@ -690,7 +785,10 @@ export default function WorkerOrdersPage() {
|
||||
<div className="worker-order-mobile-footer-row">
|
||||
<div className="worker-order-mobile-note-block">
|
||||
{workerNote ? (
|
||||
<div className="worker-note-badge" onClick={() => openNoteModal(order)}>
|
||||
<div
|
||||
className={`worker-note-badge theme-${resolveNoteTheme(workerNote)}`}
|
||||
onClick={() => openNoteModal(order)}
|
||||
>
|
||||
<span className="worker-note-text" title={workerNote}>
|
||||
{workerNote}
|
||||
</span>
|
||||
@@ -1012,13 +1110,13 @@ export default function WorkerOrdersPage() {
|
||||
<Form form={noteForm} layout="vertical" onFinish={saveOrderNote}>
|
||||
<Form.Item label="快捷选择标签" style={{ marginBottom: 12 }}>
|
||||
<div className="worker-note-preset-tags">
|
||||
{['已安排', '未安排', '打单中', '账号问题', '排队中', '暂缓做单'].map((tag) => (
|
||||
{PRESET_NOTE_TAGS.map((item) => (
|
||||
<Tag
|
||||
key={tag}
|
||||
className="worker-note-preset-tag"
|
||||
onClick={() => noteForm.setFieldsValue({ note: tag })}
|
||||
key={item.label}
|
||||
className={`worker-note-preset-tag theme-${item.theme}`}
|
||||
onClick={() => noteForm.setFieldsValue({ note: item.label })}
|
||||
>
|
||||
{tag}
|
||||
{item.label}
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user