Files
medical-mall/utils/deliveryCareUi.uts

69 lines
3.6 KiB
Plaintext

import type { DeliveryOrderStatus, DeliveryOrderType } from '@/types/delivery.uts'
export type DeliveryTabOptionType = {
label: string
value: string
}
export function getDeliveryOrderTabs(): Array<DeliveryTabOptionType> {
return [
{ label: '待接单', value: 'pending' } as DeliveryTabOptionType,
{ label: '今日订单', value: 'today' } as DeliveryTabOptionType,
{ label: '历史订单', value: 'history' } as DeliveryTabOptionType
]
}
export function isHistoryStatus(status: DeliveryOrderStatus): boolean {
return status == 'completed' || status == 'pending_acceptance' || status == 'rejected' || status == 'cancelled' || status == 'abnormal' || status == 'terminated' || status == 'archived'
}
export function getDeliveryStatusLabel(status: DeliveryOrderStatus): string {
if (status == 'pending_assignment' || status == 'pending_accept') return '待接单'
if (status == 'accepted') return '已接单'
if (status == 'departed' || status == 'on_the_way') return '已出发'
if (status == 'arrived') return '已到达'
if (status == 'in_service' || status == 'serving') return '服务中'
if (status == 'pending_confirm' || status == 'pending_acceptance' || status == 'pending_submit') return '待确认'
if (status == 'completed') return '已完成'
if (status == 'rejected') return '已拒单'
if (status == 'cancelled') return '已取消'
if (status == 'abnormal' || status == 'exception_pending') return '异常上报'
if (status == 'terminated') return '服务终止'
return '已归档'
}
export function getPrimaryActionText(status: DeliveryOrderStatus): string {
if (status == 'pending_assignment' || status == 'pending_accept') return '接单'
if (status == 'accepted' || status == 'waiting_departure') return '前往服务'
if (status == 'departed' || status == 'on_the_way') return '我已到达'
if (status == 'arrived') return '签到'
if (status == 'in_service' || status == 'serving') return '填写记录'
if (status == 'pending_confirm' || status == 'pending_acceptance' || status == 'pending_submit') return '等待验收'
if (status == 'completed') return '查看记录'
if (status == 'abnormal' || status == 'exception_pending') return '查看异常'
return '查看详情'
}
export function getNextStepText(status: DeliveryOrderStatus): string {
if (status == 'pending_assignment' || status == 'pending_accept') return '确认是否接单'
if (status == 'accepted' || status == 'waiting_departure') return '前往服务对象地址并发起导航'
if (status == 'departed' || status == 'on_the_way') return '到达服务地点'
if (status == 'arrived') return '完成签到确认'
if (status == 'in_service' || status == 'serving') return '补充服务记录并完成服务'
if (status == 'pending_confirm' || status == 'pending_acceptance' || status == 'pending_submit') return '等待用户确认验收'
if (status == 'completed') return '查看历史记录'
if (status == 'abnormal' || status == 'exception_pending') return '跟进异常处置'
return '查看订单详情'
}
export function getStatusClass(status: DeliveryOrderStatus): string {
if (status == 'pending_assignment' || status == 'pending_accept' || status == 'pending_confirm' || status == 'pending_acceptance' || status == 'pending_submit') return 'warning'
if (status == 'completed') return 'success'
if (status == 'abnormal' || status == 'exception_pending') return 'danger'
if (status == 'rejected' || status == 'cancelled' || status == 'terminated') return 'muted'
return 'primary'
}
export function needsServiceRecord(order: DeliveryOrderType): boolean {
return order.serviceRecord == null
}