继续完善居家服务模块

This commit is contained in:
2026-05-22 10:16:51 +08:00
parent 3a7b2808af
commit d25f80ccdd
10 changed files with 670 additions and 110 deletions

View File

@@ -1,4 +1,16 @@
import { getDeliveryProfileByUserId, loginDelivery as loginDeliveryApi } from '@/api/delivery.uts'
import {
acceptOrder as acceptRealServiceOrder,
arriveOrder as arriveRealServiceOrder,
checkinOrder as checkinRealServiceOrder,
departOrder as departRealServiceOrder,
finishOrder as finishRealServiceOrder,
getDashboard as getRealDashboard,
getOrderDetail as getRealServiceOrderDetail,
getOrdersByTab as getRealOrdersByTab,
saveServiceRecord as saveRealServiceRecord,
startService as startRealService
} from '@/services/serviceOrderService.uts'
import {
acceptCareOrder,
checkInCareOrder,
@@ -47,7 +59,7 @@ export async function getDeliveryProfile(): Promise<DeliveryInfoType | null> {
if (!authResult.ok) {
return null
}
return getDeliveryCareProfile()
return authResult.deliveryInfo
}
export async function getDeliveryByUserId(userId: string): Promise<DeliveryInfoType | null> {
@@ -72,21 +84,21 @@ export async function getDeliveryDashboard(): Promise<DeliveryDashboardType> {
}
export async function getDeliveryOrders(params: DeliveryOrderQueryType): Promise<Array<DeliveryOrderType>> {
if (params.tab == 'pending' || params.tab == 'pending_assignment' || params.tab == 'pending_accept') {
return getPendingCareOrders()
if (params.tab == 'pending' || params.tab == 'pending_assignment') {
return await getRealOrdersByTab('pending')
}
if (params.tab == 'history' || params.tab == 'completed' || params.tab == 'archive') {
return getHistoryCareOrders()
return await getRealOrdersByTab('history')
}
return getTodayCareOrders()
return await getRealOrdersByTab('today')
}
export async function getDeliveryOrderDetail(id: string): Promise<DeliveryOrderType | null> {
return getCareOrderDetail(id)
return await getRealServiceOrderDetail(id)
}
export async function acceptDeliveryOrder(id: string): Promise<DeliveryOrderType | null> {
return acceptCareOrder(id)
return await acceptRealServiceOrder(id)
}
export async function rejectDeliveryOrder(id: string, reason: string): Promise<DeliveryOrderType | null> {
@@ -94,27 +106,19 @@ export async function rejectDeliveryOrder(id: string, reason: string): Promise<D
}
export async function startDepart(id: string, location: DeliveryLocationType): Promise<DeliveryOrderType | null> {
const order = markCareOrderDeparted(id)
if (order != null) {
order.lastLocation = location
}
return order
return await departRealServiceOrder(id, location)
}
export async function arriveOrder(id: string, location: DeliveryLocationType): Promise<DeliveryOrderType | null> {
const order = markCareOrderArrived(id)
if (order != null) {
order.lastLocation = location
}
return order
return await arriveRealServiceOrder(id, location)
}
export async function checkinOrder(id: string, payload: DeliveryCheckinPayloadType): Promise<DeliveryOrderType | null> {
return checkInCareOrder(id, payload.location, payload.note)
return await checkinRealServiceOrder(id, payload)
}
export async function startService(id: string): Promise<DeliveryOrderType | null> {
return startCareService(id)
return await startRealService(id)
}
export async function saveServiceProgress(id: string, payload: DeliveryProgressPayloadType): Promise<DeliveryOrderType | null> {
@@ -194,27 +198,27 @@ export async function updateDeliveryOnlineStatus(status: string): Promise<Delive
}
export async function getDeliveryDashboardStats(): Promise<DeliveryDashboardType> {
return getDeliveryCareDashboard()
return await getRealDashboard()
}
export async function getPendingServiceOrders(): Promise<Array<DeliveryOrderType>> {
return getPendingCareOrders()
return await getRealOrdersByTab('pending')
}
export async function getTodayServiceOrders(): Promise<Array<DeliveryOrderType>> {
return getTodayCareOrders()
return await getRealOrdersByTab('today')
}
export async function getHistoryServiceOrders(): Promise<Array<DeliveryOrderType>> {
return getHistoryCareOrders()
return await getRealOrdersByTab('history')
}
export async function getServiceOrderDetail(orderId: string): Promise<DeliveryOrderType | null> {
return getCareOrderDetail(orderId)
return await getRealServiceOrderDetail(orderId)
}
export async function acceptServiceOrder(orderId: string): Promise<DeliveryOrderType | null> {
return acceptCareOrder(orderId)
return await acceptRealServiceOrder(orderId)
}
export async function rejectServiceOrder(orderId: string, reason: string): Promise<DeliveryOrderType | null> {
@@ -222,27 +226,35 @@ export async function rejectServiceOrder(orderId: string, reason: string): Promi
}
export async function markDeparted(orderId: string): Promise<DeliveryOrderType | null> {
return markCareOrderDeparted(orderId)
return await departRealServiceOrder(orderId, null)
}
export async function markArrived(orderId: string): Promise<DeliveryOrderType | null> {
return markCareOrderArrived(orderId)
return await arriveRealServiceOrder(orderId, null)
}
export async function checkInServiceOrder(orderId: string, note: string, location: DeliveryLocationType | null = null): Promise<DeliveryOrderType | null> {
return checkInCareOrder(orderId, location, note)
if (location == null) {
return null
}
return await checkinRealServiceOrder(orderId, {
location,
note,
photos: [] as Array<string>,
checkinMode: 'gps'
})
}
export async function startServiceOrder(orderId: string): Promise<DeliveryOrderType | null> {
return startCareService(orderId)
return await startRealService(orderId)
}
export async function submitServiceRecord(orderId: string, record: DeliveryServiceRecordType): Promise<DeliveryOrderType | null> {
return submitCareServiceRecord(orderId, record)
return await saveRealServiceRecord(orderId, record)
}
export async function completeServiceOrder(orderId: string): Promise<DeliveryOrderType | null> {
return completeCareOrder(orderId)
return await finishRealServiceOrder(orderId)
}
export async function submitAbnormalReport(orderId: string, report: DeliveryExceptionPayloadType): Promise<DeliveryOrderType | null> {