| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getTask, changeTaskStatus, setAssigneeReady } from '@/api/task' |
| | | import { getTask, changeTaskStatus, setAssigneeReady, checkTaskConsentAttachment } from '@/api/task' |
| | | import { checkVehicleActiveTasks } from '@/api/task' |
| | | import { getPaymentInfo } from '@/api/payment' |
| | | import { formatDateTime } from '@/utils/common' |
| | |
| | | return '未设置' |
| | | } |
| | | const formatted = formatDateTime(this.taskDetail.plannedStartTime, 'YYYY-MM-DD HH:mm') |
| | | // 如果年份是1900,表示无效日期,显示为未设置 |
| | | if (formatted && formatted.startsWith('1900')) { |
| | | return '未设置' |
| | | // 如果年份是1900或1970,表示无效日期,显示为未分配时间 |
| | | if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) { |
| | | return '未分配时间' |
| | | } |
| | | return formatted |
| | | }, |
| | |
| | | return '未设置' |
| | | } |
| | | const formatted = formatDateTime(this.taskDetail.plannedEndTime, 'YYYY-MM-DD HH:mm') |
| | | // 如果年份是1900,表示无效日期,显示为未设置 |
| | | if (formatted && formatted.startsWith('1900')) { |
| | | return '未设置' |
| | | // 如果年份是1900或1970,表示无效日期,显示为未分配时间 |
| | | if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) { |
| | | return '未分配时间' |
| | | } |
| | | return formatted |
| | | }, |
| | |
| | | return '未设置' |
| | | } |
| | | const formatted = formatDateTime(this.taskDetail.actualStartTime, 'YYYY-MM-DD HH:mm') |
| | | // 如果年份是1900,表示无效日期,显示为未设置 |
| | | if (formatted && formatted.startsWith('1900')) { |
| | | return '未设置' |
| | | // 如果年份是1900或1970,表示无效日期,显示为未分配时间 |
| | | if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) { |
| | | return '未分配时间' |
| | | } |
| | | return formatted |
| | | }, |
| | |
| | | return '未设置' |
| | | } |
| | | const formatted = formatDateTime(this.taskDetail.actualEndTime, 'YYYY-MM-DD HH:mm') |
| | | // 如果年份是1900,表示无效日期,显示为未设置 |
| | | if (formatted && formatted.startsWith('1900')) { |
| | | return '未设置' |
| | | // 如果年份是1900或1970,表示无效日期,显示为未分配时间 |
| | | if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) { |
| | | return '未分配时间' |
| | | } |
| | | return formatted |
| | | } |
| | |
| | | |
| | | // 更新任务状态 |
| | | updateTaskStatus(status, remark) { |
| | | // 获取GPS位置信息 |
| | | this.getLocationAndUpdateStatus(status, remark) |
| | | // 如果是完成状态,需要检查是否上传了知情同意书 |
| | | if (status === 'COMPLETED') { |
| | | this.checkConsentAttachmentAndThen(status, remark); |
| | | } else { |
| | | // 获取GPS位置信息 |
| | | this.getLocationAndUpdateStatus(status, remark); |
| | | } |
| | | }, |
| | | |
| | | // 检查知情同意书附件并更新状态 |
| | | async checkConsentAttachmentAndThen(status, remark) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: '检查附件...' |
| | | }); |
| | | |
| | | const response = await checkTaskConsentAttachment(this.taskId); |
| | | |
| | | uni.hideLoading(); |
| | | |
| | | if (response.code === 200) { |
| | | // 已上传知情同意书,继续更新状态 |
| | | this.getLocationAndUpdateStatus(status, remark); |
| | | } else { |
| | | // 未上传知情同意书,显示提示 |
| | | this.$modal.confirm('任务未上传知情同意书,无法完成任务。是否现在去上传?').then(() => { |
| | | // 滚动到附件上传区域 |
| | | this.$nextTick(() => { |
| | | uni.pageScrollTo({ |
| | | scrollTop: 9999, // 滚动到底部 |
| | | duration: 300 |
| | | }); |
| | | }); |
| | | }).catch(() => {}); |
| | | } |
| | | } catch (error) { |
| | | uni.hideLoading(); |
| | | console.error('检查附件失败:', error); |
| | | |
| | | // 如果检查失败,询问用户是否继续 |
| | | this.$modal.confirm('检查附件状态失败,是否继续完成任务?').then(() => { |
| | | this.getLocationAndUpdateStatus(status, remark); |
| | | }).catch(() => {}); |
| | | } |
| | | }, |
| | | |
| | | // 获取位置信息并更新状态 |