/** * U64 公益服务记录 * * Phase 19:此前是硬编码假记录(与用户真实服务无关)。 * 现接入 GET /me/service-history —— 服务端只返回**本人**记录摘要, * 且已排除咨询正文与内部备注(INV-013 最小可见)。 */ const { serviceHistoryService } = require('../../services'); const CATEGORY_ICON = { appointment: '约', counseling: '咨' }; const STATUS_LABEL = { submitted: '待确认', pending_confirmation: '待确认', confirmed: '已确认', completed: '已完成', cancelled: '已取消', pending: '待处理', assigned: '已分配', scheduled: '已排期', in_progress: '进行中', closed: '已关闭', }; Page({ data: { loading: true, error: '', records: [], }, onShow() { this.load(); }, async load() { this.setData({ loading: true, error: '' }); try { const list = await serviceHistoryService.getMyServiceHistory(); const records = (list || []).map((item) => ({ key: item.id, icon: CATEGORY_ICON[item.category] || '记', title: item.title, date: item.occurredAt || '', station: item.stationName || '', status: STATUS_LABEL[item.status] || item.status || '', })); this.setData({ records, loading: false }); } catch (error) { this.setData({ loading: false, error: '加载失败,请稍后重试' }); } }, });