feat:寄卖增加对接客服,db脚本迁移修复

This commit is contained in:
2026-10-27 13:56:08 +08:00
parent 622bd779dd
commit a53321ef30
16 changed files with 43 additions and 225 deletions
@@ -48,8 +48,6 @@ type Selected = {
workerName?: string
/** 对接客服(用于履约前核对归属) */
contactSupporterName?: string
contactSupporterPhone?: string
contactSupporterWechat?: string
}
export type ConsignmentManualMatchModalProps = {
@@ -86,8 +84,6 @@ export default function ConsignmentManualMatchModal({
} | null>(null)
const [inventoryContact, setInventoryContact] = useState<{
contactSupporterName: string
contactSupporterPhone: string
contactSupporterWechat: string
} | null>(null)
const [selected, setSelected] = useState<Selected | null>(null)
const [confirmedPartial, setConfirmedPartial] = useState(false)
@@ -129,8 +125,6 @@ export default function ConsignmentManualMatchModal({
})
setInventoryContact({
contactSupporterName: res.data?.inventory?.contactSupporterName || '',
contactSupporterPhone: res.data?.inventory?.contactSupporterPhone || '',
contactSupporterWechat: res.data?.inventory?.contactSupporterWechat || '',
})
} else if (workOrder) {
const res = await fetchWorkOrderConsignmentMatchOptions(workOrder.workOrderId)
@@ -374,8 +368,6 @@ export default function ConsignmentManualMatchModal({
workerId: option.inventory.workerId,
workerName: option.inventory.workerName,
contactSupporterName: option.inventory.contactSupporterName,
contactSupporterPhone: option.inventory.contactSupporterPhone,
contactSupporterWechat: option.inventory.contactSupporterWechat,
})
setConfirmedPartial(false)
setConfirmedMismatch(false)
@@ -460,8 +452,6 @@ export default function ConsignmentManualMatchModal({
workerId: inventoryWorker?.workerId ?? null,
workerName: inventoryWorker?.workerName || '',
contactSupporterName: inventoryContact?.contactSupporterName || '',
contactSupporterPhone: inventoryContact?.contactSupporterPhone || '',
contactSupporterWechat: inventoryContact?.contactSupporterWechat || '',
})
setConfirmedPartial(false)
setConfirmedMismatch(false)
@@ -33,8 +33,6 @@ const { Text } = Typography
type ContactForm = {
name: string
phone?: string
wechat?: string
note?: string
sortOrder?: number
enabled?: boolean
@@ -98,8 +96,6 @@ export default function AdminConsignmentContactsPage() {
setEditingContact(record)
form.setFieldsValue({
name: record.name,
phone: record.phone,
wechat: record.wechat,
note: record.note,
sortOrder: record.sortOrder,
enabled: record.enabled,
@@ -113,8 +109,6 @@ export default function AdminConsignmentContactsPage() {
setSubmitting(true)
const payload = {
name: values.name,
phone: values.phone || '',
wechat: values.wechat || '',
note: values.note || '',
sortOrder: Number(values.sortOrder || 0),
enabled: values.enabled !== false,
@@ -174,30 +168,17 @@ export default function AdminConsignmentContactsPage() {
const columns: TableColumnsType<ConsignmentContactSupporter> = [
{
title: '姓名',
key: 'name',
dataIndex: 'name',
width: 160,
render: (_, record) => (
<Space direction="vertical" size={2}>
<Text strong>{record.name}</Text>
{record.note ? (
<Text type="secondary" style={{ fontSize: 12 }}>
{record.note}
</Text>
) : null}
</Space>
),
render: (value: string) => <Text strong>{value}</Text>,
},
{
title: '手机号',
dataIndex: 'phone',
width: 150,
render: (value: string) => value || <Text type="secondary">-</Text>,
},
{
title: '微信号',
dataIndex: 'wechat',
width: 160,
render: (value: string) => value || <Text type="secondary">-</Text>,
title: '备注',
dataIndex: 'note',
width: 240,
ellipsis: true,
render: (value: string) =>
value ? <Text style={{ fontSize: 12 }}>{value}</Text> : <Text type="secondary">-</Text>,
},
{
title: '排序',
@@ -265,7 +246,7 @@ export default function AdminConsignmentContactsPage() {
<Input
allowClear
prefix={<SearchOutlined />}
placeholder="搜索姓名 / 手机 / 微信 / 备注"
placeholder="搜索姓名 / 备注"
value={keywordInput}
onChange={(event) => setKeywordInput(event.target.value)}
style={{ width: 280 }}
@@ -313,14 +294,6 @@ export default function AdminConsignmentContactsPage() {
>
<Input placeholder="如:小张" maxLength={60} />
</Form.Item>
<Space size={12} style={{ width: '100%' }} align="start">
<Form.Item name="phone" label="手机号" style={{ width: 240 }}>
<Input placeholder="选填" maxLength={30} />
</Form.Item>
<Form.Item name="wechat" label="微信号" style={{ width: 240 }}>
<Input placeholder="选填" maxLength={60} />
</Form.Item>
</Space>
<Form.Item name="note" label="备注">
<Input.TextArea rows={2} placeholder="如:负责苏尔南寄卖 / 白班" maxLength={200} />
</Form.Item>
@@ -182,9 +182,7 @@ export default function ConsignmentInventoryPanel() {
queryFn: () => fetchAdminConsignmentContacts(),
})
const contactSupporterOptions = (contactsQuery.data?.data.items || []).map((item) => ({
label: `${item.name}${item.enabled ? '' : '(已禁用)'}${
item.phone ? ` · ${item.phone}` : item.wechat ? ` · ${item.wechat}` : ''
}`,
label: `${item.name}${item.enabled ? '' : '(已禁用)'}`,
value: item.id,
}))
@@ -475,17 +473,11 @@ export default function ConsignmentInventoryPanel() {
title: '对接客服',
key: 'contactSupporter',
width: 150,
render: (_, record) => {
const contact = formatConsignmentContactSupporter(record)
return (
<div style={{ fontSize: 12 }}>
<div style={{ fontWeight: 600 }}>{contact.name || contact.text}</div>
{contact.contact ? (
<div style={{ color: '#8c8c8c', marginTop: 2 }}>{contact.contact}</div>
) : null}
</div>
)
},
render: (_, record) => (
<div style={{ fontSize: 12, fontWeight: 600 }}>
{formatConsignmentContactSupporter(record).text}
</div>
),
},
{
title: '凭证',
@@ -1132,21 +1124,7 @@ export default function ConsignmentInventoryPanel() {
)}
</Descriptions.Item>
<Descriptions.Item label="对接客服">
{(() => {
const contact = formatConsignmentContactSupporter(viewingItem)
return contact.name ? (
<Space direction="vertical" size={2}>
<Text strong>{contact.name}</Text>
{contact.contact ? (
<Text type="secondary" style={{ fontSize: 12 }}>
{contact.contact}
</Text>
) : null}
</Space>
) : (
<Text type="secondary">未指定</Text>
)
})()}
<Text>{formatConsignmentContactSupporter(viewingItem).text}</Text>
</Descriptions.Item>
<Descriptions.Item label="履约押金要求">
{viewingItem.depositAmountFen ? (
@@ -276,17 +276,11 @@ export default function ConsignmentSubmissionsPanel() {
title: '对接客服',
key: 'contactSupporter',
width: 150,
render: (_, record) => {
const contact = formatConsignmentContactSupporter(record)
return (
<div style={{ fontSize: 12 }}>
<div style={{ fontWeight: 600 }}>{contact.name || contact.text}</div>
{contact.contact ? (
<div style={{ color: '#8c8c8c', marginTop: 2 }}>{contact.contact}</div>
) : null}
</div>
)
},
render: (_, record) => (
<div style={{ fontSize: 12, fontWeight: 600 }}>
{formatConsignmentContactSupporter(record).text}
</div>
),
},
{
title: '提报凭证(游戏主页截图)',
@@ -874,21 +868,7 @@ export default function ConsignmentSubmissionsPanel() {
)}
</Descriptions.Item>
<Descriptions.Item label="对接客服">
{(() => {
const contact = formatConsignmentContactSupporter(viewingSubmission)
return contact.name ? (
<Space direction="vertical" size={2}>
<Text strong>{contact.name}</Text>
{contact.contact ? (
<Text type="secondary" style={{ fontSize: 12 }}>
{contact.contact}
</Text>
) : null}
</Space>
) : (
<Text type="secondary">未指定</Text>
)
})()}
<Text>{formatConsignmentContactSupporter(viewingSubmission).text}</Text>
</Descriptions.Item>
<Descriptions.Item label="履约押金要求">
{viewingSubmission.depositAmountFen ? (
@@ -863,13 +863,7 @@ export default function WorkerConsignmentPage() {
placeholder="请选择对接客服"
options={contactSupporters.map((item) => ({
value: item.id,
label: `${item.name}${
item.phone
? ` · ${item.phone}`
: item.wechat
? ` · ${item.wechat}`
: ''
}`,
label: item.name,
}))}
notFoundContent="暂无启用中的对接客服"
showSearch
-4
View File
@@ -417,8 +417,6 @@ export type WorkerConsignmentItem = {
contentJson: Record<string, unknown>
contactSupporterId?: number | null
contactSupporterName?: string
contactSupporterPhone?: string
contactSupporterWechat?: string
createdAt: string
}
@@ -462,8 +460,6 @@ export type WorkerConsignmentRecord = {
depositAmountFen: number
contactSupporterId?: number | null
contactSupporterName?: string
contactSupporterPhone?: string
contactSupporterWechat?: string
reviewNote: string
screenshotsJson: string[]
giftEvidenceImages?: string[]
-6
View File
@@ -15,8 +15,6 @@ export type GiftEvidenceReviewStatus = 'none' | 'pending' | 'accepted' | 'submit
export type ConsignmentContactSupporter = {
id: number
name: string
phone: string
wechat: string
note: string
enabled: boolean
sortOrder: number
@@ -28,8 +26,6 @@ export type ConsignmentContactSupporter = {
export type ConsignmentContactFields = {
contactSupporterId?: number | null
contactSupporterName?: string
contactSupporterPhone?: string
contactSupporterWechat?: string
}
/**
@@ -141,8 +137,6 @@ export type ConsignmentFulfillmentInfo = {
/** 对接客服(履约时从现货复制到工单物料,用于工单侧联系) */
contactSupporterId?: number | null
contactSupporterName?: string
contactSupporterPhone?: string
contactSupporterWechat?: string
[key: string]: unknown
}
+2 -17
View File
@@ -2,17 +2,13 @@
export type ConsignmentContactDisplay = {
/** 姓名;没有对接客服时为空串 */
name: string
/** 联系方式(电话 / 微信),没有时为空串 */
contact: string
/** 姓名 + 联系方式,列表里直接展示 */
/** 姓名,没有时回退为指定文案(默认「未指定」) */
text: string
}
type ConsignmentContactLike =
| {
contactSupporterName?: string | null
contactSupporterPhone?: string | null
contactSupporterWechat?: string | null
}
| null
| undefined
@@ -22,16 +18,5 @@ export function formatConsignmentContactSupporter(
emptyText = '未指定',
): ConsignmentContactDisplay {
const name = String(source?.contactSupporterName || '').trim()
const phone = String(source?.contactSupporterPhone || '').trim()
const wechat = String(source?.contactSupporterWechat || '').trim()
const parts: string[] = []
if (phone) parts.push(`电话 ${phone}`)
if (wechat) parts.push(`微信 ${wechat}`)
const contact = parts.join(' · ')
if (!name) {
return { name: '', contact, text: contact || emptyText }
}
return { name, contact, text: contact ? `${name} · ${contact}` : name }
return { name, text: name || emptyText }
}