"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
const _sfc_main = {
|
__name: "schedule",
|
setup(__props) {
|
const doctor = common_vendor.ref({
|
name: "张医生",
|
title: "主任医师",
|
avatar: "/static/doctor/doctor1.jpg",
|
specialty: "擅长:冠心病、心律失常、高血压等心血管疾病的诊治",
|
department: "心内科",
|
fee: 100
|
});
|
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 selectedDate = common_vendor.ref("");
|
const selectedTime = common_vendor.ref("");
|
const selectedPatient = 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 selectPatient = (patientId) => {
|
selectedPatient.value = patientId;
|
};
|
const addNewPatient = () => {
|
common_vendor.index.navigateTo({
|
url: "/pages/patient/add"
|
});
|
};
|
const submitAppointment = () => {
|
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.navigateTo({
|
url: `/pages/payment/index?orderId=123456`
|
});
|
}
|
});
|
}, 1500);
|
};
|
return (_ctx, _cache) => {
|
return {
|
a: doctor.value.avatar,
|
b: common_vendor.t(doctor.value.name),
|
c: common_vendor.t(doctor.value.title),
|
d: common_vendor.t(doctor.value.specialty),
|
e: common_vendor.t(doctor.value.department),
|
f: 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)
|
};
|
}),
|
g: 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)
|
});
|
}),
|
h: 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: selectedPatient.value === patient.id ? 1 : "",
|
f: common_vendor.o(($event) => selectPatient(patient.id), index)
|
};
|
}),
|
i: common_vendor.o(addNewPatient),
|
j: common_vendor.t(doctor.value.fee),
|
k: !canSubmit.value,
|
l: common_vendor.o(submitAppointment),
|
m: common_vendor.gei(_ctx, "")
|
};
|
};
|
}
|
};
|
wx.createPage(_sfc_main);
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/appointment/schedule.js.map
|