修复体检客户类型问题

This commit is contained in:
xianyi
2025-12-10 17:30:17 +08:00
parent 0efc4c186e
commit 6d68d618b7

View File

@@ -52,11 +52,22 @@ export const ExamPage = () => {
.then((res) => { .then((res) => {
const list = res.Data || []; const list = res.Data || [];
const mapped: ExamClient[] = list.map((item) => { const mapped: ExamClient[] = list.map((item) => {
// 简单映射为现有 UI 使用的字段 // 状态映射到联合类型
const statusName = item.physical_exam_status_name || ''; const status: ExamClient['status'] =
const signStatus = item.is_register === 1 ? '已登记' : '未登记'; item.is_sign_in === 1
const customerType = item.customer_type === 1 ? '团客' : '散客'; ? '已签到'
const vipType = item.is_vip === 1 ? '高客' : '普客'; : (item.physical_exam_status_name ?? '').includes('餐')
? '用餐'
: '体检中';
const signStatus: ExamClient['signStatus'] = item.is_register === 1 ? '已登记' : '未登记';
const customerType: ExamClient['customerType'] = item.customer_type === 1 ? '团客' : '散客';
const vipType: ExamClient['vipType'] = item.is_vip === 1 ? '高客' : '普客';
// 粗略判断上午/下午
const timeSlot: ExamClient['timeSlot'] =
(item.physical_exam_time || '').includes('下午') ? '下午' : '上午';
return { return {
id: String(item.physical_exam_id ?? ''), id: String(item.physical_exam_id ?? ''),
name: item.customer_name || '未知客户', name: item.customer_name || '未知客户',
@@ -64,11 +75,11 @@ export const ExamPage = () => {
age: 0, age: 0,
level: item.member_level || (item.is_vip === 1 ? 'VIP' : '普通'), level: item.member_level || (item.is_vip === 1 ? 'VIP' : '普通'),
packageName: item.package_name || '未提供套餐', packageName: item.package_name || '未提供套餐',
status: statusName || '未开始', status,
elapsed: '', elapsed: '',
checkedItems: [], checkedItems: [],
pendingItems: [], pendingItems: [],
timeSlot: '上午', timeSlot,
vipType, vipType,
signStatus, signStatus,
customerType, customerType,