完成consumer端同步

This commit is contained in:
2026-05-14 15:28:09 +08:00
parent 612fb3d360
commit 0ffbc53902
197 changed files with 92657 additions and 7564 deletions

View File

@@ -0,0 +1,122 @@
<template>
<scroll-view class="page" scroll-y="true">
<ServicePanel title="到岗签到" subtitle="先用 mock 方式记录签到结果、到岗说明和留痕提示。">
<text class="info">任务编号:{{ taskNo }}</text>
<text class="info">当前状态:{{ taskStatus }}</text>
<view class="block">
<text class="label">签到确认</text>
<view class="tag-row">
<view class="tag active">GPS 已到位</view>
<view class="tag active">服务对象确认</view>
<view class="tag">拍照凭证待接入</view>
</view>
</view>
<view class="block">
<text class="label">签到说明</text>
<textarea v-model="note" class="textarea" placeholder="可填写到岗时间、现场情况、陪护确认信息"></textarea>
</view>
<view class="submit-btn" @click="submitCheckIn">确认签到</view>
</ServicePanel>
</scroll-view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import { fetchWorkerTaskDetail, submitWorkerCheckIn } from '@/services/homeServiceService.uts'
const taskId = ref('')
const taskNo = ref('')
const taskStatus = ref('待上门')
const note = ref('已完成到岗签到,服务对象和家属已确认。')
onLoad((options) => {
const id = options['id']
if (id != null) {
taskId.value = id as string
fetchWorkerTaskDetail(taskId.value).then((res) => {
if (res != null) {
taskNo.value = res.caseNo
taskStatus.value = res.statusText
}
})
}
})
async function submitCheckIn() {
if (taskId.value == '') {
return
}
const result = await submitWorkerCheckIn(taskId.value, note.value)
if (result != null) {
uni.showToast({ title: '签到完成', icon: 'success' })
setTimeout(() => {
uni.navigateBack()
}, 400)
}
}
</script>
<style scoped>
.page {
min-height: 100vh;
background: #f3f7f9;
padding: 24rpx;
box-sizing: border-box;
}
.info,
.label {
font-size: 28rpx;
line-height: 40rpx;
color: #16324f;
}
.block {
margin-top: 24rpx;
}
.tag-row {
margin-top: 16rpx;
flex-direction: row;
flex-wrap: wrap;
gap: 16rpx;
}
.tag {
padding: 12rpx 20rpx;
border-radius: 999rpx;
background: #eef2f6;
font-size: 24rpx;
color: #66788a;
}
.active {
background: #e8f7ef;
color: #15803d;
}
.textarea {
margin-top: 16rpx;
width: 100%;
height: 220rpx;
padding: 24rpx;
box-sizing: border-box;
background: #f8fbfc;
border-radius: 20rpx;
font-size: 28rpx;
color: #23384d;
}
.submit-btn {
margin-top: 32rpx;
padding: 26rpx 0;
border-radius: 20rpx;
background: #0f766e;
text-align: center;
font-size: 30rpx;
font-weight: 700;
color: #ffffff;
}
</style>

View File

@@ -0,0 +1,143 @@
<template>
<scroll-view class="page" scroll-y="true">
<ServicePanel title="异常上报" subtitle="先完成异常类型、说明和调度通知的 mock 处理。">
<text class="info">任务编号:{{ taskNo }}</text>
<view class="block">
<text class="label">异常类型</text>
<view class="type-wrap">
<view
v-for="item in exceptionTypes"
:key="item"
class="type-item"
:class="selectedType == item ? 'active-type' : ''"
@click="selectedType = item"
>
{{ item }}
</view>
</view>
</view>
<view class="block">
<text class="label">异常说明</text>
<textarea v-model="description" class="textarea" placeholder="填写未能执行原因、现场情况、已采取措施"></textarea>
</view>
<view class="block">
<text class="label">处理建议</text>
<view class="suggestion-box">上报后将同步给调度员与管理端,后续可继续补充整改结果。</view>
</view>
<view class="submit-btn warn" @click="submitException">提交异常</view>
</ServicePanel>
</scroll-view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import { fetchWorkerTaskDetail, submitWorkerException } from '@/services/homeServiceService.uts'
const taskId = ref('')
const taskNo = ref('')
const selectedType = ref('服务对象不在家')
const description = ref('现场无人响应,已电话联系家属,等待调度重新确认上门时间。')
const exceptionTypes = ['服务对象不在家', '临时身体不适', '环境不具备执行条件', '物资缺失', '其他']
onLoad((options) => {
const id = options['id']
if (id != null) {
taskId.value = id as string
fetchWorkerTaskDetail(taskId.value).then((res) => {
if (res != null) {
taskNo.value = res.caseNo
}
})
}
})
async function submitException() {
if (taskId.value == '' || description.value == '') {
uni.showToast({ title: '请填写异常说明', icon: 'none' })
return
}
const result = await submitWorkerException(taskId.value, selectedType.value, description.value)
if (result != null) {
uni.showToast({ title: '异常已上报', icon: 'success' })
setTimeout(() => {
uni.navigateBack()
}, 400)
}
}
</script>
<style scoped>
.page {
min-height: 100vh;
background: #f3f7f9;
padding: 24rpx;
box-sizing: border-box;
}
.info,
.label,
.suggestion-box,
.type-item {
font-size: 28rpx;
line-height: 40rpx;
color: #16324f;
}
.block {
margin-top: 24rpx;
}
.type-wrap {
margin-top: 16rpx;
flex-direction: row;
flex-wrap: wrap;
gap: 16rpx;
}
.type-item {
padding: 18rpx 22rpx;
border-radius: 18rpx;
background: #f8fbfc;
}
.active-type {
background: #fff4e5;
color: #b45309;
}
.textarea {
margin-top: 16rpx;
width: 100%;
height: 240rpx;
padding: 24rpx;
box-sizing: border-box;
background: #f8fbfc;
border-radius: 20rpx;
font-size: 28rpx;
color: #23384d;
}
.suggestion-box {
margin-top: 16rpx;
padding: 22rpx 24rpx;
background: #f8fbfc;
border-radius: 18rpx;
color: #66788a;
}
.submit-btn {
margin-top: 32rpx;
padding: 26rpx 0;
border-radius: 20rpx;
text-align: center;
font-size: 30rpx;
font-weight: 700;
color: #ffffff;
}
.warn {
background: #b45309;
}
</style>

View File

@@ -0,0 +1,111 @@
<template>
<scroll-view class="page" scroll-y="true">
<ServicePanel title="服务记录" subtitle="本页先记录执行摘要、服务步骤和后续待上传凭证占位。">
<text class="info">任务编号:{{ taskNo }}</text>
<view class="block">
<text class="label">执行步骤</text>
<view class="step-card" v-for="item in steps" :key="item">{{ item }}</view>
</view>
<view class="block">
<text class="label">服务摘要</text>
<textarea v-model="summary" class="textarea" placeholder="记录生命体征、护理动作、家属沟通和后续建议"></textarea>
</view>
<view class="block">
<text class="label">凭证上传</text>
<view class="upload-box">后续接入拍照、音视频和签名凭证</view>
</view>
<view class="submit-btn" @click="submitRecord">保存记录</view>
</ServicePanel>
</scroll-view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import { fetchWorkerTaskDetail, submitWorkerServiceRecord } from '@/services/homeServiceService.uts'
const taskId = ref('')
const taskNo = ref('')
const summary = ref('已完成血压监测、基础照护和风险提醒,家属已确认后续随访时间。')
const steps = ['生命体征记录', '基础照护执行', '家属沟通说明']
onLoad((options) => {
const id = options['id']
if (id != null) {
taskId.value = id as string
fetchWorkerTaskDetail(taskId.value).then((res) => {
if (res != null) {
taskNo.value = res.caseNo
summary.value = res.recordSummary
}
})
}
})
async function submitRecord() {
if (taskId.value == '') {
return
}
const result = await submitWorkerServiceRecord(taskId.value, summary.value)
if (result != null) {
uni.showToast({ title: '记录已保存', icon: 'success' })
setTimeout(() => {
uni.navigateBack()
}, 400)
}
}
</script>
<style scoped>
.page {
min-height: 100vh;
background: #f3f7f9;
padding: 24rpx;
box-sizing: border-box;
}
.info,
.label,
.step-card,
.upload-box {
font-size: 28rpx;
line-height: 40rpx;
color: #16324f;
}
.block {
margin-top: 24rpx;
}
.step-card,
.upload-box {
margin-top: 16rpx;
padding: 22rpx 24rpx;
background: #f8fbfc;
border-radius: 18rpx;
}
.textarea {
margin-top: 16rpx;
width: 100%;
height: 260rpx;
padding: 24rpx;
box-sizing: border-box;
background: #f8fbfc;
border-radius: 20rpx;
font-size: 28rpx;
color: #23384d;
}
.submit-btn {
margin-top: 32rpx;
padding: 26rpx 0;
border-radius: 20rpx;
background: #0f766e;
text-align: center;
font-size: 30rpx;
font-weight: 700;
color: #ffffff;
}
</style>

View File

@@ -0,0 +1,154 @@
<template>
<scroll-view class="page" scroll-y="true">
<view v-if="detail == null" class="empty-box">
<text class="empty-text">未找到任务详情</text>
</view>
<view v-else>
<ServicePanel title="任务状态" subtitle="执行端首批支持签到开始与完成提交两个动作。">
<ServiceInfoCard
:title="detail.serviceName"
:code="detail.caseNo"
:status-text="detail.statusText"
:status-tone="detail.statusTone"
:items="[
{ label: '服务对象', value: detail.elderName },
{ label: '上门时间', value: detail.appointmentTime },
{ label: '签到状态', value: detail.checkInStatus },
{ label: '执行人员', value: detail.staffName + ' ' + detail.staffPhone },
{ label: '服务地址', value: detail.address }
]"
></ServiceInfoCard>
<ServiceActionRow
:actions="[
{ key: 'check-in', label: '到岗签到', tone: 'teal' },
{ key: 'record', label: '服务记录', tone: 'ghost' },
{ key: 'exception', label: '异常上报', tone: 'warn' }
]"
@action="handleDetailAction"
></ServiceActionRow>
<view class="primary-btn" @click="handleAdvance">{{ detail.actionText }}</view>
</ServicePanel>
<ServicePanel title="服务记录">
<text class="task-info">记录摘要:{{ detail.recordSummary }}</text>
<text class="task-info">后续将补充签到拍照、服务步骤打卡和上传凭证组件。</text>
</ServicePanel>
<ServicePanel title="过程时间线">
<ServiceTimeline :items="detail.timeline"></ServiceTimeline>
</ServicePanel>
</view>
</scroll-view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import ServiceActionRow from '@/components/homeService/ServiceActionRow.uvue'
import ServiceInfoCard from '@/components/homeService/ServiceInfoCard.uvue'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import ServiceTimeline from '@/components/homeService/ServiceTimeline.uvue'
import { advanceWorkerTask, fetchWorkerTaskDetail } from '@/services/homeServiceService.uts'
import { HomeServiceTaskType } from '@/types/home-service.uts'
const taskId = ref('')
const detail = ref<HomeServiceTaskType | null>(null)
async function loadData() {
if (taskId.value == '') {
return
}
detail.value = await fetchWorkerTaskDetail(taskId.value)
}
async function handleAdvance() {
if (taskId.value == '') {
return
}
if (detail.value != null && detail.value.status == 'pending_visit') {
goCheckIn()
return
}
const result = await advanceWorkerTask(taskId.value)
if (result != null) {
detail.value = result
uni.showToast({ title: '任务状态已更新', icon: 'success' })
}
}
function goCheckIn() {
if (taskId.value == '') {
return
}
uni.navigateTo({ url: '/pages/mall/merchant/home-service/check-in?id=' + taskId.value })
}
function goRecord() {
if (taskId.value == '') {
return
}
uni.navigateTo({ url: '/pages/mall/merchant/home-service/service-record?id=' + taskId.value })
}
function goException() {
if (taskId.value == '') {
return
}
uni.navigateTo({ url: '/pages/mall/merchant/home-service/exception-report?id=' + taskId.value })
}
function handleDetailAction(actionKey: string) {
if (actionKey == 'check-in') {
goCheckIn()
} else if (actionKey == 'record') {
goRecord()
} else if (actionKey == 'exception') {
goException()
}
}
onLoad((options) => {
const id = options['id']
if (id != null) {
taskId.value = id as string
loadData()
}
})
onShow(() => {
loadData()
})
</script>
<style scoped>
.page {
min-height: 100vh;
background: #f3f7f9;
padding: 24rpx;
box-sizing: border-box;
}
.task-info,
.empty-text {
margin-top: 10rpx;
font-size: 26rpx;
line-height: 38rpx;
color: #66788a;
}
.primary-btn {
margin-top: 24rpx;
padding: 24rpx 0;
text-align: center;
font-size: 30rpx;
font-weight: 700;
color: #ffffff;
background: #0f766e;
border-radius: 18rpx;
}
.empty-box {
padding: 120rpx 0;
align-items: center;
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<scroll-view class="page" scroll-y="true">
<ServicePanel title="执行任务" subtitle="按移动执行页风格,先做任务卡片与状态动作。">
<view v-for="item in tasks" :key="item.id" class="task-card" @click="goDetail(item.id)">
<view class="task-top">
<view>
<text class="task-title">{{ item.elderName }} · {{ item.serviceName }}</text>
<text class="task-meta">{{ item.caseNo }}</text>
</view>
<ServiceStatusTag :text="item.statusText" :tone="item.statusTone"></ServiceStatusTag>
</view>
<text class="task-info">预约时间:{{ item.appointmentTime }}</text>
<text class="task-info">签到状态:{{ item.checkInStatus }}</text>
<text class="task-info">服务地址:{{ item.address }}</text>
<view class="action-btn">{{ item.actionText }}</view>
</view>
</ServicePanel>
</scroll-view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import ServiceStatusTag from '@/components/homeService/ServiceStatusTag.uvue'
import { fetchWorkerTasks } from '@/services/homeServiceService.uts'
import { HomeServiceTaskType } from '@/types/home-service.uts'
const tasks = ref<Array<HomeServiceTaskType>>([])
async function loadData() {
tasks.value = await fetchWorkerTasks()
}
function goDetail(taskId: string) {
uni.navigateTo({ url: '/pages/mall/merchant/home-service/task-detail?id=' + taskId })
}
onLoad(() => {
loadData()
})
onShow(() => {
loadData()
})
</script>
<style scoped>
.page {
min-height: 100vh;
background: #f3f7f9;
padding: 24rpx;
box-sizing: border-box;
}
.task-card {
padding: 24rpx;
border-radius: 20rpx;
background: #f8fbfc;
margin-bottom: 20rpx;
}
.task-top {
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
}
.task-title {
font-size: 32rpx;
font-weight: 700;
color: #16324f;
}
.task-meta,
.task-info {
margin-top: 10rpx;
font-size: 26rpx;
line-height: 38rpx;
color: #66788a;
}
.action-btn {
margin-top: 20rpx;
padding: 20rpx 0;
text-align: center;
font-size: 28rpx;
font-weight: 700;
color: #ffffff;
background: #0f766e;
border-radius: 16rpx;
}
</style>