WXL
11 小时以前 05c363fdd7ab04e3bd9a753e2c5d5bfff04d681c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
"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