73 lines
3.7 KiB
Plaintext
73 lines
3.7 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 == '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 == 'waiting_departure') return '待出发'
|
|
if (status == 'departed' || status == 'on_the_way') return '已出发'
|
|
if (status == 'arrived') return '已到达'
|
|
if (status == 'checked_in') 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 == 'checked_in') 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 == 'checked_in') 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
|
|
} |