15 lines
668 B
JavaScript
15 lines
668 B
JavaScript
const STATUS_LABELS = { received: '待确认', contacting: '沟通中', confirmed: '已确认', completed: '已完成', cancelled: '已取消' };
|
|
const FULFILLMENT_LABELS = { pickup: '线上沟通', delivery: '线下沟通' };
|
|
|
|
function bookingViewModel(item) {
|
|
return {
|
|
...item,
|
|
statusLabel: STATUS_LABELS[item.status] || '未知状态',
|
|
fulfillmentLabel: FULFILLMENT_LABELS[item.fulfillmentType] || '待确认',
|
|
serviceName: item.service?.name || item.items?.[0]?.serviceNameSnapshot || '未命名服务',
|
|
quantityLabel: `${item.items?.[0]?.quantity || 1} 份`,
|
|
};
|
|
}
|
|
|
|
module.exports = { STATUS_LABELS, FULFILLMENT_LABELS, bookingViewModel };
|