const ROLE_OPTIONS = [ { value: 'admin', label: '管理员', hint: '管理员/超级管理员账号' }, { value: 'operator', label: '运营', hint: '运营角色或订单管理权限账号' }, { value: 'purchaser', label: '采购员', hint: '使用采购员账号登录' }, { value: 'supplier', label: '供应商', hint: '使用供应商管理中创建的账号' }, { value: 'warehouse', label: '仓管员', hint: '到货验收、加工与验收' }, { value: 'picker', label: '分拣员', hint: '分拣复核、提交出库' }, { value: 'order_entry', label: '录单员', hint: '使用录单权限账号登录' }, { value: 'delivery', label: '配送员', hint: '配送任务、验货上车' }, ]; const ROLE_LABELS = { admin: '管理员', operator: '运营', purchaser: '采购员', supplier: '供应商', warehouse: '仓管员', inspector: '检验人员', picker: '分拣员', order_entry: '录单员', delivery: '配送员', }; const SESSION_KEY = 'canteen.mp.session'; /** 录单常用加工方式(与 Web processingMethods 对齐) */ const PROCESSING_METHOD_OPTIONS = [ '原材料', '净菜', '切配', '熟食', '砍', '去皮', '切片', '切块', '切丝', '切段', '切丁', '清洗', '洗净', '打包', '分装', '剁碎', '去根', '去叶', ]; const ORDER_STATUS_LABELS = { 20: '待分配', 30: '待备货', 40: '待验收', 41: '拒收待处理', 45: '待分拣', 50: '待配送', 60: '配送中', 90: '已完成', }; const ORDER_ADVANCE_LABELS = { 20: '确认分配', 30: '确认备货', 40: '确认验收', 45: '分拣出库', 50: '开始配送', 60: '完成配送', }; const DELIVERY_TIME_SLOT_LABELS = { morning: '上午', afternoon: '下午', evening: '晚上', noon: '中午', all: '全天', custom: '自定义', }; function deliveryTimeSlotLabel(value) { const key = String(value || '').trim().toLowerCase(); if (!key) return ''; return DELIVERY_TIME_SLOT_LABELS[key] || value; } function displayCustomerDeliveryDeadline(raw) { const trimmed = String(raw || '').trim(); if (!trimmed) return ''; const m = trimmed.match(/^(\d{1,2})[::](\d{2})(?::\d{2})?$/); if (!m) return trimmed; const hour = Number(m[1]); const minute = Number(m[2]); if (!Number.isInteger(hour) || !Number.isInteger(minute)) return trimmed; if (hour < 0 || hour > 23 || minute < 0 || minute > 59) return trimmed; return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`; } module.exports = { ROLE_OPTIONS, ROLE_LABELS, SESSION_KEY, PROCESSING_METHOD_OPTIONS, ORDER_STATUS_LABELS, ORDER_ADVANCE_LABELS, DELIVERY_TIME_SLOT_LABELS, deliveryTimeSlotLabel, displayCustomerDeliveryDeadline, };