修复订单显示bug
This commit is contained in:
@@ -86,6 +86,43 @@ const photoCount = ref(0)
|
||||
|
||||
const photosText = computed((): string => '已添加占位照片 ' + String(photoCount.value) + ' 张')
|
||||
|
||||
function formatDisplayTime(isoStr: string): string {
|
||||
if (isoStr == '') {
|
||||
return ''
|
||||
}
|
||||
// 如果已经是 YYYY-MM-DD HH:mm 格式,直接返回
|
||||
if (isoStr.indexOf('T') == -1 && isoStr.length >= 16) {
|
||||
return isoStr.substring(0, 16)
|
||||
}
|
||||
// 处理 ISO 8601: 2026-05-19T03:00:00+08:00
|
||||
const parts = isoStr.split('T')
|
||||
if (parts.length < 2) {
|
||||
return isoStr
|
||||
}
|
||||
const datePart = parts[0]
|
||||
let timePart = parts[1]
|
||||
// 去掉时区后缀
|
||||
const plusIdx = timePart.indexOf('+')
|
||||
if (plusIdx != -1) {
|
||||
timePart = timePart.substring(0, plusIdx)
|
||||
}
|
||||
const zIdx = timePart.indexOf('Z')
|
||||
if (zIdx != -1) {
|
||||
timePart = timePart.substring(0, zIdx)
|
||||
}
|
||||
// 去掉毫秒
|
||||
const dotIdx = timePart.indexOf('.')
|
||||
if (dotIdx != -1) {
|
||||
timePart = timePart.substring(0, dotIdx)
|
||||
}
|
||||
// 取 HH:mm
|
||||
const timeSegments = timePart.split(':')
|
||||
if (timeSegments.length >= 2) {
|
||||
return datePart + ' ' + timeSegments[0] + ':' + timeSegments[1]
|
||||
}
|
||||
return datePart + ' ' + timePart
|
||||
}
|
||||
|
||||
function toggleItem(itemId: string, event: any) {
|
||||
for (let i = 0; i < serviceItems.value.length; i++) {
|
||||
if (serviceItems.value[i].id == itemId) {
|
||||
@@ -111,8 +148,8 @@ async function loadData() {
|
||||
order.value = await getServiceOrderDetail(orderId.value)
|
||||
if (order.value != null) {
|
||||
serviceItems.value = order.value.serviceItems
|
||||
startTime.value = order.value.startServiceTime != null && order.value.startServiceTime != '' ? order.value.startServiceTime : order.value.appointmentTime
|
||||
endTime.value = order.value.finishTime
|
||||
startTime.value = formatDisplayTime(order.value.startServiceTime != null && order.value.startServiceTime != '' ? order.value.startServiceTime : order.value.appointmentTime)
|
||||
endTime.value = formatDisplayTime(order.value.finishTime)
|
||||
processNote.value = order.value.serviceSummary
|
||||
staffRemark.value = order.value.progressNote
|
||||
if (order.value.serviceRecord != null) {
|
||||
|
||||
Reference in New Issue
Block a user