117 lines
4.0 KiB
JavaScript
117 lines
4.0 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const modules_Config = require("../../modules/Config.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) => {
|
|
console.error("加载热门服务详情失败:", error);
|
|
this.loading = false;
|
|
}
|
|
});
|
|
} catch (error) {
|
|
console.error("加载热门服务详情失败:", error);
|
|
this.loading = false;
|
|
}
|
|
},
|
|
handleImageError(e) {
|
|
console.error("详情图片加载失败:", 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_vendor.o((...args) => $options.back && $options.back(...args)),
|
|
b: common_vendor.t($data.title),
|
|
c: $data.detailImage
|
|
}, $data.detailImage ? {
|
|
d: $data.detailImage,
|
|
e: common_vendor.o((...args) => $options.handleImageError && $options.handleImageError(...args))
|
|
} : {
|
|
f: common_vendor.t($data.loading ? _ctx.$t("common.loading") : "暂无详情图片")
|
|
}, {
|
|
g: common_vendor.t(_ctx.$t("reserveDetails.reserve")),
|
|
h: common_vendor.o(($event) => $options.toEntry())
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/gitCode/uniapp/appointment_system/miniprogram/src/pages/index/reserve-details-page.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|