WXL
15 小时以前 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
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
  __name: "refund",
  setup(__props) {
    const order = common_vendor.ref({
      id: 1,
      hospitalName: "青岛镜湖医院",
      hospitalLogo: "/static/hospital/kiang-wu.jpg",
      departmentName: "心内科",
      amount: 360
    });
    const refundAmount = common_vendor.ref("");
    const refundReasons = [
      { value: 1, label: "预约时间冲突" },
      { value: 2, label: "重复预约" },
      { value: 3, label: "身体原因无法就医" },
      { value: 4, label: "其他原因" }
    ];
    const selectedReason = common_vendor.ref(null);
    const refundDesc = common_vendor.ref("");
    const uploadImages = common_vendor.ref([]);
    const canSubmit = common_vendor.computed(() => {
      const amount = Number(refundAmount.value);
      return amount > 0 && amount <= order.value.amount && selectedReason.value;
    });
    const onReasonChange = (e) => {
      selectedReason.value = refundReasons[e.detail.value];
    };
    const chooseImage = () => {
      common_vendor.index.chooseImage({
        count: 3 - uploadImages.value.length,
        sizeType: ["compressed"],
        sourceType: ["album", "camera"],
        success: (res) => {
          uploadImages.value.push(...res.tempFilePaths);
        }
      });
    };
    const previewImage = (index) => {
      common_vendor.index.previewImage({
        urls: uploadImages.value,
        current: index
      });
    };
    const deleteImage = (index) => {
      uploadImages.value.splice(index, 1);
    };
    const submitRefund = () => {
      if (!canSubmit.value)
        return;
      common_vendor.index.showModal({
        title: "确认提交",
        content: "确定要提交退款申请吗?",
        success: (res) => {
          if (res.confirm) {
            common_vendor.index.showLoading({
              title: "提交中..."
            });
            setTimeout(() => {
              common_vendor.index.hideLoading();
              common_vendor.index.showToast({
                title: "提交成功",
                icon: "success"
              });
              setTimeout(() => {
                common_vendor.index.navigateBack();
              }, 1500);
            }, 1e3);
          }
        }
      });
    };
    return (_ctx, _cache) => {
      var _a;
      return common_vendor.e({
        a: order.value.hospitalLogo,
        b: common_vendor.t(order.value.hospitalName),
        c: common_vendor.t(order.value.departmentName),
        d: common_vendor.t(order.value.amount),
        e: refundAmount.value,
        f: common_vendor.o(($event) => refundAmount.value = $event.detail.value),
        g: common_vendor.t(order.value.amount),
        h: common_vendor.t(((_a = selectedReason.value) == null ? void 0 : _a.label) || "请选择退款原因"),
        i: refundReasons,
        j: common_vendor.o(onReasonChange),
        k: refundDesc.value,
        l: common_vendor.o(($event) => refundDesc.value = $event.detail.value),
        m: common_vendor.t(refundDesc.value.length),
        n: common_vendor.f(uploadImages.value, (image, index, i0) => {
          return {
            a: image,
            b: common_vendor.o(($event) => previewImage(index), index),
            c: common_vendor.o(($event) => deleteImage(index), index),
            d: index
          };
        }),
        o: uploadImages.value.length < 3
      }, uploadImages.value.length < 3 ? {
        p: common_vendor.o(chooseImage)
      } : {}, {
        q: !canSubmit.value,
        r: common_vendor.o(submitRefund),
        s: common_vendor.gei(_ctx, "")
      });
    };
  }
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/payment/refund.js.map