2025008071805
This commit is contained in:
parent
325512b168
commit
b2bea149f3
File diff suppressed because it is too large
Load Diff
|
|
@ -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) {
|
processDispatch(worker) {
|
||||||
|
|
@ -5211,6 +5031,82 @@ export default {
|
||||||
// 打开订单详情对话框
|
// 打开订单详情对话框
|
||||||
this.orderDetailVisible = true
|
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: {
|
computed: {
|
||||||
imageListOnly() {
|
imageListOnly() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue