Files
WXProgram/dist/pages/index/modules/deliveryPersonModule.js
2025-10-26 13:15:04 +08:00

109 lines
3.2 KiB
JavaScript

"use strict";
// 货运人员模块 - 专门处理货运人员相关功能
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeliveryPersonModule = void 0;
class DeliveryPersonModule {
constructor(_pageContext, dataModule) {
this.dataModule = dataModule;
}
/**
* 处理货运人员标记点点击
*/
onDeliveryPersonMarkerClick(deliveryPerson, position) {
console.log('货运人员被点击:', deliveryPerson);
// 显示货运人员详情面板(包含订单列表)
this.showDeliveryPersonPanel(deliveryPerson, position);
}
/**
* 显示货运人员详情面板
*/
showDeliveryPersonPanel(deliveryPerson, _position) {
console.log('显示货运人员详情面板:', deliveryPerson);
// 设置当前货运人员
this.dataModule.setCurrentDeliveryPerson(deliveryPerson);
// 显示面板
this.dataModule.toggleDeliveryPersonModal(true, 'bottom');
}
/**
* 隐藏货运人员详情面板
*/
hideDeliveryPersonPanel() {
this.dataModule.toggleDeliveryPersonModal(false);
this.dataModule.setCurrentDeliveryPerson(null);
}
/**
* 展开货运人员详情面板
*/
expandDeliveryPersonPanel() {
this.dataModule.toggleDeliveryPersonModal(true, 'full');
}
/**
* 收起货运人员详情面板
*/
collapseDeliveryPersonPanel() {
this.dataModule.toggleDeliveryPersonModal(true, 'bottom');
}
/**
* 获取货运人员信息摘要
*/
getDeliveryPersonSummary(deliveryPerson) {
return `${deliveryPerson.name || '货运人员'} - ${deliveryPerson.role || 'DRIVER'}`;
}
/**
* 获取货运人员状态文本
*/
getDeliveryPersonStatusText(status) {
const statusMap = {
'idle': '空闲',
'busy': '忙碌',
'offline': '离线'
};
return statusMap[status] || status;
}
/**
* 获取货运人员状态颜色
*/
getDeliveryPersonStatusColor(status) {
switch (status) {
case 'idle':
return '#52c41a'; // 绿色
case 'busy':
return '#faad14'; // 橙色
case 'offline':
return '#d9d9d9'; // 灰色
default:
return '#d9d9d9'; // 灰色
}
}
/**
* 获取货运人员当前订单信息
*/
getCurrentOrderInfo(person) {
if (!person.currentOrder) {
return '暂无订单';
}
const order = person.currentOrder;
return `订单 #${order.id} - ${this.getOrderStatusText(order.status)}`;
}
/**
* 获取订单状态文本
*/
getOrderStatusText(status) {
const statusMap = {
'pending': '未分配',
'assigned': '已分配',
'in_transit': '配送中',
'delivered': '已完成',
'cancelled': '已取消'
};
return statusMap[status] || status;
}
/**
* 清理资源
*/
cleanup() {
console.log('清理货运人员模块资源');
}
}
exports.DeliveryPersonModule = DeliveryPersonModule;