"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
if (!Array) {
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
_easycom_uni_popup2();
|
}
|
const _easycom_uni_popup = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.js";
|
if (!Math) {
|
_easycom_uni_popup();
|
}
|
const _sfc_main = {
|
__name: "book",
|
setup(__props) {
|
const vaccine = common_vendor.ref({
|
id: 1,
|
nameKey: "vaccine.list.covid.name",
|
descKey: "vaccine.list.covid.desc",
|
image: "/static/vaccine/covid.jpg",
|
price: 0
|
});
|
const availableDates = [
|
{ value: "2024-03-21", week: "周四", day: "21", month: "3" },
|
{ value: "2024-03-22", week: "周五", day: "22", month: "3" },
|
{ value: "2024-03-23", week: "周六", day: "23", month: "3" },
|
{ value: "2024-03-24", week: "周日", day: "24", month: "3" },
|
{ value: "2024-03-25", week: "周一", day: "25", month: "3" }
|
];
|
const availableTimes = [
|
{ value: "0900", label: "09:00", count: 10 },
|
{ value: "0930", label: "09:30", count: 8 },
|
{ value: "1000", label: "10:00", count: 5 },
|
{ value: "1030", label: "10:30", disabled: true },
|
{ value: "1100", label: "11:00", count: 3 }
|
];
|
const patients = [
|
{ id: 1, name: "张三", idCard: "1234567890", relation: "本人" },
|
{ id: 2, name: "张小明", idCard: "0987654321", relation: "子女" }
|
];
|
const notices = [
|
"请携带身份证件准时到达接种点",
|
"接种前请确保身体状况良好,无发热等症状",
|
"接种后需要留观30分钟",
|
"如有特殊情况请提前与工作人员沟通"
|
];
|
const selectedDate = common_vendor.ref("");
|
const selectedTime = common_vendor.ref("");
|
const selectedPatient = common_vendor.ref(null);
|
const selectedPatientId = common_vendor.ref(null);
|
const remark = common_vendor.ref("");
|
const patientPopup = common_vendor.ref(null);
|
const canSubmit = common_vendor.computed(() => {
|
return selectedDate.value && selectedTime.value && selectedPatient.value;
|
});
|
const selectDate = (date) => {
|
selectedDate.value = date;
|
};
|
const selectTime = (time) => {
|
if (!time.disabled) {
|
selectedTime.value = time.value;
|
}
|
};
|
const showPatientSelect = () => {
|
var _a;
|
(_a = patientPopup.value) == null ? void 0 : _a.open();
|
};
|
const closePatientPopup = () => {
|
var _a;
|
(_a = patientPopup.value) == null ? void 0 : _a.close();
|
};
|
const selectPatient = (patient) => {
|
selectedPatientId.value = patient.id;
|
};
|
const confirmPatient = () => {
|
if (selectedPatientId.value) {
|
selectedPatient.value = patients.find((p) => p.id === selectedPatientId.value);
|
closePatientPopup();
|
}
|
};
|
const addNewPatient = () => {
|
common_vendor.index.navigateTo({
|
url: "/pages/patient/add"
|
});
|
};
|
const submitBooking = () => {
|
if (!canSubmit.value)
|
return;
|
common_vendor.index.showLoading({
|
title: "提交中..."
|
});
|
setTimeout(() => {
|
common_vendor.index.hideLoading();
|
common_vendor.index.showModal({
|
title: "预约成功",
|
content: "您的疫苗预约已提交成功",
|
showCancel: false,
|
success: () => {
|
common_vendor.index.navigateBack();
|
}
|
});
|
}, 1500);
|
};
|
return (_ctx, _cache) => {
|
return common_vendor.e({
|
a: vaccine.value.image,
|
b: common_vendor.t(_ctx.$t(vaccine.value.nameKey)),
|
c: common_vendor.t(_ctx.$t(vaccine.value.descKey)),
|
d: vaccine.value.price > 0
|
}, vaccine.value.price > 0 ? {
|
e: common_vendor.t(vaccine.value.price)
|
} : {
|
f: common_vendor.t(_ctx.$t("vaccine.free"))
|
}, {
|
g: common_vendor.t(selectedPatient.value ? selectedPatient.value.name : "请选择接种人"),
|
h: common_vendor.o(showPatientSelect),
|
i: common_vendor.f(availableDates, (date, index, i0) => {
|
return {
|
a: common_vendor.t(date.week),
|
b: common_vendor.t(date.day),
|
c: common_vendor.t(date.month),
|
d: index,
|
e: selectedDate.value === date.value ? 1 : "",
|
f: common_vendor.o(($event) => selectDate(date.value), index)
|
};
|
}),
|
j: common_vendor.f(availableTimes, (time, index, i0) => {
|
return common_vendor.e({
|
a: common_vendor.t(time.label),
|
b: !time.disabled
|
}, !time.disabled ? {
|
c: common_vendor.t(time.count)
|
} : {}, {
|
d: index,
|
e: selectedTime.value === time.value ? 1 : "",
|
f: time.disabled ? 1 : "",
|
g: common_vendor.o(($event) => selectTime(time), index)
|
});
|
}),
|
k: remark.value,
|
l: common_vendor.o(($event) => remark.value = $event.detail.value),
|
m: common_vendor.t(remark.value.length),
|
n: common_vendor.f(notices, (notice, index, i0) => {
|
return {
|
a: common_vendor.t(notice),
|
b: index
|
};
|
}),
|
o: vaccine.value.price > 0
|
}, vaccine.value.price > 0 ? {
|
p: common_vendor.t(vaccine.value.price)
|
} : {
|
q: common_vendor.t(_ctx.$t("vaccine.free"))
|
}, {
|
r: !canSubmit.value,
|
s: common_vendor.o(submitBooking),
|
t: common_vendor.o(closePatientPopup),
|
v: common_vendor.f(patients, (patient, index, i0) => {
|
return {
|
a: common_vendor.t(patient.name),
|
b: common_vendor.t(patient.idCard),
|
c: common_vendor.t(patient.relation),
|
d: index,
|
e: selectedPatientId.value === patient.id ? 1 : "",
|
f: common_vendor.o(($event) => selectPatient(patient), index)
|
};
|
}),
|
w: common_vendor.o(addNewPatient),
|
x: common_vendor.o(confirmPatient),
|
y: common_vendor.sr(patientPopup, "45df7850-0", {
|
"k": "patientPopup"
|
}),
|
z: common_vendor.p({
|
type: "bottom"
|
}),
|
A: common_vendor.gei(_ctx, "")
|
});
|
};
|
}
|
};
|
wx.createPage(_sfc_main);
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/vaccine/book.js.map
|