补充数据库数据,修改分类栏内容
This commit is contained in:
@@ -1,82 +1,214 @@
|
||||
<template>
|
||||
<ServicePageScaffold title="工单详情" fallback-url="/pages/mall/delivery/orders/index">
|
||||
<ServicePanel title="基础信息" subtitle="接单前脱敏,接单后展示完整信息。">
|
||||
<view v-if="order != null">
|
||||
<text class="row-text">工单号:{{ order.orderNo }}</text>
|
||||
<text class="row-text">服务项目:{{ order.serviceName }}</text>
|
||||
<text class="row-text">服务对象:{{ order.status == 'pending_accept' ? order.elderNameMasked : order.fullElderName }}</text>
|
||||
<text class="row-text">联系电话:{{ order.status == 'pending_accept' ? order.elderPhoneMasked : order.fullPhone }}</text>
|
||||
<text class="row-text">服务地址:{{ order.status == 'pending_accept' ? order.addressSummary : order.fullAddress }}</text>
|
||||
<text class="row-text">预约时间:{{ order.appointmentStartTime }} - {{ order.appointmentEndTime }}</text>
|
||||
<text class="row-text">联系人:{{ order.contactName }} / {{ order.contactPhone }}</text>
|
||||
<text class="row-text">注意事项:{{ order.notices.join(';') }}</text>
|
||||
<ServicePageScaffold title="订单详情" fallback-url="/pages/mall/delivery/orders/index">
|
||||
<view v-if="order != null" class="page">
|
||||
<view class="status-card">
|
||||
<view class="status-head">
|
||||
<view>
|
||||
<text class="status-title">当前状态</text>
|
||||
<text class="status-subtitle">{{ order.statusText }}</text>
|
||||
</view>
|
||||
<text class="status-tag">{{ nextStepText }}</text>
|
||||
</view>
|
||||
<view class="timeline-box">
|
||||
<view v-for="item in order.timeline" :key="item.id" class="timeline-item">
|
||||
<text class="timeline-title">{{ item.title }}</text>
|
||||
<text class="timeline-meta">{{ item.time }}</text>
|
||||
<text class="timeline-desc">{{ item.description }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</ServicePanel>
|
||||
|
||||
<ServicePanel title="服务项目" subtitle="未完成项需在执行页填写原因。">
|
||||
<view v-if="order != null" v-for="item in order.serviceItems" :key="item.id" class="item-row">
|
||||
<text class="row-text">{{ item.name }}</text>
|
||||
<view class="card">
|
||||
<text class="section-title">服务信息</text>
|
||||
<text class="row-text">服务名称:{{ order.serviceName }}</text>
|
||||
<text class="row-text">服务类型:{{ order.serviceType }}</text>
|
||||
<text class="row-text">预约时间:{{ order.appointmentTime }}</text>
|
||||
<text class="row-text">预计时长:{{ order.duration }} 分钟</text>
|
||||
<text class="row-text">服务价格:¥{{ order.price }}</text>
|
||||
<text class="row-text">预计收入:¥{{ order.staffIncome }}</text>
|
||||
</view>
|
||||
</ServicePanel>
|
||||
|
||||
<ServicePanel title="状态时间轴" subtitle="所有关键动作都需要留痕。">
|
||||
<ServiceTimeline :items="timelineItems"></ServiceTimeline>
|
||||
</ServicePanel>
|
||||
<view class="card">
|
||||
<text class="section-title">服务对象</text>
|
||||
<text class="row-text">姓名:{{ order.elderName }}</text>
|
||||
<text class="row-text">性别:{{ order.elderGender }}</text>
|
||||
<text class="row-text">年龄:{{ order.elderAge }}</text>
|
||||
<text class="row-text">电话:{{ order.elderPhone }}</text>
|
||||
<text class="row-text">健康标签:{{ joinTags(order.healthTags) }}</text>
|
||||
</view>
|
||||
|
||||
<view class="bottom-space"></view>
|
||||
<view v-if="order != null" class="fixed-bar">
|
||||
<view class="bar-btn secondary-btn" @click="goException"><text class="bar-text secondary-text">异常上报</text></view>
|
||||
<view v-if="order.status == 'pending_accept'" class="bar-btn primary-btn" @click="acceptOrder"><text class="bar-text">接单</text></view>
|
||||
<view v-else-if="order.status == 'accepted' || order.status == 'on_the_way' || order.status == 'arrived'" class="bar-btn primary-btn" @click="goRoute"><text class="bar-text">出发/签到</text></view>
|
||||
<view v-else class="bar-btn primary-btn" @click="goExecute"><text class="bar-text">进入执行</text></view>
|
||||
<view class="card">
|
||||
<text class="section-title">联系人信息</text>
|
||||
<text class="row-text">联系人:{{ order.contactName }}</text>
|
||||
<text class="row-text">联系电话:{{ order.contactPhone }}</text>
|
||||
<text class="row-text">关系:{{ order.contactRelation }}</text>
|
||||
<view class="inline-actions">
|
||||
<view class="outline-btn" @click="makePhoneCall(order.contactPhone)"><text class="outline-btn-text">拨打联系人</text></view>
|
||||
<view class="outline-btn" @click="makePhoneCall(order.elderPhone)"><text class="outline-btn-text">拨打服务对象</text></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<text class="section-title">地址信息</text>
|
||||
<text class="row-text">完整地址:{{ order.address }}</text>
|
||||
<text class="row-text">门牌号:{{ order.addressDetail }}</text>
|
||||
<text class="row-text">距离:{{ order.distance }}</text>
|
||||
<view class="inline-actions">
|
||||
<view class="outline-btn" @click="mockNavigate"><text class="outline-btn-text">导航按钮</text></view>
|
||||
<view class="outline-btn" @click="makePhoneCall(order.contactPhone)"><text class="outline-btn-text">拨打电话</text></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<text class="section-title">用户备注</text>
|
||||
<text class="row-text">特殊需求:{{ order.remark }}</text>
|
||||
<text class="row-text">需家属在场:{{ order.needFamilyPresent ? '是' : '否' }}</text>
|
||||
<text class="row-text">需携带耗材:{{ order.needMaterials ? '是' : '否' }}</text>
|
||||
<text class="row-text">风险标签:{{ joinTags(order.riskTags) }}</text>
|
||||
</view>
|
||||
|
||||
<view v-if="order.abnormalReport != null" class="card">
|
||||
<text class="section-title">异常记录</text>
|
||||
<text class="row-text">异常类型:{{ order.abnormalReport!.type }}</text>
|
||||
<text class="row-text">异常说明:{{ order.abnormalReport!.description }}</text>
|
||||
<text class="row-text">发生时间:{{ order.abnormalReport!.occurredAt }}</text>
|
||||
</view>
|
||||
|
||||
<view class="action-card">
|
||||
<view class="action-row">
|
||||
<view class="outline-btn" @click="goException"><text class="outline-btn-text">异常上报</text></view>
|
||||
<view v-if="showRejectButton" class="warn-btn" @click="rejectOrder"><text class="warn-btn-text">拒单</text></view>
|
||||
<view class="primary-btn" @click="handlePrimary"><text class="primary-btn-text">{{ primaryText }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</ServicePageScaffold>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uvue'
|
||||
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
|
||||
import ServiceTimeline from '@/components/homeService/ServiceTimeline.uvue'
|
||||
import { acceptDeliveryOrder, getDeliveryOrderDetail } from '@/services/deliveryService.uts'
|
||||
import type { DeliveryOrderType } from '@/types/delivery.uts'
|
||||
import {
|
||||
acceptServiceOrder,
|
||||
checkInServiceOrder,
|
||||
completeServiceOrder,
|
||||
getServiceOrderDetail,
|
||||
markArrived,
|
||||
markDeparted,
|
||||
rejectServiceOrder,
|
||||
startServiceOrder
|
||||
} from '@/services/deliveryService.uts'
|
||||
import { getNextStepText, getPrimaryActionText, needsServiceRecord } from '@/utils/deliveryCareUi.uts'
|
||||
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
|
||||
import { getDeliveryRouteParam } from '@/utils/deliveryRoute.uts'
|
||||
|
||||
const orderId = ref('')
|
||||
const order = ref<DeliveryOrderType | null>(null)
|
||||
const timelineItems = ref([] as Array<any>)
|
||||
|
||||
const primaryText = computed((): string => order.value == null ? '查看详情' : getPrimaryActionText(order.value!.status))
|
||||
const nextStepText = computed((): string => order.value == null ? '' : getNextStepText(order.value!.status))
|
||||
const showRejectButton = computed((): boolean => order.value != null && (order.value!.status == 'pending_assignment' || order.value!.status == 'pending_accept'))
|
||||
|
||||
async function loadData() {
|
||||
const authResult = await requireDeliveryAuth({ redirectOnFail: true, toastOnFail: true })
|
||||
if (!authResult.ok || orderId.value == '') {
|
||||
return
|
||||
}
|
||||
order.value = await getDeliveryOrderDetail(orderId.value)
|
||||
if (order.value != null) {
|
||||
timelineItems.value = order.value.timeline
|
||||
}
|
||||
order.value = await getServiceOrderDetail(orderId.value)
|
||||
}
|
||||
|
||||
async function acceptOrder() {
|
||||
await acceptDeliveryOrder(orderId.value)
|
||||
uni.showToast({ title: '接单成功', icon: 'success' })
|
||||
loadData()
|
||||
function joinTags(tags: Array<string>): string {
|
||||
if (tags.length == 0) return '无'
|
||||
return tags.join(' / ')
|
||||
}
|
||||
|
||||
function goRoute() {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/route?id=' + orderId.value })
|
||||
function makePhoneCall(phone: string) {
|
||||
uni.makePhoneCall({ phoneNumber: phone })
|
||||
}
|
||||
|
||||
function goExecute() {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/execute?id=' + orderId.value })
|
||||
function mockNavigate() {
|
||||
uni.showToast({ title: '导航为 mock 占位', icon: 'none' })
|
||||
}
|
||||
|
||||
function goException() {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/exception?id=' + orderId.value })
|
||||
}
|
||||
|
||||
function goRecord() {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/service-record/index?id=' + orderId.value })
|
||||
}
|
||||
|
||||
async function rejectOrder() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['时间冲突', '距离过远', '技能不匹配', '其他原因'],
|
||||
success: async (result) => {
|
||||
const reasons = ['时间冲突', '距离过远', '技能不匹配', '其他原因']
|
||||
await rejectServiceOrder(orderId.value, reasons[result.tapIndex])
|
||||
uni.showToast({ title: '已拒单', icon: 'success' })
|
||||
loadData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function handlePrimary() {
|
||||
if (order.value == null) {
|
||||
return
|
||||
}
|
||||
const status = order.value.status
|
||||
if (status == 'pending_assignment' || status == 'pending_accept') {
|
||||
await acceptServiceOrder(orderId.value)
|
||||
uni.showToast({ title: '已接单', icon: 'success' })
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
if (status == 'accepted' || status == 'waiting_departure') {
|
||||
await markDeparted(orderId.value)
|
||||
uni.showToast({ title: '已出发', icon: 'success' })
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
if (status == 'departed' || status == 'on_the_way') {
|
||||
await markArrived(orderId.value)
|
||||
uni.showToast({ title: '已到达', icon: 'success' })
|
||||
loadData()
|
||||
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()
|
||||
return
|
||||
}
|
||||
if (status == 'in_service' || status == 'serving' || status == 'completed') {
|
||||
goRecord()
|
||||
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()
|
||||
return
|
||||
}
|
||||
if (status == 'abnormal' || status == 'exception_pending') {
|
||||
goException()
|
||||
return
|
||||
}
|
||||
goRecord()
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options != null) {
|
||||
orderId.value = getDeliveryRouteParam(options as UTSJSONObject, 'id')
|
||||
@@ -86,59 +218,123 @@ onLoad((options) => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.row-text {
|
||||
display: block;
|
||||
margin-bottom: 14rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 38rpx;
|
||||
.page {
|
||||
padding-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.status-card,
|
||||
.card,
|
||||
.action-card {
|
||||
margin-bottom: 18rpx;
|
||||
padding: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 10rpx 24rpx rgba(15, 35, 55, 0.06);
|
||||
}
|
||||
|
||||
.status-head,
|
||||
.inline-actions,
|
||||
.action-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.status-title,
|
||||
.section-title,
|
||||
.timeline-title,
|
||||
.primary-btn-text {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-title,
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
color: #16324f;
|
||||
}
|
||||
|
||||
.item-row {
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 1rpx solid #e6edf1;
|
||||
.status-subtitle,
|
||||
.status-tag,
|
||||
.row-text,
|
||||
.timeline-meta,
|
||||
.timeline-desc,
|
||||
.outline-btn-text,
|
||||
.warn-btn-text {
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.bottom-space {
|
||||
height: 140rpx;
|
||||
.status-subtitle,
|
||||
.timeline-meta,
|
||||
.timeline-desc,
|
||||
.outline-btn-text {
|
||||
color: #5e758c;
|
||||
}
|
||||
|
||||
.fixed-bar {
|
||||
position: fixed;
|
||||
left: 24rpx;
|
||||
right: 24rpx;
|
||||
bottom: 24rpx;
|
||||
padding: 16rpx;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
background: #ffffff;
|
||||
border-radius: 24rpx;
|
||||
box-shadow: 0 12rpx 24rpx rgba(15, 118, 110, 0.08);
|
||||
.status-tag {
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background-color: #e6f3fa;
|
||||
color: #176e97;
|
||||
}
|
||||
|
||||
.bar-btn {
|
||||
width: 48%;
|
||||
padding: 20rpx 0;
|
||||
.timeline-box {
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx;
|
||||
border-radius: 18rpx;
|
||||
background-color: #f7fbfd;
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.timeline-title {
|
||||
font-size: 26rpx;
|
||||
color: #16324f;
|
||||
}
|
||||
|
||||
.row-text {
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
color: #16324f;
|
||||
}
|
||||
|
||||
.inline-actions,
|
||||
.action-row {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.outline-btn,
|
||||
.warn-btn,
|
||||
.primary-btn {
|
||||
width: 31%;
|
||||
padding: 18rpx 0;
|
||||
border-radius: 18rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background: #0f766e;
|
||||
.outline-btn {
|
||||
background-color: #eef6fa;
|
||||
}
|
||||
|
||||
.secondary-btn {
|
||||
background: #eaf2f0;
|
||||
.warn-btn {
|
||||
background-color: #fff3e6;
|
||||
}
|
||||
|
||||
.bar-text {
|
||||
font-size: 28rpx;
|
||||
.warn-btn-text {
|
||||
color: #c77413;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background-color: #1f7db4;
|
||||
}
|
||||
|
||||
.primary-btn-text {
|
||||
font-size: 26rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.secondary-text {
|
||||
color: #0f766e;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user