优化
This commit is contained in:
@@ -17,7 +17,6 @@ interface LogRow { id: string; occurredAt: string; node: string; operator: strin
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const orderId = computed(() => String(route.params.orderId || ''))
|
||||
const customerId = computed(() => String(route.query.customerId || ''))
|
||||
const detail = ref<LastMileOrderDetailDto | null>(null)
|
||||
const loading = ref(false)
|
||||
const loadError = ref<ApiErrorDetails | null>(null)
|
||||
@@ -111,14 +110,18 @@ const logColumns: DataTableColumn[] = [
|
||||
]
|
||||
|
||||
async function load() {
|
||||
if (!orderId.value || !customerId.value) {
|
||||
loadError.value = { message: '详情缺少客户范围,请从尾程订单列表重新进入' }
|
||||
if (!orderId.value) {
|
||||
loadError.value = { message: '详情缺少尾程订单号' }
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
loadError.value = null
|
||||
try { detail.value = await getLastMileOrder(orderId.value, customerId.value) }
|
||||
catch (error) { loadError.value = getApiErrorDetails(error, '尾程订单详情加载失败,请重试') }
|
||||
try { detail.value = await getLastMileOrder(orderId.value) }
|
||||
catch (error) {
|
||||
loadError.value = error instanceof Error && error.message === '当前环境未签发海外访问令牌'
|
||||
? { message: error.message }
|
||||
: getApiErrorDetails(error, '尾程订单详情加载失败,请重试')
|
||||
}
|
||||
finally { loading.value = false }
|
||||
}
|
||||
function back() { void router.push({ name: 'overseas-last-mile-orders' }) }
|
||||
|
||||
Reference in New Issue
Block a user