appointment_system/miniprogram/unpackage/dist/dev/mp-weixin/pages/me/my-appointments-page.js
2025-12-19 00:37:31 +08:00

458 lines
18 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const modules_api_AppServer = require("../../modules/api/AppServer.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = {
data() {
return {
statusBarHeight: 0,
activeTab: "all",
loading: false,
appointmentList: [],
pagination: { page: 1, limit: 10, total: 0 },
hasMore: true,
showDetailPopup: false,
currentDetail: {}
};
},
onLoad(options) {
const systemInfo = common_vendor.index.getSystemInfoSync();
this.statusBarHeight = systemInfo.statusBarHeight || 0;
if (options.tab)
this.activeTab = options.tab;
this.fetchAppointments();
},
methods: {
goBack() {
common_vendor.index.navigateBack({ delta: 1 });
},
switchTab(tab) {
if (this.activeTab === tab)
return;
this.activeTab = tab;
this.pagination.page = 1;
this.appointmentList = [];
this.hasMore = true;
this.fetchAppointments();
},
async fetchAppointments() {
var _a;
if (this.loading)
return;
this.loading = true;
try {
const appserver = new modules_api_AppServer.AppServer();
const params = { page: this.pagination.page, limit: this.pagination.limit };
if (this.activeTab === "inProgress")
params.status = "in-progress";
else if (this.activeTab === "completed")
params.status = "completed";
const res = await appserver.GetAppointments(params);
if (res.success || res.code === 0) {
const newList = res.data || [];
if (this.pagination.page === 1)
this.appointmentList = newList;
else
this.appointmentList = [...this.appointmentList, ...newList];
this.pagination.total = ((_a = res.pagination) == null ? void 0 : _a.total) || 0;
this.hasMore = newList.length >= this.pagination.limit;
}
} catch (e) {
common_vendor.index.__f__("error", "at pages/me/my-appointments-page.vue:395", "获取预约列表失败:", e);
} finally {
this.loading = false;
}
},
loadMore() {
if (!this.hasMore || this.loading)
return;
this.pagination.page++;
this.fetchAppointments();
},
showDetail(item) {
this.currentDetail = item;
this.showDetailPopup = true;
},
closeDetail() {
this.showDetailPopup = false;
},
getServiceTitle(item) {
if (!item)
return "-";
const locale = this.$i18n.locale;
if (item.service) {
if (locale === "zh")
return item.service.titleZh || item.service.titleEn || "-";
else if (locale === "pt")
return item.service.titlePt || item.service.titleEn || "-";
else
return item.service.titleEn || item.service.titleZh || "-";
}
if (item.hotService) {
if (locale === "zh")
return item.hotService.name_zh || item.hotService.name_en || "-";
else if (locale === "pt")
return item.hotService.name_pt || item.hotService.name_en || "-";
else
return item.hotService.name_en || item.hotService.name_zh || "-";
}
return this.getServiceTypeText(item.serviceType) || "-";
},
getServiceTypeText(type) {
const typeMap = {
"travel": "全球机票代理",
"flight": "全球机票代理",
"hotel": "全球酒店预定",
"vip_lounge": "全球机场贵宾室服务",
"lounge": "全球机场贵宾室服务",
"airport_transfer": "机场接/送机服务",
"unaccompanied_minor": "无成人陪伴儿童代办",
"rail_ticket": "高铁票代订",
"train": "高铁票代订",
"medical_consultation": "远程医疗问诊代理服务",
"telemedicine": "远程医疗问诊代理服务",
"special_needs": "特殊旅客定制服务代办",
"special_passenger": "特殊旅客定制服务代办",
"pet_transportation": "宠物托运代理",
"pet_transport": "宠物托运代理",
"guide_translation": "西班牙语专业导游/翻译服务",
"visa_consultation": "签证咨询",
"visa": "签证咨询",
"exhibition_service": "墨西哥展会咨询与协办服务",
"exhibition": "墨西哥展会咨询与协办服务",
"air_logistics": "跨境航空物流/快递一站式服务",
"sea_freight": "海运/清关一站式服务",
"travel_planning": "旅游线路规划/咨询",
"insurance_consultation": "跨境出行意外保险/国际财产保险咨询",
"insurance": "跨境出行意外保险/国际财产保险咨询"
};
return typeMap[type] || type;
},
getContactInfo(item) {
if (!item)
return "-";
return item.phone || item.wechatId || item.whatsapp || item.contactValue || "-";
},
getAllContactInfo(item) {
if (!item)
return "-";
const contacts = [];
if (item.phone)
contacts.push((item.phoneCountryCode || "") + " " + item.phone);
if (item.wechatId)
contacts.push("微信: " + item.wechatId);
if (item.whatsapp)
contacts.push("WhatsApp: " + item.whatsapp);
return contacts.length > 0 ? contacts.join("\n") : "-";
},
formatDate(dateStr) {
if (!dateStr)
return "-";
const date = new Date(dateStr);
return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
},
getStatusText(status) {
const statusMap = {
"pending": this.$t("myAppointment.statusPending") || "待处理",
"confirmed": this.$t("myAppointment.statusConfirmed") || "已确认",
"in-progress": this.$t("myAppointment.statusInProgress") || "进行中",
"completed": this.$t("myAppointment.statusCompleted") || "已结束",
"cancelled": this.$t("myAppointment.statusCancelled") || "已取消"
};
return statusMap[status] || status;
},
getStatusClass(status) {
return {
"status-in-progress": status === "in-progress" || status === "pending" || status === "confirmed",
"status-completed": status === "completed",
"status-cancelled": status === "cancelled"
};
},
getCabinTypeText(type) {
const map = { "economy": "经济舱", "premium_economy": "超级经济舱", "business": "商务舱" };
return map[type] || type;
},
getMealPlanText(plan) {
const map = { "breakfast": "早餐", "three_meals": "三餐", "all_inclusive": "全包" };
return map[plan] || plan;
},
getSeatClassText(seatClass) {
const map = { "first": "一等座", "second": "二等座", "third": "三等座" };
return map[seatClass] || seatClass;
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.statusBarHeight + "px",
b: common_assets._imports_0,
c: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
d: common_vendor.t(_ctx.$t("myAppointment.title") || "我的预约单"),
e: common_vendor.t(_ctx.$t("myAppointment.all") || "全部"),
f: $data.activeTab === "all" ? 1 : "",
g: $data.activeTab === "all" ? 1 : "",
h: common_vendor.o(($event) => $options.switchTab("all")),
i: common_vendor.t(_ctx.$t("myAppointment.inProgress") || "进行中"),
j: $data.activeTab === "inProgress" ? 1 : "",
k: $data.activeTab === "inProgress" ? 1 : "",
l: common_vendor.o(($event) => $options.switchTab("inProgress")),
m: common_vendor.t(_ctx.$t("myAppointment.completed") || "已结束"),
n: $data.activeTab === "completed" ? 1 : "",
o: $data.activeTab === "completed" ? 1 : "",
p: common_vendor.o(($event) => $options.switchTab("completed")),
q: common_vendor.f($data.appointmentList, (item, k0, i0) => {
return {
a: common_vendor.t($options.getServiceTitle(item)),
b: common_vendor.t($options.formatDate(item.createdAt)),
c: common_vendor.t(item.realName || "-"),
d: common_vendor.t($options.getContactInfo(item)),
e: common_vendor.o(($event) => $options.showDetail(item), item.id),
f: common_vendor.t($options.getStatusText(item.status)),
g: common_vendor.n($options.getStatusClass(item.status)),
h: item.id,
i: common_vendor.o(($event) => $options.showDetail(item), item.id)
};
}),
r: common_assets._imports_1$4,
s: common_assets._imports_2$3,
t: common_assets._imports_3$1,
v: common_vendor.t(_ctx.$t("myAppointment.viewDetail") || "查看详情"),
w: $data.loading
}, $data.loading ? {
x: common_vendor.t(_ctx.$t("common.loading"))
} : {}, {
y: !$data.loading && !$data.hasMore && $data.appointmentList.length > 0
}, !$data.loading && !$data.hasMore && $data.appointmentList.length > 0 ? {
z: common_vendor.t(_ctx.$t("common.noMore") || "没有更多了")
} : {}, {
A: $data.appointmentList.length === 0 && !$data.loading
}, $data.appointmentList.length === 0 && !$data.loading ? {
B: common_vendor.t(_ctx.$t("myAppointment.noAppointment") || "暂无预约记录")
} : {}, {
C: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
D: $data.showDetailPopup
}, $data.showDetailPopup ? common_vendor.e({
E: common_vendor.t(_ctx.$t("myAppointment.serviceDetail") || "服务详情"),
F: common_assets._imports_4,
G: common_vendor.o((...args) => $options.closeDetail && $options.closeDetail(...args)),
H: common_vendor.t($options.getServiceTitle($data.currentDetail)),
I: common_vendor.t($data.currentDetail.realName || "-"),
J: common_vendor.t($options.formatDate($data.currentDetail.createdAt)),
K: common_vendor.t($options.getAllContactInfo($data.currentDetail)),
L: $data.currentDetail.appointmentDate
}, $data.currentDetail.appointmentDate ? {
M: common_vendor.t($data.currentDetail.appointmentDate)
} : {}, {
N: $data.currentDetail.tripType
}, $data.currentDetail.tripType ? {
O: common_vendor.t($data.currentDetail.tripType === "single" ? "单程" : "往返")
} : {}, {
P: $data.currentDetail.departureCity
}, $data.currentDetail.departureCity ? {
Q: common_vendor.t($data.currentDetail.departureCity)
} : {}, {
R: $data.currentDetail.arrivalCity
}, $data.currentDetail.arrivalCity ? {
S: common_vendor.t($data.currentDetail.arrivalCity)
} : {}, {
T: $data.currentDetail.departureDate
}, $data.currentDetail.departureDate ? {
U: common_vendor.t($data.currentDetail.departureDate)
} : {}, {
V: $data.currentDetail.returnDate
}, $data.currentDetail.returnDate ? {
W: common_vendor.t($data.currentDetail.returnDate)
} : {}, {
X: $data.currentDetail.cabinType
}, $data.currentDetail.cabinType ? {
Y: common_vendor.t($options.getCabinTypeText($data.currentDetail.cabinType))
} : {}, {
Z: $data.currentDetail.luggageCount
}, $data.currentDetail.luggageCount ? {
aa: common_vendor.t($data.currentDetail.luggageCount)
} : {}, {
ab: $data.currentDetail.countryCity
}, $data.currentDetail.countryCity ? {
ac: common_vendor.t($data.currentDetail.countryCity)
} : {}, {
ad: $data.currentDetail.hotelName
}, $data.currentDetail.hotelName ? {
ae: common_vendor.t($data.currentDetail.hotelName)
} : {}, {
af: $data.currentDetail.checkInDate
}, $data.currentDetail.checkInDate ? {
ag: common_vendor.t($data.currentDetail.checkInDate)
} : {}, {
ah: $data.currentDetail.checkOutDate
}, $data.currentDetail.checkOutDate ? {
ai: common_vendor.t($data.currentDetail.checkOutDate)
} : {}, {
aj: $data.currentDetail.roomCount
}, $data.currentDetail.roomCount ? {
ak: common_vendor.t($data.currentDetail.roomCount)
} : {}, {
al: $data.currentDetail.roomType
}, $data.currentDetail.roomType ? {
am: common_vendor.t($data.currentDetail.roomType)
} : {}, {
an: $data.currentDetail.needMeal !== null && $data.currentDetail.needMeal !== void 0
}, $data.currentDetail.needMeal !== null && $data.currentDetail.needMeal !== void 0 ? {
ao: common_vendor.t($data.currentDetail.needMeal ? "是" : "否")
} : {}, {
ap: $data.currentDetail.mealPlan
}, $data.currentDetail.mealPlan ? {
aq: common_vendor.t($options.getMealPlanText($data.currentDetail.mealPlan))
} : {}, {
ar: $data.currentDetail.adultCount
}, $data.currentDetail.adultCount ? {
as: common_vendor.t($data.currentDetail.adultCount)
} : {}, {
at: $data.currentDetail.childCount
}, $data.currentDetail.childCount ? {
av: common_vendor.t($data.currentDetail.childCount)
} : {}, {
aw: $data.currentDetail.infantCount
}, $data.currentDetail.infantCount ? {
ax: common_vendor.t($data.currentDetail.infantCount)
} : {}, {
ay: $data.currentDetail.passengerCount
}, $data.currentDetail.passengerCount ? {
az: common_vendor.t($data.currentDetail.passengerCount)
} : {}, {
aA: $data.currentDetail.airportTerminal
}, $data.currentDetail.airportTerminal ? {
aB: common_vendor.t($data.currentDetail.airportTerminal)
} : {}, {
aC: $data.currentDetail.arrivalFlightNo
}, $data.currentDetail.arrivalFlightNo ? {
aD: common_vendor.t($data.currentDetail.arrivalFlightNo)
} : {}, {
aE: $data.currentDetail.departureFlightNo
}, $data.currentDetail.departureFlightNo ? {
aF: common_vendor.t($data.currentDetail.departureFlightNo)
} : {}, {
aG: $data.currentDetail.flightNo
}, $data.currentDetail.flightNo ? {
aH: common_vendor.t($data.currentDetail.flightNo)
} : {}, {
aI: $data.currentDetail.deliveryAddress
}, $data.currentDetail.deliveryAddress ? {
aJ: common_vendor.t($data.currentDetail.deliveryAddress)
} : {}, {
aK: $data.currentDetail.originStation
}, $data.currentDetail.originStation ? {
aL: common_vendor.t($data.currentDetail.originStation)
} : {}, {
aM: $data.currentDetail.destinationStation
}, $data.currentDetail.destinationStation ? {
aN: common_vendor.t($data.currentDetail.destinationStation)
} : {}, {
aO: $data.currentDetail.seatClass
}, $data.currentDetail.seatClass ? {
aP: common_vendor.t($options.getSeatClassText($data.currentDetail.seatClass))
} : {}, {
aQ: $data.currentDetail.itinerary
}, $data.currentDetail.itinerary ? {
aR: common_vendor.t($data.currentDetail.itinerary)
} : {}, {
aS: $data.currentDetail.childAge
}, $data.currentDetail.childAge ? {
aT: common_vendor.t($data.currentDetail.childAge)
} : {}, {
aU: $data.currentDetail.boyCount
}, $data.currentDetail.boyCount ? {
aV: common_vendor.t($data.currentDetail.boyCount)
} : {}, {
aW: $data.currentDetail.girlCount
}, $data.currentDetail.girlCount ? {
aX: common_vendor.t($data.currentDetail.girlCount)
} : {}, {
aY: $data.currentDetail.hospitalName
}, $data.currentDetail.hospitalName ? {
aZ: common_vendor.t($data.currentDetail.hospitalName)
} : {}, {
ba: $data.currentDetail.conditionDescription
}, $data.currentDetail.conditionDescription ? {
bb: common_vendor.t($data.currentDetail.conditionDescription)
} : {}, {
bc: $data.currentDetail.specialAssistanceReason
}, $data.currentDetail.specialAssistanceReason ? {
bd: common_vendor.t($data.currentDetail.specialAssistanceReason)
} : {}, {
be: $data.currentDetail.origin
}, $data.currentDetail.origin ? {
bf: common_vendor.t($data.currentDetail.origin)
} : {}, {
bg: $data.currentDetail.destination
}, $data.currentDetail.destination ? {
bh: common_vendor.t($data.currentDetail.destination)
} : {}, {
bi: $data.currentDetail.petType
}, $data.currentDetail.petType ? {
bj: common_vendor.t($data.currentDetail.petType)
} : {}, {
bk: $data.currentDetail.petName
}, $data.currentDetail.petName ? {
bl: common_vendor.t($data.currentDetail.petName)
} : {}, {
bm: $data.currentDetail.hasQuarantineCert !== null && $data.currentDetail.hasQuarantineCert !== void 0
}, $data.currentDetail.hasQuarantineCert !== null && $data.currentDetail.hasQuarantineCert !== void 0 ? {
bn: common_vendor.t($data.currentDetail.hasQuarantineCert ? "有" : "无")
} : {}, {
bo: $data.currentDetail.serviceDays
}, $data.currentDetail.serviceDays ? {
bp: common_vendor.t($data.currentDetail.serviceDays)
} : {}, {
bq: $data.currentDetail.originPort
}, $data.currentDetail.originPort ? {
br: common_vendor.t($data.currentDetail.originPort)
} : {}, {
bs: $data.currentDetail.destinationPort
}, $data.currentDetail.destinationPort ? {
bt: common_vendor.t($data.currentDetail.destinationPort)
} : {}, {
bv: $data.currentDetail.itemName
}, $data.currentDetail.itemName ? {
bw: common_vendor.t($data.currentDetail.itemName)
} : {}, {
bx: $data.currentDetail.itemQuantity
}, $data.currentDetail.itemQuantity ? {
by: common_vendor.t($data.currentDetail.itemQuantity)
} : {}, {
bz: $data.currentDetail.cargoName
}, $data.currentDetail.cargoName ? {
bA: common_vendor.t($data.currentDetail.cargoName)
} : {}, {
bB: $data.currentDetail.cargoQuantity
}, $data.currentDetail.cargoQuantity ? {
bC: common_vendor.t($data.currentDetail.cargoQuantity)
} : {}, {
bD: $data.currentDetail.travelDestination
}, $data.currentDetail.travelDestination ? {
bE: common_vendor.t($data.currentDetail.travelDestination)
} : {}, {
bF: $data.currentDetail.travelDate
}, $data.currentDetail.travelDate ? {
bG: common_vendor.t($data.currentDetail.travelDate)
} : {}, {
bH: $data.currentDetail.travelDays
}, $data.currentDetail.travelDays ? {
bI: common_vendor.t($data.currentDetail.travelDays)
} : {}, {
bJ: $data.currentDetail.specificRequirements
}, $data.currentDetail.specificRequirements ? {
bK: common_vendor.t($data.currentDetail.specificRequirements)
} : {}, {
bL: $data.currentDetail.notes
}, $data.currentDetail.notes ? {
bM: common_vendor.t($data.currentDetail.notes)
} : {}, {
bN: common_vendor.o(() => {
}),
bO: common_vendor.o((...args) => $options.closeDetail && $options.closeDetail(...args))
}) : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/me/my-appointments-page.js.map