忽略本地报错信息文件
This commit is contained in:
@@ -38,6 +38,8 @@ import supa from '@/components/supadb/aksupainstance.uts'
|
||||
import { getCurrentUserId } from '@/utils/store.uts'
|
||||
import {
|
||||
getServiceOrderStatusText,
|
||||
isArrivalPendingStatus,
|
||||
normalizeOrderStatusCode,
|
||||
type ServiceOrderStatus,
|
||||
type ServiceOrderTimelineItemType,
|
||||
type ServiceOrderType
|
||||
@@ -496,11 +498,36 @@ export async function fetchConsumerHomeServiceCases(): Promise<Array<HomeService
|
||||
}
|
||||
|
||||
export async function fetchConsumerHomeServiceCaseDetail(caseId: string): Promise<HomeServiceCaseType | null> {
|
||||
const detail = await getServiceOrderDetail(caseId)
|
||||
if (detail != null) {
|
||||
return mapOrderToCase(detail)
|
||||
console.log('[CONSUMER_SERVICE_TRACE][fetchConsumerHomeServiceCaseDetail][START]', {
|
||||
caseId: caseId
|
||||
})
|
||||
try {
|
||||
const detail = await getServiceOrderDetail(caseId)
|
||||
console.log('[CONSUMER_SERVICE_TRACE][fetchConsumerHomeServiceCaseDetail][RAW]', {
|
||||
result: detail
|
||||
})
|
||||
if (detail != null) {
|
||||
const parsed = mapOrderToCase(detail)
|
||||
console.log('[CONSUMER_SERVICE_TRACE][fetchConsumerHomeServiceCaseDetail][PARSED]', {
|
||||
id: parsed.id,
|
||||
status: parsed.status,
|
||||
statusText: parsed.statusText,
|
||||
checkinTime: parsed.checkinTime,
|
||||
arriveTime: '',
|
||||
evidenceCount: parsed.evidenceCount,
|
||||
timelineCount: parsed.timeline.length
|
||||
})
|
||||
return parsed
|
||||
}
|
||||
return null
|
||||
} catch (e) {
|
||||
console.error('[CONSUMER_SERVICE_TRACE][fetchConsumerHomeServiceCaseDetail][ERROR]', {
|
||||
caseId: caseId,
|
||||
errorMessage: e != null ? String(e) : '',
|
||||
errorStack: ''
|
||||
})
|
||||
throw e
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export async function createHomeServiceApplication(draft: HomeServiceApplicationDraftType): Promise<HomeServiceCaseType | null> {
|
||||
@@ -569,6 +596,7 @@ function getCaseStep(status: ServiceOrderStatus): number {
|
||||
if (status == 'assigned') return 3
|
||||
if (status == 'accepted') return 4
|
||||
if (status == 'departed') return 5
|
||||
if (status == 'ARRIVAL_PENDING') return 6
|
||||
if (status == 'arrived' || status == 'in_service') return 6
|
||||
if (status == 'pending_acceptance') return 7
|
||||
if (status == 'accepted_by_user' || status == 'reviewed' || status == 'settled') return 8
|
||||
@@ -577,7 +605,7 @@ function getCaseStep(status: ServiceOrderStatus): number {
|
||||
}
|
||||
|
||||
function getCaseTone(status: ServiceOrderStatus): string {
|
||||
if (status == 'created' || status == 'assigned' || status == 'pending_acceptance') return 'warning'
|
||||
if (status == 'created' || status == 'assigned' || status == 'pending_acceptance' || status == 'ARRIVAL_PENDING') return 'warning'
|
||||
if (status == 'accepted' || status == 'departed' || status == 'arrived' || status == 'in_service') return 'primary'
|
||||
if (status == 'accepted_by_user' || status == 'reviewed' || status == 'settled') return 'success'
|
||||
if (status == 'exception' || status == 'cancelled' || status == 'rejected') return 'danger'
|
||||
@@ -593,6 +621,7 @@ function getTimelineDescription(log: ServiceOrderTimelineItemType): string {
|
||||
if (log.toStatus == 'accepted') return '服务人员已接单,正在准备上门。'
|
||||
if (log.toStatus == 'departed') return '服务人员已出发,正在前往服务地点。'
|
||||
if (log.toStatus == 'arrived') return '服务人员已到达服务地点。'
|
||||
if (log.toStatus == 'ARRIVAL_PENDING') return '服务人员已提交到达签到,等待消费者确认。'
|
||||
if (log.toStatus == 'in_service') return '服务已开始执行,请留意后续进度。'
|
||||
if (log.toStatus == 'completed') return '服务执行已完成,正在整理结果。'
|
||||
if (log.toStatus == 'pending_acceptance') return '服务记录已提交,等待家属验收。'
|
||||
@@ -604,6 +633,26 @@ function getTimelineDescription(log: ServiceOrderTimelineItemType): string {
|
||||
return '服务过程状态已更新。'
|
||||
}
|
||||
|
||||
function buildArrivalPendingTimelineFallback(order: ServiceOrderType): HomeServiceTimelineItemType | null {
|
||||
if (!order.waitingConsumerConfirm && !isArrivalPendingStatus(order.status)) {
|
||||
return null
|
||||
}
|
||||
for (let i = 0; i < order.logs.length; i++) {
|
||||
if (isArrivalPendingStatus(order.logs[i].toStatus)) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
const timeValue = order.executionRecord != null && order.executionRecord.checkinTime != ''
|
||||
? order.executionRecord.checkinTime
|
||||
: order.arrivedAt
|
||||
return {
|
||||
id: order.id + '-arrival-pending-fallback',
|
||||
title: '等待消费者确认到达',
|
||||
time: timeValue,
|
||||
description: '服务人员已提交到达签到,请确认其是否已到达服务地点'
|
||||
} as HomeServiceTimelineItemType
|
||||
}
|
||||
|
||||
function formatServiceAppointmentText(value: string): string {
|
||||
if (value == '') {
|
||||
return ''
|
||||
@@ -655,6 +704,11 @@ function mapOrderToCase(order: ServiceOrderType): HomeServiceCaseType {
|
||||
const displayStatus = getHomecareOrderDisplayStatus(order)
|
||||
let statusText = displayStatus
|
||||
let statusTone = getCaseTone(order.status)
|
||||
const timeline = mapLogsToTimeline(order.logs)
|
||||
const arrivalPendingFallback = buildArrivalPendingTimelineFallback(order)
|
||||
if (arrivalPendingFallback != null) {
|
||||
timeline.unshift(arrivalPendingFallback)
|
||||
}
|
||||
if (displayStatus == '已超时未支付') {
|
||||
statusTone = 'danger'
|
||||
}
|
||||
@@ -667,6 +721,7 @@ function mapOrderToCase(order: ServiceOrderType): HomeServiceCaseType {
|
||||
status: order.status,
|
||||
statusText: statusText,
|
||||
statusTone: statusTone,
|
||||
waitingConsumerConfirm: order.waitingConsumerConfirm,
|
||||
serviceName: order.serviceName,
|
||||
serviceTime: formatServiceAppointmentText(order.appointmentTime),
|
||||
applicantName: order.contactName,
|
||||
@@ -689,7 +744,7 @@ function mapOrderToCase(order: ServiceOrderType): HomeServiceCaseType {
|
||||
executionSummary: order.executionRecord != null ? (order.executionRecord.summary != '' ? order.executionRecord.summary : order.executionRecord.remark) : '',
|
||||
evidenceCount: order.evidenceFiles.length,
|
||||
serviceAddressSnapshot: null,
|
||||
timeline: mapLogsToTimeline(order.logs)
|
||||
timeline: timeline
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user