/**
 * 预约登记规则混入
 * 用于在预约表单页面加载和显示预约规则
 */
import { AppServer } from '@/modules/api/AppServer.js'

const appServer = new AppServer()

export default {
  data() {
    return {
      bookingRules: '' // 预约登记规则
    }
  },
  methods: {
    /**
     * 加载预约登记规则
     * @param {String} serviceType - 服务类型
     */
    async loadBookingRules(serviceType) {
      try {
        const result = await appServer.GetBookingRule(serviceType)
        if (result.code === 0 && result.data && result.data.rules) {
          this.bookingRules = result.data.rules
        }
      } catch (error) {
        console.error('加载预约规则失败:', error)
      }
    }
  }
}
