移除平台配置中的 91卡券 Tab
该入口并非平台配置,仅为订单运维队列,已从后台平台配置页删除相关 UI 与前端 API 封装。
This commit is contained in:
@@ -30,22 +30,19 @@ import { useEffect, useState } from 'react'
|
||||
import { useSearchParams } from 'react-router'
|
||||
|
||||
import PageHeader from '@/components/admin/PageHeader'
|
||||
import { isFeedbackDismissed, showError, showPrompt, showSuccess } from '@/lib/feedback'
|
||||
import { showError, showSuccess } from '@/lib/feedback'
|
||||
import {
|
||||
deleteAdminCloudtentaclesSource,
|
||||
exchangeAdminKuaishouIndustryAuthorizationCode,
|
||||
failAdminNinetyoneOrder,
|
||||
fetchAdminCloudtentaclesAsset,
|
||||
fetchAdminCloudtentaclesSkuList,
|
||||
fetchAdminCloudtentaclesSourceConfig,
|
||||
fetchAdminKuaishouFeifeiConfig,
|
||||
fetchAdminKuaishouIndustrySourceConfig,
|
||||
fetchAdminNinetyoneOrders,
|
||||
fetchAdminNotificationConfig,
|
||||
fetchAdminScheduledJobsConfig,
|
||||
matchAdminKuaishouFeifeiProduct,
|
||||
refreshAdminKuaishouIndustryAccessToken,
|
||||
retryAdminNinetyoneOrder,
|
||||
runAdminScheduledJob,
|
||||
saveAdminCloudtentaclesSourceConfig,
|
||||
saveAdminKuaishouFeifeiConfig,
|
||||
@@ -69,8 +66,6 @@ import type {
|
||||
AdminKuaishouFeifeiConfigResponse,
|
||||
AdminKuaishouFeifeiMatchResult,
|
||||
AdminKuaishouFeifeiProductRule,
|
||||
AdminNinetyoneOrderItem,
|
||||
AdminNinetyoneOrderListResult,
|
||||
AdminNotificationConfig,
|
||||
AdminNotificationTestResult,
|
||||
AdminScheduledJobAccountRuntime,
|
||||
@@ -80,15 +75,10 @@ import type {
|
||||
AdminScheduledJobsConfig,
|
||||
} from '@/types/admin'
|
||||
import { hasAdminRole } from '@/utils/admin-auth'
|
||||
import {
|
||||
ADMIN_DEFAULT_PAGE_SIZE,
|
||||
buildAdminLocalTablePagination,
|
||||
buildAdminTablePagination,
|
||||
} from '@/utils/admin-pagination'
|
||||
import { buildAdminLocalTablePagination } from '@/utils/admin-pagination'
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
|
||||
type PlatformTab =
|
||||
| 'ninetyone'
|
||||
| 'notifications'
|
||||
| 'kuaishouIndustry'
|
||||
| 'kuaishouFeifei'
|
||||
@@ -107,7 +97,6 @@ type ScheduledJobsState = {
|
||||
}
|
||||
|
||||
const platformTabs: PlatformTab[] = [
|
||||
'ninetyone',
|
||||
'notifications',
|
||||
'kuaishouIndustry',
|
||||
'kuaishouFeifei',
|
||||
@@ -125,7 +114,6 @@ export default function AdminPlatformShopsPage() {
|
||||
const [feifeiConfig, setFeifeiConfig] = useState<AdminKuaishouFeifeiConfigResponse | null>(null)
|
||||
const [cloudtentaclesConfig, setCloudtentaclesConfig] =
|
||||
useState<AdminCloudtentaclesSourceConfigResponse | null>(null)
|
||||
const [ninetyoneData, setNinetyoneData] = useState<AdminNinetyoneOrderListResult | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
void loadConfigs()
|
||||
@@ -147,14 +135,12 @@ export default function AdminPlatformShopsPage() {
|
||||
industryResponse,
|
||||
feifeiResponse,
|
||||
cloudtentaclesResponse,
|
||||
ninetyoneResponse,
|
||||
] = await Promise.all([
|
||||
fetchAdminNotificationConfig(),
|
||||
fetchAdminScheduledJobsConfig(),
|
||||
fetchAdminKuaishouIndustrySourceConfig(),
|
||||
fetchAdminKuaishouFeifeiConfig(),
|
||||
fetchAdminCloudtentaclesSourceConfig(),
|
||||
fetchAdminNinetyoneOrders({ page: 1, pageSize: 20 }),
|
||||
])
|
||||
|
||||
setNotificationConfig(notificationResponse.data)
|
||||
@@ -162,7 +148,6 @@ export default function AdminPlatformShopsPage() {
|
||||
setIndustryConfig(industryResponse.data)
|
||||
setFeifeiConfig(feifeiResponse.data)
|
||||
setCloudtentaclesConfig(cloudtentaclesResponse.data)
|
||||
setNinetyoneData(ninetyoneResponse.data)
|
||||
} catch (error) {
|
||||
setErrorMessage(error instanceof Error ? error.message : '读取平台配置失败')
|
||||
} finally {
|
||||
@@ -204,16 +189,6 @@ export default function AdminPlatformShopsPage() {
|
||||
onChange={updateActiveTab}
|
||||
className="platform-tabs"
|
||||
items={[
|
||||
{
|
||||
key: 'ninetyone',
|
||||
label: '91卡券',
|
||||
children: (
|
||||
<NinetyonePanel
|
||||
data={ninetyoneData}
|
||||
onDataChange={setNinetyoneData}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'notifications',
|
||||
label: '内部通知',
|
||||
@@ -274,184 +249,6 @@ export default function AdminPlatformShopsPage() {
|
||||
)
|
||||
}
|
||||
|
||||
function NinetyonePanel({
|
||||
data,
|
||||
onDataChange,
|
||||
}: {
|
||||
data: AdminNinetyoneOrderListResult | null
|
||||
onDataChange: (data: AdminNinetyoneOrderListResult) => void
|
||||
}) {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [actionLoadingId, setActionLoadingId] = useState('')
|
||||
const [status, setStatus] = useState('')
|
||||
const page = data?.page || 1
|
||||
const pageSize = data?.pageSize || 20
|
||||
|
||||
async function loadOrders(nextPage = page, nextPageSize = pageSize, nextStatus = status) {
|
||||
setLoading(true)
|
||||
try {
|
||||
const response = await fetchAdminNinetyoneOrders({
|
||||
page: nextPage,
|
||||
pageSize: nextPageSize,
|
||||
status: nextStatus || undefined,
|
||||
})
|
||||
onDataChange(response.data)
|
||||
} catch (error) {
|
||||
showError(error instanceof Error ? error.message : '读取 91 卡券订单失败')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function retryOrder(order: AdminNinetyoneOrderItem) {
|
||||
setActionLoadingId(`retry-${order.orderId}`)
|
||||
try {
|
||||
await retryAdminNinetyoneOrder(order.orderId)
|
||||
showSuccess('已重新处理 91 卡券订单')
|
||||
await loadOrders()
|
||||
} catch (error) {
|
||||
showError(error instanceof Error ? error.message : '重试订单失败')
|
||||
} finally {
|
||||
setActionLoadingId('')
|
||||
}
|
||||
}
|
||||
|
||||
async function failOrder(order: AdminNinetyoneOrderItem) {
|
||||
try {
|
||||
const result = await showPrompt('请输入失败原因', '标记订单失败')
|
||||
setActionLoadingId(`fail-${order.orderId}`)
|
||||
await failAdminNinetyoneOrder(order.orderId, { reason: result.value })
|
||||
showSuccess('已标记 91 卡券订单失败')
|
||||
await loadOrders()
|
||||
} catch (error) {
|
||||
if (!isFeedbackDismissed(error)) {
|
||||
showError(error instanceof Error ? error.message : '标记失败订单失败')
|
||||
}
|
||||
} finally {
|
||||
setActionLoadingId('')
|
||||
}
|
||||
}
|
||||
|
||||
const columns: TableColumnsType<AdminNinetyoneOrderItem> = [
|
||||
{
|
||||
title: '订单',
|
||||
dataIndex: 'orderNo',
|
||||
minWidth: 220,
|
||||
render: (_, row) => (
|
||||
<div className="cell-stack">
|
||||
<Typography.Text strong>{row.orderNo || '-'}</Typography.Text>
|
||||
<Typography.Text type="secondary">{row.outTradeNo || '-'}</Typography.Text>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '商品',
|
||||
dataIndex: 'productName',
|
||||
minWidth: 260,
|
||||
render: (_, row) => (
|
||||
<div className="cell-stack">
|
||||
<span>{row.productName || '-'}</span>
|
||||
<span className="muted">{row.productNo || '-'} · 数量 {row.buyNum || 0}</span>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '店铺',
|
||||
minWidth: 160,
|
||||
render: (_, row) => row.shopName || row.shopId || '-',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
minWidth: 160,
|
||||
render: (_, row) => (
|
||||
<Space wrap size={[0, 6]}>
|
||||
<Tag>{row.orderStatus || '-'}</Tag>
|
||||
<Tag color={row.payStatus === 'paid' ? 'green' : undefined}>{row.payStatus || '-'}</Tag>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '任务',
|
||||
dataIndex: 'taskCount',
|
||||
width: 110,
|
||||
render: (value) => `${Number(value || 0)} 个`,
|
||||
},
|
||||
{
|
||||
title: '时间',
|
||||
dataIndex: 'createdAt',
|
||||
width: 180,
|
||||
render: (value) => formatAdminDateTime(value),
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
width: 180,
|
||||
render: (_, row) => (
|
||||
<Space>
|
||||
<Button
|
||||
size="small"
|
||||
loading={actionLoadingId === `retry-${row.orderId}`}
|
||||
onClick={() => retryOrder(row)}
|
||||
>
|
||||
重试
|
||||
</Button>
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
loading={actionLoadingId === `fail-${row.orderId}`}
|
||||
onClick={() => failOrder(row)}
|
||||
>
|
||||
失败
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<Card
|
||||
title="91 卡券来源订单"
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Select
|
||||
allowClear
|
||||
value={status || undefined}
|
||||
placeholder="处理状态"
|
||||
style={{ width: 160 }}
|
||||
options={[
|
||||
{ label: '待处理', value: 'pending' },
|
||||
{ label: '失败', value: 'failed' },
|
||||
{ label: '已完成', value: 'completed' },
|
||||
]}
|
||||
onChange={(nextStatus) => {
|
||||
const normalized = String(nextStatus || '')
|
||||
setStatus(normalized)
|
||||
void loadOrders(1, pageSize, normalized)
|
||||
}}
|
||||
/>
|
||||
<Button icon={<ReloadOutlined />} loading={loading} onClick={() => loadOrders()}>
|
||||
刷新
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Table<AdminNinetyoneOrderItem>
|
||||
rowKey="orderId"
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
dataSource={data?.items || []}
|
||||
scroll={{ x: 1200 }}
|
||||
pagination={buildAdminTablePagination({
|
||||
current: data?.page || 1,
|
||||
pageSize: data?.pageSize || ADMIN_DEFAULT_PAGE_SIZE,
|
||||
total: data?.total || 0,
|
||||
onChange: (nextPage, nextPageSize) => loadOrders(nextPage, nextPageSize),
|
||||
})}
|
||||
/>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
function NotificationPanel({
|
||||
notificationConfig,
|
||||
scheduledJobs,
|
||||
@@ -2323,5 +2120,5 @@ function LabeledInput({
|
||||
function normalizePlatformTab(value: unknown): PlatformTab {
|
||||
return typeof value === 'string' && platformTabs.includes(value as PlatformTab)
|
||||
? (value as PlatformTab)
|
||||
: 'ninetyone'
|
||||
: 'notifications'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user