| | |
| | | </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' |
| | |
| | | |
| | | // 更新任务状态 |
| | | updateTaskStatus(status, remark) { |
| | | // 如果是完成状态,需要检查是否上传了知情同意书 |
| | | if (status === 'COMPLETED') { |
| | | this.checkConsentAttachmentAndThen(status, remark); |
| | | } else { |
| | | // 获取GPS位置信息 |
| | | this.getLocationAndUpdateStatus(status, remark) |
| | | 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(() => {}); |
| | | } |
| | | }, |
| | | |
| | | // 获取位置信息并更新状态 |