WXL
21 小时以前 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
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
  __name: "detail",
  setup(__props) {
    const detail = common_vendor.ref({
      id: 1,
      hospitalName: "青岛镜湖医院",
      hospitalLogo: "/static/hospital/kiang-wu.jpg",
      hospitalAddress: "青岛连胜马路33号",
      departmentName: "心内科",
      departmentIcon: "/static/department/cardiology.png",
      doctorName: "张医生",
      doctorTitle: "主任医师",
      patientName: "张三",
      cardNo: "1234567890",
      status: "unpaid",
      // unpaid-待支付 completed-已完成 refunded-已退款
      statusText: "待支付",
      payTime: "2024-03-25 09:30:00",
      orderNo: "P202403250001",
      paymentMethod: "微信支付",
      items: [
        {
          name: "挂号费",
          desc: "普通门诊",
          amount: 60
        },
        {
          name: "检查费",
          desc: "心电图检查",
          amount: 180
        },
        {
          name: "药品费",
          desc: "处方药品",
          amount: 120
        }
      ],
      totalAmount: 360,
      hasInvoice: true
    });
    const canRefund = common_vendor.computed(() => {
      if (detail.value.status !== "completed")
        return false;
      const payTime = new Date(detail.value.payTime).getTime();
      const now = Date.now();
      return now - payTime <= 24 * 60 * 60 * 1e3;
    });
    const getStatusDesc = (status) => {
      const desc = {
        unpaid: "请在15分钟内完成支付",
        completed: "支付成功",
        refunded: "退款已完成"
      };
      return desc[status] || "";
    };
    const getStatusImage = (status) => {
      return `/static/payment/status-${status}.png`;
    };
    const navigateToHospital = () => {
      common_vendor.index.navigateTo({
        url: `/pages/hospital/detail?id=${detail.value.hospitalId}`
      });
    };
    const goPay = () => {
      common_vendor.index.navigateTo({
        url: `/pages/payment/index?id=${detail.value.id}`
      });
    };
    const applyRefund = () => {
      common_vendor.index.showModal({
        title: "申请退款",
        content: "确定要申请退款吗?",
        success: (res) => {
          if (res.confirm) {
            common_vendor.index.__f__("log", "at pages/payment/detail.vue:194", "申请退款:", detail.value.id);
          }
        }
      });
    };
    const viewInvoice = () => {
      common_vendor.index.navigateTo({
        url: `/pages/payment/invoice?id=${detail.value.id}`
      });
    };
    common_vendor.onMounted(() => {
      var _a, _b;
      const pages = getCurrentPages();
      const page = pages[pages.length - 1];
      const id = (_b = (_a = page.$page) == null ? void 0 : _a.options) == null ? void 0 : _b.id;
      loadPaymentDetail(id);
    });
    const loadPaymentDetail = (id) => {
      common_vendor.index.__f__("log", "at pages/payment/detail.vue:219", "加载缴费详情:", id);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.t(detail.value.statusText),
        b: common_vendor.t(getStatusDesc(detail.value.status)),
        c: getStatusImage(detail.value.status),
        d: common_vendor.n(detail.value.status),
        e: detail.value.hospitalLogo,
        f: common_vendor.t(detail.value.hospitalName),
        g: common_vendor.t(detail.value.hospitalAddress),
        h: common_vendor.o(navigateToHospital),
        i: detail.value.departmentIcon,
        j: common_vendor.t(detail.value.departmentName),
        k: common_vendor.t(detail.value.doctorName),
        l: common_vendor.t(detail.value.doctorTitle),
        m: common_vendor.f(detail.value.items, (item, index, i0) => {
          return {
            a: common_vendor.t(item.name),
            b: common_vendor.t(item.desc),
            c: common_vendor.t(item.amount),
            d: index
          };
        }),
        n: common_vendor.t(detail.value.totalAmount),
        o: common_vendor.t(detail.value.patientName),
        p: common_vendor.t(detail.value.cardNo),
        q: common_vendor.t(detail.value.payTime),
        r: common_vendor.t(detail.value.orderNo),
        s: common_vendor.t(detail.value.paymentMethod),
        t: detail.value.status === "unpaid"
      }, detail.value.status === "unpaid" ? {
        v: common_vendor.t(detail.value.totalAmount),
        w: common_vendor.o(goPay)
      } : detail.value.status === "completed" ? common_vendor.e({
        y: canRefund.value
      }, canRefund.value ? {
        z: common_vendor.o(applyRefund)
      } : {}, {
        A: detail.value.hasInvoice
      }, detail.value.hasInvoice ? {
        B: common_vendor.o(viewInvoice)
      } : {}) : {}, {
        x: detail.value.status === "completed",
        C: common_vendor.gei(_ctx, "")
      });
    };
  }
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/payment/detail.js.map