Revert "fix(semi-auto): 换绑失败资料不一致时引导修改资料"

This reverts commit f6214e8995.
This commit is contained in:
2026-11-17 13:33:03 +08:00
parent f6214e8995
commit 1a485cee0c
2 changed files with 15 additions and 105 deletions
@@ -608,23 +608,8 @@ export default function CustomerFulfillmentPage() {
} }
} }
/** 资料不一致时展开资料编辑表单并滚动到可见位置。 */
function openProfileEditor() {
setProfileEditing(true)
window.setTimeout(() => {
document
.getElementById('customer-profile-form')
?.scrollIntoView({ behavior: 'smooth', block: 'center' })
}, 0)
}
async function handleSubmitRebind() { async function handleSubmitRebind() {
if (!selectedTask) return if (!selectedTask) return
if (bindingInfo?.comparison?.verdict === 'mismatch') {
message.warning('当前资料与平台角色不一致,请先修改资料')
openProfileEditor()
return
}
setBindingLoading(true) setBindingLoading(true)
try { try {
const response = await submitCustomerRebind(orderNo, selectedTask.id) const response = await submitCustomerRebind(orderNo, selectedTask.id)
@@ -681,11 +666,7 @@ export default function CustomerFulfillmentPage() {
) )
const bindingResponse = await pollCustomerBinding(orderNo, selectedTask.id) const bindingResponse = await pollCustomerBinding(orderNo, selectedTask.id)
if (bindingResponse.data.binding) setBindingInfo(bindingResponse.data.binding) if (bindingResponse.data.binding) setBindingInfo(bindingResponse.data.binding)
message.success( message.success('资料已按平台角色同步,请核对后确认绑定')
bindingInfo?.rebindUnchanged
? '资料已按平台角色同步,请点「仍使用原角色」继续'
: '资料已按平台角色同步,请核对后确认绑定',
)
} catch (error) { } catch (error) {
message.error(error instanceof Error ? error.message : '同步角色资料失败') message.error(error instanceof Error ? error.message : '同步角色资料失败')
} finally { } finally {
@@ -726,11 +707,6 @@ export default function CustomerFulfillmentPage() {
/** 换绑被虎牙拒绝时的二次确认:客户可以选择继续使用原绑定角色。 */ /** 换绑被虎牙拒绝时的二次确认:客户可以选择继续使用原绑定角色。 */
function handleAcceptExistingRole() { function handleAcceptExistingRole() {
if (!selectedTask || bindingLoading) return if (!selectedTask || bindingLoading) return
if (bindingInfo?.comparison?.verdict === 'mismatch') {
message.warning('当前资料与平台原角色不一致,请先修改资料')
openProfileEditor()
return
}
const reason = String(bindingInfo?.rebindConfirmMessage || '').trim() const reason = String(bindingInfo?.rebindConfirmMessage || '').trim()
modal.confirm({ modal.confirm({
title: '仍使用原绑定角色?', title: '仍使用原绑定角色?',
@@ -770,9 +746,7 @@ export default function CustomerFulfillmentPage() {
} catch { } catch {
// 绑定尚未开始时没有 binding,可忽略。 // 绑定尚未开始时没有 binding,可忽略。
} }
message.success( message.success('角色资料已保存')
bindingInfo?.rebindUnchanged ? '资料已保存,请点「仍使用原角色」继续' : '角色资料已保存',
)
} catch (error) { } catch (error) {
message.error(error instanceof Error ? error.message : '保存角色资料失败') message.error(error instanceof Error ? error.message : '保存角色资料失败')
} finally { } finally {
@@ -882,16 +856,10 @@ export default function CustomerFulfillmentPage() {
const nextRebindText = bindingInfo?.nextRebindAt const nextRebindText = bindingInfo?.nextRebindAt
? formatAdminDateTime(bindingInfo.nextRebindAt) ? formatAdminDateTime(bindingInfo.nextRebindAt)
: '' : ''
const bindingProfileMismatch = const comparisonMismatch =
selectedTask?.bindingStatus === 'role_ready' && bindingComparison?.verdict === 'mismatch' selectedTask?.bindingStatus === 'role_ready' &&
const comparisonMismatch = bindingProfileMismatch && !rebindUnchanged !rebindUnchanged &&
const canSyncBindingProfile = Boolean( bindingComparison?.verdict === 'mismatch'
bindingComparison &&
bindingComparison.boundRoleName &&
bindingComparison.boundRoleId &&
/^\d+$/.test(bindingComparison.boundRoleId) &&
bindingComparison.boundZone,
)
const showProfileForm = showBindingStage && profileEditing const showProfileForm = showBindingStage && profileEditing
const bindingCustomerReady = Boolean( const bindingCustomerReady = Boolean(
bindingComparison?.customerRoleId || bindingComparison?.customerRoleName, bindingComparison?.customerRoleId || bindingComparison?.customerRoleName,
@@ -1384,11 +1352,6 @@ export default function CustomerFulfillmentPage() {
{!bindingInfo?.rebindConfirmMessage && !nextRebindText ? ( {!bindingInfo?.rebindConfirmMessage && !nextRebindText ? (
<span>请核对虎牙弹窗中选中的目标角色后重新提交。</span> <span>请核对虎牙弹窗中选中的目标角色后重新提交。</span>
) : null} ) : null}
{bindingProfileMismatch ? (
<span>
当前资料与平台原角色不一致,无法直接确认;请修改资料为原角色,或等可换绑时间后再试。
</span>
) : null}
</Space> </Space>
} }
/> />
@@ -1450,38 +1413,15 @@ export default function CustomerFulfillmentPage() {
</div> </div>
) : rebindUnchanged ? ( ) : rebindUnchanged ? (
<div className="customer-binding-role-actions"> <div className="customer-binding-role-actions">
{bindingProfileMismatch ? ( <Button
<Button block
block size="large"
size="large" className="customer-binding-confirm"
className="customer-binding-confirm" loading={bindingLoading}
loading={profileSaving} onClick={() => void handleSubmitRebind()}
onClick={openProfileEditor} >
> 重新提交换绑
修改资料,使用原角色 </Button>
</Button>
) : (
<Button
block
size="large"
className="customer-binding-confirm"
loading={bindingLoading}
onClick={() => void handleSubmitRebind()}
>
重新提交换绑
</Button>
)}
{bindingProfileMismatch && canSyncBindingProfile ? (
<Button
block
size="large"
className="customer-binding-rebind"
loading={profileSaving}
onClick={() => void handleSyncBindingProfile()}
>
同步平台角色并继续
</Button>
) : null}
<Button <Button
block block
size="large" size="large"
@@ -1,30 +0,0 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import test from 'node:test'
const source = readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
'../src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx',
),
'utf8',
)
test('换绑失败且资料不一致时提供修改资料与同步入口', () => {
assert.ok(source.includes('bindingProfileMismatch'))
assert.ok(source.includes('修改资料,使用原角色'))
assert.ok(source.includes('同步平台角色并继续'))
assert.ok(source.includes('openProfileEditor'))
})
test('资料不一致时前置拦截仍使用原角色与重新提交换绑', () => {
assert.ok(source.includes("bindingInfo?.comparison?.verdict === 'mismatch'"))
assert.ok(source.includes('请先修改资料'))
})
test('修改资料复用现有内嵌表单', () => {
assert.ok(source.includes('id="customer-profile-form"'))
assert.ok(source.includes('setProfileEditing(true)'))
})