新增 affiliate_dash 统一领取页流程(阶段 4)
- 后端:claim 详情分流 affiliate_dash 分支 + 详情轮询刷新 bind-result - 输 UID 触发 bind(拿 bindUuid/二维码, task→waiting_binding) - 新增 POST /claim/:token/affiliate-dash/submit(submit→redeeming + 事件) - 前端:ClaimAffiliateDashSteps(二维码/绑定状态/mismatch警告/提交发货) - claim-snapshot/claim-poll 按 flowType 分流(step2 绑定中/step3 已绑定待提交/step4 结果) - 前后端 typecheck + 后端 212 测试通过
This commit is contained in:
@@ -10,10 +10,12 @@ import {
|
||||
fetchClaimDetail,
|
||||
rebindKuaishouCloudClaimRole,
|
||||
redeemKuaishouCloudClaim,
|
||||
submitAffiliateDashClaim,
|
||||
submitClaimUid,
|
||||
} from '@/services/claim'
|
||||
import type { ClaimDetailData } from '@/types/claim'
|
||||
|
||||
import { AffiliateDashClaimPanel, AffiliateDashResultStep } from './ClaimAffiliateDashSteps'
|
||||
import { FeifeiClaimPanel, FeifeiResultStep } from './ClaimFeifeiSteps'
|
||||
import { ClaimHeaderCard } from './ClaimHeaderCard'
|
||||
import { ClaimResultStep, KuaishouCloudClaimSteps } from './ClaimLewanSteps'
|
||||
@@ -32,6 +34,7 @@ export default function ClaimPage() {
|
||||
const [confirmingRole, setConfirmingRole] = useState(false)
|
||||
const [rebindingRole, setRebindingRole] = useState(false)
|
||||
const [redeeming, setRedeeming] = useState(false)
|
||||
const [submittingSubmit, setSubmittingSubmit] = useState(false)
|
||||
const [errorMessage, setErrorMessage] = useState('')
|
||||
const [detail, setDetail] = useState<ClaimDetailData | null>(null)
|
||||
const [qrCodeDataUrl, setQrCodeDataUrl] = useState('')
|
||||
@@ -81,7 +84,11 @@ export default function ClaimPage() {
|
||||
setUidInput(expectedUid)
|
||||
}
|
||||
await generateQRCode(
|
||||
String(nextDetail.kuaishouCloudFulfillment?.binding.bindUrl || '').trim(),
|
||||
String(
|
||||
nextDetail.kuaishouCloudFulfillment?.binding.bindUrl ||
|
||||
nextDetail.affiliateDash?.bindUrl ||
|
||||
'',
|
||||
).trim(),
|
||||
)
|
||||
},
|
||||
[generateQRCode],
|
||||
@@ -172,6 +179,28 @@ export default function ClaimPage() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmitAffiliateDash() {
|
||||
const affiliateDash = snapshot.affiliateDash
|
||||
const uid = uidInput.trim() || affiliateDash?.gameAccount || ''
|
||||
const bindUuid = affiliateDash?.bindUuid || ''
|
||||
|
||||
if (!uid || !bindUuid) {
|
||||
showError('绑定尚未完成,请先绑定账号')
|
||||
return
|
||||
}
|
||||
|
||||
setSubmittingSubmit(true)
|
||||
try {
|
||||
const response = await submitAffiliateDashClaim(token, { gameAccount: uid, bindUuid })
|
||||
await applyDetail(response.data)
|
||||
showSuccess('发货已提交')
|
||||
} catch (error) {
|
||||
showError(error instanceof Error ? error.message : '提交发货失败')
|
||||
} finally {
|
||||
setSubmittingSubmit(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshRole() {
|
||||
setRefreshingRole(true)
|
||||
try {
|
||||
@@ -263,7 +292,9 @@ export default function ClaimPage() {
|
||||
}
|
||||
|
||||
function openBindUrl(useCurrentPage = false) {
|
||||
const bindUrl = String(snapshot.flow?.binding.bindUrl || '').trim()
|
||||
const bindUrl = String(
|
||||
snapshot.flow?.binding.bindUrl || snapshot.affiliateDash?.bindUrl || '',
|
||||
).trim()
|
||||
if (!bindUrl) {
|
||||
showError('绑定链接还没准备好,请稍后刷新')
|
||||
return
|
||||
@@ -337,9 +368,27 @@ export default function ClaimPage() {
|
||||
) : snapshot.hasRedeemResult ? (
|
||||
snapshot.isFeifeiFlow ? (
|
||||
<FeifeiResultStep snapshot={snapshot} />
|
||||
) : snapshot.isAffiliateDashFlow ? (
|
||||
<AffiliateDashResultStep snapshot={snapshot} />
|
||||
) : (
|
||||
<ClaimResultStep snapshot={snapshot} />
|
||||
)
|
||||
) : snapshot.isAffiliateDashFlow && snapshot.affiliateDash ? (
|
||||
<AffiliateDashClaimPanel
|
||||
affiliateDash={snapshot.affiliateDash}
|
||||
expectedUid={snapshot.expectedUid}
|
||||
order={snapshot.order}
|
||||
product={snapshot.product}
|
||||
taskLastError={snapshot.task?.lastError}
|
||||
qrCodeDataUrl={qrCodeDataUrl}
|
||||
submittingUid={submittingUid}
|
||||
submittingSubmit={submittingSubmit}
|
||||
uidInput={uidInput}
|
||||
onUidChange={setUidInput}
|
||||
onResubmitUid={() => void handleSubmitUid()}
|
||||
onSubmit={() => void handleSubmitAffiliateDash()}
|
||||
onOpenBindUrl={openBindUrl}
|
||||
/>
|
||||
) : snapshot.isFeifeiFlow && snapshot.feifei ? (
|
||||
<FeifeiClaimPanel
|
||||
feifei={snapshot.feifei}
|
||||
|
||||
Reference in New Issue
Block a user