feat(semi-auto): 首次绑定自动提交并由客户本地确认,统一客户页控件尺寸
1) 首次绑定(isBindAccount/isBindRole 任一为 0)扫码完成后自动调 confirmBindActAccount,新增 bindConfirmState/bindConfirmMessage,失败透出虎牙原文并提示重新扫码。 2) 确认绑定改为纯本地流转:不再调用 confirmBindActAccount,也不再重复查角色;换绑被虎牙拒绝时需 acceptExistingRole 二次确认「仍使用原角色」。新增 bindingSnapshot 只读快照。 3) 客户页资料收集去掉顶部大图,只保留温馨提示;输入框/选择器 48px、主按钮 52px、次级按钮 48px,登录/绑定/资料页统一。 4) 修正已确认/已过期/绑定失败状态仍显示「登录成功,请继续扫码绑定游戏角色」的横幅错误,改为按 bindingStatus 显式映射,确认后只保留「等待客服核实」卡片。
This commit is contained in:
@@ -37,7 +37,6 @@ import type {
|
||||
CustomerSemiAutoTask,
|
||||
} from '@/types/customer-fulfillment'
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
import collectHero from '@/assets/claim/game-role-id-guide.jpg'
|
||||
import { runWeiboYidunChallenge } from '@/utils/weibo-yidun'
|
||||
import HuyaChallengeModal from './HuyaChallengeModal'
|
||||
|
||||
@@ -49,7 +48,7 @@ const SERVER_ZONE_OPTIONS = ['苹果Q区', '苹果V区', '安卓Q区', '安卓V
|
||||
const SERVER_ZONE_SELECT_CLASS_NAMES = { popup: { root: 'customer-collect-dropdown' } }
|
||||
|
||||
export default function CustomerFulfillmentPage() {
|
||||
const { message } = App.useApp()
|
||||
const { message, modal } = App.useApp()
|
||||
const { orderNo: routeOrderNo } = useParams<{ orderNo?: string }>()
|
||||
const orderNo = String(routeOrderNo || '').trim()
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -677,17 +676,23 @@ export default function CustomerFulfillmentPage() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleConfirmBinding() {
|
||||
async function handleConfirmBinding(acceptExistingRole = false) {
|
||||
if (!selectedTask) return
|
||||
setBindingLoading(true)
|
||||
try {
|
||||
const response = await confirmCustomerBinding(orderNo, selectedTask.id)
|
||||
const response = await confirmCustomerBinding(
|
||||
orderNo,
|
||||
selectedTask.id,
|
||||
acceptExistingRole ? { acceptExistingRole: true } : {},
|
||||
)
|
||||
setTasks((current) =>
|
||||
current.map((task) => (task.id === response.data.task.id ? response.data.task : task)),
|
||||
)
|
||||
setBindingInfo(response.data.binding)
|
||||
setBindingConfirmOpen(false)
|
||||
message.success('绑定已确认,等待客服处理')
|
||||
message.success(
|
||||
acceptExistingRole ? '已按原绑定角色确认,等待客服处理' : '绑定已确认,等待客服处理',
|
||||
)
|
||||
} catch (error) {
|
||||
if (isHuyaSessionExpired(error)) {
|
||||
setBindingSessionExpired(true)
|
||||
@@ -701,6 +706,21 @@ export default function CustomerFulfillmentPage() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 换绑被虎牙拒绝时的二次确认:客户可以选择继续使用原绑定角色。 */
|
||||
function handleAcceptExistingRole() {
|
||||
if (!selectedTask || bindingLoading) return
|
||||
const reason = String(bindingInfo?.rebindConfirmMessage || '').trim()
|
||||
modal.confirm({
|
||||
title: '仍使用原绑定角色?',
|
||||
content: `本次换绑未成功${reason ? `(${reason})` : ''},平台仍返回原绑定角色「${
|
||||
bindingRoleName || '当前角色'
|
||||
}」。确认后本次换绑作废,直接使用该角色继续履约。`,
|
||||
okText: '仍使用原角色',
|
||||
cancelText: '先不确认',
|
||||
onOk: () => handleConfirmBinding(true),
|
||||
})
|
||||
}
|
||||
|
||||
async function handleSaveProfile() {
|
||||
if (!selectedTask) return
|
||||
if (!profileServerZone.trim() || !profileRoleId.trim() || !profileRoleName.trim()) {
|
||||
@@ -778,6 +798,42 @@ export default function CustomerFulfillmentPage() {
|
||||
const rebindConfirmState = bindingInfo?.rebindConfirmState || 'idle'
|
||||
const rebindRejected = rebindConfirmState === 'rejected'
|
||||
const rebindAccepted = rebindConfirmState === 'accepted'
|
||||
const bindConfirmState = bindingInfo?.bindConfirmState || 'idle'
|
||||
const bindConfirmRejected = bindConfirmState === 'rejected'
|
||||
const bindConfirmPending = bindConfirmState === 'submitting' || bindConfirmState === 'accepted'
|
||||
// 还没有绑定角色时,二维码区域已经说明了原因,不再重复提示「缺角色ID」。
|
||||
const showMissingRoleIdWarning =
|
||||
!bindingPendingUid && !rebindUnchanged && bindingInfo?.hasExistingBinding !== false
|
||||
// 绑定阶段顶部状态条:按 bindingStatus 显式映射,已确认/已过期/失败不再显示(各自有卡片)。
|
||||
const bindingBanner = (() => {
|
||||
if (bindingSessionExpired) return null
|
||||
if (rebindUnchanged) {
|
||||
return {
|
||||
tone: 'is-warning',
|
||||
text: rebindRejected ? '虎牙未接受本次换绑,请查看下方原因' : '换绑未生效,请查看下方原因',
|
||||
}
|
||||
}
|
||||
if (selectedTask?.bindingStatus === 'role_ready') {
|
||||
return { tone: 'is-info', text: '已识别绑定角色,请核对后确认' }
|
||||
}
|
||||
if (
|
||||
selectedTask?.bindingStatus === 'confirmed' ||
|
||||
selectedTask?.bindingStatus === 'expired' ||
|
||||
selectedTask?.bindingStatus === 'failed'
|
||||
) {
|
||||
return null
|
||||
}
|
||||
if (bindingInfo?.hasExistingBinding === false) {
|
||||
return {
|
||||
tone: 'is-info',
|
||||
text: '登录成功,该虎牙账号还没有绑定游戏角色,请扫码完成绑定',
|
||||
}
|
||||
}
|
||||
if (!bindingRoleId) {
|
||||
return { tone: 'is-warning', text: '未获取到已绑定的角色ID,请重新扫码绑定' }
|
||||
}
|
||||
return null
|
||||
})()
|
||||
const nextRebindText = bindingInfo?.nextRebindAt
|
||||
? formatAdminDateTime(bindingInfo.nextRebindAt)
|
||||
: ''
|
||||
@@ -1121,24 +1177,10 @@ export default function CustomerFulfillmentPage() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{!bindingSessionExpired ? (
|
||||
rebindUnchanged ? (
|
||||
<div className="customer-binding-alert is-warning">
|
||||
{rebindRejected
|
||||
? '虎牙未接受本次换绑,请查看下方原因'
|
||||
: '换绑未生效,请查看下方原因'}
|
||||
</div>
|
||||
) : selectedTask?.bindingStatus === 'role_ready' ? (
|
||||
<div className="customer-binding-alert is-info">已识别绑定角色,请核对后确认</div>
|
||||
) : selectedTask?.bindingStatus === 'confirmed' || bindingRoleId ? (
|
||||
<div className="customer-binding-alert is-info">
|
||||
登录成功,请继续扫码绑定游戏角色
|
||||
</div>
|
||||
) : (
|
||||
<div className="customer-binding-alert is-warning">
|
||||
未获取到已绑定的角色ID,请重新扫码绑定
|
||||
</div>
|
||||
)
|
||||
{bindingBanner ? (
|
||||
<div className={`customer-binding-alert ${bindingBanner.tone}`}>
|
||||
{bindingBanner.text}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{showProfileForm && !bindingSessionExpired ? (
|
||||
@@ -1219,14 +1261,20 @@ export default function CustomerFulfillmentPage() {
|
||||
<span>正在生成绑定二维码...</span>
|
||||
</div>
|
||||
)}
|
||||
<p className="customer-binding-qr-hint">请使用微信APP扫码进行游戏角色绑定</p>
|
||||
<p className="customer-binding-qr-hint">
|
||||
{bindingInfo?.hasExistingBinding === false
|
||||
? '该虎牙账号还没有绑定游戏角色,请用微信扫码完成绑定'
|
||||
: '请使用微信APP扫码进行游戏角色绑定'}
|
||||
</p>
|
||||
<p className="customer-binding-qr-tip">
|
||||
{selectedTask?.bindingStatus === 'scanned'
|
||||
? rebindAccepted
|
||||
? '已向虎牙提交换绑,正在等待角色生效,请稍候刷新。'
|
||||
: bindingInfo?.rebindRequested
|
||||
? '扫码后请在虎牙弹窗中选中目标角色;选好后点下方「已选好角色,提交换绑」。'
|
||||
: '请在微信中完成角色绑定确认,再点击下方按钮进入下一步。'
|
||||
: bindConfirmPending
|
||||
? '已向虎牙提交绑定,正在等待角色生效,请稍候刷新。'
|
||||
: bindingInfo?.rebindRequested
|
||||
? '扫码后请在虎牙弹窗中选中目标角色;选好后点下方「已选好角色,提交换绑」。'
|
||||
: '请在微信中完成角色绑定确认,再点击下方按钮进入下一步。'
|
||||
: '扫码后请在微信确认框中核对目标角色。'}
|
||||
</p>
|
||||
{nextRebindText ? (
|
||||
@@ -1267,7 +1315,9 @@ export default function CustomerFulfillmentPage() {
|
||||
loading={bindingLoading}
|
||||
onClick={() => void handlePollBindingNow()}
|
||||
>
|
||||
{rebindAccepted ? '刷新绑定状态' : '已扫码绑定,点击进入下一步'}
|
||||
{rebindAccepted || bindConfirmPending
|
||||
? '刷新绑定状态'
|
||||
: '已扫码绑定,点击进入下一步'}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -1291,7 +1341,7 @@ export default function CustomerFulfillmentPage() {
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
message="绑定失败"
|
||||
message={bindConfirmRejected ? '虎牙未接受本次绑定' : '绑定失败'}
|
||||
description={
|
||||
bindingInfo?.message || '请刷新二维码后重新扫码,如持续失败请联系客服。'
|
||||
}
|
||||
@@ -1363,7 +1413,7 @@ export default function CustomerFulfillmentPage() {
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
{!bindingPendingUid && !rebindUnchanged ? (
|
||||
{showMissingRoleIdWarning ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
@@ -1392,6 +1442,15 @@ export default function CustomerFulfillmentPage() {
|
||||
>
|
||||
重新扫码换绑
|
||||
</Button>
|
||||
<Button
|
||||
block
|
||||
size="large"
|
||||
className="customer-binding-accept"
|
||||
loading={bindingLoading}
|
||||
onClick={() => handleAcceptExistingRole()}
|
||||
>
|
||||
仍使用原角色
|
||||
</Button>
|
||||
</div>
|
||||
) : comparisonMismatch ? (
|
||||
<div className="customer-binding-role-actions">
|
||||
@@ -1672,8 +1731,6 @@ function CustomerCollectStep(input: {
|
||||
return (
|
||||
<div className="customer-collect-page">
|
||||
<div className="customer-collect-hero">
|
||||
<img src={collectHero} alt="" className="customer-collect-hero-image" />
|
||||
<div className="customer-collect-hero-mask" />
|
||||
<p className="customer-collect-warning">温馨提示:未成年人禁止下单</p>
|
||||
</div>
|
||||
<div className="customer-collect-body">
|
||||
|
||||
@@ -59,10 +59,14 @@ export function pollCustomerBinding(orderNo: string, taskId: number) {
|
||||
)
|
||||
}
|
||||
|
||||
export function confirmCustomerBinding(orderNo: string, taskId: number) {
|
||||
export function confirmCustomerBinding(
|
||||
orderNo: string,
|
||||
taskId: number,
|
||||
options: { acceptExistingRole?: boolean } = {},
|
||||
) {
|
||||
return apiPost<{ task: CustomerSemiAutoTask; binding: CustomerBindingInfo }>(
|
||||
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/binding/confirm`,
|
||||
{},
|
||||
options.acceptExistingRole ? { acceptExistingRole: true } : {},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2149,30 +2149,12 @@
|
||||
}
|
||||
|
||||
.customer-collect-hero {
|
||||
position: relative;
|
||||
height: 210px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.customer-collect-hero-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: left center;
|
||||
filter: saturate(0.9) brightness(0.72);
|
||||
}
|
||||
|
||||
.customer-collect-hero-mask {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(180deg, rgba(11, 18, 32, 0.1), rgba(11, 18, 32, 0.96));
|
||||
padding: 42px 20px 6px;
|
||||
text-align: center;
|
||||
background: linear-gradient(180deg, #0f1a2d, #0b1220);
|
||||
}
|
||||
|
||||
.customer-collect-warning {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 22px;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
color: #f87171;
|
||||
@@ -2201,7 +2183,7 @@
|
||||
}
|
||||
|
||||
.customer-collect-readonly {
|
||||
height: 56px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
@@ -2255,7 +2237,7 @@
|
||||
}
|
||||
|
||||
.customer-collect-input.ant-input {
|
||||
height: 56px;
|
||||
height: 48px;
|
||||
border-radius: 12px;
|
||||
background: #1b2436;
|
||||
border-color: #26344d;
|
||||
@@ -2268,7 +2250,7 @@
|
||||
|
||||
.customer-collect-select.ant-select {
|
||||
width: 100%;
|
||||
height: 56px;
|
||||
height: 48px;
|
||||
padding-inline: 16px;
|
||||
align-items: center;
|
||||
font-size: 15px;
|
||||
@@ -2276,7 +2258,7 @@
|
||||
border: 1px solid #26344d;
|
||||
background: #1b2436;
|
||||
color: #fff;
|
||||
--ant-select-height: 56px;
|
||||
--ant-select-height: 48px;
|
||||
--ant-select-border-radius: 12px;
|
||||
--ant-select-border-color: #26344d;
|
||||
--ant-select-background-color: #1b2436;
|
||||
@@ -2340,7 +2322,7 @@
|
||||
|
||||
.customer-collect-page .customer-collect-submit.ant-btn,
|
||||
.customer-auth-profile .customer-collect-submit.ant-btn {
|
||||
height: 56px;
|
||||
height: 52px;
|
||||
margin-top: 14px;
|
||||
border-radius: 14px;
|
||||
font-size: 17px;
|
||||
@@ -2391,7 +2373,7 @@
|
||||
.customer-login-mobile.ant-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 52px;
|
||||
height: 48px;
|
||||
padding: 0 16px;
|
||||
border-radius: 8px;
|
||||
border-color: #3a4150;
|
||||
@@ -2407,7 +2389,7 @@
|
||||
.customer-login-code-button.ant-btn {
|
||||
flex: none;
|
||||
width: 118px;
|
||||
height: 52px;
|
||||
height: 48px;
|
||||
border-radius: 8px;
|
||||
background: #3b82f6 !important;
|
||||
border-color: #3b82f6 !important;
|
||||
@@ -2416,7 +2398,7 @@
|
||||
}
|
||||
|
||||
.customer-login-code-input.ant-input {
|
||||
height: 52px;
|
||||
height: 48px;
|
||||
border-radius: 8px;
|
||||
border-color: #3a4150;
|
||||
background: #1b2130;
|
||||
@@ -2431,7 +2413,7 @@
|
||||
}
|
||||
|
||||
.customer-login-submit.ant-btn {
|
||||
height: 56px;
|
||||
height: 52px;
|
||||
border-radius: 14px;
|
||||
background: #2563eb !important;
|
||||
border-color: #2563eb !important;
|
||||
@@ -2448,7 +2430,7 @@
|
||||
}
|
||||
|
||||
.customer-login-alt.ant-btn {
|
||||
height: 52px;
|
||||
height: 48px;
|
||||
border-radius: 8px;
|
||||
background: transparent !important;
|
||||
border-color: #3a4150 !important;
|
||||
@@ -2634,7 +2616,7 @@
|
||||
}
|
||||
|
||||
.customer-binding-role-actions .customer-binding-confirm.ant-btn {
|
||||
height: 56px;
|
||||
height: 52px;
|
||||
border-radius: 14px;
|
||||
background: #2563eb !important;
|
||||
border-color: #2563eb !important;
|
||||
@@ -2651,7 +2633,7 @@
|
||||
}
|
||||
|
||||
.customer-binding-role-actions .customer-binding-rebind.ant-btn {
|
||||
height: 56px;
|
||||
height: 48px;
|
||||
border-radius: 14px;
|
||||
background: transparent !important;
|
||||
border-color: #3a4150 !important;
|
||||
@@ -2671,6 +2653,23 @@
|
||||
color: #fbbf24 !important;
|
||||
}
|
||||
|
||||
.customer-binding-role-actions .customer-binding-accept.ant-btn {
|
||||
height: 46px;
|
||||
border-radius: 12px;
|
||||
background: transparent !important;
|
||||
border-color: transparent !important;
|
||||
color: #94a3b8 !important;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.customer-binding-role-actions .customer-binding-accept.ant-btn:hover,
|
||||
.customer-binding-role-actions .customer-binding-accept.ant-btn:focus-visible {
|
||||
background: rgba(148, 163, 184, 0.1) !important;
|
||||
border-color: transparent !important;
|
||||
color: #e2e8f0 !important;
|
||||
}
|
||||
|
||||
.customer-binding-info {
|
||||
padding: 16px;
|
||||
border: 1px solid #3a4150;
|
||||
@@ -2804,7 +2803,7 @@
|
||||
|
||||
.customer-binding-next.ant-btn {
|
||||
width: 100%;
|
||||
height: 56px;
|
||||
height: 52px;
|
||||
margin-top: 6px;
|
||||
border-radius: 14px;
|
||||
background: #2563eb !important;
|
||||
@@ -2897,7 +2896,7 @@
|
||||
|
||||
.customer-auth-button-stack .ant-btn,
|
||||
.customer-auth-form > .ant-btn {
|
||||
height: 50px;
|
||||
height: 52px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@ export type CustomerBindingInfo = {
|
||||
rebindUnchanged: boolean
|
||||
rebindConfirmState: 'idle' | 'submitting' | 'accepted' | 'rejected'
|
||||
rebindConfirmMessage: string
|
||||
bindConfirmState?: 'idle' | 'submitting' | 'accepted' | 'rejected'
|
||||
bindConfirmMessage?: string
|
||||
rebindCooldownDays: number
|
||||
nextRebindAt: string
|
||||
platformChangeBindDay?: number
|
||||
|
||||
Reference in New Issue
Block a user