|
|
@@ -11,7 +11,9 @@ Page({
|
|
|
showSuccessModal: false,
|
|
|
isFormValid: false,
|
|
|
idTypes: [{value: 1, name: '身份证'}],
|
|
|
- existingVisitors: [] // 我的联系人列表
|
|
|
+ existingVisitors: [], // 我的联系人列表
|
|
|
+ appointmentServices: [], // 讲解服务列表
|
|
|
+ selectedServiceId: 0 // 选中的讲解服务ID,默认为0(不需要讲解服务)
|
|
|
},
|
|
|
|
|
|
onLoad(options) {
|
|
|
@@ -44,6 +46,9 @@ Page({
|
|
|
|
|
|
// 加载已有参观人数据
|
|
|
this.loadExistingVisitors();
|
|
|
+
|
|
|
+ // 加载讲解服务列表
|
|
|
+ this.loadAppointmentServices();
|
|
|
},
|
|
|
|
|
|
// 新增参观人
|
|
|
@@ -264,6 +269,45 @@ Page({
|
|
|
existingVisitors[index].selected = !existingVisitors[index].selected;
|
|
|
this.setData({
|
|
|
existingVisitors: existingVisitors
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 加载讲解服务列表
|
|
|
+ loadAppointmentServices() {
|
|
|
+ museumApi.getAppointmentServiceList()
|
|
|
+ .then(response => {
|
|
|
+ console.log('获取讲解服务列表成功:', response);
|
|
|
+ if (response && response.length > 0) {
|
|
|
+ // 确保第一个是"不需要讲解服务"
|
|
|
+ const services = response;
|
|
|
+ // 默认选中第一个服务(通常是"不需要讲解服务")
|
|
|
+ this.setData({
|
|
|
+ appointmentServices: services,
|
|
|
+ selectedServiceId: services[0].id
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('获取讲解服务列表失败:', error);
|
|
|
+ // 如果接口失败,使用默认数据
|
|
|
+ const defaultServices = [
|
|
|
+ { id: 0, name: '不需要讲解服务', price: 0 },
|
|
|
+ { id: 1, name: '展厅基本列', price: 120 },
|
|
|
+ { id: 2, name: '展厅基本列、黑油山地貌、外景文物', price: 150 },
|
|
|
+ { id: 3, name: '展厅基本列、黑油山地貌、外景文物、临展厅', price: 180 }
|
|
|
+ ];
|
|
|
+ this.setData({
|
|
|
+ appointmentServices: defaultServices,
|
|
|
+ selectedServiceId: defaultServices[0].id
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 选择讲解服务
|
|
|
+ selectAppointmentService(e) {
|
|
|
+ const serviceId = e.currentTarget.dataset.serviceId;
|
|
|
+ this.setData({
|
|
|
+ selectedServiceId: parseInt(serviceId)
|
|
|
});
|
|
|
},
|
|
|
|
|
|
@@ -326,6 +370,7 @@ Page({
|
|
|
activityId: this.data.activityId || 0,
|
|
|
appointmentSlotsId: this.data.appointmentSlotsId || 0,
|
|
|
appointmentTime: this.data.selectedDate,
|
|
|
+ appointmentServiceId: this.data.selectedServiceId, // 添加讲解服务ID
|
|
|
type: this.data.type,
|
|
|
visitors: this.data.visitors.map(visitor => ({
|
|
|
cardType: this.data.idTypes[visitor.idTypeIndex].value,
|