WXL
17 小时以前 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
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = {
  __name: "record",
  setup(__props) {
    const stats = common_vendor.ref({
      totalAmount: 1280,
      totalCount: 8,
      pendingCount: 2
    });
    const paymentTypes = [
      { label: "全部", value: "all" },
      { label: "待支付", value: "unpaid" },
      { label: "已完成", value: "completed" },
      { label: "已退款", value: "refunded" }
    ];
    const currentType = common_vendor.ref("all");
    const startDate = common_vendor.ref("");
    const endDate = common_vendor.ref("");
    const records = common_vendor.ref([
      {
        id: 1,
        hospitalName: "青岛镜湖医院",
        hospitalLogo: "/static/hospital/kiang-wu.jpg",
        paymentType: "门诊缴费",
        departmentName: "心内科",
        patientName: "张三",
        items: ["挂号费", "检查费", "药品费"],
        amount: 360,
        time: "2024-03-25 09:30",
        status: "unpaid",
        statusText: "待支付"
      },
      {
        id: 2,
        hospitalName: "青岛科大医院",
        hospitalLogo: "/static/hospital/must.jpg",
        paymentType: "住院预交金",
        departmentName: "骨科",
        patientName: "张三",
        items: ["住院预交金"],
        amount: 5e3,
        time: "2024-03-20 15:00",
        status: "completed",
        statusText: "已完成"
      }
    ]);
    const filteredRecords = common_vendor.computed(() => {
      let result = records.value;
      if (currentType.value !== "all") {
        result = result.filter((record) => record.status === currentType.value);
      }
      if (startDate.value && endDate.value) {
        result = result.filter((record) => {
          const recordDate = record.time.split(" ")[0];
          return recordDate >= startDate.value && recordDate <= endDate.value;
        });
      }
      return result;
    });
    const hasMore = common_vendor.ref(true);
    const refreshing = common_vendor.ref(false);
    const selectType = (type) => {
      currentType.value = type;
    };
    const onStartDateChange = (e) => {
      startDate.value = e.detail.value;
    };
    const onEndDateChange = (e) => {
      endDate.value = e.detail.value;
    };
    const viewDetail = (record) => {
      common_vendor.index.navigateTo({
        url: `/pages/payment/detail?id=${record.id}`
      });
    };
    const goPay = (record) => {
      common_vendor.index.navigateTo({
        url: `/pages/payment/index?id=${record.id}`
      });
    };
    const viewInvoice = (record) => {
      common_vendor.index.navigateTo({
        url: `/pages/payment/invoice?id=${record.id}`
      });
    };
    const onRefresh = () => {
      refreshing.value = true;
      loadRecords();
      setTimeout(() => {
        refreshing.value = false;
      }, 1e3);
    };
    const onLoadMore = () => {
      if (!hasMore.value)
        return;
      loadRecords();
    };
    const loadRecords = () => {
      setTimeout(() => {
        hasMore.value = false;
      }, 1e3);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.t(stats.value.totalAmount),
        b: common_vendor.t(stats.value.totalCount),
        c: common_vendor.t(stats.value.pendingCount),
        d: common_vendor.f(paymentTypes, (type, index, i0) => {
          return {
            a: common_vendor.t(type.label),
            b: index,
            c: currentType.value === type.value ? 1 : "",
            d: common_vendor.o(($event) => selectType(type.value), index)
          };
        }),
        e: common_vendor.t(startDate.value || "开始日期"),
        f: startDate.value,
        g: endDate.value,
        h: common_vendor.o(onStartDateChange),
        i: common_vendor.t(endDate.value || "结束日期"),
        j: endDate.value,
        k: startDate.value,
        l: common_vendor.o(onEndDateChange),
        m: common_vendor.f(filteredRecords.value, (record, index, i0) => {
          return common_vendor.e({
            a: record.hospitalLogo,
            b: common_vendor.t(record.hospitalName),
            c: common_vendor.t(record.paymentType),
            d: common_vendor.t(record.statusText),
            e: common_vendor.n(record.status),
            f: common_vendor.t(record.items.join("、")),
            g: common_vendor.t(record.patientName),
            h: common_vendor.t(record.departmentName),
            i: common_vendor.t(record.time),
            j: common_vendor.t(record.amount),
            k: record.status === "unpaid"
          }, record.status === "unpaid" ? {
            l: common_vendor.o(($event) => goPay(record), index)
          } : {}, {
            m: record.status === "completed"
          }, record.status === "completed" ? {
            n: common_vendor.o(($event) => viewInvoice(record), index)
          } : {}, {
            o: index,
            p: common_vendor.o(($event) => viewDetail(record), index)
          });
        }),
        n: hasMore.value
      }, hasMore.value ? {} : {}, {
        o: filteredRecords.value.length === 0
      }, filteredRecords.value.length === 0 ? {
        p: common_assets._imports_0$9
      } : {}, {
        q: refreshing.value,
        r: common_vendor.o(onRefresh),
        s: common_vendor.o(onLoadMore),
        t: common_vendor.gei(_ctx, "")
      });
    };
  }
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/payment/record.js.map