diff --git a/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx b/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx index f7e305b9..76215fe5 100644 --- a/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx +++ b/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx @@ -608,8 +608,23 @@ export default function CustomerFulfillmentPage() { } } + /** 资料不一致时展开资料编辑表单并滚动到可见位置。 */ + function openProfileEditor() { + setProfileEditing(true) + window.setTimeout(() => { + document + .getElementById('customer-profile-form') + ?.scrollIntoView({ behavior: 'smooth', block: 'center' }) + }, 0) + } + async function handleSubmitRebind() { if (!selectedTask) return + if (bindingInfo?.comparison?.verdict === 'mismatch') { + message.warning('当前资料与平台角色不一致,请先修改资料') + openProfileEditor() + return + } setBindingLoading(true) try { const response = await submitCustomerRebind(orderNo, selectedTask.id) @@ -666,7 +681,11 @@ export default function CustomerFulfillmentPage() { ) const bindingResponse = await pollCustomerBinding(orderNo, selectedTask.id) if (bindingResponse.data.binding) setBindingInfo(bindingResponse.data.binding) - message.success('资料已按平台角色同步,请核对后确认绑定') + message.success( + bindingInfo?.rebindUnchanged + ? '资料已按平台角色同步,请点「仍使用原角色」继续' + : '资料已按平台角色同步,请核对后确认绑定', + ) } catch (error) { message.error(error instanceof Error ? error.message : '同步角色资料失败') } finally { @@ -707,6 +726,11 @@ export default function CustomerFulfillmentPage() { /** 换绑被虎牙拒绝时的二次确认:客户可以选择继续使用原绑定角色。 */ function handleAcceptExistingRole() { if (!selectedTask || bindingLoading) return + if (bindingInfo?.comparison?.verdict === 'mismatch') { + message.warning('当前资料与平台原角色不一致,请先修改资料') + openProfileEditor() + return + } const reason = String(bindingInfo?.rebindConfirmMessage || '').trim() modal.confirm({ title: '仍使用原绑定角色?', @@ -746,7 +770,9 @@ export default function CustomerFulfillmentPage() { } catch { // 绑定尚未开始时没有 binding,可忽略。 } - message.success('角色资料已保存') + message.success( + bindingInfo?.rebindUnchanged ? '资料已保存,请点「仍使用原角色」继续' : '角色资料已保存', + ) } catch (error) { message.error(error instanceof Error ? error.message : '保存角色资料失败') } finally { @@ -856,10 +882,16 @@ export default function CustomerFulfillmentPage() { const nextRebindText = bindingInfo?.nextRebindAt ? formatAdminDateTime(bindingInfo.nextRebindAt) : '' - const comparisonMismatch = - selectedTask?.bindingStatus === 'role_ready' && - !rebindUnchanged && - bindingComparison?.verdict === 'mismatch' + const bindingProfileMismatch = + selectedTask?.bindingStatus === 'role_ready' && bindingComparison?.verdict === 'mismatch' + const comparisonMismatch = bindingProfileMismatch && !rebindUnchanged + const canSyncBindingProfile = Boolean( + bindingComparison && + bindingComparison.boundRoleName && + bindingComparison.boundRoleId && + /^\d+$/.test(bindingComparison.boundRoleId) && + bindingComparison.boundZone, + ) const showProfileForm = showBindingStage && profileEditing const bindingCustomerReady = Boolean( bindingComparison?.customerRoleId || bindingComparison?.customerRoleName, @@ -1352,6 +1384,11 @@ export default function CustomerFulfillmentPage() { {!bindingInfo?.rebindConfirmMessage && !nextRebindText ? ( 请核对虎牙弹窗中选中的目标角色后重新提交。 ) : null} + {bindingProfileMismatch ? ( + + 当前资料与平台原角色不一致,无法直接确认;请修改资料为原角色,或等可换绑时间后再试。 + + ) : null} } /> @@ -1413,15 +1450,38 @@ export default function CustomerFulfillmentPage() { ) : rebindUnchanged ? (