Files
TakeoutSaaS.C-Side-Mini-Pro…/src/pages/order/detail/composables/order-detail-page/status-helpers.ts

41 lines
1.6 KiB
TypeScript

import { FulfillmentScenes, formatPrice as formatPriceUtil, SCENE_LABEL_MAP } from '@/shared'
import type { FulfillmentScene, OrderDetail } from '@/shared'
export function formatPrice (value: number) {
return formatPriceUtil(value)
}
export function resolveSceneLabel (scene: FulfillmentScene) {
return SCENE_LABEL_MAP[scene]
}
export function resolveOrderSubtitle (order: OrderDetail | null) {
if (!order) return ''
if (order.tableNo) return `桌号 ${order.tableNo}`
return order.customerName
}
export function resolveStatusDescription (order: OrderDetail | null) {
if (!order) return ''
const statusText = order.statusText
if (statusText === '待支付') return '请尽快完成支付'
if (statusText === '已接单' || statusText === '制作中') return '商家已接单,正在为您精心准备餐品'
if (statusText === '配送中') return '骑手正在为您配送'
if (statusText === '已完成') return '订单已完成,欢迎再次光临'
return '订单处理中'
}
export function resolveFulfillmentHint (order: OrderDetail | null) {
if (!order) return ''
if (order.scene === FulfillmentScenes.DineIn) return '餐品制作完成后将尽快为您上桌,请留意取餐提醒'
if (order.scene === FulfillmentScenes.Pickup) return '餐品制作完成后请到店取餐'
return '预计 30 分钟送达'
}
export function resolveTimelineNodeClass (index: number, currentTimelineIndex: number) {
if (index < currentTimelineIndex) return 'od-page__tl-node--done'
if (index === currentTimelineIndex) return 'od-page__tl-node--current'
return 'od-page__tl-node--pending'
}