WXL
18 小时以前 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
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
  __name: "record",
  setup(__props) {
    const tabs = [
      { label: "全部", value: "all" },
      { label: "待支付", value: "unpaid" },
      { label: "待就诊", value: "paid" },
      { label: "已完成", value: "completed" },
      { label: "已取消", value: "cancelled" }
    ];
    const currentTab = common_vendor.ref("all");
    const records = common_vendor.ref([
      {
        id: 1,
        hospital: "青岛镜湖医院",
        department: "心内科",
        doctorName: "张医生",
        doctorTitle: "主任医师",
        doctorAvatar: "/static/doctor/doctor1.png",
        date: "2024-03-21",
        time: "09:00",
        patientName: "张三",
        patientRelation: "本人",
        fee: 100,
        status: "unpaid",
        statusText: "待支付"
      },
      {
        id: 2,
        hospital: "青岛科大医院",
        department: "儿科",
        doctorName: "李医生",
        doctorTitle: "副主任医师",
        doctorAvatar: "/static/doctor/doctor2.png",
        date: "2024-03-20",
        time: "10:30",
        patientName: "张小明",
        patientRelation: "子女",
        fee: 80,
        status: "paid",
        statusText: "待就诊"
      }
    ]);
    const filteredRecords = common_vendor.computed(() => {
      if (currentTab.value === "all") {
        return records.value;
      }
      return records.value.filter((record) => record.status === currentTab.value);
    });
    const switchTab = (tab) => {
      currentTab.value = tab;
    };
    const goPay = (record) => {
      common_vendor.index.navigateTo({
        url: `/pages/payment/index?orderId=${record.id}`
      });
    };
    const cancelAppointment = (record) => {
      common_vendor.index.showModal({
        title: "取消预约",
        content: "确定要取消该预约吗?",
        success: (res) => {
          if (res.confirm) {
            common_vendor.index.showToast({
              title: "取消成功",
              icon: "success"
            });
          }
        }
      });
    };
    const viewReport = (record) => {
      common_vendor.index.navigateTo({
        url: `/pages/report/detail?id=${record.id}`
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(tabs, (tab, index, i0) => {
          return {
            a: common_vendor.t(tab.label),
            b: index,
            c: currentTab.value === tab.value ? 1 : "",
            d: common_vendor.o(($event) => switchTab(tab.value), index)
          };
        }),
        b: common_vendor.f(filteredRecords.value, (record, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(record.hospital),
            b: common_vendor.t(record.statusText),
            c: common_vendor.n(record.status),
            d: common_vendor.t(record.department),
            e: common_vendor.t(record.doctorName),
            f: common_vendor.t(record.doctorTitle),
            g: common_vendor.t(record.date),
            h: common_vendor.t(record.time),
            i: record.doctorAvatar,
            j: common_vendor.t(record.patientName),
            k: common_vendor.t(record.patientRelation),
            l: common_vendor.t(record.fee),
            m: record.status === "unpaid"
          }, record.status === "unpaid" ? {
            n: common_vendor.o(($event) => goPay(record), index)
          } : {}, {
            o: record.status === "paid"
          }, record.status === "paid" ? {
            p: common_vendor.o(($event) => cancelAppointment(), index)
          } : {}, {
            q: record.status === "completed"
          }, record.status === "completed" ? {
            r: common_vendor.o(($event) => viewReport(record), index)
          } : {}, {
            s: index
          });
        }),
        c: common_vendor.gei(_ctx, "")
      };
    };
  }
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/appointment/record.js.map