"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