feat(order-service): 重构分类资料收集与订单状态链路

This commit is contained in:
yml2213
2026-11-03 19:46:49 +08:00
parent 6e4758a3c7
commit 9f14e8de7a
59 changed files with 4866 additions and 1734 deletions
+46 -36
View File
@@ -12,7 +12,11 @@ import {
import { getAdminRole, hasAdminSession } from '@/utils/admin-auth'
import { isClaimPath, isH5ClaimPath } from '@/utils/claim-path'
import { isCollectMaterialLinkPath } from '@/utils/collect-link'
import {
isLegacySupplementPath,
isOrderServicePath,
resolveLegacySupplementOrderNo,
} from '@/utils/order-service-link'
import { isRedeemPath } from '@/utils/redeem'
import { isWorkerSite, WORKER_SITE_ORIGIN } from '@/utils/site'
import { hasWorkerSession } from '@/utils/worker-auth'
@@ -43,11 +47,7 @@ const AdminDevMockPage = lazy(() => import('@/pages/admin/AdminDevMockPage'))
const AdminWorkerPlatformPage = lazy(() => import('@/pages/admin/AdminWorkerPlatformPage'))
const ClaimPage = lazy(() => import('@/pages/claim/ClaimPage'))
const H5ClaimEntryPage = lazy(() => import('@/pages/claim/H5ClaimEntryPage'))
const CollectPage = lazy(() => import('@/pages/collect/CollectPage'))
const CollectMaterialLinkEntryPage = lazy(
() => import('@/pages/collect/CollectMaterialLinkEntryPage'),
)
const CollectMaterialLinkPage = lazy(() => import('@/pages/collect/CollectMaterialLinkPage'))
const OrderServicePage = lazy(() => import('@/pages/public/OrderServicePage'))
const NotFoundPage = lazy(() => import('@/pages/NotFoundPage'))
const RedeemPage = lazy(() => import('@/pages/redeem/RedeemPage'))
const WorkerHallPage = lazy(() => import('@/pages/worker/WorkerHallPage'))
@@ -125,10 +125,15 @@ export default function App() {
return <RedeemApplication />
}
// 补资料页(`/supplement`):路径式公开页,先于站点判断,
// 保证在后台域名和打手端域名下都能打开。带订单号直接进补资料页,不带订单号进输入页。
if (isCollectMaterialLinkPath(window.location.pathname)) {
return <CollectMaterialLinkApplication />
// 订单服务页(`/o`):路径式公开页,先于站点判断,
// 保证后台域名和打手端域名下都能打开。旧 /supplement 也统一跳到这里。
if (isOrderServicePath(window.location.pathname)) {
return <OrderServiceApplication />
}
// 旧 /supplement 短期兼容:统一跳到 /o。
if (isLegacySupplementPath(window.location.pathname)) {
return <CollectRedirectApplication />
}
if (isWorkerSite()) {
@@ -138,6 +143,29 @@ export default function App() {
return <AdminApplication />
}
function OrderServiceApplication() {
useClearStrayHash()
return (
<BrowserRouter>
<Suspense fallback={<RouteLoading />}>
<Routes>
<Route path="/o" element={<OrderServicePage />} />
<Route path="/o/:orderNo" element={<OrderServicePage />} />
<Route path="*" element={<OrderServicePage />} />
</Routes>
</Suspense>
</BrowserRouter>
)
}
function CollectRedirectApplication() {
useEffect(() => {
const orderNo = resolveLegacySupplementOrderNo(window.location.pathname)
window.location.replace(orderNo ? `/o/${encodeURIComponent(orderNo)}` : '/o')
}, [])
return null
}
function AdminApplication() {
return (
<HashRouter>
@@ -193,7 +221,7 @@ function AdminApplication() {
</Route>
</Route>
<Route path="/claim/:token" element={<ClaimPage />} />
<Route path="/collect" element={<CollectPage />} />
<Route path="/collect" element={<CollectHashRedirectApplication />} />
<Route path="*" element={<NotFoundPage />} />
</Routes>
</Suspense>
@@ -201,6 +229,13 @@ function AdminApplication() {
)
}
function CollectHashRedirectApplication() {
useEffect(() => {
window.location.replace('/o')
}, [])
return null
}
function RedeemApplication() {
return (
<BrowserRouter>
@@ -239,31 +274,6 @@ function ClaimApplication() {
)
}
/**
* 补资料页(`/supplement`)的独立路由树。
*
* - `/supplement`:输入平台订单号;
* - `/supplement/<订单号>`:直接打开对应订单的补资料页;
* - 其余子路径:交给补资料页展示「订单号无效」。
*
* 路径式公开页,不带 hash;不依赖后台会话。
*/
function CollectMaterialLinkApplication() {
useClearStrayHash()
return (
<BrowserRouter>
<Suspense fallback={<RouteLoading />}>
<Routes>
<Route path="/supplement" element={<CollectMaterialLinkEntryPage />} />
<Route path="/supplement/:code" element={<CollectMaterialLinkPage />} />
<Route path="*" element={<CollectMaterialLinkPage />} />
</Routes>
</Suspense>
</BrowserRouter>
)
}
/**
* H5 领取入口(`/h5` 命名空间)的独立路由树。
*