feat(semi-auto): 换绑失败页支持返回角色核对界面
This commit is contained in:
@@ -75,6 +75,7 @@ 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 hydratingBindingRef = useRef(false)
|
||||
const autoOpenedRoleRef = useRef('')
|
||||
@@ -136,6 +137,7 @@ export default function CustomerFulfillmentPage() {
|
||||
autoOpenedRoleRef.current = ''
|
||||
setBindingSessionExpired(false)
|
||||
setBindingLoadError('')
|
||||
setRebindFailureDismissed(false)
|
||||
}, [selectedTask?.id])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -709,11 +711,11 @@ export default function CustomerFulfillmentPage() {
|
||||
if (!selectedTask || bindingLoading) return
|
||||
const reason = String(bindingInfo?.rebindConfirmMessage || '').trim()
|
||||
modal.confirm({
|
||||
title: '仍使用原绑定角色?',
|
||||
title: '确认使用原角色?',
|
||||
content: `本次换绑未成功${reason ? `(${reason})` : ''},平台仍返回原绑定角色「${
|
||||
bindingRoleName || '当前角色'
|
||||
}」。确认后本次换绑作废,直接使用该角色继续履约。`,
|
||||
okText: '仍使用原角色',
|
||||
okText: '确认使用原角色',
|
||||
cancelText: '先不确认',
|
||||
onOk: () => handleConfirmBinding(true),
|
||||
})
|
||||
@@ -808,6 +810,8 @@ export default function CustomerFulfillmentPage() {
|
||||
})()
|
||||
const bindingRoleName = bindingInfo?.bindGameRole || selectedTask?.bindGameRole || ''
|
||||
const rebindUnchanged = bindingInfo?.rebindUnchanged === true
|
||||
// 换绑失败视图可返回「已识别角色 + 资料不一致」的核对界面;后端 rebindUnchanged 保持不变。
|
||||
const showRebindFailure = rebindUnchanged && !rebindFailureDismissed
|
||||
const rebindConfirmState = bindingInfo?.rebindConfirmState || 'idle'
|
||||
const rebindRejected = rebindConfirmState === 'rejected'
|
||||
const rebindAccepted = rebindConfirmState === 'accepted'
|
||||
@@ -829,7 +833,7 @@ export default function CustomerFulfillmentPage() {
|
||||
text: '已登录,但平台未返回可核对的角色ID,请联系客服人工核实',
|
||||
}
|
||||
}
|
||||
if (rebindUnchanged) {
|
||||
if (showRebindFailure) {
|
||||
return {
|
||||
tone: 'is-warning',
|
||||
text: rebindRejected ? '虎牙未接受本次换绑,请查看下方原因' : '换绑未生效,请查看下方原因',
|
||||
@@ -857,9 +861,7 @@ export default function CustomerFulfillmentPage() {
|
||||
? formatAdminDateTime(bindingInfo.nextRebindAt)
|
||||
: ''
|
||||
const comparisonMismatch =
|
||||
selectedTask?.bindingStatus === 'role_ready' &&
|
||||
!rebindUnchanged &&
|
||||
bindingComparison?.verdict === 'mismatch'
|
||||
selectedTask?.bindingStatus === 'role_ready' && bindingComparison?.verdict === 'mismatch'
|
||||
const showProfileForm = showBindingStage && profileEditing
|
||||
const bindingCustomerReady = Boolean(
|
||||
bindingComparison?.customerRoleId || bindingComparison?.customerRoleName,
|
||||
@@ -1107,7 +1109,7 @@ export default function CustomerFulfillmentPage() {
|
||||
) : null}
|
||||
|
||||
{showBindingStage ? (
|
||||
<section className="customer-binding-stage">
|
||||
<section id="customer-binding-stage" className="customer-binding-stage">
|
||||
<div className="customer-binding-info">
|
||||
<h3>
|
||||
绑定信息 <small>(已登录虎牙账号)</small>
|
||||
@@ -1329,7 +1331,7 @@ export default function CustomerFulfillmentPage() {
|
||||
orderNo || selectedTask?.orderNo || ''
|
||||
} 联系客服,核实完成前请不要确认绑定。`}
|
||||
/>
|
||||
) : rebindUnchanged ? (
|
||||
) : showRebindFailure ? (
|
||||
<Alert
|
||||
type={rebindRejected ? 'error' : 'warning'}
|
||||
showIcon
|
||||
@@ -1365,7 +1367,10 @@ export default function CustomerFulfillmentPage() {
|
||||
.join(' · ')}
|
||||
/>
|
||||
)}
|
||||
{!bindingRequiresSupport && comparisonMismatch && bindingComparison ? (
|
||||
{!bindingRequiresSupport &&
|
||||
!showRebindFailure &&
|
||||
comparisonMismatch &&
|
||||
bindingComparison ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
@@ -1411,7 +1416,7 @@ export default function CustomerFulfillmentPage() {
|
||||
刷新状态
|
||||
</Button>
|
||||
</div>
|
||||
) : rebindUnchanged ? (
|
||||
) : showRebindFailure ? (
|
||||
<div className="customer-binding-role-actions">
|
||||
<Button
|
||||
block
|
||||
@@ -1436,10 +1441,16 @@ export default function CustomerFulfillmentPage() {
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-accept"
|
||||
loading={bindingLoading}
|
||||
onClick={() => handleAcceptExistingRole()}
|
||||
onClick={() => {
|
||||
setRebindFailureDismissed(true)
|
||||
window.setTimeout(() => {
|
||||
document
|
||||
.getElementById('customer-binding-stage')
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
}, 0)
|
||||
}}
|
||||
>
|
||||
仍使用原角色
|
||||
返回上一步
|
||||
</Button>
|
||||
</div>
|
||||
) : comparisonMismatch ? (
|
||||
@@ -1464,6 +1475,28 @@ export default function CustomerFulfillmentPage() {
|
||||
角色不对,重新扫码换绑
|
||||
</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>
|
||||
</div>
|
||||
) : (
|
||||
<div className="customer-binding-role-actions">
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user