feat(semi-auto): 虎牙客户页登录→资料→绑定流程与返回上一步重置
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Suspense, lazy, useEffect } from 'react'
|
||||
import { Suspense, lazy, useEffect, useLayoutEffect } from 'react'
|
||||
import { Spin } from 'antd'
|
||||
import {
|
||||
BrowserRouter,
|
||||
@@ -169,6 +169,21 @@ function OrderServiceApplication() {
|
||||
|
||||
function CustomerFulfillmentApplication() {
|
||||
useClearStrayHash()
|
||||
/**
|
||||
* 客户履约页固定移动端:
|
||||
* 全局 base.css 给 body 设了 min-width:320px,worker.css 又用 overflow-x:hidden
|
||||
* 裁掉横向溢出。应用内浏览器/分屏/系统显示放大时,实际视口可能小于 320px,
|
||||
* 页面右侧(输入框、商品值、提示文案)会被直接裁掉。
|
||||
* 这里只给客户履约路由挂移动端根类,覆盖最小宽度,不影响后台与打手端。
|
||||
*/
|
||||
useLayoutEffect(() => {
|
||||
document.documentElement.classList.add('customer-mobile-html')
|
||||
document.body.classList.add('customer-mobile-body')
|
||||
return () => {
|
||||
document.documentElement.classList.remove('customer-mobile-html')
|
||||
document.body.classList.remove('customer-mobile-body')
|
||||
}
|
||||
}, [])
|
||||
// 非标准子路径也按首段路径绑定平台,避免 /c/.../extra 这类地址绕过严格绑定。
|
||||
const prefix = window.location.pathname.split('/').filter(Boolean)[0]
|
||||
const wildcardPlatform = prefix === 'c' ? 'huya' : prefix === 'd' ? 'weibo' : undefined
|
||||
|
||||
@@ -53,6 +53,7 @@ import { resolvePostInjectionUrl } from '@/utils/semi-auto-injection'
|
||||
const { Text } = Typography
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
waiting_profile: 'gold',
|
||||
waiting_customer: 'blue',
|
||||
waiting_login: 'blue',
|
||||
login_scanned: 'cyan',
|
||||
@@ -773,19 +774,49 @@ export default function AdminSemiAutoTasksPage() {
|
||||
? '微博登录即授权'
|
||||
: BINDING_STATUS_LABELS[detail.task.bindingStatus] || detail.task.bindingStatus}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="绑定角色">
|
||||
{detail.task.bindGameRole
|
||||
? `${detail.task.bindGameRole}${detail.task.bindGameRoleId ? `(${detail.task.bindGameRoleId})` : '(无角色ID)'}`
|
||||
: '-'}
|
||||
<Descriptions.Item label="平台绑定角色">
|
||||
{detail.task.bindGameRole || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="平台角色ID">
|
||||
{detail.task.bindGameRoleId || detail.task.huyaUid || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="平台绑定渠道">
|
||||
{[
|
||||
detail.task.bindGameChannel,
|
||||
detail.comparison?.boundZone ? `识别区服 ${detail.comparison.boundZone}` : '',
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ') || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="客户填写角色">
|
||||
{detail.task.customerGameRoleName
|
||||
? `${detail.task.customerGameRoleName}${detail.task.customerGameRoleId ? `(${detail.task.customerGameRoleId})` : ''}`
|
||||
: '-'}
|
||||
{detail.task.customerGameRoleName || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="区服">
|
||||
<Descriptions.Item label="客户游戏编号">
|
||||
{detail.task.customerGameRoleId || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="客户区服">
|
||||
{detail.task.customerServerZone || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="角色比对" span={2}>
|
||||
<Space direction="vertical" size={2}>
|
||||
<Tag
|
||||
color={
|
||||
detail.comparison?.verdict === 'match'
|
||||
? 'green'
|
||||
: detail.comparison?.verdict === 'mismatch'
|
||||
? 'red'
|
||||
: 'orange'
|
||||
}
|
||||
>
|
||||
{detail.comparison?.verdict === 'match'
|
||||
? '三项一致,可提交平台绑定'
|
||||
: detail.comparison?.verdict === 'mismatch'
|
||||
? '资料与平台角色不一致'
|
||||
: '信息不完整,需人工核实'}
|
||||
</Tag>
|
||||
<Text type="secondary">{detail.comparison?.message || '-'}</Text>
|
||||
</Space>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="客服">
|
||||
{detail.task.assignedAdminName || '未领取'}
|
||||
</Descriptions.Item>
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
pollCustomerBinding,
|
||||
pollCustomerLogin,
|
||||
pollCustomerWeiboQrLogin,
|
||||
resetCustomerBinding,
|
||||
saveCustomerTaskProfile,
|
||||
sendCustomerHuyaSmsCode,
|
||||
sendCustomerWeiboSmsCode,
|
||||
@@ -56,7 +57,7 @@ export default function CustomerFulfillmentPage({
|
||||
}: {
|
||||
expectedPlatform?: CustomerFulfillmentPlatform
|
||||
}) {
|
||||
const { message, modal } = App.useApp()
|
||||
const { message } = App.useApp()
|
||||
const { orderNo: routeOrderNo } = useParams<{ orderNo?: string }>()
|
||||
const navigate = useNavigate()
|
||||
const { search, hash } = useLocation()
|
||||
@@ -86,8 +87,8 @@ export default function CustomerFulfillmentPage({
|
||||
const [profileServerZone, setProfileServerZone] = useState('')
|
||||
const [profileSaving, setProfileSaving] = useState(false)
|
||||
const [profileEditing, setProfileEditing] = useState(false)
|
||||
const [rebindFailureDismissed, setRebindFailureDismissed] = useState(false)
|
||||
const startingBindingRef = useRef(false)
|
||||
const resettingBindingRef = useRef(false)
|
||||
const hydratingBindingRef = useRef(false)
|
||||
const autoOpenedRoleRef = useRef('')
|
||||
const redirectingRef = useRef(false)
|
||||
@@ -100,6 +101,13 @@ export default function CustomerFulfillmentPage({
|
||||
[selectedTaskId, tasks],
|
||||
)
|
||||
const isWeibo = selectedTask?.platform === 'weibo'
|
||||
// 虎牙流程:登录 → 填写资料(区服/游戏编号/角色名)→ 绑定角色。
|
||||
// 三项资料齐全前不生成绑定二维码,避免客户在资料缺失时先绑错角色。
|
||||
const profileComplete = Boolean(
|
||||
String(selectedTask?.customerServerZone || '').trim() &&
|
||||
String(selectedTask?.customerGameRoleId || '').trim() &&
|
||||
String(selectedTask?.customerGameRoleName || '').trim(),
|
||||
)
|
||||
|
||||
const load = useCallback(
|
||||
async (silent = false) => {
|
||||
@@ -171,7 +179,6 @@ export default function CustomerFulfillmentPage({
|
||||
autoOpenedRoleRef.current = ''
|
||||
setBindingSessionExpired(false)
|
||||
setBindingLoadError('')
|
||||
setRebindFailureDismissed(false)
|
||||
}, [selectedTask?.id])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -263,10 +270,12 @@ export default function CustomerFulfillmentPage({
|
||||
return () => window.clearInterval(timer)
|
||||
}, [orderNo, selectedTask?.id, selectedTask?.loginStatus, selectedTask?.platform])
|
||||
|
||||
// 登录成功后自动进入绑定阶段;失败或过期时由客户点按钮重试,避免页面来回跳。
|
||||
// 登录并填写完整资料后才自动进入绑定阶段;资料不全或客户正在返回修改资料时停留在资料步骤。
|
||||
// 失败或过期时由客户点按钮重试,避免页面来回跳。
|
||||
useEffect(() => {
|
||||
if (!selectedTask || !orderNo || selectedTask.platform !== 'huya') return
|
||||
if (selectedTask.loginStatus !== 'authenticated') return
|
||||
if (!profileComplete || profileEditing) return
|
||||
if (selectedTask.bindingStatus === 'confirmed') return
|
||||
if (selectedTask.bindingStatus !== 'not_started' || startingBindingRef.current) return
|
||||
startingBindingRef.current = true
|
||||
@@ -293,6 +302,8 @@ export default function CustomerFulfillmentPage({
|
||||
}, [
|
||||
message,
|
||||
orderNo,
|
||||
profileComplete,
|
||||
profileEditing,
|
||||
selectedTask?.bindingStatus,
|
||||
selectedTask?.id,
|
||||
selectedTask?.loginStatus,
|
||||
@@ -374,7 +385,9 @@ export default function CustomerFulfillmentPage({
|
||||
if (!bindingInfo?.comparison) return
|
||||
// 换绑后仍是原角色时只展示失败原因,不能自动弹出确认框。
|
||||
if (bindingInfo.rebindUnchanged) return
|
||||
// 识别到角色(含与资料不一致)都要弹出对比框,由客户选择修改资料或同步平台角色。
|
||||
// 只有三项完全一致才自动弹出核对框,让客户直接提交平台绑定;
|
||||
// 不一致时不弹框,由下方「重新扫码换绑 / 上一步修改资料」两个按钮处理。
|
||||
if (bindingInfo.comparison.verdict !== 'match') return
|
||||
const key = `${selectedTask.id}:${bindingInfo.bindGameRoleId || ''}`
|
||||
if (autoOpenedRoleRef.current === key) return
|
||||
autoOpenedRoleRef.current = key
|
||||
@@ -509,7 +522,7 @@ export default function CustomerFulfillmentPage({
|
||||
)
|
||||
setLoginInfo(response.data.login)
|
||||
setHuyaChallenge(null)
|
||||
message.success(isWeibo ? '微博登录成功,等待客服处理' : '登录成功,请继续绑定游戏角色')
|
||||
message.success(isWeibo ? '微博登录成功,等待客服处理' : '登录成功,请填写游戏角色资料')
|
||||
} catch (error) {
|
||||
const errorCode = (error as { errorCode?: string } | null)?.errorCode || ''
|
||||
if (errorCode === 'weibo_sms_mfa_required') {
|
||||
@@ -597,13 +610,21 @@ export default function CustomerFulfillmentPage({
|
||||
}
|
||||
return
|
||||
}
|
||||
// 资料不一致同样打开对比框,客户可在弹窗内修改资料或同步平台角色。
|
||||
setBindingConfirmOpen(true)
|
||||
// 只有三项完全一致才打开核对框;不一致由页面按钮引导换绑或修改资料。
|
||||
if (nextBinding?.comparison?.verdict === 'match') {
|
||||
setBindingConfirmOpen(true)
|
||||
} else {
|
||||
setBindingConfirmOpen(false)
|
||||
message.warning(
|
||||
nextBinding?.comparison?.message ||
|
||||
'平台角色与已填资料不一致,请重新扫码换绑或修改资料',
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (nextTask.bindingStatus === 'confirmed') {
|
||||
setBindingConfirmOpen(false)
|
||||
message.success('绑定已确认,等待客服处理')
|
||||
message.success('已提交平台绑定,等待客服处理')
|
||||
return
|
||||
}
|
||||
// 弹窗内点「刷新」:角色不再是待确认状态时收起弹窗,避免展示过期比对。
|
||||
@@ -661,7 +682,7 @@ export default function CustomerFulfillmentPage({
|
||||
return
|
||||
}
|
||||
if (nextTask.bindingStatus === 'role_ready') {
|
||||
message.success('换绑已生效,请核对角色后确认绑定')
|
||||
message.success('换绑已生效,请核对角色后提交平台绑定')
|
||||
return
|
||||
}
|
||||
message.info('已向虎牙提交换绑,正在等待角色生效')
|
||||
@@ -680,55 +701,17 @@ export default function CustomerFulfillmentPage({
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSyncBindingProfile() {
|
||||
if (!selectedTask) return
|
||||
const comparison = bindingInfo?.comparison
|
||||
if (!comparison) return
|
||||
const roleName = comparison.boundRoleName
|
||||
const roleId = comparison.boundRoleId
|
||||
const serverZone = comparison.boundZone
|
||||
if (!roleName || !roleId || !/^\d+$/.test(roleId) || !serverZone) {
|
||||
message.warning('平台角色信息不完整,请点「修改资料」手动填写')
|
||||
return
|
||||
}
|
||||
setProfileSaving(true)
|
||||
try {
|
||||
const response = await saveCustomerTaskProfile(orderNo, selectedTask.id, {
|
||||
roleName,
|
||||
roleId,
|
||||
serverZone,
|
||||
})
|
||||
setTasks((current) =>
|
||||
current.map((task) => (task.id === response.data.task.id ? response.data.task : task)),
|
||||
)
|
||||
const bindingResponse = await pollCustomerBinding(orderNo, selectedTask.id)
|
||||
if (bindingResponse.data.binding) setBindingInfo(bindingResponse.data.binding)
|
||||
reopenBindingConfirm(bindingResponse.data.task, bindingResponse.data.binding)
|
||||
message.success('资料已按平台角色同步,请核对后确认绑定')
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '同步角色资料失败')
|
||||
} finally {
|
||||
setProfileSaving(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleConfirmBinding(acceptExistingRole = false) {
|
||||
async function handleConfirmBinding() {
|
||||
if (!selectedTask) return
|
||||
setBindingLoading(true)
|
||||
try {
|
||||
const response = await confirmCustomerBinding(
|
||||
orderNo,
|
||||
selectedTask.id,
|
||||
acceptExistingRole ? { acceptExistingRole: true } : {},
|
||||
)
|
||||
const response = await confirmCustomerBinding(orderNo, selectedTask.id)
|
||||
setTasks((current) =>
|
||||
current.map((task) => (task.id === response.data.task.id ? response.data.task : task)),
|
||||
)
|
||||
setBindingInfo(response.data.binding)
|
||||
setBindingConfirmOpen(false)
|
||||
message.success(
|
||||
acceptExistingRole ? '已按原绑定角色确认,等待客服处理' : '绑定已确认,等待客服处理',
|
||||
)
|
||||
message.success('已提交平台绑定,等待客服处理')
|
||||
} catch (error) {
|
||||
if (isHuyaSessionExpired(error)) {
|
||||
setBindingSessionExpired(true)
|
||||
@@ -736,48 +719,62 @@ export default function CustomerFulfillmentPage({
|
||||
message.warning('虎牙登录会话已过期,请重新登录')
|
||||
return
|
||||
}
|
||||
message.error(error instanceof Error ? error.message : '确认绑定失败')
|
||||
message.error(error instanceof Error ? error.message : '提交平台绑定失败')
|
||||
} finally {
|
||||
setBindingLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
/** 换绑被虎牙拒绝时的二次确认:客户可以选择继续使用原绑定角色。 */
|
||||
function handleAcceptExistingRole() {
|
||||
if (!selectedTask || bindingLoading) return
|
||||
const reason = String(bindingInfo?.rebindConfirmMessage || '').trim()
|
||||
modal.confirm({
|
||||
title: '确认使用原角色?',
|
||||
content: `本次换绑未成功${reason ? `(${reason})` : ''},平台仍返回原绑定角色「${
|
||||
bindingRoleName || '当前角色'
|
||||
}」。确认后本次换绑作废,直接使用该角色继续履约。`,
|
||||
okText: '确认使用原角色',
|
||||
cancelText: '先不确认',
|
||||
onOk: () => handleConfirmBinding(true),
|
||||
})
|
||||
}
|
||||
|
||||
/** 资料变更后重新打开对比弹窗,让客户基于最新两侧信息再次核对。 */
|
||||
/** 资料变更后重新打开核对弹窗:只有三项完全一致才让客户直接提交平台绑定。 */
|
||||
function reopenBindingConfirm(
|
||||
nextTask: CustomerSemiAutoTask,
|
||||
nextBinding: CustomerBindingInfo | null | undefined,
|
||||
) {
|
||||
if (nextTask.bindingStatus !== 'role_ready') return false
|
||||
if (!nextBinding?.comparison || nextBinding.rebindUnchanged) return false
|
||||
if (nextBinding.comparison.verdict !== 'match') return false
|
||||
autoOpenedRoleRef.current = `${nextTask.id}:${nextBinding.bindGameRoleId || ''}`
|
||||
setBindingConfirmOpen(true)
|
||||
return true
|
||||
}
|
||||
|
||||
/** 从对比弹窗回到资料表单,保存成功后会自动重新打开对比。 */
|
||||
function openProfileEditor() {
|
||||
/**
|
||||
* 返回第二步修改资料:
|
||||
* 立即切回资料表单(步骤条高亮第 2 步、隐藏绑定/换绑结果),同时调后端清空虎牙
|
||||
* 绑定与换绑失败状态;登录状态和已填资料保留,客户提交资料后重新走绑定流程。
|
||||
*/
|
||||
async function openProfileEditor() {
|
||||
if (!selectedTask) return
|
||||
if (resettingBindingRef.current) return
|
||||
setBindingConfirmOpen(false)
|
||||
setProfileEditing(true)
|
||||
// 资料步骤会隐藏绑定二维码与比对区,等 React 完成切换后再回到第二步顶部。
|
||||
window.setTimeout(() => {
|
||||
document
|
||||
.getElementById('customer-profile-form')
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
}, 0)
|
||||
.getElementById('customer-binding-stage')
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
}, 60)
|
||||
if (selectedTask.platform !== 'huya' || selectedTask.bindingStatus === 'not_started') return
|
||||
resettingBindingRef.current = true
|
||||
try {
|
||||
const response = await resetCustomerBinding(orderNo, selectedTask.id)
|
||||
setTasks((current) =>
|
||||
current.map((task) => (task.id === response.data.task.id ? response.data.task : task)),
|
||||
)
|
||||
// 换绑失败原因(rebindUnchanged / rebindConfirmState 等)随绑定详情一并清掉。
|
||||
setBindingInfo(response.data.binding)
|
||||
setBindingLoadError('')
|
||||
message.success('已返回上一步,请修改资料后重新提交')
|
||||
} catch (error) {
|
||||
if (isHuyaSessionExpired(error)) {
|
||||
setBindingSessionExpired(true)
|
||||
} else {
|
||||
// 重置失败不阻断客户改资料,保存后会重新识别平台角色。
|
||||
message.error(error instanceof Error ? error.message : '重置绑定状态失败,请稍后重试')
|
||||
}
|
||||
} finally {
|
||||
resettingBindingRef.current = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSaveProfile() {
|
||||
@@ -790,6 +787,10 @@ export default function CustomerFulfillmentPage({
|
||||
message.warning('请选择区服')
|
||||
return
|
||||
}
|
||||
if (!/^\d+$/.test(profileRoleId.trim())) {
|
||||
message.warning('游戏编号只能是数字')
|
||||
return
|
||||
}
|
||||
setProfileSaving(true)
|
||||
try {
|
||||
const response = await saveCustomerTaskProfile(orderNo, selectedTask.id, {
|
||||
@@ -809,7 +810,7 @@ export default function CustomerFulfillmentPage({
|
||||
} catch {
|
||||
// 绑定尚未开始时没有 binding,可忽略。
|
||||
}
|
||||
message.success(reopened ? '角色资料已保存,请重新核对绑定角色' : '角色资料已保存')
|
||||
message.success(reopened ? '资料已保存且与平台角色一致,请提交平台绑定' : '资料已保存')
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '保存角色资料失败')
|
||||
} finally {
|
||||
@@ -846,7 +847,6 @@ export default function CustomerFulfillmentPage({
|
||||
}
|
||||
}
|
||||
|
||||
const config = selectedTask?.semiAutoConfig || {}
|
||||
const displayTitle = isWeibo ? '微博账号登录授权' : '绑定游戏角色'
|
||||
const loginQrVisible =
|
||||
Boolean(selectedTask) && ['qr_pending', 'scanned'].includes(selectedTask.loginStatus)
|
||||
@@ -857,9 +857,9 @@ export default function CustomerFulfillmentPage({
|
||||
selectedTask.executionStatus !== 'completed' &&
|
||||
selectedTask.executionStatus !== 'cancelled',
|
||||
)
|
||||
const bindingQrVisible = ['not_started', 'qr_pending', 'scanned'].includes(
|
||||
selectedTask?.bindingStatus || '',
|
||||
)
|
||||
const bindingQrVisible =
|
||||
profileComplete &&
|
||||
['not_started', 'qr_pending', 'scanned'].includes(selectedTask?.bindingStatus || '')
|
||||
const bindingComparison = bindingInfo?.comparison || null
|
||||
const bindingRoleId = bindingInfo?.bindGameRoleId || selectedTask?.bindGameRoleId || ''
|
||||
// 虎牙 gameRole.roleId 是加密串,客户侧统一展示数值 UID(huyaUid)。
|
||||
@@ -871,8 +871,9 @@ export default function CustomerFulfillmentPage({
|
||||
})()
|
||||
const bindingRoleName = bindingInfo?.bindGameRole || selectedTask?.bindGameRole || ''
|
||||
const rebindUnchanged = bindingInfo?.rebindUnchanged === true
|
||||
// 换绑失败视图可返回「已识别角色 + 资料不一致」的核对界面;后端 rebindUnchanged 保持不变。
|
||||
const showRebindFailure = rebindUnchanged && !rebindFailureDismissed
|
||||
// 换绑被虎牙拒绝或未生效时展示失败原因;若客户已把资料改成与平台当前角色一致,
|
||||
// 比对为 match,则回到正常提交流程,不再显示换绑失败。
|
||||
const showRebindFailure = rebindUnchanged && bindingComparison?.verdict !== 'match'
|
||||
const rebindConfirmState = bindingInfo?.rebindConfirmState || 'idle'
|
||||
const rebindRejected = rebindConfirmState === 'rejected'
|
||||
const rebindAccepted = rebindConfirmState === 'accepted'
|
||||
@@ -886,12 +887,18 @@ export default function CustomerFulfillmentPage({
|
||||
(bindingInfo?.requiresSupport ??
|
||||
(Boolean(bindingInfo?.bindGameRole || bindingRoleName) && !bindingRoleIdNumeric))
|
||||
// 绑定阶段顶部状态条:按 bindingStatus 显式映射,已确认/已过期/失败不再显示(各自有卡片)。
|
||||
const comparisonMismatch =
|
||||
selectedTask?.bindingStatus === 'role_ready' && bindingComparison?.verdict === 'mismatch'
|
||||
const comparisonUnknown =
|
||||
selectedTask?.bindingStatus === 'role_ready' && bindingComparison?.verdict === 'unknown'
|
||||
// 平台没给出可核对角色或比对缺项时,都只能转客服人工核实。
|
||||
const bindingNeedsSupport = bindingRequiresSupport || comparisonUnknown
|
||||
const bindingBanner = (() => {
|
||||
if (bindingSessionExpired) return null
|
||||
if (bindingRequiresSupport && selectedTask?.bindingStatus !== 'confirmed') {
|
||||
if (bindingNeedsSupport && selectedTask?.bindingStatus !== 'confirmed') {
|
||||
return {
|
||||
tone: 'is-warning',
|
||||
text: '已登录,但平台未返回可核对的角色ID,请联系客服人工核实',
|
||||
text: '已登录,但两侧角色信息不完整,无法自动核对,请联系客服人工核实',
|
||||
}
|
||||
}
|
||||
if (showRebindFailure) {
|
||||
@@ -900,8 +907,12 @@ export default function CustomerFulfillmentPage({
|
||||
text: rebindRejected ? '虎牙未接受本次换绑,请查看下方原因' : '换绑未生效,请查看下方原因',
|
||||
}
|
||||
}
|
||||
if (comparisonMismatch) {
|
||||
return { tone: 'is-warning', text: '平台角色与已填资料不一致,请重新扫码换绑或修改资料' }
|
||||
}
|
||||
if (selectedTask?.bindingStatus === 'role_ready') {
|
||||
return { tone: 'is-info', text: '已识别绑定角色,请核对后确认' }
|
||||
if (!bindingComparison) return { tone: 'is-info', text: '正在核对平台角色,请稍候' }
|
||||
return { tone: 'is-info', text: '平台角色与已填资料一致,请提交平台绑定' }
|
||||
}
|
||||
if (
|
||||
selectedTask?.bindingStatus === 'confirmed' ||
|
||||
@@ -921,27 +932,8 @@ export default function CustomerFulfillmentPage({
|
||||
const nextRebindText = bindingInfo?.nextRebindAt
|
||||
? formatAdminDateTime(bindingInfo.nextRebindAt)
|
||||
: ''
|
||||
const comparisonMismatch =
|
||||
selectedTask?.bindingStatus === 'role_ready' && bindingComparison?.verdict === 'mismatch'
|
||||
const showProfileForm = showBindingStage && profileEditing
|
||||
const bindingCustomerReady = Boolean(
|
||||
bindingComparison?.customerRoleId || bindingComparison?.customerRoleName,
|
||||
)
|
||||
// 平台角色名、数字角色 ID、区服齐全时,才支持一键同步为平台角色。
|
||||
const canSyncBindingProfile = Boolean(
|
||||
bindingComparison?.boundRoleName &&
|
||||
/^\d+$/.test(String(bindingComparison?.boundRoleId || '').trim()) &&
|
||||
bindingComparison?.boundZone,
|
||||
)
|
||||
const needsProfileCollection = Boolean(
|
||||
selectedTask &&
|
||||
selectedTask.platform === 'huya' &&
|
||||
selectedTask.executionStatus !== 'completed' &&
|
||||
selectedTask.bindingStatus !== 'confirmed' &&
|
||||
(!selectedTask.customerServerZone ||
|
||||
!selectedTask.customerGameRoleId ||
|
||||
!selectedTask.customerGameRoleName),
|
||||
)
|
||||
// 登录后资料不全时自动展开资料表单;资料齐全后才展示绑定二维码。
|
||||
const showProfileForm = showBindingStage && (profileEditing || !profileComplete)
|
||||
|
||||
const renderLoginForm = (options: {
|
||||
platformLabel: string
|
||||
@@ -1060,17 +1052,6 @@ export default function CustomerFulfillmentPage({
|
||||
)
|
||||
}
|
||||
|
||||
if (needsProfileCollection && selectedTask) {
|
||||
return (
|
||||
<CustomerCollectStep
|
||||
task={selectedTask}
|
||||
onSaved={(task) =>
|
||||
setTasks((current) => current.map((item) => (item.id === task.id ? task : item)))
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<CustomerAuthFrame platform={selectedTask?.platform} title={displayTitle}>
|
||||
<div className="customer-auth-content-stack">
|
||||
@@ -1096,6 +1077,20 @@ export default function CustomerFulfillmentPage({
|
||||
|
||||
<CustomerOrderCard task={selectedTask} />
|
||||
|
||||
{selectedTask?.platform === 'huya' ? (
|
||||
<CustomerHuyaSteps
|
||||
current={
|
||||
selectedTask.loginStatus !== 'authenticated'
|
||||
? 1
|
||||
: profileEditing || !profileComplete
|
||||
? 2
|
||||
: selectedTask.bindingStatus === 'confirmed'
|
||||
? 4
|
||||
: 3
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{selectedTask?.loginStatus === 'waiting_login' ||
|
||||
selectedTask?.loginStatus === 'failed' ||
|
||||
selectedTask?.loginStatus === 'expired' ||
|
||||
@@ -1177,21 +1172,23 @@ export default function CustomerFulfillmentPage({
|
||||
|
||||
{showBindingStage ? (
|
||||
<section id="customer-binding-stage" className="customer-binding-stage">
|
||||
<div className="customer-binding-info">
|
||||
<h3>
|
||||
绑定信息 <small>(已登录虎牙账号)</small>
|
||||
</h3>
|
||||
<div>
|
||||
<span>登录账号</span>
|
||||
<strong>
|
||||
{bindingInfo?.bindGameAccount || selectedTask.bindGameAccount || '未获取'}
|
||||
</strong>
|
||||
{profileComplete && !profileEditing ? (
|
||||
<div className="customer-binding-info">
|
||||
<h3>
|
||||
绑定信息 <small>(已登录虎牙账号)</small>
|
||||
</h3>
|
||||
<div>
|
||||
<span>登录账号</span>
|
||||
<strong>
|
||||
{bindingInfo?.bindGameAccount || selectedTask.bindGameAccount || '未获取'}
|
||||
</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span>绑定角色</span>
|
||||
<strong>{bindingRoleName || '未识别到角色'}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span>绑定角色</span>
|
||||
<strong>{bindingRoleName || '未识别到角色'}</strong>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{bindingSessionExpired ? (
|
||||
<div className="customer-binding-session-card">
|
||||
@@ -1211,7 +1208,7 @@ export default function CustomerFulfillmentPage({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{bindingBanner ? (
|
||||
{bindingBanner && !profileEditing ? (
|
||||
<div className={`customer-binding-alert ${bindingBanner.tone}`}>
|
||||
{bindingBanner.text}
|
||||
</div>
|
||||
@@ -1219,7 +1216,11 @@ export default function CustomerFulfillmentPage({
|
||||
|
||||
{showProfileForm && !bindingSessionExpired ? (
|
||||
<div className="customer-auth-profile" id="customer-profile-form">
|
||||
<p>修改资料后会重新核对平台识别角色。</p>
|
||||
<p>
|
||||
{profileComplete
|
||||
? '第二步:修改资料后会用最新资料重新核对平台角色,三项完全一致才能提交平台绑定。'
|
||||
: '第二步:请填写游戏角色资料:区服、游戏编号(虎牙账号 UID)与角色名,提交后才能生成绑定二维码。'}
|
||||
</p>
|
||||
<div className="customer-profile-form">
|
||||
<label className="customer-collect-label">
|
||||
区服 <span>*</span>
|
||||
@@ -1262,11 +1263,21 @@ export default function CustomerFulfillmentPage({
|
||||
>
|
||||
提交资料
|
||||
</Button>
|
||||
{profileComplete ? (
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-login-alt"
|
||||
onClick={() => setProfileEditing(false)}
|
||||
>
|
||||
返回绑定角色
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{bindingQrVisible && !bindingSessionExpired ? (
|
||||
{bindingQrVisible && !bindingSessionExpired && !profileEditing ? (
|
||||
<div className="customer-binding-qr-card">
|
||||
<h3>游戏角色绑定二维码</h3>
|
||||
{bindingInfo?.qrImage || bindingQrImage ? (
|
||||
@@ -1301,7 +1312,7 @@ export default function CustomerFulfillmentPage({
|
||||
: '请使用微信APP扫码进行游戏角色绑定'}
|
||||
</p>
|
||||
<p className="customer-binding-qr-hint">
|
||||
扫码后系统会核对平台角色与已填资料;不一致时可修改资料或同步平台角色。
|
||||
扫码后系统会核对平台角色与已填资料;三项完全一致才能提交平台绑定。
|
||||
</p>
|
||||
<p className="customer-binding-qr-tip">
|
||||
{selectedTask?.bindingStatus === 'scanned'
|
||||
@@ -1311,7 +1322,7 @@ export default function CustomerFulfillmentPage({
|
||||
? '已向虎牙提交绑定,正在等待角色生效,请稍候刷新。'
|
||||
: bindingInfo?.rebindRequested
|
||||
? '扫码后请在虎牙弹窗中选中目标角色;选好后点下方「已选好角色,提交换绑」。'
|
||||
: '请在微信中完成角色绑定确认,再点击下方按钮进入下一步。'
|
||||
: '请在微信中完成角色绑定确认,再点击下方按钮核对平台角色。'
|
||||
: '扫码后请在微信确认框中核对目标角色。'}
|
||||
</p>
|
||||
{nextRebindText ? (
|
||||
@@ -1354,13 +1365,13 @@ export default function CustomerFulfillmentPage({
|
||||
>
|
||||
{rebindAccepted || bindConfirmPending
|
||||
? '刷新绑定状态'
|
||||
: '已扫码绑定,点击进入下一步'}
|
||||
: '已扫码绑定,点击核对平台角色'}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{selectedTask?.bindingStatus === 'expired' ? (
|
||||
{selectedTask?.bindingStatus === 'expired' && !profileEditing ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
@@ -1374,7 +1385,7 @@ export default function CustomerFulfillmentPage({
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{selectedTask?.bindingStatus === 'failed' ? (
|
||||
{selectedTask?.bindingStatus === 'failed' && !profileEditing ? (
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
@@ -1390,16 +1401,18 @@ export default function CustomerFulfillmentPage({
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{selectedTask?.bindingStatus === 'role_ready' && !bindingSessionExpired ? (
|
||||
{selectedTask?.bindingStatus === 'role_ready' &&
|
||||
!bindingSessionExpired &&
|
||||
!profileEditing ? (
|
||||
<Space direction="vertical" size={12} style={{ width: '100%' }}>
|
||||
{bindingRequiresSupport ? (
|
||||
{bindingNeedsSupport ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
message="请联系客服人工核实绑定角色"
|
||||
description={`平台未返回可核对的角色ID,无法自动核对。请复制订单号 ${
|
||||
description={`两侧角色信息不完整,无法自动核对。请复制订单号 ${
|
||||
orderNo || selectedTask?.orderNo || ''
|
||||
} 联系客服,核实完成前请不要确认绑定。`}
|
||||
} 联系客服,核实完成前请不要提交平台绑定。`}
|
||||
/>
|
||||
) : showRebindFailure ? (
|
||||
<Alert
|
||||
@@ -1427,24 +1440,11 @@ export default function CustomerFulfillmentPage({
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<Alert
|
||||
type="success"
|
||||
showIcon
|
||||
message={bindingRoleName ? `已识别角色:${bindingRoleName}` : '已识别绑定角色'}
|
||||
description={[bindingInfo?.bindGameAccount, bindingInfo?.bindGameChannel]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
/>
|
||||
)}
|
||||
{!bindingRequiresSupport &&
|
||||
!showRebindFailure &&
|
||||
comparisonMismatch &&
|
||||
bindingComparison ? (
|
||||
) : comparisonMismatch && bindingComparison ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
message="平台识别的角色与已填资料不一致"
|
||||
message="平台角色与已填资料不一致"
|
||||
description={
|
||||
<Space direction="vertical" size={2}>
|
||||
<span>
|
||||
@@ -1457,12 +1457,23 @@ export default function CustomerFulfillmentPage({
|
||||
{bindingComparison.customerRoleName || '角色未填'}(ID{' '}
|
||||
{bindingComparison.customerRoleId || '未填'})
|
||||
</span>
|
||||
<span>三项一致后才能提交确认;可一键同步平台角色。</span>
|
||||
<span>
|
||||
三项完全一致才能提交平台绑定;请重新扫码换绑,或上一步修改资料。
|
||||
</span>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
{bindingRequiresSupport ? (
|
||||
) : (
|
||||
<Alert
|
||||
type="success"
|
||||
showIcon
|
||||
message={bindingRoleName ? `已识别角色:${bindingRoleName}` : '已识别绑定角色'}
|
||||
description={[bindingInfo?.bindGameAccount, bindingInfo?.bindGameChannel]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
/>
|
||||
)}
|
||||
{bindingNeedsSupport ? (
|
||||
<div className="customer-binding-role-actions">
|
||||
<Button
|
||||
block
|
||||
@@ -1486,86 +1497,53 @@ export default function CustomerFulfillmentPage({
|
||||
刷新状态
|
||||
</Button>
|
||||
</div>
|
||||
) : showRebindFailure ? (
|
||||
) : showRebindFailure || comparisonMismatch ? (
|
||||
<div className="customer-binding-role-actions">
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-confirm"
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleSubmitRebind()}
|
||||
>
|
||||
重新提交换绑
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-rebind"
|
||||
icon={<ReloadOutlined />}
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleRefreshBinding(true)}
|
||||
>
|
||||
重新扫码换绑
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-accept"
|
||||
onClick={() => {
|
||||
setRebindFailureDismissed(true)
|
||||
window.setTimeout(() => {
|
||||
document
|
||||
.getElementById('customer-binding-stage')
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
}, 0)
|
||||
}}
|
||||
>
|
||||
返回上一步
|
||||
</Button>
|
||||
</div>
|
||||
) : comparisonMismatch ? (
|
||||
<div className="customer-binding-role-actions">
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-confirm"
|
||||
loading={profileSaving}
|
||||
onClick={() => void handleSyncBindingProfile()}
|
||||
>
|
||||
同步平台角色并继续
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-rebind"
|
||||
icon={<ExclamationCircleOutlined />}
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleRefreshBinding(true)}
|
||||
>
|
||||
角色不对,重新扫码换绑
|
||||
</Button>
|
||||
</div>
|
||||
) : rebindUnchanged ? (
|
||||
<div className="customer-binding-role-actions">
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-confirm"
|
||||
loading={bindingLoading}
|
||||
onClick={() => handleAcceptExistingRole()}
|
||||
>
|
||||
确认使用原角色
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-rebind"
|
||||
icon={<ExclamationCircleOutlined />}
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleRefreshBinding(true)}
|
||||
>
|
||||
角色不对,重新扫码换绑
|
||||
</Button>
|
||||
{comparisonMismatch && rebindAccepted ? (
|
||||
<>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-confirm"
|
||||
icon={<ExclamationCircleOutlined />}
|
||||
onClick={() => void openProfileEditor()}
|
||||
>
|
||||
上一步修改资料
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-rebind"
|
||||
icon={<ReloadOutlined />}
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleRefreshBinding(true)}
|
||||
>
|
||||
重新扫码换绑
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-confirm"
|
||||
icon={showRebindFailure ? <ReloadOutlined /> : undefined}
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleRefreshBinding(true)}
|
||||
>
|
||||
重新扫码换绑
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-rebind"
|
||||
icon={<ExclamationCircleOutlined />}
|
||||
onClick={() => void openProfileEditor()}
|
||||
>
|
||||
上一步修改资料
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="customer-binding-role-actions">
|
||||
@@ -1574,26 +1552,17 @@ export default function CustomerFulfillmentPage({
|
||||
size="large"
|
||||
className="customer-binding-confirm"
|
||||
loading={bindingLoading}
|
||||
disabled={!bindingComparison}
|
||||
onClick={() => setBindingConfirmOpen(true)}
|
||||
>
|
||||
确认绑定角色
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-rebind"
|
||||
icon={<ExclamationCircleOutlined />}
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleRefreshBinding(true)}
|
||||
>
|
||||
角色不对,重新扫码换绑
|
||||
{bindingComparison ? '提交平台绑定' : '正在核对平台角色...'}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Space>
|
||||
) : null}
|
||||
|
||||
{selectedTask?.bindingStatus === 'confirmed' ? (
|
||||
{selectedTask?.bindingStatus === 'confirmed' && !profileEditing ? (
|
||||
<div className="customer-binding-verify">
|
||||
<p>绑定状态需要平台人工核实,请联系客服处理</p>
|
||||
<Button
|
||||
@@ -1637,44 +1606,44 @@ export default function CustomerFulfillmentPage({
|
||||
bindingConfirmOpen &&
|
||||
selectedTask?.bindingStatus === 'role_ready' &&
|
||||
!rebindUnchanged &&
|
||||
!bindingRequiresSupport
|
||||
!bindingNeedsSupport &&
|
||||
!profileEditing
|
||||
}
|
||||
title="确认绑定角色"
|
||||
className="customer-binding-modal"
|
||||
title="核对绑定角色"
|
||||
onCancel={() => {
|
||||
if (!bindingLoading) setBindingConfirmOpen(false)
|
||||
}}
|
||||
footer={
|
||||
<div className="customer-binding-modal-footer">
|
||||
<div className="customer-binding-modal-actions">
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (!bindingLoading) setBindingConfirmOpen(false)
|
||||
}}
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
loading={bindingLoading}
|
||||
disabled={!bindingCustomerReady || bindingComparison?.verdict === 'mismatch'}
|
||||
onClick={() => void handleConfirmBinding()}
|
||||
>
|
||||
确认绑定
|
||||
</Button>
|
||||
</div>
|
||||
{bindingComparison?.verdict === 'mismatch' ? (
|
||||
<div className="customer-binding-modal-actions is-mismatch">
|
||||
<Button onClick={openProfileEditor}>修改资料</Button>
|
||||
{canSyncBindingProfile ? (
|
||||
<Button loading={profileSaving} onClick={() => void handleSyncBindingProfile()}>
|
||||
同步平台角色
|
||||
</Button>
|
||||
) : null}
|
||||
{bindingComparison?.verdict === 'match' ? (
|
||||
<div className="customer-binding-modal-actions">
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (!bindingLoading) setBindingConfirmOpen(false)
|
||||
}}
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handleConfirmBinding()}
|
||||
>
|
||||
提交平台绑定
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
) : (
|
||||
<div className="customer-binding-modal-actions is-mismatch">
|
||||
<Button onClick={() => void openProfileEditor()}>上一步修改资料</Button>
|
||||
<Button loading={bindingLoading} onClick={() => void handleRefreshBinding(true)}>
|
||||
重新扫码换绑
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{bindingComparison?.verdict === 'mismatch' ? (
|
||||
<p className="customer-binding-modal-error">
|
||||
{bindingComparison?.message || '两侧角色信息不一致,无法确认绑定'}
|
||||
{bindingComparison?.message || '两侧角色信息不一致,无法提交平台绑定'}
|
||||
</p>
|
||||
) : bindingComparison?.verdict === 'unknown' ? (
|
||||
<p className="customer-binding-modal-warning">两侧角色信息不完整,请联系客服核实</p>
|
||||
@@ -1684,12 +1653,14 @@ export default function CustomerFulfillmentPage({
|
||||
destroyOnClose
|
||||
>
|
||||
<Space direction="vertical" size={14} style={{ width: '100%' }}>
|
||||
<p style={{ margin: 0 }}>检测到待确认的绑定角色,请核对两侧角色是否一致。</p>
|
||||
<p style={{ margin: 0 }}>
|
||||
请核对两侧区服、角色名称与角色 ID,三项完全一致才能提交平台绑定。
|
||||
</p>
|
||||
<div className="customer-binding-compare">
|
||||
<div className="customer-binding-compare-side">
|
||||
<div className="customer-binding-compare-head">
|
||||
<span>您填写的角色</span>
|
||||
<Button type="link" size="small" onClick={openProfileEditor}>
|
||||
<Button type="link" size="small" onClick={() => void openProfileEditor()}>
|
||||
编辑
|
||||
</Button>
|
||||
</div>
|
||||
@@ -1698,7 +1669,7 @@ export default function CustomerFulfillmentPage({
|
||||
</div>
|
||||
<div className="customer-binding-compare-side">
|
||||
<div className="customer-binding-compare-head">
|
||||
<span>待确认角色</span>
|
||||
<span>平台识别角色</span>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
@@ -1808,114 +1779,23 @@ function CustomerOrderCard({ task }: { task: CustomerSemiAutoTask }) {
|
||||
)
|
||||
}
|
||||
|
||||
function CustomerCollectStep(input: {
|
||||
task: CustomerSemiAutoTask
|
||||
onSaved: (task: CustomerSemiAutoTask) => void
|
||||
}) {
|
||||
const { message } = App.useApp()
|
||||
const [serverZone, setServerZone] = useState(input.task.customerServerZone || '')
|
||||
const [roleId, setRoleId] = useState(input.task.customerGameRoleId || '')
|
||||
const [roleName, setRoleName] = useState(input.task.customerGameRoleName || '')
|
||||
const [saving, setSaving] = useState(false)
|
||||
|
||||
async function submit() {
|
||||
if (!serverZone.trim() || !roleId.trim() || !roleName.trim()) {
|
||||
message.warning('请完整填写区服、游戏编号和角色名')
|
||||
return
|
||||
}
|
||||
if (!SERVER_ZONE_OPTIONS.includes(serverZone.trim())) {
|
||||
message.warning('请选择区服')
|
||||
return
|
||||
}
|
||||
if (!/^\d+$/.test(roleId.trim())) {
|
||||
message.warning('游戏编号只能是数字')
|
||||
return
|
||||
}
|
||||
setSaving(true)
|
||||
try {
|
||||
const response = await saveCustomerTaskProfile(input.task.orderNo, input.task.id, {
|
||||
roleName: roleName.trim(),
|
||||
roleId: roleId.trim(),
|
||||
serverZone: serverZone.trim(),
|
||||
})
|
||||
input.onSaved(response.data.task)
|
||||
message.success('资料已提交')
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '提交资料失败')
|
||||
} finally {
|
||||
setSaving(false)
|
||||
}
|
||||
}
|
||||
const HUYA_FLOW_STEPS = ['登录虎牙账号', '填写游戏资料', '绑定游戏角色']
|
||||
|
||||
/** 虎牙三步进度:登录 → 填写资料 → 绑定角色。current=4 表示三步都已走完。 */
|
||||
function CustomerHuyaSteps({ current }: { current: number }) {
|
||||
return (
|
||||
<div className="customer-collect-page">
|
||||
<div className="customer-collect-hero">
|
||||
<p className="customer-collect-warning">温馨提示:未成年人禁止下单</p>
|
||||
</div>
|
||||
<div className="customer-collect-body">
|
||||
<label className="customer-collect-label">
|
||||
订单号 <span>*</span>
|
||||
</label>
|
||||
<div className="customer-collect-readonly">{input.task.orderNo}</div>
|
||||
|
||||
<div className="customer-collect-card">
|
||||
<div>
|
||||
<span>商品</span>
|
||||
<strong>{input.task.productName || input.task.skuName}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span>游戏</span>
|
||||
<strong>和平精英</strong>
|
||||
</div>
|
||||
<p>填完资料记得截图联系客服。</p>
|
||||
</div>
|
||||
|
||||
<label className="customer-collect-label">
|
||||
区服 <span>*</span>
|
||||
</label>
|
||||
<Select
|
||||
className="customer-collect-select"
|
||||
classNames={SERVER_ZONE_SELECT_CLASS_NAMES}
|
||||
value={serverZone || undefined}
|
||||
onChange={(value) => setServerZone(String(value))}
|
||||
placeholder="请选择区服"
|
||||
options={SERVER_ZONE_OPTIONS.map((value) => ({ value, label: value }))}
|
||||
/>
|
||||
|
||||
<label className="customer-collect-label">
|
||||
游戏编号 <span>*</span>
|
||||
</label>
|
||||
<Input
|
||||
className="customer-collect-input"
|
||||
value={roleId}
|
||||
onChange={(event) => setRoleId(event.target.value)}
|
||||
placeholder="请输入游戏编号"
|
||||
maxLength={64}
|
||||
inputMode="numeric"
|
||||
/>
|
||||
|
||||
<label className="customer-collect-label">
|
||||
角色名 <span>*</span>
|
||||
</label>
|
||||
<Input
|
||||
className="customer-collect-input"
|
||||
value={roleName}
|
||||
onChange={(event) => setRoleName(event.target.value)}
|
||||
placeholder="请输入角色名"
|
||||
maxLength={100}
|
||||
/>
|
||||
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-collect-submit"
|
||||
loading={saving}
|
||||
onClick={() => void submit()}
|
||||
>
|
||||
提交资料
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<ol className="customer-huya-steps" aria-label="虎牙履约步骤">
|
||||
{HUYA_FLOW_STEPS.map((label, index) => {
|
||||
const step = index + 1
|
||||
const state = step < current ? 'is-done' : step === current ? 'is-active' : ''
|
||||
return (
|
||||
<li key={label} className={`customer-huya-step ${state}`.trim()}>
|
||||
<span className="customer-huya-step-index">{step < current ? '✓' : step}</span>
|
||||
<span className="customer-huya-step-label">{label}</span>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ol>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ export default function HuyaChallengeModal(input: Props) {
|
||||
return (
|
||||
<Modal
|
||||
open={input.open}
|
||||
className="customer-huya-challenge-modal"
|
||||
title="完成虎牙安全验证"
|
||||
width={430}
|
||||
centered
|
||||
|
||||
@@ -59,6 +59,14 @@ export function pollCustomerBinding(orderNo: string, taskId: number) {
|
||||
)
|
||||
}
|
||||
|
||||
/** 返回上一步修改资料:清空绑定/换绑状态,保留登录会话与已填资料。 */
|
||||
export function resetCustomerBinding(orderNo: string, taskId: number) {
|
||||
return apiPost<{ task: CustomerSemiAutoTask; binding: CustomerBindingInfo | null }>(
|
||||
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/binding/reset`,
|
||||
{},
|
||||
)
|
||||
}
|
||||
|
||||
export function confirmCustomerBinding(
|
||||
orderNo: string,
|
||||
taskId: number,
|
||||
|
||||
@@ -1465,29 +1465,24 @@
|
||||
}
|
||||
|
||||
.customer-auth-hero {
|
||||
min-height: auto;
|
||||
position: relative;
|
||||
min-height: clamp(112px, 15vw, 136px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 38px 16px 10px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
/* 微博登录页顶部 KV:与资料页共用 inside-kv.jpg,叠加深色渐变保证标题可读。 */
|
||||
.customer-auth-page.is-weibo .customer-auth-hero {
|
||||
min-height: 134px;
|
||||
align-items: flex-start;
|
||||
align-items: flex-end;
|
||||
justify-content: flex-start;
|
||||
padding: 26px 20px 20px;
|
||||
padding: 12px 20px 14px;
|
||||
overflow: hidden;
|
||||
text-align: left;
|
||||
background-color: #0b1220;
|
||||
background-image:
|
||||
linear-gradient(180deg, rgba(11, 18, 32, 0.12) 0%, rgba(11, 18, 32, 0.72) 72%, #232936 100%),
|
||||
linear-gradient(180deg, rgba(11, 18, 32, 0.06) 0%, rgba(11, 18, 32, 0.62) 72%, #232936 100%),
|
||||
url('/images/customer/inside-kv.jpg');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center 38%;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
/* 微博与虎牙客户页统一使用同一套顶部 KV,不再单独覆盖背景。 */
|
||||
.customer-auth-page.is-weibo .customer-auth-brand {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
@@ -1499,17 +1494,18 @@
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.customer-auth-page.is-weibo .customer-auth-hero {
|
||||
min-height: 118px;
|
||||
padding: 20px 16px 14px;
|
||||
.customer-auth-hero {
|
||||
min-height: 112px;
|
||||
padding: 12px 16px 14px;
|
||||
background-position: center 42%;
|
||||
}
|
||||
}
|
||||
|
||||
.customer-auth-brand {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
@@ -1535,7 +1531,8 @@
|
||||
line-height: 1.4;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72);
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
@@ -2184,19 +2181,19 @@
|
||||
/* 资料页顶部 KV:原图 https://game.gtimg.cn/images/gp/web201908/inside_kv.jpg(本地 1600×510 q82) */
|
||||
.customer-collect-hero {
|
||||
position: relative;
|
||||
min-height: clamp(190px, 24vw, 240px);
|
||||
min-height: clamp(132px, 18vw, 160px);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
padding: 0 20px 16px;
|
||||
padding: 0 18px 12px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
background-color: #0b1220;
|
||||
background-image:
|
||||
linear-gradient(180deg, rgba(11, 18, 32, 0) 45%, rgba(11, 18, 32, 0.55) 72%, #0b1220 100%),
|
||||
linear-gradient(180deg, rgba(11, 18, 32, 0) 38%, rgba(11, 18, 32, 0.55) 72%, #0b1220 100%),
|
||||
url('/images/customer/inside-kv.jpg');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center 38%;
|
||||
background-position: center 40%;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
@@ -2211,8 +2208,8 @@
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.customer-collect-hero {
|
||||
min-height: 180px;
|
||||
padding: 0 16px 14px;
|
||||
min-height: 132px;
|
||||
padding: 0 16px 12px;
|
||||
background-position: center 42%;
|
||||
}
|
||||
|
||||
@@ -2497,6 +2494,72 @@
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.customer-huya-steps {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin: 12px 16px 0;
|
||||
padding: 12px 14px;
|
||||
list-style: none;
|
||||
border: 1px solid #3a4150;
|
||||
border-radius: 12px;
|
||||
background: #1b212c;
|
||||
}
|
||||
|
||||
.customer-huya-step {
|
||||
display: flex;
|
||||
flex: 1 1 0;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
min-width: 0;
|
||||
color: #64748b;
|
||||
font-size: 13px;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.customer-huya-step-index {
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border: 1px solid #3a4150;
|
||||
border-radius: 50%;
|
||||
color: #94a3b8;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
background: #212733;
|
||||
}
|
||||
|
||||
.customer-huya-step-label {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.customer-huya-step.is-active {
|
||||
color: #f8fafc;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.customer-huya-step.is-active .customer-huya-step-index {
|
||||
color: #fff;
|
||||
border-color: #2563eb;
|
||||
background: #2563eb;
|
||||
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
|
||||
}
|
||||
|
||||
.customer-huya-step.is-done {
|
||||
color: #6ee7b7;
|
||||
}
|
||||
|
||||
.customer-huya-step.is-done .customer-huya-step-index {
|
||||
color: #6ee7b7;
|
||||
border-color: #065f46;
|
||||
background: rgba(6, 78, 59, 0.4);
|
||||
}
|
||||
|
||||
.customer-order-card {
|
||||
margin: 10px 16px 0;
|
||||
padding: 16px;
|
||||
@@ -3088,9 +3151,9 @@
|
||||
}
|
||||
|
||||
.customer-auth-hero {
|
||||
min-height: auto;
|
||||
padding: 38px 16px 10px;
|
||||
background: none;
|
||||
min-height: 112px;
|
||||
padding: 12px 16px 14px;
|
||||
background-position: center 42%;
|
||||
}
|
||||
|
||||
.customer-auth-brand h1 {
|
||||
@@ -3111,6 +3174,23 @@
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.customer-huya-steps {
|
||||
gap: 6px;
|
||||
margin: 10px 16px 0;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.customer-huya-step {
|
||||
gap: 5px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.customer-huya-step-index {
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.customer-auth-facts {
|
||||
padding-inline: 20px;
|
||||
}
|
||||
@@ -3231,3 +3311,244 @@
|
||||
line-height: 1.45;
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
客户履约页(半自动)固定移动端 + 窄屏自适应
|
||||
--------------------------------------------------------------------------
|
||||
全局 base.css 给 body 设了 min-width:320px,worker.css 又用 overflow-x:hidden
|
||||
裁掉横向溢出。应用内浏览器 / 分屏 / 系统显示放大时实际视口可能小于 320px,
|
||||
页面右侧(输入框、商品值、提示文案)会被直接裁掉。
|
||||
下面只作用于客户履约页(body.customer-mobile-body),不影响后台与打手端。
|
||||
========================================================================== */
|
||||
|
||||
html.customer-mobile-html,
|
||||
body.customer-mobile-body {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
body.customer-mobile-body #root {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-page,
|
||||
body.customer-mobile-body .customer-auth-page {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-hero {
|
||||
width: min(480px, 100%);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-body {
|
||||
width: 100%;
|
||||
max-width: 480px;
|
||||
margin: 0 auto;
|
||||
padding: 20px clamp(12px, 4vw, 20px) calc(40px + env(safe-area-inset-bottom));
|
||||
padding-left: max(clamp(12px, 4vw, 20px), env(safe-area-inset-left));
|
||||
padding-right: max(clamp(12px, 4vw, 20px), env(safe-area-inset-right));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-shell {
|
||||
width: min(480px, 100%);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-main {
|
||||
padding-bottom: calc(24px + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-content-stack,
|
||||
body.customer-mobile-body .customer-auth-section,
|
||||
body.customer-mobile-body .customer-auth-facts,
|
||||
body.customer-mobile-body .customer-auth-facts > div,
|
||||
body.customer-mobile-body .customer-auth-task-switcher,
|
||||
body.customer-mobile-body .customer-login-form,
|
||||
body.customer-mobile-body .customer-collect-card,
|
||||
body.customer-mobile-body .customer-order-card {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-card,
|
||||
body.customer-mobile-body .customer-collect-readonly,
|
||||
body.customer-mobile-body .customer-collect-input.ant-input,
|
||||
body.customer-mobile-body .customer-collect-select.ant-select,
|
||||
body.customer-mobile-body .customer-login-mobile.ant-input,
|
||||
body.customer-mobile-body .customer-login-code-input.ant-input,
|
||||
body.customer-mobile-body .customer-login-submit.ant-btn,
|
||||
body.customer-mobile-body .customer-login-alt.ant-btn {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* 订单卡片自带左右 16px 外边距,不能用 width:100% 再加边距 */
|
||||
body.customer-mobile-body .customer-order-card {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-card > div,
|
||||
body.customer-mobile-body .customer-order-card > div {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-card > div strong,
|
||||
body.customer-mobile-body .customer-order-card > div strong {
|
||||
flex: 1 1 10ch;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* 状态胶囊保持自身宽度,不参与长值换行规则 */
|
||||
body.customer-mobile-body .customer-order-card > div strong.customer-order-status {
|
||||
flex: 0 0 auto;
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-readonly {
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-card > p {
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-login-form,
|
||||
body.customer-mobile-body .customer-login-mobile-row,
|
||||
body.customer-mobile-body .customer-login-code-input.ant-input {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-role-card,
|
||||
body.customer-mobile-body .customer-auth-button-stack {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 登录/绑定二维码:容器与图片都不超过可用宽度,避免 232/252/260px 固定宽溢出 */
|
||||
body.customer-mobile-body .customer-auth-qr-image,
|
||||
body.customer-mobile-body .customer-auth-qr-placeholder {
|
||||
width: min(252px, 100%);
|
||||
min-height: 0;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-qr-image .ant-image,
|
||||
body.customer-mobile-body .customer-auth-qr-image img,
|
||||
body.customer-mobile-body .customer-binding-qr-card .ant-image,
|
||||
body.customer-mobile-body .customer-binding-qr-card img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* 固定宽度弹窗(绑定确认 520 / 虎牙验证 430)在窄屏必须收到视口内 */
|
||||
@media (max-width: 640px) {
|
||||
.customer-binding-modal,
|
||||
.customer-huya-challenge-modal {
|
||||
width: calc(100vw - 24px) !important;
|
||||
max-width: 480px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.customer-binding-modal .ant-modal-content,
|
||||
.customer-huya-challenge-modal .ant-modal-content {
|
||||
max-height: calc(100vh - 32px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 380px) {
|
||||
body.customer-mobile-body .customer-binding-qr-actions,
|
||||
body.customer-mobile-body .customer-binding-modal-actions {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 340px) {
|
||||
body.customer-mobile-body .customer-collect-body {
|
||||
padding-inline: 12px;
|
||||
}
|
||||
|
||||
/* 标签 + 长值改为上下排列,值不再被挤到屏幕外 */
|
||||
body.customer-mobile-body .customer-collect-card > div,
|
||||
body.customer-mobile-body .customer-order-card > div {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-card > div strong,
|
||||
body.customer-mobile-body .customer-order-card > div strong {
|
||||
flex: 0 1 auto;
|
||||
max-width: 100%;
|
||||
justify-self: start;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-order-card > div strong.customer-order-status {
|
||||
flex: 0 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-collect-card > p {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-login-mobile-row {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-login-code-button.ant-btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-task-switcher {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-task-switcher > span {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-facts {
|
||||
padding-inline: 12px;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-facts > div {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 4px;
|
||||
min-height: 0;
|
||||
padding-block: 12px;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-facts > div > strong {
|
||||
justify-self: start;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-state {
|
||||
padding: 32px 16px;
|
||||
}
|
||||
|
||||
body.customer-mobile-body .customer-auth-privacy {
|
||||
margin-inline: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,21 @@ export type SemiAutoTaskListResult = {
|
||||
pagination: { page: number; pageSize: number; total: number }
|
||||
}
|
||||
|
||||
export type SemiAutoBindingComparison = {
|
||||
verdict: 'match' | 'mismatch' | 'unknown'
|
||||
customerRoleName: string
|
||||
customerRoleId: string
|
||||
customerZone: string
|
||||
boundRoleName: string
|
||||
boundRoleId: string
|
||||
boundZone: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export type SemiAutoTaskDetail = {
|
||||
task: SemiAutoTask
|
||||
/** 与客户页同源的区服 / 角色名 / 角色 ID 三项比对结果。 */
|
||||
comparison: SemiAutoBindingComparison
|
||||
events: SemiAutoTaskEvent[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user