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

452 lines
18 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const modules_api_AppServer = require("../../modules/api/AppServer.js");
require("../../modules/Config.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) {
console.error("获取预约列表失败:", 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_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
c: common_vendor.t(_ctx.$t("myAppointment.title") || "我的预约单"),
d: common_vendor.t(_ctx.$t("myAppointment.all") || "全部"),
e: $data.activeTab === "all" ? 1 : "",
f: $data.activeTab === "all" ? 1 : "",
g: common_vendor.o(($event) => $options.switchTab("all")),
h: common_vendor.t(_ctx.$t("myAppointment.inProgress") || "进行中"),
i: $data.activeTab === "inProgress" ? 1 : "",
j: $data.activeTab === "inProgress" ? 1 : "",
k: common_vendor.o(($event) => $options.switchTab("inProgress")),
l: common_vendor.t(_ctx.$t("myAppointment.completed") || "已结束"),
m: $data.activeTab === "completed" ? 1 : "",
n: $data.activeTab === "completed" ? 1 : "",
o: common_vendor.o(($event) => $options.switchTab("completed")),
p: 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)
};
}),
q: common_vendor.t(_ctx.$t("myAppointment.viewDetail") || "查看详情"),
r: $data.loading
}, $data.loading ? {
s: common_vendor.t(_ctx.$t("common.loading"))
} : {}, {
t: !$data.loading && !$data.hasMore && $data.appointmentList.length > 0
}, !$data.loading && !$data.hasMore && $data.appointmentList.length > 0 ? {
v: common_vendor.t(_ctx.$t("common.noMore") || "没有更多了")
} : {}, {
w: $data.appointmentList.length === 0 && !$data.loading
}, $data.appointmentList.length === 0 && !$data.loading ? {
x: common_vendor.t(_ctx.$t("myAppointment.noAppointment") || "暂无预约记录")
} : {}, {
y: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
z: $data.showDetailPopup
}, $data.showDetailPopup ? common_vendor.e({
A: common_vendor.t(_ctx.$t("myAppointment.serviceDetail") || "服务详情"),
B: common_vendor.o((...args) => $options.closeDetail && $options.closeDetail(...args)),
C: common_vendor.t($options.getServiceTitle($data.currentDetail)),
D: common_vendor.t($data.currentDetail.realName || "-"),
E: common_vendor.t($options.formatDate($data.currentDetail.createdAt)),
F: common_vendor.t($options.getAllContactInfo($data.currentDetail)),
G: $data.currentDetail.appointmentDate
}, $data.currentDetail.appointmentDate ? {
H: common_vendor.t($data.currentDetail.appointmentDate)
} : {}, {
I: $data.currentDetail.tripType
}, $data.currentDetail.tripType ? {
J: common_vendor.t($data.currentDetail.tripType === "single" ? "单程" : "往返")
} : {}, {
K: $data.currentDetail.departureCity
}, $data.currentDetail.departureCity ? {
L: common_vendor.t($data.currentDetail.departureCity)
} : {}, {
M: $data.currentDetail.arrivalCity
}, $data.currentDetail.arrivalCity ? {
N: common_vendor.t($data.currentDetail.arrivalCity)
} : {}, {
O: $data.currentDetail.departureDate
}, $data.currentDetail.departureDate ? {
P: common_vendor.t($data.currentDetail.departureDate)
} : {}, {
Q: $data.currentDetail.returnDate
}, $data.currentDetail.returnDate ? {
R: common_vendor.t($data.currentDetail.returnDate)
} : {}, {
S: $data.currentDetail.cabinType
}, $data.currentDetail.cabinType ? {
T: common_vendor.t($options.getCabinTypeText($data.currentDetail.cabinType))
} : {}, {
U: $data.currentDetail.luggageCount
}, $data.currentDetail.luggageCount ? {
V: common_vendor.t($data.currentDetail.luggageCount)
} : {}, {
W: $data.currentDetail.countryCity
}, $data.currentDetail.countryCity ? {
X: common_vendor.t($data.currentDetail.countryCity)
} : {}, {
Y: $data.currentDetail.hotelName
}, $data.currentDetail.hotelName ? {
Z: common_vendor.t($data.currentDetail.hotelName)
} : {}, {
aa: $data.currentDetail.checkInDate
}, $data.currentDetail.checkInDate ? {
ab: common_vendor.t($data.currentDetail.checkInDate)
} : {}, {
ac: $data.currentDetail.checkOutDate
}, $data.currentDetail.checkOutDate ? {
ad: common_vendor.t($data.currentDetail.checkOutDate)
} : {}, {
ae: $data.currentDetail.roomCount
}, $data.currentDetail.roomCount ? {
af: common_vendor.t($data.currentDetail.roomCount)
} : {}, {
ag: $data.currentDetail.roomType
}, $data.currentDetail.roomType ? {
ah: common_vendor.t($data.currentDetail.roomType)
} : {}, {
ai: $data.currentDetail.needMeal !== null && $data.currentDetail.needMeal !== void 0
}, $data.currentDetail.needMeal !== null && $data.currentDetail.needMeal !== void 0 ? {
aj: common_vendor.t($data.currentDetail.needMeal ? "是" : "否")
} : {}, {
ak: $data.currentDetail.mealPlan
}, $data.currentDetail.mealPlan ? {
al: common_vendor.t($options.getMealPlanText($data.currentDetail.mealPlan))
} : {}, {
am: $data.currentDetail.adultCount
}, $data.currentDetail.adultCount ? {
an: common_vendor.t($data.currentDetail.adultCount)
} : {}, {
ao: $data.currentDetail.childCount
}, $data.currentDetail.childCount ? {
ap: common_vendor.t($data.currentDetail.childCount)
} : {}, {
aq: $data.currentDetail.infantCount
}, $data.currentDetail.infantCount ? {
ar: common_vendor.t($data.currentDetail.infantCount)
} : {}, {
as: $data.currentDetail.passengerCount
}, $data.currentDetail.passengerCount ? {
at: common_vendor.t($data.currentDetail.passengerCount)
} : {}, {
av: $data.currentDetail.airportTerminal
}, $data.currentDetail.airportTerminal ? {
aw: common_vendor.t($data.currentDetail.airportTerminal)
} : {}, {
ax: $data.currentDetail.arrivalFlightNo
}, $data.currentDetail.arrivalFlightNo ? {
ay: common_vendor.t($data.currentDetail.arrivalFlightNo)
} : {}, {
az: $data.currentDetail.departureFlightNo
}, $data.currentDetail.departureFlightNo ? {
aA: common_vendor.t($data.currentDetail.departureFlightNo)
} : {}, {
aB: $data.currentDetail.flightNo
}, $data.currentDetail.flightNo ? {
aC: common_vendor.t($data.currentDetail.flightNo)
} : {}, {
aD: $data.currentDetail.deliveryAddress
}, $data.currentDetail.deliveryAddress ? {
aE: common_vendor.t($data.currentDetail.deliveryAddress)
} : {}, {
aF: $data.currentDetail.originStation
}, $data.currentDetail.originStation ? {
aG: common_vendor.t($data.currentDetail.originStation)
} : {}, {
aH: $data.currentDetail.destinationStation
}, $data.currentDetail.destinationStation ? {
aI: common_vendor.t($data.currentDetail.destinationStation)
} : {}, {
aJ: $data.currentDetail.seatClass
}, $data.currentDetail.seatClass ? {
aK: common_vendor.t($options.getSeatClassText($data.currentDetail.seatClass))
} : {}, {
aL: $data.currentDetail.itinerary
}, $data.currentDetail.itinerary ? {
aM: common_vendor.t($data.currentDetail.itinerary)
} : {}, {
aN: $data.currentDetail.childAge
}, $data.currentDetail.childAge ? {
aO: common_vendor.t($data.currentDetail.childAge)
} : {}, {
aP: $data.currentDetail.boyCount
}, $data.currentDetail.boyCount ? {
aQ: common_vendor.t($data.currentDetail.boyCount)
} : {}, {
aR: $data.currentDetail.girlCount
}, $data.currentDetail.girlCount ? {
aS: common_vendor.t($data.currentDetail.girlCount)
} : {}, {
aT: $data.currentDetail.hospitalName
}, $data.currentDetail.hospitalName ? {
aU: common_vendor.t($data.currentDetail.hospitalName)
} : {}, {
aV: $data.currentDetail.conditionDescription
}, $data.currentDetail.conditionDescription ? {
aW: common_vendor.t($data.currentDetail.conditionDescription)
} : {}, {
aX: $data.currentDetail.specialAssistanceReason
}, $data.currentDetail.specialAssistanceReason ? {
aY: common_vendor.t($data.currentDetail.specialAssistanceReason)
} : {}, {
aZ: $data.currentDetail.origin
}, $data.currentDetail.origin ? {
ba: common_vendor.t($data.currentDetail.origin)
} : {}, {
bb: $data.currentDetail.destination
}, $data.currentDetail.destination ? {
bc: common_vendor.t($data.currentDetail.destination)
} : {}, {
bd: $data.currentDetail.petType
}, $data.currentDetail.petType ? {
be: common_vendor.t($data.currentDetail.petType)
} : {}, {
bf: $data.currentDetail.petName
}, $data.currentDetail.petName ? {
bg: common_vendor.t($data.currentDetail.petName)
} : {}, {
bh: $data.currentDetail.hasQuarantineCert !== null && $data.currentDetail.hasQuarantineCert !== void 0
}, $data.currentDetail.hasQuarantineCert !== null && $data.currentDetail.hasQuarantineCert !== void 0 ? {
bi: common_vendor.t($data.currentDetail.hasQuarantineCert ? "有" : "无")
} : {}, {
bj: $data.currentDetail.serviceDays
}, $data.currentDetail.serviceDays ? {
bk: common_vendor.t($data.currentDetail.serviceDays)
} : {}, {
bl: $data.currentDetail.originPort
}, $data.currentDetail.originPort ? {
bm: common_vendor.t($data.currentDetail.originPort)
} : {}, {
bn: $data.currentDetail.destinationPort
}, $data.currentDetail.destinationPort ? {
bo: common_vendor.t($data.currentDetail.destinationPort)
} : {}, {
bp: $data.currentDetail.itemName
}, $data.currentDetail.itemName ? {
bq: common_vendor.t($data.currentDetail.itemName)
} : {}, {
br: $data.currentDetail.itemQuantity
}, $data.currentDetail.itemQuantity ? {
bs: common_vendor.t($data.currentDetail.itemQuantity)
} : {}, {
bt: $data.currentDetail.cargoName
}, $data.currentDetail.cargoName ? {
bv: common_vendor.t($data.currentDetail.cargoName)
} : {}, {
bw: $data.currentDetail.cargoQuantity
}, $data.currentDetail.cargoQuantity ? {
bx: common_vendor.t($data.currentDetail.cargoQuantity)
} : {}, {
by: $data.currentDetail.travelDestination
}, $data.currentDetail.travelDestination ? {
bz: common_vendor.t($data.currentDetail.travelDestination)
} : {}, {
bA: $data.currentDetail.travelDate
}, $data.currentDetail.travelDate ? {
bB: common_vendor.t($data.currentDetail.travelDate)
} : {}, {
bC: $data.currentDetail.travelDays
}, $data.currentDetail.travelDays ? {
bD: common_vendor.t($data.currentDetail.travelDays)
} : {}, {
bE: $data.currentDetail.specificRequirements
}, $data.currentDetail.specificRequirements ? {
bF: common_vendor.t($data.currentDetail.specificRequirements)
} : {}, {
bG: $data.currentDetail.notes
}, $data.currentDetail.notes ? {
bH: common_vendor.t($data.currentDetail.notes)
} : {}, {
bI: common_vendor.o(() => {
}),
bJ: common_vendor.o((...args) => $options.closeDetail && $options.closeDetail(...args))
}) : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/gitCode/uniapp/appointment_system/miniprogram/src/pages/me/my-appointments-page.vue"]]);
wx.createPage(MiniProgramPage);