补充数据库数据,修改分类栏内容
This commit is contained in:
@@ -1,363 +1,433 @@
|
||||
<template>
|
||||
<ServicePageScaffold title="工作台" fallback-url="/pages/user/login?mode=delivery" :hide-header="true">
|
||||
<view class="delivery-home-page">
|
||||
<view class="delivery-home-hero">
|
||||
<view class="delivery-home-hero-top">
|
||||
<view class="delivery-home-hero-main">
|
||||
<text class="delivery-home-hero-title">服务工作台</text>
|
||||
<text class="delivery-home-hero-subtitle">聚焦今日任务、异常处理和服务进度,帮助你快速进入当前工作状态。</text>
|
||||
<view class="delivery-home-user-tags">
|
||||
<text class="delivery-home-user-tag delivery-home-user-tag-light">{{ onlineStatusText }}</text>
|
||||
<text class="delivery-home-user-tag delivery-home-user-tag-soft">今日完成 {{ dashboard.completedCount }} 单</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="delivery-home-hero-actions">
|
||||
<view class="delivery-home-hero-action" @click="loadData()">
|
||||
<text class="delivery-home-hero-action-text">刷新</text>
|
||||
</view>
|
||||
<view class="delivery-home-hero-action" @click="goMessages()">
|
||||
<text class="delivery-home-hero-action-text">消息</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="delivery-home-hero-info-row">
|
||||
<view class="delivery-home-hero-info-item">
|
||||
<text class="delivery-home-hero-info-value">{{ dashboard.pendingAcceptCount }}</text>
|
||||
<text class="delivery-home-hero-info-label">待接单</text>
|
||||
</view>
|
||||
<view class="delivery-home-hero-info-item">
|
||||
<text class="delivery-home-hero-info-value">{{ dashboard.servingCount }}</text>
|
||||
<text class="delivery-home-hero-info-label">服务中</text>
|
||||
</view>
|
||||
<view class="delivery-home-hero-info-item">
|
||||
<text class="delivery-home-hero-info-value">{{ dashboard.exceptionCount }}</text>
|
||||
<text class="delivery-home-hero-info-label">异常待跟进</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="delivery-home-card delivery-home-overview-card">
|
||||
<view class="delivery-home-card-header">
|
||||
<view class="page">
|
||||
<view class="hero">
|
||||
<view class="hero-top">
|
||||
<view>
|
||||
<text class="delivery-home-card-title">今日概览</text>
|
||||
<text class="delivery-home-card-subtitle">聚焦待接单、服务执行和异常处理</text>
|
||||
<text class="hero-title">服务人员工作台</text>
|
||||
<text class="hero-subtitle">聚焦今日接单、上门履约和异常处理</text>
|
||||
</view>
|
||||
<text class="delivery-status-pill" :class="getStatusPillClass()">{{ onlineStatusText }}</text>
|
||||
<view class="hero-refresh" @click="loadData"><text class="hero-refresh-text">刷新</text></view>
|
||||
</view>
|
||||
<view class="delivery-overview-row">
|
||||
<view class="delivery-overview-item">
|
||||
<text class="delivery-overview-num delivery-overview-num-warning">{{ dashboard.pendingAcceptCount }}</text>
|
||||
<text class="delivery-overview-label">待接单</text>
|
||||
</view>
|
||||
<view class="delivery-overview-item">
|
||||
<text class="delivery-overview-num delivery-overview-num-active">{{ dashboard.pendingDepartCount }}</text>
|
||||
<text class="delivery-overview-label">待出发</text>
|
||||
</view>
|
||||
<view class="delivery-overview-item">
|
||||
<text class="delivery-overview-num delivery-overview-num-teal">{{ dashboard.servingCount }}</text>
|
||||
<text class="delivery-overview-label">服务中</text>
|
||||
</view>
|
||||
<view class="delivery-overview-item">
|
||||
<text class="delivery-overview-num delivery-overview-num-success">{{ dashboard.completedCount }}</text>
|
||||
<text class="delivery-overview-label">已完成</text>
|
||||
<view class="profile-card">
|
||||
<view class="avatar"><text class="avatar-text">护</text></view>
|
||||
<view class="profile-main">
|
||||
<text class="profile-name">{{ profileName }}</text>
|
||||
<text class="profile-role">{{ profileRole }}</text>
|
||||
<text class="profile-org">{{ organizationName }}</text>
|
||||
</view>
|
||||
<view class="status-pill"><text class="status-pill-text">{{ onlineText }}</text></view>
|
||||
</view>
|
||||
<view class="delivery-home-inline-alert" @click="goOrders('exception')">
|
||||
<view class="delivery-status-left">
|
||||
<text class="delivery-status-title">异常任务</text>
|
||||
<text class="delivery-status-desc">待优先跟进 {{ dashboard.exceptionCount }} 个异常事项</text>
|
||||
</view>
|
||||
|
||||
<view class="card stats-card">
|
||||
<view class="section-head">
|
||||
<text class="section-title">今日数据</text>
|
||||
<text class="section-desc">面向上门服务场景的实时工作概览</text>
|
||||
</view>
|
||||
<view class="stats-grid">
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">{{ dashboard.pendingAssignmentCount }}</text>
|
||||
<text class="stat-label">待接单</text>
|
||||
</view>
|
||||
<view class="delivery-status-right">
|
||||
<text class="delivery-exception-num">{{ dashboard.exceptionCount }}</text>
|
||||
<text class="delivery-inline-link">立即查看</text>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">{{ dashboard.todayOrderCount }}</text>
|
||||
<text class="stat-label">今日待服务</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">{{ dashboard.servingCount }}</text>
|
||||
<text class="stat-label">服务中</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value money">{{ incomeText }}</text>
|
||||
<text class="stat-label">预计收入</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="dashboard.exceptionCount > 0" class="delivery-home-card delivery-home-alert-card" @click="goOrders('exception')">
|
||||
<view class="delivery-alert-main">
|
||||
<text class="delivery-alert-title">当前有 {{ dashboard.exceptionCount }} 个异常任务待处理</text>
|
||||
<text class="delivery-alert-desc">建议先进入异常工单列表,确认原因、联系对象并更新处理进度。</text>
|
||||
<view class="card quick-card">
|
||||
<view class="section-head">
|
||||
<text class="section-title">快捷入口</text>
|
||||
<text class="section-desc">适配上门场景的大按钮操作</text>
|
||||
</view>
|
||||
<view class="delivery-alert-action">
|
||||
<text class="delivery-alert-action-text">查看异常</text>
|
||||
<view class="quick-grid">
|
||||
<view class="quick-item" @click="openOrders('pending')"><text class="quick-title">待接单</text><text class="quick-desc">优先确认新派单</text></view>
|
||||
<view class="quick-item" @click="openOrders('today')"><text class="quick-title">今日订单</text><text class="quick-desc">查看全部待服务订单</text></view>
|
||||
<view class="quick-item" @click="openServingOrder"><text class="quick-title">服务中</text><text class="quick-desc">继续填写记录</text></view>
|
||||
<view class="quick-item" @click="openOrders('history')"><text class="quick-title">历史订单</text><text class="quick-desc">查看已完成和异常</text></view>
|
||||
<view class="quick-item" @click="openAbnormal"><text class="quick-title">异常上报</text><text class="quick-desc">快速上报现场风险</text></view>
|
||||
<view class="quick-item" @click="openProfile"><text class="quick-title">我的资料</text><text class="quick-desc">查看个人信息与设置</text></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="delivery-home-card delivery-home-current-card">
|
||||
<view class="delivery-home-card-header">
|
||||
<view>
|
||||
<text class="delivery-home-card-title">当前任务</text>
|
||||
<text class="delivery-home-card-subtitle">首页先看这一单,明确今天的下一步动作</text>
|
||||
</view>
|
||||
<view class="card next-card">
|
||||
<view class="section-head">
|
||||
<text class="section-title">下一单服务提醒</text>
|
||||
<text class="section-desc">优先处理当前最需要行动的一单</text>
|
||||
</view>
|
||||
<view v-if="dashboard.recentOrders.length == 0" class="empty-box"><text class="empty-text">暂无待执行服务</text></view>
|
||||
<view v-else class="current-task-card" :class="getStatusSurfaceClass(dashboard.recentOrders[0].status)" @click="goDetail(dashboard.recentOrders[0].id)">
|
||||
<view class="current-task-top">
|
||||
<view class="current-task-main">
|
||||
<text class="current-task-title">{{ dashboard.recentOrders[0].serviceName }}</text>
|
||||
<text class="current-task-subtitle">{{ dashboard.recentOrders[0].elderNameMasked }} · {{ dashboard.recentOrders[0].appointmentStartTime }}</text>
|
||||
</view>
|
||||
<ServiceStatusTag :text="dashboard.recentOrders[0].statusText" :tone="dashboard.recentOrders[0].statusTone"></ServiceStatusTag>
|
||||
<view v-if="dashboard.nextOrder == null" class="empty-box"><text class="empty-text">暂无待处理订单</text></view>
|
||||
<view v-else class="next-body">
|
||||
<view class="next-row">
|
||||
<text class="next-title">{{ dashboard.nextOrder!.serviceName }}</text>
|
||||
<text class="next-status">{{ nextStatusText }}</text>
|
||||
</view>
|
||||
<view class="current-task-info-card">
|
||||
<view class="current-task-field">
|
||||
<text class="current-task-field-label">服务地址</text>
|
||||
<text class="current-task-field-value">{{ dashboard.recentOrders[0].addressSummary }}</text>
|
||||
</view>
|
||||
<view class="current-task-field current-task-field-last">
|
||||
<text class="current-task-field-label">风险标签</text>
|
||||
<text class="current-task-field-value">{{ formatRiskTags(dashboard.recentOrders[0].riskTags) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="current-task-footer">
|
||||
<view class="current-task-step">
|
||||
<text class="current-task-step-label">下一步</text>
|
||||
<text class="current-task-step-text">{{ getPrimaryActionText(dashboard.recentOrders[0].status) }}</text>
|
||||
</view>
|
||||
<view class="current-task-btn" :class="getPrimaryActionClass(dashboard.recentOrders[0].status)" @click.stop="handlePrimaryAction(dashboard.recentOrders[0])">
|
||||
<text class="current-task-btn-text">{{ getPrimaryActionText(dashboard.recentOrders[0].status) }}</text>
|
||||
</view>
|
||||
<text class="next-meta">预约时间:{{ dashboard.nextOrder!.appointmentTime }}</text>
|
||||
<text class="next-meta">服务地址:{{ dashboard.nextOrder!.address }}</text>
|
||||
<text class="next-meta">下一步:{{ nextStepText }}</text>
|
||||
<view class="next-actions">
|
||||
<view class="outline-btn" @click="goDetail(dashboard.nextOrder!.id)"><text class="outline-btn-text">查看详情</text></view>
|
||||
<view class="primary-btn" @click="handleOrderAction(dashboard.nextOrder!.id)"><text class="primary-btn-text">{{ nextActionText }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="delivery-home-card delivery-home-tools-card">
|
||||
<view class="delivery-home-card-header">
|
||||
<view>
|
||||
<text class="delivery-home-card-title">常用功能</text>
|
||||
<text class="delivery-home-card-subtitle">保留当前可用入口,缩短日常处理路径</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="shortcut-grid">
|
||||
<view class="shortcut-item" @click="goOrders('pending_accept')">
|
||||
<view class="shortcut-icon shortcut-icon-warning"><text class="shortcut-icon-text">接</text></view>
|
||||
<text class="shortcut-title">待接单</text>
|
||||
<text class="shortcut-desc">优先查看新派单</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goOrders('all')">
|
||||
<view class="shortcut-icon shortcut-icon-primary"><text class="shortcut-icon-text">单</text></view>
|
||||
<text class="shortcut-title">今日任务</text>
|
||||
<text class="shortcut-desc">进入全部工单列表</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goMessages()">
|
||||
<view class="shortcut-icon shortcut-icon-teal"><text class="shortcut-icon-text">讯</text></view>
|
||||
<text class="shortcut-title">消息提醒</text>
|
||||
<text class="shortcut-desc">查看沟通与通知</text>
|
||||
</view>
|
||||
<view class="shortcut-item" @click="goRecords()">
|
||||
<view class="shortcut-icon shortcut-icon-success"><text class="shortcut-icon-text">档</text></view>
|
||||
<text class="shortcut-title">服务记录</text>
|
||||
<text class="shortcut-desc">回顾已完成服务</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="delivery-home-card delivery-home-list-card">
|
||||
<view class="delivery-home-card-header">
|
||||
<view>
|
||||
<text class="delivery-home-card-title">服务工单</text>
|
||||
<text class="delivery-home-card-subtitle">保留最近工单,突出状态、地址和下一步动作</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="dashboard.recentOrders.length == 0" class="empty-box"><text class="empty-text">暂无任务</text></view>
|
||||
<view v-for="item in dashboard.recentOrders" :key="item.id" class="order-card" :class="getStatusSurfaceClass(item.status)" @click="goDetail(item.id)">
|
||||
<view class="card-top">
|
||||
<view class="order-main">
|
||||
<text class="order-title">{{ item.serviceName }} · {{ item.elderNameMasked }}</text>
|
||||
<text class="order-meta">预约时间:{{ item.appointmentStartTime }}</text>
|
||||
</view>
|
||||
<ServiceStatusTag :text="item.statusText" :tone="item.statusTone"></ServiceStatusTag>
|
||||
</view>
|
||||
<view class="order-info-box">
|
||||
<text class="order-meta">服务地址:{{ item.addressSummary }}</text>
|
||||
<text class="order-meta">风险标签:{{ formatRiskTags(item.riskTags) }}</text>
|
||||
</view>
|
||||
<view class="order-footer">
|
||||
<text class="order-next-text">下一步:{{ getPrimaryActionText(item.status) }}</text>
|
||||
<view class="order-action-btn" :class="getPrimaryActionClass(item.status)" @click.stop="handlePrimaryAction(item)">
|
||||
<text class="order-action-btn-text">立即处理</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="delivery-home-safe"></view>
|
||||
</view>
|
||||
</ServicePageScaffold>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uvue'
|
||||
import ServiceStatusTag from '@/components/homeService/ServiceStatusTag.uvue'
|
||||
import type { DeliveryDashboardType, DeliveryInfoType, DeliveryOrderType } from '@/types/delivery.uts'
|
||||
import { getDeliveryDashboard, getDeliveryProfile } from '@/services/deliveryService.uts'
|
||||
import { getDeliveryInfo, requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
|
||||
import type { DeliveryDashboardType, DeliveryInfoType } from '@/types/delivery.uts'
|
||||
import { acceptServiceOrder, getDeliveryDashboardStats, getDeliveryProfile, markDeparted } from '@/services/deliveryService.uts'
|
||||
import { getNextStepText, getPrimaryActionText } from '@/utils/deliveryCareUi.uts'
|
||||
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
|
||||
|
||||
const dashboard = ref<DeliveryDashboardType>({
|
||||
const dashboard = ref({
|
||||
pendingAssignmentCount: 0,
|
||||
pendingAcceptCount: 0,
|
||||
todayOrderCount: 0,
|
||||
pendingDepartCount: 0,
|
||||
servingCount: 0,
|
||||
completedCount: 0,
|
||||
exceptionCount: 0,
|
||||
onlineStatus: 'resting',
|
||||
expectedIncome: 0,
|
||||
onlineStatus: 'online',
|
||||
nextOrder: null,
|
||||
recentOrders: [] as Array<any>
|
||||
} as DeliveryDashboardType)
|
||||
const onlineStatusText = ref('休息中')
|
||||
const deliveryInfo = ref<DeliveryInfoType | null>(null)
|
||||
const profile = ref<DeliveryInfoType | null>(null)
|
||||
|
||||
function syncStatusText(status: string) {
|
||||
if (status == 'online') {
|
||||
onlineStatusText.value = '在线接单'
|
||||
return
|
||||
}
|
||||
if (status == 'busy') {
|
||||
onlineStatusText.value = '忙碌中'
|
||||
return
|
||||
}
|
||||
onlineStatusText.value = '休息中'
|
||||
}
|
||||
|
||||
function getStatusPillClass(): string {
|
||||
if (onlineStatusText.value == '在线接单') {
|
||||
return 'delivery-status-online'
|
||||
}
|
||||
if (onlineStatusText.value == '忙碌中') {
|
||||
return 'delivery-status-busy'
|
||||
}
|
||||
return 'delivery-status-resting'
|
||||
}
|
||||
|
||||
function getPrimaryActionText(status: string): string {
|
||||
if (status == 'pending_accept') {
|
||||
return '立即接单'
|
||||
}
|
||||
if (status == 'accepted') {
|
||||
return '准备出发'
|
||||
}
|
||||
if (status == 'on_the_way' || status == 'arrived') {
|
||||
return '去签到'
|
||||
}
|
||||
if (status == 'checked_in' || status == 'serving' || status == 'pending_submit' || status == 'pending_acceptance') {
|
||||
return '继续服务'
|
||||
}
|
||||
if (status == 'exception_pending') {
|
||||
return '处理异常'
|
||||
}
|
||||
if (status == 'completed' || status == 'settled' || status == 'archived') {
|
||||
return '查看结果'
|
||||
}
|
||||
return '查看详情'
|
||||
}
|
||||
|
||||
function getPrimaryActionClass(status: string): string {
|
||||
if (status == 'pending_accept') {
|
||||
return 'action-warning'
|
||||
}
|
||||
if (status == 'accepted' || status == 'on_the_way' || status == 'arrived') {
|
||||
return 'action-primary'
|
||||
}
|
||||
if (status == 'checked_in' || status == 'serving' || status == 'pending_submit' || status == 'pending_acceptance') {
|
||||
return 'action-teal'
|
||||
}
|
||||
if (status == 'exception_pending') {
|
||||
return 'action-danger'
|
||||
}
|
||||
if (status == 'completed' || status == 'settled' || status == 'archived') {
|
||||
return 'action-success'
|
||||
}
|
||||
return 'action-default'
|
||||
}
|
||||
|
||||
function getStatusSurfaceClass(status: string): string {
|
||||
if (status == 'pending_accept') {
|
||||
return 'status-surface-warning'
|
||||
}
|
||||
if (status == 'accepted' || status == 'on_the_way' || status == 'arrived') {
|
||||
return 'status-surface-primary'
|
||||
}
|
||||
if (status == 'checked_in' || status == 'serving' || status == 'pending_submit' || status == 'pending_acceptance') {
|
||||
return 'status-surface-teal'
|
||||
}
|
||||
if (status == 'exception_pending') {
|
||||
return 'status-surface-danger'
|
||||
}
|
||||
if (status == 'completed' || status == 'settled' || status == 'archived') {
|
||||
return 'status-surface-success'
|
||||
}
|
||||
return 'status-surface-default'
|
||||
}
|
||||
|
||||
function formatRiskTags(tags: Array<string>): string {
|
||||
if (tags.length == 0) {
|
||||
return '常规服务'
|
||||
}
|
||||
return tags.join(' / ')
|
||||
}
|
||||
|
||||
function goRoute(id: string) {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/route?id=' + id })
|
||||
}
|
||||
|
||||
function goCheckin(id: string) {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/checkin?id=' + id })
|
||||
}
|
||||
|
||||
function goExecute(id: string) {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/execute?id=' + id })
|
||||
}
|
||||
|
||||
function goException(id: string) {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/exception?id=' + id })
|
||||
}
|
||||
|
||||
function handlePrimaryAction(order: DeliveryOrderType) {
|
||||
if (order.status == 'pending_accept') {
|
||||
goDetail(order.id)
|
||||
return
|
||||
}
|
||||
if (order.status == 'accepted') {
|
||||
goRoute(order.id)
|
||||
return
|
||||
}
|
||||
if (order.status == 'on_the_way' || order.status == 'arrived') {
|
||||
goCheckin(order.id)
|
||||
return
|
||||
}
|
||||
if (order.status == 'checked_in' || order.status == 'serving' || order.status == 'pending_submit' || order.status == 'pending_acceptance') {
|
||||
goExecute(order.id)
|
||||
return
|
||||
}
|
||||
if (order.status == 'exception_pending') {
|
||||
goException(order.id)
|
||||
return
|
||||
}
|
||||
goDetail(order.id)
|
||||
}
|
||||
const profileName = computed((): string => profile.value != null ? profile.value.name : '服务人员')
|
||||
const profileRole = computed((): string => profile.value != null ? '护工 / 上门服务人员' : '服务人员')
|
||||
const organizationName = computed((): string => profile.value != null ? profile.value.organizationName : '机构待绑定')
|
||||
const onlineText = computed((): string => {
|
||||
if (profile.value == null) return '离线'
|
||||
if (profile.value.onlineStatus == 'online') return '在线'
|
||||
if (profile.value.onlineStatus == 'busy') return '忙碌'
|
||||
return '离线'
|
||||
})
|
||||
const incomeText = computed((): string => '¥' + String(dashboard.value.expectedIncome))
|
||||
const nextActionText = computed((): string => dashboard.value.nextOrder == null ? '查看详情' : getPrimaryActionText(dashboard.value.nextOrder!.status))
|
||||
const nextStepText = computed((): string => dashboard.value.nextOrder == null ? '暂无' : getNextStepText(dashboard.value.nextOrder!.status))
|
||||
const nextStatusText = computed((): string => dashboard.value.nextOrder == null ? '' : dashboard.value.nextOrder!.statusText)
|
||||
|
||||
async function loadData() {
|
||||
const startedAt = Date.now()
|
||||
console.log('[deliveryHome] loadData start')
|
||||
const authResult = await requireDeliveryAuth({ redirectOnFail: true, toastOnFail: true })
|
||||
console.log('[deliveryHome] auth done', {
|
||||
ok: authResult.ok,
|
||||
message: authResult.message,
|
||||
elapsed: Date.now() - startedAt
|
||||
})
|
||||
if (!authResult.ok) {
|
||||
return
|
||||
}
|
||||
dashboard.value = await getDeliveryDashboard()
|
||||
console.log('[deliveryHome] dashboard loaded, elapsed=' + (Date.now() - startedAt))
|
||||
deliveryInfo.value = await getDeliveryProfile()
|
||||
console.log('[deliveryHome] profile loaded, elapsed=' + (Date.now() - startedAt))
|
||||
const info = deliveryInfo.value != null ? deliveryInfo.value : getDeliveryInfo()
|
||||
if (info != null) {
|
||||
syncStatusText(info.onlineStatus)
|
||||
profile.value = await getDeliveryProfile()
|
||||
dashboard.value = await getDeliveryDashboardStats()
|
||||
}
|
||||
|
||||
function openOrders(tab: string) {
|
||||
uni.setStorageSync('delivery_order_tab', tab)
|
||||
uni.switchTab({ url: '/pages/mall/delivery/orders/index' })
|
||||
}
|
||||
|
||||
function openProfile() {
|
||||
uni.switchTab({ url: '/pages/mall/delivery/profile/index' })
|
||||
}
|
||||
|
||||
function openServingOrder() {
|
||||
if (dashboard.value.nextOrder == null) {
|
||||
openOrders('today')
|
||||
return
|
||||
}
|
||||
goDetail(dashboard.value.nextOrder!.id)
|
||||
}
|
||||
|
||||
function openAbnormal() {
|
||||
if (dashboard.value.nextOrder != null) {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/exception?id=' + dashboard.value.nextOrder!.id })
|
||||
return
|
||||
}
|
||||
uni.showToast({ title: '请先进入订单详情页再上报异常', icon: 'none' })
|
||||
}
|
||||
|
||||
function goDetail(orderId: string) {
|
||||
uni.navigateTo({ url: '/pages/mall/delivery/orders/detail?id=' + orderId })
|
||||
}
|
||||
|
||||
async function handleOrderAction(orderId: string) {
|
||||
const order = dashboard.value.nextOrder
|
||||
if (order == null) {
|
||||
return
|
||||
}
|
||||
if (order.status == 'pending_assignment' || order.status == 'pending_accept') {
|
||||
await acceptServiceOrder(orderId)
|
||||
uni.showToast({ title: '已接单', icon: 'success' })
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
if (order.status == 'accepted' || order.status == 'waiting_departure') {
|
||||
await markDeparted(orderId)
|
||||
uni.showToast({ title: '已标记出发', icon: 'success' })
|
||||
loadData()
|
||||
return
|
||||
}
|
||||
goDetail(orderId)
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page {
|
||||
min-height: 100%;
|
||||
margin-left: -24rpx;
|
||||
margin-right: -24rpx;
|
||||
margin-top: -24rpx;
|
||||
padding: 0 24rpx 36rpx;
|
||||
background-color: #f3f8fb;
|
||||
}
|
||||
|
||||
.hero {
|
||||
padding: 64rpx 28rpx 32rpx;
|
||||
border-bottom-left-radius: 36rpx;
|
||||
border-bottom-right-radius: 36rpx;
|
||||
background: linear-gradient(180deg, #1f7db4 0%, #22a380 100%);
|
||||
}
|
||||
|
||||
.hero-top,
|
||||
.profile-card,
|
||||
.section-head,
|
||||
.stats-grid,
|
||||
.quick-grid,
|
||||
.next-row,
|
||||
.next-actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.hero-top,
|
||||
.section-head,
|
||||
.next-row,
|
||||
.next-actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.hero-subtitle,
|
||||
.profile-role,
|
||||
.profile-org,
|
||||
.section-desc,
|
||||
.stat-label,
|
||||
.quick-desc,
|
||||
.next-meta,
|
||||
.empty-text {
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.hero-subtitle,
|
||||
.profile-role,
|
||||
.profile-org {
|
||||
margin-top: 10rpx;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.hero-refresh {
|
||||
padding: 14rpx 22rpx;
|
||||
border-radius: 999rpx;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.hero-refresh-text,
|
||||
.status-pill-text,
|
||||
.primary-btn-text,
|
||||
.quick-title,
|
||||
.section-title,
|
||||
.profile-name,
|
||||
.next-title,
|
||||
.stat-value {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero-refresh-text,
|
||||
.status-pill-text {
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.profile-card,
|
||||
.card,
|
||||
.quick-item,
|
||||
.next-body {
|
||||
background-color: #ffffff;
|
||||
border-radius: 28rpx;
|
||||
}
|
||||
|
||||
.profile-card {
|
||||
align-items: center;
|
||||
margin-top: 28rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
background-color: #d8eff8;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: #166e96;
|
||||
}
|
||||
|
||||
.profile-main {
|
||||
flex: 1;
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
.profile-name {
|
||||
font-size: 32rpx;
|
||||
color: #16324f;
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
padding: 12rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background-color: #22a380;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-top: 22rpx;
|
||||
padding: 26rpx;
|
||||
box-shadow: 0 10rpx 28rpx rgba(15, 35, 55, 0.06);
|
||||
}
|
||||
|
||||
.section-head {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
color: #16324f;
|
||||
}
|
||||
|
||||
.section-desc,
|
||||
.stat-label,
|
||||
.quick-desc,
|
||||
.next-meta,
|
||||
.empty-text,
|
||||
.outline-btn-text {
|
||||
color: #5e758c;
|
||||
}
|
||||
|
||||
.stats-grid,
|
||||
.quick-grid {
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.stat-item,
|
||||
.quick-item {
|
||||
width: 48%;
|
||||
margin-top: 14rpx;
|
||||
padding: 22rpx;
|
||||
background-color: #f7fbfd;
|
||||
border-radius: 22rpx;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 38rpx;
|
||||
color: #166e96;
|
||||
}
|
||||
|
||||
.money {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.quick-title {
|
||||
font-size: 28rpx;
|
||||
color: #16324f;
|
||||
}
|
||||
|
||||
.quick-desc,
|
||||
.next-meta {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.next-body {
|
||||
margin-top: 18rpx;
|
||||
padding: 24rpx;
|
||||
background-color: #f7fbfd;
|
||||
}
|
||||
|
||||
.next-title {
|
||||
font-size: 30rpx;
|
||||
color: #16324f;
|
||||
flex: 1;
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
.next-status {
|
||||
font-size: 24rpx;
|
||||
color: #1f7db4;
|
||||
}
|
||||
|
||||
.next-actions {
|
||||
margin-top: 20rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.outline-btn,
|
||||
.primary-btn {
|
||||
width: 48%;
|
||||
padding: 18rpx 0;
|
||||
border-radius: 18rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.outline-btn {
|
||||
background-color: #eef6fa;
|
||||
}
|
||||
|
||||
.outline-btn-text {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background-color: #1f7db4;
|
||||
}
|
||||
|
||||
.primary-btn-text {
|
||||
font-size: 26rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.empty-box {
|
||||
padding: 24rpx 0;
|
||||
}
|
||||
</style>
|
||||
console.log('[deliveryHome] loadData complete, elapsed=' + (Date.now() - startedAt))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user