"use strict";
const common_vendor = require("../../common/vendor.js");
const modules_Config = require("../../modules/Config.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = {
  data() {
    return {
      id: "",
      title: "",
      detailImage: "",
      serviceType: "",
      loading: true
    };
  },
  onLoad(options) {
    this.id = options.id || "";
    this.title = decodeURIComponent(options.title || "");
    this.serviceType = decodeURIComponent(options.serviceType || "");
    if (this.id) {
      this.loadHotServiceDetail();
    } else {
      this.loading = false;
    }
  },
  methods: {
    /**
     * 加载热门服务详情
     */
    async loadHotServiceDetail() {
      var _a;
      try {
        common_vendor.index.request({
          url: modules_Config.Config.API_BASE_URL + "/api/v1/home/hot-services",
          method: "GET",
          header: {
            "Accept-Language": ((_a = this.$i18n) == null ? void 0 : _a.locale) || "zh"
          },
          success: (res) => {
            if (res.statusCode === 200 && res.data.code === 0) {
              const service = res.data.data.find((item) => item.id == this.id);
              if (service && service.detail_image) {
                this.detailImage = modules_Config.Config.getImageUrl(service.detail_image);
              }
            }
            this.loading = false;
          },
          fail: (error) => {
            common_vendor.index.__f__("error", "at pages/index/reserve-details-page.vue:74", "加载热门服务详情失败:", error);
            this.loading = false;
          }
        });
      } catch (error) {
        common_vendor.index.__f__("error", "at pages/index/reserve-details-page.vue:79", "加载热门服务详情失败:", error);
        this.loading = false;
      }
    },
    handleImageError(e) {
      common_vendor.index.__f__("error", "at pages/index/reserve-details-page.vue:85", "详情图片加载失败:", e);
      this.detailImage = "";
    },
    back() {
      common_vendor.index.navigateBack({
        delta: 1,
        animationType: "slide-out-right",
        animationDuration: 300
      });
    },
    toEntry() {
      const servicePageMap = {
        "flight": "airfare-info-entry-page",
        "hotel": "hotel-reservation-page",
        "lounge": "vip-lounge-page",
        "airport_transfer": "airport-transfer-page",
        "unaccompanied_minor": "unaccompanied-minor-page",
        "rail_ticket": "rail-ticket-page",
        "medical_consultation": "medical-consultation-page",
        "special_passenger": "special-needs-page",
        "pet_transportation": "pet-transportation-page",
        "guide_translation": "guide-translation-page",
        "visa_consultation": "visa-consultation-page",
        "exhibition_service": "exhibition-service-page",
        "air_logistics": "air-logistics-page",
        "sea_freight": "sea-freight-page",
        "travel_planning": "travel-planning-page",
        "insurance_consultation": "insurance-consultation-page"
      };
      const pageName = servicePageMap[this.serviceType];
      if (pageName) {
        common_vendor.index.navigateTo({
          url: "/pages/appointment/" + pageName + "?id=" + this.id + "&title=" + encodeURIComponent(this.title)
        });
      } else {
        common_vendor.index.showToast({
          title: "该服务暂未开放预约",
          icon: "none"
        });
      }
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: common_assets._imports_0,
    b: common_vendor.o((...args) => $options.back && $options.back(...args)),
    c: common_vendor.t($data.title),
    d: $data.detailImage
  }, $data.detailImage ? {
    e: $data.detailImage,
    f: common_vendor.o((...args) => $options.handleImageError && $options.handleImageError(...args))
  } : {
    g: common_vendor.t($data.loading ? _ctx.$t("common.loading") : "暂无详情图片")
  }, {
    h: common_vendor.t(_ctx.$t("reserveDetails.reserve")),
    i: common_vendor.o(($event) => $options.toEntry())
  });
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/reserve-details-page.js.map
