feat(consignment): 新增和平精英寄卖库存管理、定向收集审核与工单智能匹配履约

This commit is contained in:
yml2213
2026-09-14 11:39:15 +08:00
parent 38c0cf1223
commit 1aa6dba931
30 changed files with 6350 additions and 44 deletions
@@ -0,0 +1,453 @@
import {
CheckCircleOutlined,
CloudUploadOutlined,
LockOutlined,
TrophyOutlined,
} from '@ant-design/icons'
import {
Alert,
App,
Button,
Card,
Col,
Descriptions,
Form,
Image,
Input,
InputNumber,
Radio,
Result,
Row,
Select,
Space,
Spin,
Tag,
Typography,
Upload,
} from 'antd'
import type { UploadFile } from 'antd'
import { useEffect, useState } from 'react'
import { useParams } from 'react-router'
import {
fetchPublicConsignmentLink,
submitPublicConsignment,
uploadConsignmentImage,
} from '@/services/consignment-public'
import type { ConsignmentCollectLink, ConsignmentSubmission } from '@/types/consignment'
const { Title, Paragraph, Text } = Typography
export default function ConsignmentCollectPage() {
const { message } = App.useApp()
const { token } = useParams<{ token: string }>()
const [loading, setLoading] = useState(true)
const [errorMsg, setErrorMsg] = useState('')
const [linkInfo, setLinkInfo] = useState<ConsignmentCollectLink | null>(null)
const [submittedResult, setSubmittedResult] = useState<ConsignmentSubmission | null>(null)
const [fileList, setFileList] = useState<UploadFile[]>([])
const [submitting, setSubmitting] = useState(false)
const [form] = Form.useForm()
useEffect(() => {
if (!token) {
setErrorMsg('缺少收集凭证')
setLoading(false)
return
}
fetchPublicConsignmentLink(token)
.then((res) => {
const data = res.data
setLinkInfo(data)
const briStr = data.brillianceCount > 0 ? `${data.brillianceCount}璀璨` : ''
form.setFieldsValue({
itemName:
data.title ||
`${data.system}${data.serverZone}${data.series}${data.diamondLevel}钻${briStr}`,
system: data.system || '苹果',
serverZone: data.serverZone || '微信区',
series: data.series || '暗潮',
diamondLevel: data.diamondLevel || 1,
brillianceCount: data.brillianceCount || 0,
askingPrice: data.presetPriceFen > 0 ? data.presetPriceFen / 100 : undefined,
loginMethod: 'wechat_qrcode',
})
})
.catch((err: any) => {
setErrorMsg(err.message || '获取收集信息失败或链接已失效')
})
.finally(() => {
setLoading(false)
})
}, [token, form])
async function handleSubmit(values: any) {
if (!token) return
setSubmitting(true)
try {
const askingPriceFen = Math.round(Number(values.askingPrice || 0) * 100)
const screenshots = fileList
.filter((f) => f.status === 'done' && (f.response?.url || f.url))
.map((f) => f.response?.url || f.url)
const payload = {
itemName: values.itemName,
system: values.system,
serverZone: values.serverZone,
series: values.series,
diamondLevel: Number(values.diamondLevel || 1),
brillianceCount: Number(values.brillianceCount || 0),
sellerContact: values.sellerContact,
contactInfo: values.sellerContact,
sellerPhone: values.sellerPhone,
sellerGameId: values.sellerGameId,
sellerPaymentInfo: values.sellerPaymentInfo,
askingPriceFen,
screenshotsJson: screenshots,
contentJson: {
loginMethod: values.loginMethod,
account: values.account,
password: values.password,
authNote: values.authNote,
sellerNote: values.sellerNote,
},
}
const res = await submitPublicConsignment(token, payload)
setSubmittedResult(res.data)
message.success('寄卖申请提交成功!')
} catch (err: any) {
message.error(err.message || '提交失败,请重试')
} finally {
setSubmitting(false)
}
}
if (loading) {
return (
<div style={{ padding: '60px 20px', textAlign: 'center' }}>
<Spin size="large" />
<div style={{ marginTop: 16, color: '#8c8c8c' }}>正在加载寄卖登记信息...</div>
</div>
)
}
if (errorMsg) {
return (
<div style={{ maxWidth: 600, margin: '40px auto', padding: '0 16px' }}>
<Result
status="warning"
title="链接无法访问"
subTitle={errorMsg}
extra={<Text type="secondary">如有疑问,请联系客服重新获取有效链接</Text>}
/>
</div>
)
}
if (submittedResult) {
return (
<div style={{ maxWidth: 600, margin: '40px auto', padding: '0 16px' }}>
<Card
bordered={false}
style={{ boxShadow: '0 4px 12px rgba(0,0,0,0.05)', borderRadius: 12 }}
>
<Result
status="success"
title="寄卖登记提交成功!"
subTitle={
<div>
<div>
您的登记单号:
<Text strong copyable>
{submittedResult.submissionNo}
</Text>
</div>
<div style={{ marginTop: 8 }}>
客服将在核实账号及物品品质后,通过您填写的联系方式与您确认交接并打款。
</div>
</div>
}
extra={[
<Button key="back" type="primary" onClick={() => window.location.reload()}>
返回重新填写
</Button>,
]}
/>
</Card>
</div>
)
}
return (
<div
style={{
minHeight: '100vh',
background: '#f5f7fa',
padding: '24px 16px 60px',
}}
>
<div style={{ maxWidth: 680, margin: '0 auto' }}>
{/* 顶部标题区 */}
<Card
bordered={false}
style={{
borderRadius: 12,
marginBottom: 16,
boxShadow: '0 2px 8px rgba(0,0,0,0.04)',
background: 'linear-gradient(135deg, #1890ff 0%, #096dd9 100%)',
color: '#fff',
}}
>
<Space orientation="vertical" size={6} style={{ width: '100%' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<TrophyOutlined style={{ fontSize: 24, color: '#ffd666' }} />
<Title level={4} style={{ color: '#fff', margin: 0 }}>
{linkInfo?.title || '和平精英 装备/账号 寄卖登记'}
</Title>
</div>
<Paragraph style={{ color: 'rgba(255,255,255,0.85)', margin: 0, fontSize: 13 }}>
平台保障 · 极速审核 · 验货即打款 · 请如实填写以下信息
</Paragraph>
{linkInfo ? (
<div style={{ marginTop: 8, display: 'flex', flexWrap: 'wrap', gap: 6 }}>
{linkInfo.system ? <Tag color="blue">{linkInfo.system}</Tag> : null}
{linkInfo.serverZone ? <Tag color="cyan">{linkInfo.serverZone}</Tag> : null}
{linkInfo.series ? <Tag color="orange">{linkInfo.series}</Tag> : null}
{linkInfo.diamondLevel ? <Tag color="gold">{linkInfo.diamondLevel} 钻</Tag> : null}
{linkInfo.brillianceCount > 0 ? (
<Tag color="magenta">{linkInfo.brillianceCount} 璀璨</Tag>
) : null}
{linkInfo.presetPriceFen > 0 ? (
<Tag color="volcano" style={{ fontWeight: 600 }}>
指导收购价 ¥{(linkInfo.presetPriceFen / 100).toFixed(0)}
</Tag>
) : null}
</div>
) : null}
</Space>
</Card>
{/* 表单填写区 */}
<Card
bordered={false}
style={{
borderRadius: 12,
boxShadow: '0 2px 8px rgba(0,0,0,0.04)',
}}
>
<Form form={form} layout="vertical" onFinish={handleSubmit}>
<Title level={5} style={{ marginBottom: 16 }}>
1. 物品与规格确认
</Title>
<Row gutter={12}>
<Col span={12}>
<Form.Item name="system" label="操作系统" rules={[{ required: true }]}>
<Select
options={[
{ label: '苹果 (iOS)', value: '苹果' },
{ label: '安卓 (Android)', value: '安卓' },
{ label: '通用/双端', value: '通用' },
]}
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="serverZone" label="游戏区服" rules={[{ required: true }]}>
<Select
options={[
{ label: '微信区', value: '微信区' },
{ label: 'QQ区', value: 'QQ区' },
]}
/>
</Form.Item>
</Col>
</Row>
<Row gutter={12}>
<Col span={8}>
<Form.Item name="series" label="系列/枪系" rules={[{ required: true }]}>
<Select
options={[
{ label: '暗潮', value: '暗潮' },
{ label: '怒嚎', value: '怒嚎' },
{ label: '血宴', value: '血宴' },
{ label: '矩阵', value: '矩阵' },
{ label: '其他', value: '其他' },
]}
/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="diamondLevel" label="钻石等级" rules={[{ required: true }]}>
<Select
options={[
{ label: '1 钻', value: 1 },
{ label: '2 钻', value: 2 },
{ label: '3 钻', value: 3 },
{ label: '4 钻', value: 4 },
{ label: '5 钻', value: 5 },
{ label: '6 钻', value: 6 },
]}
/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item name="brillianceCount" label="璀璨数">
<InputNumber min={0} max={6} style={{ width: '100%' }} />
</Form.Item>
</Col>
</Row>
<Form.Item
name="itemName"
label="物品/账号名称"
rules={[{ required: true, message: '请输入物品名称' }]}
>
<Input placeholder="如:苹果微信暗潮1钻" />
</Form.Item>
<Form.Item
name="askingPrice"
label="期望转让/收购价格 (元)"
rules={[{ required: true, message: '请填写出价' }]}
>
<InputNumber
min={1}
step={1}
style={{ width: '100%' }}
placeholder="请输入您的心理价位 (元)"
/>
</Form.Item>
<Title level={5} style={{ margin: '24px 0 16px' }}>
2. 卖家联系与收款方式
</Title>
<Row gutter={12}>
<Col span={12}>
<Form.Item
name="sellerContact"
label="您的微信号/QQ号"
rules={[{ required: true, message: '请填写联系微信号或QQ' }]}
>
<Input placeholder="方便客服核实联系" />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="sellerPhone" label="联系电话">
<Input placeholder="手机号 (选填)" />
</Form.Item>
</Col>
</Row>
<Form.Item
name="sellerGameId"
label="游戏内角色名 / 角色数字ID"
rules={[{ required: true, message: '请填写游戏内角色名称或ID' }]}
>
<Input placeholder="如:和平精英-玩家张三 (用于核实号主)" />
</Form.Item>
<Form.Item
name="sellerPaymentInfo"
label="收款账户 (支付宝账号及姓名 或 微信收款卡号)"
rules={[{ required: true, message: '请填写收款信息' }]}
>
<Input placeholder="如:支付宝 13800000000 (张三) / 工商银行 6222... (张三)" />
</Form.Item>
<Title level={5} style={{ margin: '24px 0 16px' }}>
3. 凭据截图与账号交接 (仅内部审核验号可见)
</Title>
<Alert
showIcon
icon={<LockOutlined />}
type="info"
message="信息安全保障"
description="您填写的账号凭据与截图受平台严格加密保护,仅由官方指定客服在验货核实时可见,绝不泄露给任何无关第三方。"
style={{ marginBottom: 16 }}
/>
<Form.Item label="游戏内物品/品质/仓库截图证明 (最多4张)">
<Upload
listType="picture-card"
fileList={fileList}
maxCount={4}
customRequest={async ({ file, onSuccess, onError }) => {
try {
const res = await uploadConsignmentImage(file as File)
onSuccess?.(res)
} catch (err: any) {
onError?.(err)
message.error(err.message || '上传失败')
}
}}
onChange={({ fileList: nextList }) => setFileList(nextList)}
>
{fileList.length < 4 ? (
<div>
<CloudUploadOutlined style={{ fontSize: 20, color: '#1890ff' }} />
<div style={{ marginTop: 6, fontSize: 12 }}>上传截图</div>
</div>
) : null}
</Upload>
</Form.Item>
<Form.Item name="loginMethod" label="交付/上号方式">
<Radio.Group>
<Radio value="wechat_qrcode">微信扫码登录</Radio>
<Radio value="qq_qrcode">QQ扫码登录</Radio>
<Radio value="account_pwd">账号密码交付</Radio>
<Radio value="in_game_transfer">游戏内转赠/投喂</Radio>
</Radio.Group>
</Form.Item>
<Row gutter={12}>
<Col span={12}>
<Form.Item name="account" label="游戏账号/上号手机号">
<Input placeholder="如账号密码交付请填写" />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="password" label="上号密码">
<Input.Password placeholder="如需密码登录请填写" />
</Form.Item>
</Col>
</Row>
<Form.Item name="authNote" label="上号与二次验证说明">
<Input placeholder="如:需发微信确认登录、备用安全码、在线时间段等" />
</Form.Item>
<Form.Item name="sellerNote" label="其他留言与补充">
<Input.TextArea rows={2} placeholder="如有其他装备搭配或说明可在此补充" />
</Form.Item>
<Button
type="primary"
htmlType="submit"
size="large"
block
loading={submitting}
style={{
marginTop: 16,
height: 48,
fontSize: 16,
borderRadius: 8,
}}
>
提交寄卖申请并登记
</Button>
</Form>
</Card>
</div>
</div>
)
}