继续完善居家服务模块
This commit is contained in:
@@ -127,7 +127,7 @@ async function submitCheckin() {
|
||||
checkinMode: 'gps'
|
||||
})
|
||||
uni.showToast({ title: '签到成功', icon: 'success' })
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/execute?id=' + orderId.value })
|
||||
uni.redirectTo({ url: '/pages/mall/delivery/service-record/index?id=' + orderId.value })
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
|
||||
@@ -92,15 +92,10 @@ import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uv
|
||||
import type { DeliveryOrderType } from '@/types/delivery.uts'
|
||||
import {
|
||||
acceptServiceOrder,
|
||||
checkInServiceOrder,
|
||||
completeServiceOrder,
|
||||
getServiceOrderDetail,
|
||||
markArrived,
|
||||
markDeparted,
|
||||
rejectServiceOrder,
|
||||
startServiceOrder
|
||||
rejectServiceOrder
|
||||
} from '@/services/deliveryService.uts'
|
||||
import { getNextStepText, getPrimaryActionText, needsServiceRecord } from '@/utils/deliveryCareUi.uts'
|
||||
import { getNextStepText, getPrimaryActionText } from '@/utils/deliveryCareUi.uts'
|
||||
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
|
||||
import { getDeliveryRouteParam } from '@/utils/deliveryRoute.uts'
|
||||
|
||||
@@ -129,7 +124,10 @@ function makePhoneCall(phone: string) {
|
||||
}
|
||||
|
||||
function mockNavigate() {
|
||||
uni.showToast({ title: '导航为 mock 占位', icon: 'none' })
|
||||
if (order.value == null) {
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/route?id=' + order.value!.id })
|
||||
}
|
||||
|
||||
function goException() {
|
||||
@@ -164,27 +162,15 @@ async function handlePrimary() {
|
||||
return
|
||||
}
|
||||
if (status == 'accepted' || status == 'waiting_departure') {
|
||||
await markDeparted(orderId.value)
|
||||
uni.showToast({ title: '已出发', icon: 'success' })
|
||||
loadData()
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/route?id=' + orderId.value })
|
||||
return
|
||||
}
|
||||
if (status == 'departed' || status == 'on_the_way') {
|
||||
await markArrived(orderId.value)
|
||||
uni.showToast({ title: '已到达', icon: 'success' })
|
||||
loadData()
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/route?id=' + orderId.value })
|
||||
return
|
||||
}
|
||||
if (status == 'arrived') {
|
||||
await checkInServiceOrder(orderId.value, '详情页签到', null)
|
||||
uni.showToast({ title: '签到成功', icon: 'success' })
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
if (status == 'checked_in') {
|
||||
await startServiceOrder(orderId.value)
|
||||
uni.showToast({ title: '开始服务', icon: 'success' })
|
||||
loadData()
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/checkin?id=' + orderId.value })
|
||||
return
|
||||
}
|
||||
if (status == 'in_service' || status == 'serving' || status == 'completed') {
|
||||
@@ -192,14 +178,7 @@ async function handlePrimary() {
|
||||
return
|
||||
}
|
||||
if (status == 'pending_confirm' || status == 'pending_acceptance' || status == 'pending_submit') {
|
||||
if (needsServiceRecord(order.value)) {
|
||||
uni.showToast({ title: '请先填写服务记录', icon: 'none' })
|
||||
goRecord()
|
||||
return
|
||||
}
|
||||
await completeServiceOrder(orderId.value)
|
||||
uni.showToast({ title: '服务已完成', icon: 'success' })
|
||||
loadData()
|
||||
uni.showToast({ title: '已完成服务,等待用户验收', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (status == 'abnormal' || status == 'exception_pending') {
|
||||
|
||||
@@ -43,15 +43,10 @@ import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uv
|
||||
import type { DeliveryOrderStatus, DeliveryOrderType } from '@/types/delivery.uts'
|
||||
import {
|
||||
acceptServiceOrder,
|
||||
checkInServiceOrder,
|
||||
completeServiceOrder,
|
||||
getHistoryServiceOrders,
|
||||
getPendingServiceOrders,
|
||||
getTodayServiceOrders,
|
||||
markArrived,
|
||||
markDeparted,
|
||||
rejectServiceOrder,
|
||||
startServiceOrder
|
||||
rejectServiceOrder
|
||||
} from '@/services/deliveryService.uts'
|
||||
import { getDeliveryOrderTabs, getPrimaryActionText } from '@/utils/deliveryCareUi.uts'
|
||||
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
|
||||
@@ -137,27 +132,15 @@ async function handleAction(orderId: string, status: DeliveryOrderStatus) {
|
||||
return
|
||||
}
|
||||
if (status == 'accepted' || status == 'waiting_departure') {
|
||||
await markDeparted(orderId)
|
||||
uni.showToast({ title: '已标记出发', icon: 'success' })
|
||||
loadData()
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/route?id=' + orderId })
|
||||
return
|
||||
}
|
||||
if (status == 'departed' || status == 'on_the_way') {
|
||||
await markArrived(orderId)
|
||||
uni.showToast({ title: '已标记到达', icon: 'success' })
|
||||
loadData()
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/route?id=' + orderId })
|
||||
return
|
||||
}
|
||||
if (status == 'arrived') {
|
||||
await checkInServiceOrder(orderId, '已到达并签到', null)
|
||||
uni.showToast({ title: '签到成功', icon: 'success' })
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
if (status == 'checked_in') {
|
||||
await startServiceOrder(orderId)
|
||||
uni.showToast({ title: '已开始服务', icon: 'success' })
|
||||
loadData()
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/checkin?id=' + orderId })
|
||||
return
|
||||
}
|
||||
if (status == 'in_service' || status == 'serving' || status == 'completed') {
|
||||
@@ -165,13 +148,7 @@ async function handleAction(orderId: string, status: DeliveryOrderStatus) {
|
||||
return
|
||||
}
|
||||
if (status == 'pending_confirm' || status == 'pending_acceptance' || status == 'pending_submit') {
|
||||
const result = await completeServiceOrder(orderId)
|
||||
if (result == null) {
|
||||
uni.showToast({ title: '请先填写服务记录', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.showToast({ title: '服务已完成', icon: 'success' })
|
||||
loadData()
|
||||
uni.showToast({ title: '已完成服务,等待用户验收', icon: 'none' })
|
||||
return
|
||||
}
|
||||
goDetail(orderId)
|
||||
|
||||
Reference in New Issue
Block a user