643 lines
22 KiB
TypeScript
643 lines
22 KiB
TypeScript
import {
|
||
CheckCircleFilled,
|
||
LoadingOutlined,
|
||
QrcodeOutlined,
|
||
ReloadOutlined,
|
||
SafetyCertificateOutlined,
|
||
} from '@ant-design/icons'
|
||
import { App, Button, Image, Input, Spin, Tabs } from 'antd'
|
||
import QRCode from 'qrcode'
|
||
import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'
|
||
import { useParams } from 'react-router'
|
||
|
||
import {
|
||
fetchCustomerFulfillment,
|
||
loginCustomerHuyaSms,
|
||
loginCustomerWeiboSms,
|
||
markCustomerFulfillmentOpened,
|
||
pollCustomerLogin,
|
||
pollCustomerWeiboQrLogin,
|
||
sendCustomerHuyaSmsCode,
|
||
sendCustomerWeiboSmsCode,
|
||
startCustomerLogin,
|
||
startCustomerWeiboQrLogin,
|
||
verifyCustomerHuyaSmsChallenge,
|
||
type CustomerHuyaChallengeSolution,
|
||
type CustomerHuyaSmsChallenge,
|
||
} from '@/services/customer-fulfillment'
|
||
import type { CustomerLoginInfo, CustomerSemiAutoTask } from '@/types/customer-fulfillment'
|
||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||
import { runWeiboYidunChallenge } from '@/utils/weibo-yidun'
|
||
import HuyaChallengeModal from './HuyaChallengeModal'
|
||
|
||
const POLL_INTERVAL_MS = 2000
|
||
|
||
export default function CustomerFulfillmentPage() {
|
||
const { message } = App.useApp()
|
||
const { orderNo: routeOrderNo } = useParams<{ orderNo?: string }>()
|
||
const orderNo = String(routeOrderNo || '').trim()
|
||
const [loading, setLoading] = useState(true)
|
||
const [loadError, setLoadError] = useState('')
|
||
const [tasks, setTasks] = useState<CustomerSemiAutoTask[]>([])
|
||
const [selectedTaskId, setSelectedTaskId] = useState(0)
|
||
const [loginInfo, setLoginInfo] = useState<CustomerLoginInfo | null>(null)
|
||
const [loginQrImage, setLoginQrImage] = useState('')
|
||
const [loginMode, setLoginMode] = useState<'sms' | 'qr'>('sms')
|
||
const [mobile, setMobile] = useState('')
|
||
const [smsCode, setSmsCode] = useState('')
|
||
const [smsSending, setSmsSending] = useState(false)
|
||
const [smsLogging, setSmsLogging] = useState(false)
|
||
const [smsCountdown, setSmsCountdown] = useState(0)
|
||
const [smsMfaRequired, setSmsMfaRequired] = useState(false)
|
||
const [huyaChallenge, setHuyaChallenge] = useState<CustomerHuyaSmsChallenge | null>(null)
|
||
const [huyaChallengeLoading, setHuyaChallengeLoading] = useState(false)
|
||
|
||
const selectedTask = useMemo(
|
||
() => tasks.find((task) => task.id === selectedTaskId) || tasks[0] || null,
|
||
[selectedTaskId, tasks],
|
||
)
|
||
const isWeibo = selectedTask?.platform === 'weibo'
|
||
const isHuya = selectedTask?.platform === 'huya'
|
||
|
||
const load = useCallback(
|
||
async (silent = false) => {
|
||
if (!orderNo) {
|
||
setLoadError('订单号无效,请确认订单号是否正确')
|
||
setLoading(false)
|
||
return
|
||
}
|
||
if (!silent) setLoading(true)
|
||
try {
|
||
const response = await fetchCustomerFulfillment(orderNo)
|
||
const nextTasks = response.data || []
|
||
setTasks(nextTasks)
|
||
setLoadError('')
|
||
setSelectedTaskId((current) => {
|
||
if (nextTasks.some((task) => task.id === current)) return current
|
||
return nextTasks[0]?.id || 0
|
||
})
|
||
} catch (error) {
|
||
if (!silent) {
|
||
setTasks([])
|
||
setLoadError(error instanceof Error ? error.message : '读取订单履约信息失败')
|
||
}
|
||
} finally {
|
||
if (!silent) setLoading(false)
|
||
}
|
||
},
|
||
[orderNo],
|
||
)
|
||
|
||
useEffect(() => {
|
||
void load()
|
||
}, [load])
|
||
|
||
useEffect(() => {
|
||
if (!selectedTask) return
|
||
setLoginMode('sms')
|
||
setMobile('')
|
||
setSmsCode('')
|
||
setSmsMfaRequired(false)
|
||
setSmsCountdown(0)
|
||
setHuyaChallenge(null)
|
||
}, [selectedTask?.id])
|
||
|
||
useEffect(() => {
|
||
if (!selectedTask) return
|
||
void markCustomerFulfillmentOpened(orderNo, selectedTask.id).catch(() => undefined)
|
||
}, [orderNo, selectedTask?.id])
|
||
|
||
useEffect(() => {
|
||
if (!selectedTask || !orderNo) return
|
||
if (
|
||
selectedTask.executionStatus === 'completed' ||
|
||
selectedTask.executionStatus === 'cancelled'
|
||
) {
|
||
return
|
||
}
|
||
const timer = window.setInterval(() => {
|
||
void load(true)
|
||
}, POLL_INTERVAL_MS)
|
||
return () => window.clearInterval(timer)
|
||
}, [load, orderNo, selectedTask?.executionStatus, selectedTask?.id])
|
||
|
||
useEffect(() => {
|
||
if (!selectedTask) return
|
||
if (!['waiting_login', 'failed', 'expired'].includes(selectedTask.loginStatus)) return
|
||
setLoginInfo(null)
|
||
setSmsCode('')
|
||
setSmsMfaRequired(false)
|
||
setSmsCountdown(0)
|
||
setHuyaChallenge(null)
|
||
}, [selectedTask?.id, selectedTask?.loginStatus])
|
||
|
||
useEffect(() => {
|
||
if (loginInfo?.qrImage) {
|
||
setLoginQrImage(loginInfo.qrImage)
|
||
return
|
||
}
|
||
if (!loginInfo?.qrContent) {
|
||
setLoginQrImage('')
|
||
return
|
||
}
|
||
void QRCode.toDataURL(loginInfo.qrContent, {
|
||
width: 300,
|
||
margin: 2,
|
||
color: { dark: '#111827', light: '#ffffff' },
|
||
}).then(setLoginQrImage)
|
||
}, [loginInfo?.qrContent, loginInfo?.qrImage])
|
||
|
||
useEffect(() => {
|
||
if (smsCountdown <= 0) return
|
||
const timer = window.setTimeout(() => setSmsCountdown((value) => value - 1), 1000)
|
||
return () => window.clearTimeout(timer)
|
||
}, [smsCountdown])
|
||
|
||
useEffect(() => {
|
||
if (!selectedTask || !orderNo) return
|
||
if (!['qr_pending', 'scanned'].includes(selectedTask.loginStatus)) return
|
||
const tick = async () => {
|
||
try {
|
||
const response =
|
||
selectedTask.platform === 'weibo'
|
||
? await pollCustomerWeiboQrLogin(orderNo, selectedTask.id)
|
||
: await pollCustomerLogin(orderNo, selectedTask.id)
|
||
if (response.data.task) {
|
||
setTasks((current) =>
|
||
current.map((task) => (task.id === response.data.task.id ? response.data.task : task)),
|
||
)
|
||
}
|
||
if (response.data.login) setLoginInfo(response.data.login)
|
||
} catch {
|
||
// 短暂轮询失败不打断客户页面,下一轮继续。
|
||
}
|
||
}
|
||
const timer = window.setInterval(() => {
|
||
void tick()
|
||
}, POLL_INTERVAL_MS)
|
||
return () => window.clearInterval(timer)
|
||
}, [orderNo, selectedTask?.id, selectedTask?.loginStatus, selectedTask?.platform])
|
||
|
||
async function handleStartLogin() {
|
||
if (!selectedTask) return
|
||
setLoading(true)
|
||
try {
|
||
const response =
|
||
selectedTask.platform === 'weibo'
|
||
? await startCustomerWeiboQrLogin(orderNo, selectedTask.id)
|
||
: await startCustomerLogin(orderNo, selectedTask.id)
|
||
setTasks((current) =>
|
||
current.map((task) => (task.id === response.data.task.id ? response.data.task : task)),
|
||
)
|
||
setLoginInfo(response.data.login)
|
||
} catch (error) {
|
||
message.error(error instanceof Error ? error.message : '创建登录二维码失败')
|
||
} finally {
|
||
setLoading(false)
|
||
}
|
||
}
|
||
|
||
async function handleSendSms() {
|
||
if (!selectedTask) return
|
||
const phone = mobile.trim()
|
||
if (!isValidMainlandMobile(phone)) {
|
||
message.warning('请输入正确的手机号')
|
||
return
|
||
}
|
||
setSmsSending(true)
|
||
try {
|
||
if (selectedTask.platform === 'weibo') {
|
||
let response = await sendCustomerWeiboSmsCode(orderNo, selectedTask.id, phone, '86')
|
||
if (response.data.mfaRequired) {
|
||
setSmsMfaRequired(true)
|
||
if (!response.data.mfaId || !response.data.captchaId) {
|
||
throw new Error('微博返回的安全验证参数不完整')
|
||
}
|
||
await runWeiboYidunChallenge(response.data.mfaId, response.data.captchaId)
|
||
response = await sendCustomerWeiboSmsCode(
|
||
orderNo,
|
||
selectedTask.id,
|
||
phone,
|
||
'86',
|
||
response.data.mfaId,
|
||
)
|
||
if (response.data.mfaRequired) {
|
||
throw new Error('微博安全验证未通过,请重新获取验证码')
|
||
}
|
||
}
|
||
message.success(response.data.message || '验证码已发送,请注意查收')
|
||
} else {
|
||
const response = await sendCustomerHuyaSmsCode(orderNo, selectedTask.id, phone)
|
||
if (response.data.challenge) {
|
||
setHuyaChallenge(response.data.challenge)
|
||
message.info('请先完成滑块安全验证')
|
||
return
|
||
}
|
||
message.success(response.data.message || '验证码已发送,请注意查收')
|
||
}
|
||
setSmsMfaRequired(false)
|
||
setSmsCountdown(60)
|
||
} catch (error) {
|
||
message.error(error instanceof Error ? error.message : '发送验证码失败')
|
||
} finally {
|
||
setSmsSending(false)
|
||
}
|
||
}
|
||
|
||
async function handleLoginSms() {
|
||
if (!selectedTask) return
|
||
const phone = mobile.trim()
|
||
if (!isValidMainlandMobile(phone)) {
|
||
message.warning('请输入正确的手机号')
|
||
return
|
||
}
|
||
if (!smsCode.trim()) {
|
||
message.warning('请输入短信验证码')
|
||
return
|
||
}
|
||
setSmsLogging(true)
|
||
try {
|
||
const response =
|
||
selectedTask.platform === 'weibo'
|
||
? await loginCustomerWeiboSms(orderNo, selectedTask.id, {
|
||
mobile: phone,
|
||
code: smsCode.trim(),
|
||
countryCode: '86',
|
||
})
|
||
: await loginCustomerHuyaSms(orderNo, selectedTask.id, {
|
||
mobile: phone,
|
||
code: smsCode.trim(),
|
||
})
|
||
setTasks((current) =>
|
||
current.map((task) => (task.id === response.data.task.id ? response.data.task : task)),
|
||
)
|
||
setLoginInfo(response.data.login)
|
||
setHuyaChallenge(null)
|
||
message.success(`${isWeibo ? '微博' : '虎牙'}登录成功,等待客服处理`)
|
||
} catch (error) {
|
||
const errorCode = (error as { errorCode?: string } | null)?.errorCode || ''
|
||
if (errorCode === 'weibo_sms_mfa_required') {
|
||
setSmsMfaRequired(true)
|
||
message.warning('微博要求二次验证,请改用扫码登录')
|
||
return
|
||
}
|
||
message.error(error instanceof Error ? error.message : '短信登录失败')
|
||
} finally {
|
||
setSmsLogging(false)
|
||
}
|
||
}
|
||
|
||
async function handleVerifyHuyaChallenge(solution: CustomerHuyaChallengeSolution) {
|
||
if (!selectedTask || !huyaChallenge) return
|
||
setHuyaChallengeLoading(true)
|
||
try {
|
||
const response = await verifyCustomerHuyaSmsChallenge(orderNo, selectedTask.id, solution)
|
||
if (response.data.challenge) {
|
||
setHuyaChallenge(response.data.challenge)
|
||
message.warning('安全验证未通过,请重新完成')
|
||
return
|
||
}
|
||
setHuyaChallenge(null)
|
||
setSmsCountdown(60)
|
||
message.success(response.data.message || '验证码已发送,请注意查收')
|
||
} catch (error) {
|
||
message.error(error instanceof Error ? error.message : '虎牙安全验证失败')
|
||
} finally {
|
||
setHuyaChallengeLoading(false)
|
||
}
|
||
}
|
||
|
||
const config = selectedTask?.semiAutoConfig || {}
|
||
const displayTitle = isWeibo ? '微博账号登录授权' : '虎牙账号登录授权'
|
||
const loginQrVisible =
|
||
selectedTask && ['qr_pending', 'scanned'].includes(selectedTask.loginStatus)
|
||
|
||
if (loading) {
|
||
return (
|
||
<CustomerAuthFrame title="正在读取订单信息">
|
||
<div className="customer-auth-loading">
|
||
<Spin indicator={<LoadingOutlined spin />} />
|
||
<span>正在读取订单履约信息...</span>
|
||
</div>
|
||
</CustomerAuthFrame>
|
||
)
|
||
}
|
||
|
||
if (loadError || tasks.length === 0) {
|
||
return (
|
||
<CustomerAuthFrame title="暂时无法打开订单">
|
||
<div className="customer-auth-state is-error">
|
||
<h2>订单信息读取失败</h2>
|
||
<p>{loadError || '该订单没有需要客户授权或绑定的任务。'}</p>
|
||
</div>
|
||
</CustomerAuthFrame>
|
||
)
|
||
}
|
||
|
||
if (selectedTask?.executionStatus === 'completed') {
|
||
return (
|
||
<CustomerAuthFrame platform={selectedTask.platform} title={displayTitle}>
|
||
<CustomerTaskFacts task={selectedTask} />
|
||
<div className="customer-auth-state is-success">
|
||
<div className="customer-auth-state-icon">
|
||
<CheckCircleFilled />
|
||
</div>
|
||
<h2>履约已完成</h2>
|
||
<p>
|
||
{selectedTask.completionNote ||
|
||
(isWeibo
|
||
? '客服已完成本订单的微博发帖操作,请到微博账号中确认。'
|
||
: '客服已完成本订单的充值或赠送操作,请到平台账号中确认。')}
|
||
</p>
|
||
{selectedTask.completedAt ? (
|
||
<span className="customer-auth-state-time">
|
||
完成时间:{formatAdminDateTime(selectedTask.completedAt)}
|
||
</span>
|
||
) : null}
|
||
</div>
|
||
<CustomerPrivacyNote />
|
||
</CustomerAuthFrame>
|
||
)
|
||
}
|
||
|
||
return (
|
||
<CustomerAuthFrame platform={selectedTask?.platform} title={displayTitle}>
|
||
<div className="customer-auth-content-stack">
|
||
{tasks.length > 1 ? (
|
||
<div className="customer-auth-task-switcher">
|
||
<span>本订单需要处理</span>
|
||
<div>
|
||
{tasks.map((task) => (
|
||
<Button
|
||
key={task.id}
|
||
type={task.id === selectedTask?.id ? 'primary' : 'default'}
|
||
onClick={() => {
|
||
setSelectedTaskId(task.id)
|
||
setLoginInfo(null)
|
||
}}
|
||
>
|
||
{task.productName || task.skuName} × {task.quantity}
|
||
</Button>
|
||
))}
|
||
</div>
|
||
</div>
|
||
) : null}
|
||
|
||
<CustomerTaskFacts task={selectedTask} />
|
||
|
||
{selectedTask?.loginStatus === 'waiting_login' ||
|
||
selectedTask?.loginStatus === 'failed' ||
|
||
selectedTask?.loginStatus === 'expired' ? (
|
||
<section className="customer-auth-section">
|
||
<Tabs
|
||
className="customer-auth-tabs"
|
||
activeKey={loginMode}
|
||
onChange={(key) => setLoginMode(key as 'sms' | 'qr')}
|
||
items={[
|
||
{
|
||
key: 'sms',
|
||
label: '手机号登录',
|
||
children: (
|
||
<div className="customer-auth-form">
|
||
<div className="customer-auth-field customer-auth-phone-field">
|
||
<span className="customer-auth-country-prefix">+86</span>
|
||
<Input
|
||
value={mobile}
|
||
onChange={(event) => setMobile(event.target.value)}
|
||
placeholder={`请输入${isHuya ? '虎牙' : '微博'}绑定手机号`}
|
||
maxLength={11}
|
||
inputMode="numeric"
|
||
/>
|
||
<Button
|
||
className="customer-auth-send-code"
|
||
type="primary"
|
||
loading={smsSending}
|
||
disabled={smsCountdown > 0}
|
||
onClick={() => void handleSendSms()}
|
||
>
|
||
{smsCountdown > 0 ? `${smsCountdown}s` : '发送验证码'}
|
||
</Button>
|
||
</div>
|
||
{isWeibo && smsMfaRequired ? (
|
||
<div className="customer-auth-note">
|
||
请在安全验证弹窗中完成验证,通过后会继续发送短信验证码。
|
||
</div>
|
||
) : null}
|
||
<div className="customer-auth-field customer-auth-code-field">
|
||
<Input
|
||
value={smsCode}
|
||
onChange={(event) => setSmsCode(event.target.value)}
|
||
placeholder="请输入短信验证码"
|
||
maxLength={8}
|
||
prefix={<SafetyCertificateOutlined />}
|
||
onPressEnter={() => void handleLoginSms()}
|
||
/>
|
||
<Button
|
||
type="primary"
|
||
className="customer-auth-code-submit"
|
||
loading={smsLogging}
|
||
onClick={() => void handleLoginSms()}
|
||
>
|
||
登录{isHuya ? '虎牙' : '微博'}
|
||
</Button>
|
||
</div>
|
||
{isWeibo ? (
|
||
<span className="customer-auth-form-hint">
|
||
如安全验证弹窗未出现,请检查浏览器是否拦截脚本。
|
||
</span>
|
||
) : null}
|
||
</div>
|
||
),
|
||
},
|
||
{
|
||
key: 'qr',
|
||
label: '扫码登录',
|
||
children: (
|
||
<div className="customer-auth-form">
|
||
<p className="customer-auth-form-copy">
|
||
{config.loginInstructions ||
|
||
`点击下方按钮后,使用${isHuya ? '虎牙' : '微博'} App 扫码并确认登录。`}
|
||
</p>
|
||
<Button
|
||
type="primary"
|
||
size="large"
|
||
block
|
||
onClick={() => void handleStartLogin()}
|
||
>
|
||
获取登录二维码
|
||
</Button>
|
||
</div>
|
||
),
|
||
},
|
||
]}
|
||
/>
|
||
</section>
|
||
) : null}
|
||
|
||
{loginQrVisible ? (
|
||
<section className="customer-auth-section">
|
||
<div className="customer-auth-section-heading">
|
||
<span className="customer-auth-section-icon">
|
||
<QrcodeOutlined />
|
||
</span>
|
||
<div>
|
||
<h2>{isWeibo ? '使用微博 App 扫码' : '使用虎牙 App 扫码'}</h2>
|
||
<p>二维码仅用于本次订单授权,请勿转发给他人。</p>
|
||
</div>
|
||
</div>
|
||
<div className="customer-auth-qr">
|
||
{loginQrImage ? (
|
||
<div className="customer-auth-qr-image">
|
||
<Image
|
||
src={loginQrImage}
|
||
alt={isWeibo ? '微博登录二维码' : '虎牙登录二维码'}
|
||
width={232}
|
||
preview={false}
|
||
/>
|
||
</div>
|
||
) : (
|
||
<div className="customer-auth-qr-placeholder">
|
||
<Spin />
|
||
<span>正在生成二维码...</span>
|
||
</div>
|
||
)}
|
||
<p>{loginInfo?.message || '等待扫码'}</p>
|
||
{selectedTask.loginStatus === 'scanned' ? (
|
||
<span className="customer-auth-status-pill is-scanned">
|
||
{isWeibo ? '已扫码,请在微博客户端确认登录' : '已扫码,请在 App 确认'}
|
||
</span>
|
||
) : null}
|
||
<Button
|
||
className="customer-auth-secondary-button"
|
||
onClick={() => void handleStartLogin()}
|
||
>
|
||
重新获取二维码
|
||
</Button>
|
||
</div>
|
||
</section>
|
||
) : null}
|
||
|
||
{selectedTask?.loginStatus === 'authenticated' &&
|
||
selectedTask.executionStatus !== 'completed' ? (
|
||
<div className="customer-auth-state is-waiting">
|
||
<div className="customer-auth-state-icon">
|
||
<LoadingOutlined spin />
|
||
</div>
|
||
<h2>客服正在安排</h2>
|
||
<p>请耐心等待</p>
|
||
<Button
|
||
className="customer-auth-secondary-button"
|
||
icon={<ReloadOutlined />}
|
||
onClick={() => void load()}
|
||
>
|
||
刷新状态
|
||
</Button>
|
||
</div>
|
||
) : null}
|
||
|
||
<HuyaChallengeModal
|
||
open={Boolean(huyaChallenge)}
|
||
challenge={huyaChallenge}
|
||
loading={huyaChallengeLoading}
|
||
onCancel={() => {
|
||
if (!huyaChallengeLoading) setHuyaChallenge(null)
|
||
}}
|
||
onSubmit={(solution) => void handleVerifyHuyaChallenge(solution)}
|
||
/>
|
||
|
||
<CustomerPrivacyNote />
|
||
</div>
|
||
</CustomerAuthFrame>
|
||
)
|
||
}
|
||
|
||
function CustomerAuthFrame(input: {
|
||
platform?: CustomerSemiAutoTask['platform']
|
||
title: string
|
||
children: ReactNode
|
||
}) {
|
||
const platformClass =
|
||
input.platform === 'weibo' ? 'is-weibo' : input.platform === 'huya' ? 'is-huya' : ''
|
||
return (
|
||
<div className={`customer-auth-page ${platformClass}`}>
|
||
<div className="customer-auth-shell">
|
||
<header className="customer-auth-hero">
|
||
<div className="customer-auth-brand">
|
||
<div>
|
||
<h1>{input.title}</h1>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
<div className="customer-auth-warning">
|
||
{input.platform === 'weibo'
|
||
? '温馨提示:未成年人禁止下单'
|
||
: '温馨提示:请使用本人账号完成授权'}
|
||
</div>
|
||
<main className="customer-auth-main">{input.children}</main>
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function CustomerTaskFacts(input: { task: CustomerSemiAutoTask | null }) {
|
||
const task = input.task
|
||
if (!task) return null
|
||
const statusTone =
|
||
task.displayStatus.key === 'credential_expired' || task.displayStatus.key === 'failed'
|
||
? 'is-danger'
|
||
: task.loginStatus === 'authenticated'
|
||
? 'is-success'
|
||
: 'is-pending'
|
||
const showAccountDetails = ['authenticated', 'scanned'].includes(task.loginStatus)
|
||
return (
|
||
<div className="customer-auth-facts">
|
||
<div>
|
||
<span>订单号</span>
|
||
<strong>{task.orderNo}</strong>
|
||
</div>
|
||
<div>
|
||
<span>商品</span>
|
||
<strong>
|
||
{task.productName || task.skuName} × {task.quantity}
|
||
</strong>
|
||
</div>
|
||
<div>
|
||
<span>平台</span>
|
||
<strong>{task.platformLabel || task.platform}</strong>
|
||
</div>
|
||
{showAccountDetails && task.huyaUid ? (
|
||
<div>
|
||
<span>平台账号 ID</span>
|
||
<strong>{task.huyaUid}</strong>
|
||
</div>
|
||
) : null}
|
||
{showAccountDetails && task.platform === 'weibo' && task.platformNickname ? (
|
||
<div>
|
||
<span>账号昵称</span>
|
||
<strong>{task.platformNickname}</strong>
|
||
</div>
|
||
) : null}
|
||
<div>
|
||
<span>状态</span>
|
||
<strong className={`customer-auth-status-pill ${statusTone}`}>
|
||
{task.displayStatus.label}
|
||
</strong>
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function CustomerPrivacyNote() {
|
||
return (
|
||
<div className="customer-auth-privacy">
|
||
资料仅用于本次订单履约,请勿向他人泄露验证码或账号信息。
|
||
</div>
|
||
)
|
||
}
|
||
|
||
function isValidMainlandMobile(value: string) {
|
||
const digits = value.replace(/\D/g, '')
|
||
if (!digits) return false
|
||
return /^1\d{10}$/.test(digits)
|
||
}
|