修复(接单平台): 售后微信未启用时不显示提示

This commit is contained in:
2026-11-25 11:04:11 +08:00
parent e2d9fca33c
commit 15e23312f6
@@ -81,10 +81,7 @@ export default function WorkerLoginPage() {
const [deviceManagerOpen, setDeviceManagerOpen] = useState(false) const [deviceManagerOpen, setDeviceManagerOpen] = useState(false)
const [deviceManagerLoading, setDeviceManagerLoading] = useState(false) const [deviceManagerLoading, setDeviceManagerLoading] = useState(false)
const [managedDevices, setManagedDevices] = useState<WorkerSessionDevice[]>([]) const [managedDevices, setManagedDevices] = useState<WorkerSessionDevice[]>([])
const [frozenAccountBlocked, setFrozenAccountBlocked] = useState(false)
const [supportContact, setSupportContact] = useState<WorkerSupportContactConfig | null>(null) const [supportContact, setSupportContact] = useState<WorkerSupportContactConfig | null>(null)
const [supportContactLoading, setSupportContactLoading] = useState(false)
const [supportContactError, setSupportContactError] = useState('')
useEffect(() => { useEffect(() => {
if (countdown <= 0) return if (countdown <= 0) return
@@ -187,17 +184,15 @@ export default function WorkerLoginPage() {
} }
async function loadFrozenSupportContact() { async function loadFrozenSupportContact() {
setFrozenAccountBlocked(true)
setSupportContact(null) setSupportContact(null)
setSupportContactError('')
setSupportContactLoading(true)
try { try {
const response = await fetchWorkerSupportContact() const response = await fetchWorkerSupportContact()
setSupportContact(response.data) const contact = response.data
} catch (error) { if (contact.enabled && (contact.wechatId || contact.wechatQrCodeImage)) {
setSupportContactError(error instanceof Error ? error.message : '售后微信加载失败') setSupportContact(contact)
} finally { }
setSupportContactLoading(false) } catch {
// 售后微信未启用或读取失败时,不额外展示联系卡片。
} }
} }
@@ -489,56 +484,40 @@ export default function WorkerLoginPage() {
</Button> </Button>
</Form> </Form>
)} )}
{frozenAccountBlocked ? ( {supportContact?.enabled &&
(supportContact.wechatId || supportContact.wechatQrCodeImage) ? (
<Alert <Alert
showIcon showIcon
type="warning" type="warning"
closable closable
onClose={() => setFrozenAccountBlocked(false)} onClose={() => setSupportContact(null)}
message="接单账号已被冻结,无法登录" message="接单账号已被冻结,无法登录"
style={{ marginTop: 20 }} style={{ marginTop: 20 }}
description={ description={
<Space direction="vertical" size={10} style={{ width: '100%' }}> <Space direction="vertical" size={10} style={{ width: '100%' }}>
{supportContactLoading ? ( <Typography.Text>
<Typography.Text type="secondary"> {supportContact.notice ||
正在加载售后微信… '账号已被冻结,如有疑问请添加售后微信处理。'}
</Typography.Text> </Typography.Text>
) : supportContact?.enabled ? ( {supportContact.wechatId ? (
<> <div>
<Typography.Text> <Typography.Text strong>售后微信:</Typography.Text>
{supportContact.notice || <Typography.Text copyable={{ text: supportContact.wechatId }}>
'账号已被冻结,如有疑问请添加售后微信处理。'} {supportContact.wechatId}
</Typography.Text> </Typography.Text>
{supportContact.wechatId ? ( </div>
<div> ) : null}
<Typography.Text strong>售后微信:</Typography.Text> {supportContact.wechatQrCodeImage ? (
<Typography.Text copyable={{ text: supportContact.wechatId }}> <div style={{ width: '100%', textAlign: 'center' }}>
{supportContact.wechatId} <Image
</Typography.Text> width={180}
</div> src={
) : null} supportContact.wechatQrCodeImage.mediumUrl ||
{supportContact.wechatQrCodeImage ? ( supportContact.wechatQrCodeImage.url
<div style={{ width: '100%', textAlign: 'center' }}> }
<Image alt="售后微信二维码"
width={180} />
src={ </div>
supportContact.wechatQrCodeImage.mediumUrl ||
supportContact.wechatQrCodeImage.url
}
alt="售后微信二维码"
/>
</div>
) : null}
</>
) : (
<Typography.Text type="secondary">
售后微信暂未启用,请稍后重试或通过平台其他渠道联系。
</Typography.Text>
)}
{supportContactError ? (
<Typography.Text type="danger">
{supportContactError}
</Typography.Text>
) : null} ) : null}
</Space> </Space>
} }