2025008071805

This commit is contained in:
张潘 2025-08-16 18:13:15 +08:00
parent 325512b168
commit b2bea149f3
2 changed files with 468 additions and 778 deletions

View File

@ -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() {