增加来访核验

This commit is contained in:
chenglijuan
2026-04-29 15:35:20 +08:00
parent 1ae4ba166a
commit f1d1c9b460
5 changed files with 98 additions and 3 deletions
+36 -2
View File
@@ -4,7 +4,8 @@ Page({
data: {
record: null,
loading: true,
error: ''
error: '',
verifying: false
},
onLoad(options) {
@@ -41,10 +42,16 @@ Page({
'cancelled': '已取消'
}
// checkStatus 为字符串:'0' 未核销,'1' 已核销
const checkStatus = String(result.checkStatus)
const checkStatusText = checkStatus === '1' ? '已核销' : '未核销'
this.setData({
record: {
...formatRecord(result),
statusText: statusMap[result.status] || result.status
statusText: statusMap[result.status] || result.status,
checkStatus: checkStatus,
checkStatusText: checkStatusText
},
loading: false
})
@@ -52,5 +59,32 @@ Page({
console.error('加载预约记录详情失败', err)
this.setData({ loading: false, error: '加载失败,请稍后重试' })
}
},
async onVerify() {
const { record, verifying } = this.data
if (verifying || !record || !record.id) return
wx.showModal({
title: '确认核销',
content: '确定要核销该预约记录吗?',
confirmColor: '#1890ff',
success: async (res) => {
if (!res.confirm) return
this.setData({ verifying: true })
try {
await appointmentDB.notifyHost(record.id)
wx.showToast({ title: '核销成功', icon: 'success' })
// 刷新详情页
this.loadRecordDetail(record.id)
} catch (err) {
console.error('核销失败', err)
wx.showToast({ title: '核销失败,请重试', icon: 'none' })
} finally {
this.setData({ verifying: false })
}
}
})
}
})