Commit 1de73eae by wuqian

全部状态待接单和已取消的所有状态正常展示 延期时间的值

parent 4118f798
...@@ -1956,6 +1956,7 @@ const mainColumns = computed(() => [ ...@@ -1956,6 +1956,7 @@ const mainColumns = computed(() => [
const delayText = getOrderDelayText( const delayText = getOrderDelayText(
row.createTime ?? '', row.createTime ?? '',
row.finishTime ?? '', row.finishTime ?? '',
row.status ?? '',
) )
return ( return (
<div style={{ color: 'red', fontWeight: 'bolder' }}> <div style={{ color: 'red', fontWeight: 'bolder' }}>
...@@ -2657,33 +2658,32 @@ const handleUpdateCustomsInfo = async () => { ...@@ -2657,33 +2658,32 @@ const handleUpdateCustomsInfo = async () => {
await nextTick() await nextTick()
updateCustomsDialogRef.value?.resetForm() updateCustomsDialogRef.value?.resetForm()
} }
// 值为空:待接单 // 值为空:待接单和已取消状态
const PENDING_RECEIVE_STATUSES = ['PENDING_RECEIVE'] const NULL_STATUSES = ['PENDING_RECEIVE', 'CANCELLED']
// 终态订单:已完成/已归档 // 终态订单:已完成/已归档
const TERMINAL_ORDER_STATUSES = ['COMPLETED', 'ARCHIVE'] const TERMINAL_ORDER_STATUSES = ['COMPLETED', 'ARCHIVE']
const getOrderDelayText = ( const getOrderDelayText = (
createTime?: string | null, createTime?: string | null,
finishTime?: string | null, finishTime?: string | null,
statusValue?: string | null,
) => { ) => {
if (!createTime) return '' if (!createTime) return ''
if (TERMINAL_ORDER_STATUSES.includes(status.value) && !finishTime) return '' const currentStatus = statusValue ?? ''
if (TERMINAL_ORDER_STATUSES.includes(currentStatus) && !finishTime) return ''
const createAt = dayjs(createTime) const createAt = dayjs(createTime)
if (!createAt.isValid()) return '' if (!createAt.isValid()) return ''
// 终态订单用 finishTime - createTime 的差值 // 终态订单用 finishTime - createTime 的差值
// 其他状态用 当前时间 - createTime 的差值 // 其他状态用 当前时间 - createTime 的差值
const endTime = const endTime =
TERMINAL_ORDER_STATUSES.includes(status.value) && finishTime TERMINAL_ORDER_STATUSES.includes(currentStatus) && finishTime
? dayjs(finishTime) ? dayjs(finishTime)
: dayjs() : dayjs()
const diffMinutes = Math.max(0, endTime.diff(createAt, 'minute')) const diffMinutes = Math.max(0, endTime.diff(createAt, 'minute'))
const baseHours = Math.floor(diffMinutes / 60) const baseHours = Math.floor(diffMinutes / 60)
const remainMinutes = diffMinutes % 60 const remainMinutes = diffMinutes % 60
const hours = baseHours + (remainMinutes > 30 ? 1 : 0) const hours = baseHours + (remainMinutes > 30 ? 1 : 0)
// 待接单状态不显示时间,其余显示小时数 const result = !NULL_STATUSES.includes(currentStatus) ? `${hours}h` : ''
const result = !PENDING_RECEIVE_STATUSES.includes(status?.value)
? `${hours}h`
: ''
return result return result
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment