"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
|