From b2bea149f3020f3316f35f449e4aceb3f0d1a968 Mon Sep 17 00:00:00 2001 From: "925116093-qq.com" <925116093@qq.com> Date: Sat, 16 Aug 2025 18:13:15 +0800 Subject: [PATCH] 2025008071805 --- .../Order/components/OrderDetailDialog.vue | 990 +++++++----------- ruoyi-ui/src/views/system/Order/index.vue | 256 ++--- 2 files changed, 468 insertions(+), 778 deletions(-) diff --git a/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue b/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue index 17a0be7..0aa88f0 100644 --- a/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue +++ b/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue @@ -1,254 +1,217 @@ @@ -265,33 +228,10 @@ export default { default: () => ({}) } }, - data() { - return { - actionLoading: false, - imagePreviewVisible: false, - previewImageUrl: '' - } - }, methods: { - // 关闭对话框 - closeDialog() { - this.$emit('update:visible', false) - }, - - // 格式化时间 - formatTime(time) { - if (!time) return '未设置' - if (typeof time === 'number') { - // Unix时间戳 - const date = new Date(time * 1000) - return date.toLocaleString() - } - const date = new Date(time) - return date.toLocaleString() - }, - - // 获取状态标签类型 + /** 获取状态标签类型 */ getStatusTagType(status) { + if (!status) return 'info' const statusMap = { 1: 'warning', // 待支付 2: 'primary', // 待服务 @@ -304,8 +244,9 @@ export default { return statusMap[status] || 'info' }, - // 获取状态标签文本 + /** 获取订单状态标签 */ getStatusLabel(status) { + if (!status) return '未知状态' const statusMap = { 1: '待支付', 2: '待服务', @@ -318,41 +259,47 @@ export default { return statusMap[status] || `状态${status}` }, - // 获取进度标签类型 - getProgressTagType(jsonStatus) { - const progressMap = { - 1: 'info', // 未开始 - 2: 'primary', // 进行中 - 3: 'success', // 已完成' - 8: 'warning', // 已暂停 - 9: 'success' // 已恢复 + /** 获取时间轴节点样式类 */ + getTimelineNodeClass(type) { + if (!type) return 'timeline-node-default' + const typeMap = { + 'create': 'timeline-node-primary', + 'pay': 'timeline-node-success', + 'dispatch': 'timeline-node-info', + 'accept': 'timeline-node-warning', + 'service': 'timeline-node-info', + 'complete': 'timeline-node-danger' } - return progressMap[jsonStatus] || 'info' + return typeMap[type] || 'timeline-node-default' }, - // 获取进度标签文本 - getProgressLabel(jsonStatus) { - const progressMap = { - 1: '未开始', - 2: '进行中', - 3: '已完成', - 8: '已暂停', - 9: '已恢复' + /** 获取时间轴图标 */ + getTimelineIcon(type) { + if (!type) return 'el-icon-info' + const typeMap = { + 'create': 'el-icon-plus', + 'pay': 'el-icon-check', + 'dispatch': 'el-icon-s-promotion', + 'accept': 'el-icon-check', + 'service': 'el-icon-video-play', + 'complete': 'el-icon-circle-check' } - return progressMap[jsonStatus] || `进度${jsonStatus}` + return typeMap[type] || 'el-icon-info' }, - // 获取师傅姓名 - getWorkerName(workerId) { - if (!workerId) return '未分配' - // 这里可以根据workerId查询师傅信息 - return `师傅${workerId}` + /** 格式化时间 */ + formatTime(time) { + if (!time) return '未知时间' + const date = new Date(time) + return date.toLocaleString() }, - // 获取文件列表 + /** 获取文件列表 */ getFileList() { - if (!this.orderInfo.fileData) return [] - + if (!this.orderInfo.fileData) { + return [] + } + try { let files if (typeof this.orderInfo.fileData === 'string') { @@ -366,7 +313,7 @@ export default { } else { files = [] } - + return Array.isArray(files) ? files : [] } catch (e) { console.error('解析文件数据失败:', e) @@ -374,7 +321,7 @@ export default { } }, - // 判断是否为图片 + /** 判断是否为图片文件 */ isImage(fileUrl) { if (!fileUrl || typeof fileUrl !== 'string') return false const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'] @@ -382,77 +329,32 @@ export default { return imageExtensions.some(ext => lowerUrl.includes(ext)) }, - // 预览文件 - previewFile(file) { - if (this.isImage(file)) { - this.previewImageUrl = file - this.imagePreviewVisible = true - } else { - // 非图片文件直接下载或打开 - window.open(file, '_blank') - } - }, - - // 预览图片 - previewImage(img, images) { - this.previewImageUrl = img - this.imagePreviewVisible = true - }, - - // 获取日志节点样式类 - getLogNodeClass(type) { - const classMap = { - 'create': 'log-node-primary', - 'pay': 'log-node-success', - 'dispatch': 'log-node-info', - 'accept': 'log-node-success', - 'start': 'log-node-warning', - 'complete': 'log-node-success', - 'cancel': 'log-node-danger' - } - return classMap[type] || 'log-node-default' - }, - - // 获取日志图标 - getLogIcon(type) { - const iconMap = { - 'create': 'el-icon-plus', - 'pay': 'el-icon-money', - 'dispatch': 'el-icon-s-promotion', - 'accept': 'el-icon-check', - 'start': 'el-icon-video-play', - 'complete': 'el-icon-circle-check', - 'cancel': 'el-icon-close' - } - return iconMap[type] || 'el-icon-info' - }, - - // 刷新日志 - refreshLogs() { + /** 刷新日志 */ + handleRefreshLogs() { this.$emit('refresh-logs') }, - // 导出日志 - exportLogs() { + /** 导出日志 */ + handleExportLogs() { this.$emit('export-logs') }, - // 派单操作 + /** 派单操作 */ handleDispatch() { this.$emit('dispatch-order') }, - // 接单操作 + /** 接单操作 */ handleAccept() { this.$emit('accept-order') }, - // 开始服务 - handleStart() { + /** 开始服务操作 */ + handleStartService() { this.$emit('start-service') }, - // 完成服务 + /** 完成服务操作 */ handleComplete() { this.$emit('complete-service') } @@ -463,251 +365,193 @@ export default { diff --git a/ruoyi-ui/src/views/system/Order/index.vue b/ruoyi-ui/src/views/system/Order/index.vue index de2d781..4fe588a 100644 --- a/ruoyi-ui/src/views/system/Order/index.vue +++ b/ruoyi-ui/src/views/system/Order/index.vue @@ -4763,191 +4763,11 @@ export default { - /** 获取时间轴节点样式类 */ - getTimelineNodeClass(title) { - if (!title) return 'timeline-node-default' - if (title.includes('订单生成') || title.includes('创建')) return 'timeline-node-primary' - if (title.includes('支付成功') || title.includes('接单') || title.includes('派单')) return 'timeline-node-success' - if (title.includes('出发') || title.includes('到达')) return 'timeline-node-warning' - if (title.includes('开始服务')) return 'timeline-node-info' - if (title.includes('服务完成') || title.includes('完成')) return 'timeline-node-danger' - return 'timeline-node-default' - }, - /** 获取时间轴图标 */ - getTimelineIcon(title) { - if (!title) return 'el-icon-info' - if (title.includes('订单生成') || title.includes('创建')) return 'el-icon-plus' - if (title.includes('支付成功') || title.includes('接单') || title.includes('派单')) return 'el-icon-check' - if (title.includes('出发') || title.includes('到达')) return 'el-icon-location' - if (title.includes('开始服务')) return 'el-icon-video-play' - if (title.includes('服务完成') || title.includes('完成')) return 'el-icon-circle-check' - return 'el-icon-info' - }, - /** 获取内容描述 */ - getContentDescription(content) { - if (!content) return '无描述信息' - try { - const contentData = JSON.parse(content) - if (Array.isArray(contentData)) { - return contentData[0]?.name || content - } else if (typeof contentData === 'object') { - return contentData.name || content - } - } catch (e) { - // 如果解析失败,直接返回原始内容 - } - return content - }, - /** 获取文件列表 */ - getFileList() { - if (!this.orderProcessForm.fileData) { - return [] - } - - try { - let files - if (typeof this.orderProcessForm.fileData === 'string') { - try { - files = JSON.parse(this.orderProcessForm.fileData) - } catch (e) { - // 如果不是JSON,按逗号分割 - files = this.orderProcessForm.fileData.split(',').filter(Boolean) - } - } else if (Array.isArray(this.orderProcessForm.fileData)) { - files = this.orderProcessForm.fileData - } else { - files = [] - } - - return Array.isArray(files) ? files : [] - } catch (e) { - console.error('解析文件数据失败:', e) - return [] - } - }, - - /** 判断是否为图片文件 */ - isImage(fileUrl) { - if (!fileUrl || typeof fileUrl !== 'string') return false - const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'] - const lowerUrl = fileUrl.toLowerCase() - return imageExtensions.some(ext => lowerUrl.includes(ext)) - }, - - /** 获取商品列表 */ - getProductList() { - // 这里可以根据实际数据结构来获取商品列表 - // 暂时返回模拟数据 - if (this.orderProcessForm.products && this.orderProcessForm.products.length > 0) { - return this.orderProcessForm.products - } - - // 如果没有商品数据,返回默认商品信息 - return [ - { - id: 1, - name: this.orderProcessForm.productName || '商品名称', - spec: '规格信息', - quantity: this.orderProcessForm.num || 1, - price: this.orderProcessForm.totalPrice || '0.00', - subtotal: this.orderProcessForm.totalPrice || '0.00', - status: 'pending', - image: '/static/images/default-product.png' - } - ] - }, - - /** 获取商品状态标签类型 */ - getProductStatusType(status) { - if (!status) return 'info' - const statusMap = { - 'pending': 'warning', // 待发货 - 'shipped': 'primary', // 已发货 - 'received': 'success', // 已收货 - 'refund': 'danger', // 退款中 - 'completed': 'success' // 已完成 - } - return statusMap[status] || 'info' - }, - - /** 获取商品状态标签文本 */ - getProductStatusLabel(status) { - if (!status) return '未知状态' - const statusMap = { - 'pending': '待发货', - 'shipped': '已发货', - 'received': '已收货', - 'refund': '退款中', - 'completed': '已完成' - } - return statusMap[status] || '未知状态' - }, - - /** 增加商品数量 */ - increaseQuantity(product) { - if (product.quantity < 99) { - product.quantity++ - this.updateProductSubtotal(product) - } - }, - - /** 减少商品数量 */ - decreaseQuantity(product) { - if (product.quantity > 1) { - product.quantity-- - this.updateProductSubtotal(product) - } - }, - - /** 更新商品小计 */ - updateProductSubtotal(product) { - const price = parseFloat(product.price) || 0 - const quantity = product.quantity || 1 - product.subtotal = (price * quantity).toFixed(2) - }, - - /** 从时间轴处理派单 */ - handleDispatchFromTimeline(record) { - // 设置派单表单数据 - this.dispatchForm = { - id: this.orderProcessForm.id, - orderId: this.orderProcessForm.orderId, - name: this.orderProcessForm.userName, - phone: this.orderProcessForm.userPhone, - address: this.orderProcessForm.appointmentAddress, - productName: this.orderProcessForm.productName, - payPrice: this.orderProcessForm.payPrice, - workerId: null, - workerName: '' - }; - - this.dispatchDialogVisible = true; - // 自动加载工人列表 - this.getWorkerList(); - }, - - /** 搜索工人 */ - searchWorkers() { - this.workerQueryParams.pageNum = 1; - this.getWorkerList(); - }, - - /** 重置工人搜索 */ - resetWorkerSearch() { - this.workerQueryParams = { - pageNum: 1, - pageSize: 10, - name: '', - phone: '', - status: '' - }; - this.getWorkerList(); - }, /** 调用派单接口 */ processDispatch(worker) { @@ -5211,6 +5031,82 @@ export default { // 打开订单详情对话框 this.orderDetailVisible = true }, + + /** 获取文件列表 */ + getFileList() { + if (!this.orderProcessForm.fileData) { + return [] + } + + try { + let files + if (typeof this.orderProcessForm.fileData === 'string') { + try { + files = JSON.parse(this.orderProcessForm.fileData) + } catch (e) { + // 如果不是JSON,按逗号分割 + files = this.orderProcessForm.fileData.split(',').filter(Boolean) + } + } else if (Array.isArray(this.orderProcessForm.fileData)) { + files = this.orderProcessForm.fileData + } else { + files = [] + } + + return Array.isArray(files) ? files : [] + } catch (e) { + console.error('解析文件数据失败:', e) + return [] + } + }, + + /** 判断是否为图片文件 */ + isImage(fileUrl) { + if (!fileUrl || typeof fileUrl !== 'string') return false + const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'] + const lowerUrl = fileUrl.toLowerCase() + return imageExtensions.some(ext => lowerUrl.includes(ext)) + }, + + /** 获取时间轴节点样式类 */ + getTimelineNodeClass(title) { + if (!title) return 'timeline-node-default' + if (title.includes('订单生成') || title.includes('创建')) return 'timeline-node-primary' + if (title.includes('支付成功') || title.includes('接单') || title.includes('派单')) return 'timeline-node-success' + if (title.includes('出发') || title.includes('到达')) return 'timeline-node-warning' + if (title.includes('开始服务')) return 'timeline-node-info' + if (title.includes('服务完成') || title.includes('完成')) return 'timeline-node-danger' + return 'timeline-node-default' + }, + + /** 获取时间轴图标 */ + getTimelineIcon(title) { + if (!title) return 'el-icon-info' + if (title.includes('订单生成') || title.includes('创建')) return 'el-icon-plus' + if (title.includes('支付成功') || title.includes('接单') || title.includes('派单')) return 'el-icon-check' + if (title.includes('出发') || title.includes('到达')) return 'el-icon-location' + if (title.includes('开始服务')) return 'el-icon-video-play' + if (title.includes('服务完成') || title.includes('完成')) return 'el-icon-circle-check' + return 'el-icon-info' + }, + + /** 获取内容描述 */ + getContentDescription(content) { + if (!content) return '无描述信息' + + try { + const contentData = JSON.parse(content) + if (Array.isArray(contentData)) { + return contentData[0]?.name || content + } else if (typeof contentData === 'object') { + return contentData.name || content + } + } catch (e) { + // 如果解析失败,直接返回原始内容 + } + + return content + }, }, computed: { imageListOnly() {