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