|
@@ -155,7 +155,7 @@ Page({
|
|
|
type: item.type === 1 ? 'normal' : 'activity', // 1-参观,2-活动
|
|
|
date: this.formatDate(item.appointmentTime),
|
|
|
time: item.time || '',
|
|
|
- activityName: item.activityId || '',
|
|
|
+ activityName: item.activityTitle || '',
|
|
|
status: item.status,
|
|
|
visitors: item.visitors || [],
|
|
|
isExpired: isExpired
|
|
@@ -197,24 +197,39 @@ Page({
|
|
|
* 执行取消预约操作
|
|
|
*/
|
|
|
performCancelReservation(reservationId) {
|
|
|
- // 模拟API调用
|
|
|
wx.showLoading({
|
|
|
title: '取消中...'
|
|
|
});
|
|
|
|
|
|
- setTimeout(() => {
|
|
|
+ museumApi.cancelReservation(reservationId).then(res => {
|
|
|
wx.hideLoading();
|
|
|
-
|
|
|
- // 从列表中移除已取消的预约
|
|
|
- const reservations = this.data.reservations.filter(item => item.id !== reservationId);
|
|
|
- this.setData({
|
|
|
- reservations
|
|
|
- });
|
|
|
-
|
|
|
+ console.log('取消预约结果:', res);
|
|
|
+ if (res) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '取消成功',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+
|
|
|
+ // 重新获取列表数据
|
|
|
+ this.setData({
|
|
|
+ reservations: [],
|
|
|
+ pageNum: 1,
|
|
|
+ hasMore: true
|
|
|
+ });
|
|
|
+ this.loadReservations();
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.message || '取消失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ wx.hideLoading();
|
|
|
+ console.error('取消预约失败:', error);
|
|
|
wx.showToast({
|
|
|
- title: '取消成功',
|
|
|
- icon: 'success'
|
|
|
+ title: '网络错误,请重试',
|
|
|
+ icon: 'none'
|
|
|
});
|
|
|
- }, 1000);
|
|
|
+ });
|
|
|
}
|
|
|
})
|