| | |
| | | <span v-if="taskDetail.emergencyInfo.dispatchSyncErrorMsg" style="color: #F56C6C;">{{ taskDetail.emergencyInfo.dispatchSyncErrorMsg }}</span> |
| | | <span v-else style="color: #C0C4CC;">--</span> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="任务状态同步" :span="2"> |
| | | <el-alert |
| | | title="提示:任务状态会自动同步到旧系统的调度单中,如果因网络等原因未同步,可点击下方按钮手动同步。" |
| | | type="info" |
| | | :closable="false" |
| | | show-icon |
| | | style="margin-bottom: 10px;"> |
| | | </el-alert> |
| | | <el-button |
| | | v-if="taskDetail.emergencyInfo.legacyDispatchOrdId && taskDetail.emergencyInfo.legacyDispatchOrdId > 0" |
| | | type="warning" |
| | | size="small" |
| | | icon="el-icon-refresh" |
| | | :loading="syncingTaskStatus" |
| | | @click="syncTaskStatus" |
| | | >同步任务状态到旧系统</el-button> |
| | | <el-tag v-else type="info" size="small"> |
| | | <i class="el-icon-warning"></i> 请先同步调度单 |
| | | </el-tag> |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | |
| | | <!-- 支付信息(仅急救转运任务显示) --> |
| | | <el-card v-if="taskDetail.taskType === 'EMERGENCY_TRANSFER' && paymentInfo" class="box-card" style="margin-top: 20px;"> |
| | | <div slot="header" class="clearfix"> |
| | | <span>支付信息</span> |
| | | <!-- 已完成且未申请发票时显示申请发票按钮 --> |
| | | <el-button |
| | | v-if="canApplyInvoice" |
| | | style="float: right; padding: 3px 0" |
| | | type="text" |
| | | @click="handleApplyInvoice" |
| | | v-hasPermi="['system:invoice:add']" |
| | | > |
| | | <i class="el-icon-document-add"></i> 申请发票 |
| | | </el-button> |
| | | </div> |
| | | |
| | | <!-- 支付概览 --> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getTask, updateTask, assignTask, changeTaskStatus, uploadAttachment, deleteAttachment, getTaskVehicles, getAvailableVehicles, assignVehiclesToTask, unassignVehicleFromTask, getPaymentInfo, syncServiceOrder, syncDispatchOrder } from "@/api/task"; |
| | | import { getTask, updateTask, assignTask, changeTaskStatus, uploadAttachment, deleteAttachment, getTaskVehicles, getAvailableVehicles, assignVehiclesToTask, unassignVehicleFromTask, getPaymentInfo, syncServiceOrder, syncDispatchOrder, syncTaskStatus } from "@/api/task"; |
| | | import { listUser } from "@/api/system/user"; |
| | | import { getToken } from "@/utils/auth"; |
| | | |
| | |
| | | }, |
| | | // 同步加载状态 |
| | | syncingServiceOrder: false, |
| | | syncingDispatchOrder: false |
| | | syncingDispatchOrder: false, |
| | | syncingTaskStatus: false, |
| | | // 发票申请状态 |
| | | hasInvoiceApplied: false, |
| | | invoiceStatus: null // 0-待审核, 1-已通过, 2-已驳回 |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | this.getAdditionalFeeList(); |
| | | // 初始化上传URL |
| | | this.uploadUrl = process.env.VUE_APP_BASE_API + "/task/attachment/upload/" + this.$route.params.taskId; |
| | | // 检查发票申请状态 |
| | | this.checkInvoiceStatus(); |
| | | }, |
| | | computed: { |
| | | /** 是否可以申请发票 */ |
| | | canApplyInvoice() { |
| | | // 只有急救转运任务 |
| | | if (this.taskDetail.taskType !== 'EMERGENCY_TRANSFER') return false; |
| | | // 任务必须已完成 |
| | | if (this.taskDetail.taskStatus !== 'COMPLETED') return false; |
| | | // 未申请过发票,或者曾被驳回 |
| | | return !this.hasInvoiceApplied || this.invoiceStatus === 2; |
| | | } |
| | | }, |
| | | methods: { |
| | | /** 获取任务详情 */ |
| | |
| | | }).then(() => { |
| | | this.$modal.msgSuccess("服务单同步成功"); |
| | | // 重新加载任务详情 |
| | | this.getDetail(); |
| | | this.getTaskDetail(); |
| | | }).catch(() => { |
| | | // 处理取消和错误 |
| | | }).finally(() => { |
| | |
| | | }).then(() => { |
| | | this.$modal.msgSuccess("调度单同步成功"); |
| | | // 重新加载任务详情 |
| | | this.getDetail(); |
| | | this.getTaskDetail(); |
| | | }).catch(() => { |
| | | // 处理取消和错误 |
| | | }).finally(() => { |
| | | this.syncingDispatchOrder = false; |
| | | }); |
| | | }, |
| | | /** 手动同步任务状态 */ |
| | | syncTaskStatus() { |
| | | this.$modal.confirm('是否确认同步任务状态到旧系统?').then(() => { |
| | | this.syncingTaskStatus = true; |
| | | return syncTaskStatus(this.taskDetail.taskId); |
| | | }).then(() => { |
| | | this.$modal.msgSuccess("任务状态同步成功"); |
| | | // 重新加载任务详情 |
| | | this.getTaskDetail(); |
| | | }).catch(() => { |
| | | // 处理取消和错误 |
| | | }).finally(() => { |
| | | this.syncingTaskStatus = false; |
| | | }); |
| | | }, |
| | | |
| | | /** 检查发票申请状态 */ |
| | | checkInvoiceStatus() { |
| | | // 调用后端接口检查该任务是否已申请发票 |
| | | this.$axios.get(`/system/invoice/checkTaskInvoice/${this.$route.params.taskId}`) |
| | | .then(response => { |
| | | if (response.code === 200 && response.data) { |
| | | this.hasInvoiceApplied = true; |
| | | this.invoiceStatus = response.data.status; |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | // 忽略错误,默认未申请 |
| | | }); |
| | | }, |
| | | |
| | | /** 申请发票 */ |
| | | handleApplyInvoice() { |
| | | // 跳转到发票申请页面,带上任务信息 |
| | | const taskInfo = { |
| | | taskId: this.taskDetail.taskId, |
| | | taskCode: this.taskDetail.taskCode || this.taskDetail.showTaskCode, |
| | | legacyServiceOrderId: this.taskDetail.emergencyInfo?.legacyServiceOrdId, |
| | | serviceCode: this.taskDetail.emergencyInfo?.serviceCode, |
| | | departure: this.taskDetail.departureAddress, |
| | | destination: this.taskDetail.destinationAddress, |
| | | completionTime: this.parseTime(this.taskDetail.actualEndTime), |
| | | transferPrice: this.paymentInfo?.transferPrice || this.paymentInfo?.totalAmount |
| | | }; |
| | | |
| | | // 将任务信息存储到 sessionStorage |
| | | sessionStorage.setItem('invoiceTaskInfo', JSON.stringify(taskInfo)); |
| | | |
| | | // 跳转到发票申请页面 |
| | | this.$router.push({ |
| | | path: '/system/invoice/apply', |
| | | query: { taskId: this.taskDetail.taskId } |
| | | }); |
| | | } |
| | | } |
| | | }; |