front/src/views/home/workplace/utils/workplaceLinks.ts
zzh b7d7ea1113
All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m10s
feat: 工作台操作/运营体验改版,代发进度去掉待绑定
线路双指标对比、运营柱线趋势、操作区左右待办队列;创建代发必绑口径对齐前后端 Tab。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 11:23:22 +08:00

109 lines
3.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { Router } from 'vue-router'
/** 工作台 KPI 下钻路径:与运单 / 代发 / 揽收现网 tab query 对齐 */
export const WAYBILL_PATH = '/order/waybillManage'
export const FULFILL_PATH = '/order/fulfillOrders'
export const PICKUP_PATH = '/order/pickupOrder'
export const STORE_ORDER_PATH = '/order/platformStoreOrder'
export const CUSTOMER_PATH = '/user/customer'
export const H5_ORDERS_PATH = '/h5/admin/orders'
export const H5_CUSTOMERS_PATH = '/h5/admin/customers'
export const waybillLink = {
/** 今日建单无独立 tab,进全部列表 */
todayCreated: { path: WAYBILL_PATH, query: { status: 'all' } as Record<string, string> },
pendingShip: { path: WAYBILL_PATH, query: { status: 'pendingShip' } },
pendingPayment: { path: WAYBILL_PATH, query: { status: 'pendingPayment' } },
problematic: { path: WAYBILL_PATH, query: { status: 'problematic' } },
claimed: { path: WAYBILL_PATH, query: { status: 'claimed' } },
/** monitor 待签收 = 运输中 shipping */
pendingSign: { path: WAYBILL_PATH, query: { status: 'shipping' } },
pendingOnline: { path: WAYBILL_PATH, query: { status: 'pendingOnline' } },
shipped: { path: WAYBILL_PATH, query: { status: 'shipping' } },
}
export const fulfillLink = {
domesticInTransit: { path: FULFILL_PATH, query: { progress: 'domesticInTransit' } },
arrivedPendingPick: { path: FULFILL_PATH, query: { progress: 'arrivedPendingPick' } },
outboundDone: { path: FULFILL_PATH, query: { progress: 'outboundDone' } },
}
export const pickupLink = {
pendingPayment: { path: PICKUP_PATH, query: { status: 'pendingPayment' } },
pendingSchedule: { path: PICKUP_PATH, query: { status: 'draft' } },
pendingPickup: { path: PICKUP_PATH, query: { status: 'scheduled' } },
pendingInbound: { path: PICKUP_PATH, query: { status: 'picked' } },
}
export const storeOrderPendingLink = {
path: STORE_ORDER_PATH,
query: { fulfillStatus: 'pending' },
}
export type WorkplaceNavTarget = {
path: string
query?: Record<string, string>
}
function isH5AdminPath(path: string) {
return path === '/h5/admin' || path.startsWith('/h5/admin/')
}
/** 将 PC 工作台下钻路径映射到 H5 运营中心等价页 */
export function resolveWorkplaceNav(
path: string,
query: Record<string, string> | undefined,
currentPath: string,
): WorkplaceNavTarget {
if (!isH5AdminPath(currentPath)) {
return query ? { path, query } : { path }
}
if (path === WAYBILL_PATH || path.startsWith(`${WAYBILL_PATH}/`)) {
const status = query?.status
if (!status || status === 'all') {
return { path: H5_ORDERS_PATH }
}
return { path: H5_ORDERS_PATH, query: { status } }
}
if (path === FULFILL_PATH || path.startsWith(`${FULFILL_PATH}/`)) {
return { path: H5_ORDERS_PATH, query: { group: 'fulfill' } }
}
if (path === PICKUP_PATH || path.startsWith(`${PICKUP_PATH}/`)) {
const status = query?.status
if (status) {
return { path: H5_ORDERS_PATH, query: { status } }
}
return { path: H5_ORDERS_PATH, query: { group: 'warehouse' } }
}
if (path === STORE_ORDER_PATH) {
return { path: H5_ORDERS_PATH, query: { group: 'fulfill' } }
}
if (path === CUSTOMER_PATH || path.startsWith(`${CUSTOMER_PATH}/`)) {
return query ? { path: H5_CUSTOMERS_PATH, query } : { path: H5_CUSTOMERS_PATH }
}
if (path.startsWith('/h5/')) {
return query ? { path, query } : { path }
}
return { path: H5_ORDERS_PATH }
}
export function navigateWorkplaceDrill(
router: Router,
path: string | undefined,
query?: Record<string, string>,
) {
if (!path) return
const currentPath = router.currentRoute.value.path
const target = resolveWorkplaceNav(path, query, currentPath)
router.push(target.query ? { path: target.path, query: target.query } : target.path).catch(() => undefined)
}