2026-07-29 17:30:30 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<full-page pageClass="record-page" :customScroll="true">
|
2026-08-05 15:43:23 +08:00
|
|
|
|
<scroll-view class="record-scroll" scroll-y="true" refresher-enabled="true" :refresher-triggered="refreshing"
|
|
|
|
|
|
@refresherrefresh="refreshRecords">
|
2026-08-03 10:03:56 +08:00
|
|
|
|
<view class="page-body">
|
2026-08-05 15:43:23 +08:00
|
|
|
|
<view class="profile-card" @click="switchArchive">
|
|
|
|
|
|
<view class="avatar-wrap">
|
|
|
|
|
|
<view class="avatar-placeholder">{{ avatarText }}</view>
|
2026-07-29 17:30:30 +08:00
|
|
|
|
</view>
|
2026-08-05 15:43:23 +08:00
|
|
|
|
<view class="profile-main">
|
|
|
|
|
|
<view class="profile-title">{{ customerName || "请选择档案" }}</view>
|
|
|
|
|
|
<view class="profile-sub">所属机构:{{ corpName || "-" }}</view>
|
2026-07-29 17:30:30 +08:00
|
|
|
|
</view>
|
2026-09-02 14:50:14 +08:00
|
|
|
|
<uni-icons type="right" size="16" color="#c0c4cc" />
|
2026-08-05 15:43:23 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<picker mode="date" fields="month" :value="selectedMonth" @change="handleMonthChange">
|
|
|
|
|
|
<view class="month-bar">
|
|
|
|
|
|
<text>{{ monthText }}</text>
|
|
|
|
|
|
<text class="month-arrow">▼</text>
|
2026-07-29 17:30:30 +08:00
|
|
|
|
</view>
|
2026-08-05 15:43:23 +08:00
|
|
|
|
</picker>
|
|
|
|
|
|
|
|
|
|
|
|
<view v-if="loading" class="empty">加载中...</view>
|
|
|
|
|
|
<view v-else-if="!records.length" class="empty">暂无治疗记录</view>
|
|
|
|
|
|
<view v-else class="record-list">
|
|
|
|
|
|
<view v-for="item in records" :key="item._id" class="record-card">
|
|
|
|
|
|
<view class="record-status">已治疗</view>
|
|
|
|
|
|
<view class="record-row">
|
|
|
|
|
|
<text class="row-label">【项目名称】</text>
|
|
|
|
|
|
<text class="row-value strong">{{ item.projectName || "未命名项目" }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="record-row">
|
|
|
|
|
|
<text class="row-label">【治疗时间】</text>
|
|
|
|
|
|
<text class="row-value">{{ formatDate(item.treatmentTime) }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="record-row">
|
|
|
|
|
|
<text class="row-label">【治疗数量】</text>
|
|
|
|
|
|
<text class="row-value">{{ item.deductUsageCount || 0 }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="record-row">
|
|
|
|
|
|
<text class="row-label">【治疗科室】</text>
|
|
|
|
|
|
<text class="row-value">{{ item.treatmentDeptName || "-" }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="record-row">
|
|
|
|
|
|
<text class="row-label">【治疗医生】</text>
|
|
|
|
|
|
<text class="row-value strong">{{ item.treatmentDoctorName || item.doctorName ||
|
|
|
|
|
|
staffText(item.treatmentDoctorUserId) }}</text>
|
|
|
|
|
|
</view>
|
2026-07-29 17:30:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2026-08-03 10:03:56 +08:00
|
|
|
|
</scroll-view>
|
2026-07-29 17:30:30 +08:00
|
|
|
|
</full-page>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-07-30 16:37:11 +08:00
|
|
|
|
import { computed, ref } from "vue";
|
2026-07-29 17:30:30 +08:00
|
|
|
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
|
|
|
|
|
import api from "@/utils/api";
|
|
|
|
|
|
import { normalizeCorpId } from "@/utils/api-base-config";
|
|
|
|
|
|
import { toast } from "@/utils/widget";
|
|
|
|
|
|
import FullPage from "@/components/full-page.vue";
|
|
|
|
|
|
|
|
|
|
|
|
const corpId = ref("");
|
2026-07-30 16:37:11 +08:00
|
|
|
|
const teamId = ref("");
|
2026-07-29 17:30:30 +08:00
|
|
|
|
const customerId = ref("");
|
|
|
|
|
|
const customerName = ref("");
|
2026-07-30 16:37:11 +08:00
|
|
|
|
const corpName = ref("");
|
|
|
|
|
|
const selectedMonth = ref(formatMonth(Date.now()));
|
2026-07-29 17:30:30 +08:00
|
|
|
|
const records = ref([]);
|
2026-07-30 16:37:11 +08:00
|
|
|
|
const staffNameMap = ref({});
|
2026-07-29 17:30:30 +08:00
|
|
|
|
const loading = ref(false);
|
2026-08-03 10:03:56 +08:00
|
|
|
|
const refreshing = ref(false);
|
2026-07-29 17:30:30 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
const avatarText = computed(() => (customerName.value || "档案").slice(0, 1));
|
|
|
|
|
|
const monthText = computed(() => selectedMonth.value.replace("-", "年") + "月");
|
|
|
|
|
|
|
2026-08-12 18:09:41 +08:00
|
|
|
|
async function loadCorpName() {
|
|
|
|
|
|
if (!corpId.value) {
|
|
|
|
|
|
corpName.value = "";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
const res = await api("getCorpInfo", { corpId: corpId.value }, false);
|
|
|
|
|
|
const corp = Array.isArray(res?.data) ? res.data[0] : null;
|
|
|
|
|
|
corpName.value = corp?.corp_name || corp?.corpName || "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
function pad(value) {
|
|
|
|
|
|
return String(value).padStart(2, "0");
|
|
|
|
|
|
}
|
2026-07-29 17:30:30 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
function toDate(ts) {
|
|
|
|
|
|
if (!ts) return null;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
const d = new Date(Number(ts));
|
2026-07-30 16:37:11 +08:00
|
|
|
|
return Number.isNaN(d.getTime()) ? null : d;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
function formatMonth(ts) {
|
|
|
|
|
|
const d = toDate(ts) || new Date();
|
|
|
|
|
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}`;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
function monthRange(month) {
|
|
|
|
|
|
const [year, monthIndex] = String(month || "").split("-").map(Number);
|
|
|
|
|
|
const start = new Date(year, monthIndex - 1, 1);
|
|
|
|
|
|
const end = new Date(year, monthIndex, 0);
|
|
|
|
|
|
return [
|
|
|
|
|
|
`${start.getFullYear()}-${pad(start.getMonth() + 1)}-01`,
|
|
|
|
|
|
`${end.getFullYear()}-${pad(end.getMonth() + 1)}-${pad(end.getDate())}`,
|
|
|
|
|
|
];
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
function formatDate(ts) {
|
|
|
|
|
|
const d = toDate(ts);
|
|
|
|
|
|
if (!d) return "-";
|
|
|
|
|
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function staffText(userid) {
|
|
|
|
|
|
if (!userid) return "-";
|
|
|
|
|
|
return staffNameMap.value[userid] || userid;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function assistantText(item) {
|
|
|
|
|
|
const assistants = item?.assistantDoctors;
|
|
|
|
|
|
if (!Array.isArray(assistants) || !assistants.length) return "";
|
|
|
|
|
|
return assistants.map((staff) => staffText(staff?.userid || staff?.userId || staff)).filter(Boolean).join("、");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function loadStaffNameMap() {
|
|
|
|
|
|
if (!corpId.value) {
|
|
|
|
|
|
staffNameMap.value = {};
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
const res = await api("getAllCorpMemberIncludeDeleted", { corpId: corpId.value }, false);
|
|
|
|
|
|
const list = res?.success && Array.isArray(res.data) ? res.data : [];
|
|
|
|
|
|
staffNameMap.value = list.reduce((map, staff) => {
|
|
|
|
|
|
if (staff?.userid) {
|
|
|
|
|
|
map[staff.userid] = staff.anotherName || staff.name || staff.userid;
|
|
|
|
|
|
}
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}, {});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function switchArchive() {
|
|
|
|
|
|
const corp = encodeURIComponent(corpId.value || "");
|
|
|
|
|
|
const team = encodeURIComponent(teamId.value || "");
|
|
|
|
|
|
const customer = encodeURIComponent(customerId.value || "");
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/experience-coupon/select-rights-archive?mode=target&target=treatment&corpId=${corp}&teamId=${team}&customerId=${customer}`,
|
|
|
|
|
|
});
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-03 10:03:56 +08:00
|
|
|
|
async function loadRecords(options = {}) {
|
|
|
|
|
|
const { silent = false } = options;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
if (!corpId.value || !customerId.value) {
|
|
|
|
|
|
records.value = [];
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-08-03 10:03:56 +08:00
|
|
|
|
if (!silent) loading.value = true;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const res = await api(
|
2026-07-30 16:37:11 +08:00
|
|
|
|
"getDeductRecord",
|
2026-07-29 17:30:30 +08:00
|
|
|
|
{
|
|
|
|
|
|
corpId: corpId.value,
|
|
|
|
|
|
customerId: customerId.value,
|
2026-07-30 16:37:11 +08:00
|
|
|
|
deductStatus: ["deducted"],
|
|
|
|
|
|
treatmentTimeDates: monthRange(selectedMonth.value),
|
2026-07-29 17:30:30 +08:00
|
|
|
|
page: 1,
|
|
|
|
|
|
pageSize: 200,
|
|
|
|
|
|
},
|
|
|
|
|
|
false
|
|
|
|
|
|
);
|
|
|
|
|
|
if (!res?.success) {
|
|
|
|
|
|
toast(res?.message || "加载治疗记录失败");
|
|
|
|
|
|
records.value = [];
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-07-30 16:37:11 +08:00
|
|
|
|
const list = res.data?.list || res.list || [];
|
|
|
|
|
|
records.value = Array.isArray(list)
|
|
|
|
|
|
? list.sort((a, b) => Number(b.treatmentTime || b.createTime || 0) - Number(a.treatmentTime || a.createTime || 0))
|
|
|
|
|
|
: [];
|
2026-07-29 17:30:30 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-03 10:03:56 +08:00
|
|
|
|
async function refreshRecords() {
|
|
|
|
|
|
if (refreshing.value) return;
|
|
|
|
|
|
refreshing.value = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
await loadStaffNameMap();
|
|
|
|
|
|
await loadRecords({ silent: true });
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
refreshing.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
async function handleMonthChange(event) {
|
|
|
|
|
|
selectedMonth.value = event?.detail?.value || selectedMonth.value;
|
|
|
|
|
|
await loadRecords();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-29 17:30:30 +08:00
|
|
|
|
onLoad(async (options = {}) => {
|
|
|
|
|
|
uni.setNavigationBarTitle({ title: "治疗记录" });
|
|
|
|
|
|
corpId.value = normalizeCorpId(options.corpId || "");
|
2026-07-30 16:37:11 +08:00
|
|
|
|
teamId.value = options.teamId || "";
|
2026-07-29 17:30:30 +08:00
|
|
|
|
customerId.value = options.customerId || options.id || "";
|
|
|
|
|
|
customerName.value = options.name ? decodeURIComponent(options.name) : "";
|
2026-07-30 16:37:11 +08:00
|
|
|
|
if (options.month) selectedMonth.value = options.month;
|
2026-08-12 18:09:41 +08:00
|
|
|
|
await loadCorpName();
|
2026-07-30 16:37:11 +08:00
|
|
|
|
await loadStaffNameMap();
|
2026-07-29 17:30:30 +08:00
|
|
|
|
await loadRecords();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
onShow(() => {
|
|
|
|
|
|
if (corpId.value && customerId.value) loadRecords();
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-08-03 10:03:56 +08:00
|
|
|
|
.record-page :deep(.page-scroll) {
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.record-scroll {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
background: #e9edf3;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-29 17:30:30 +08:00
|
|
|
|
.page-body {
|
|
|
|
|
|
min-height: 100%;
|
|
|
|
|
|
box-sizing: border-box;
|
2026-07-30 16:37:11 +08:00
|
|
|
|
background: #e9edf3;
|
|
|
|
|
|
border-top: 8rpx solid #0b63d8;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.profile-card {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 18rpx;
|
|
|
|
|
|
padding: 20rpx 24rpx;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
background: #fff;
|
2026-07-30 16:37:11 +08:00
|
|
|
|
border-bottom: 1rpx solid #d7dce5;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.avatar-wrap {
|
|
|
|
|
|
width: 72rpx;
|
|
|
|
|
|
height: 72rpx;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
background: #d2d5da;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.avatar-placeholder {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 30rpx;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
font-weight: 600;
|
2026-07-30 16:37:11 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.profile-main {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.profile-title {
|
|
|
|
|
|
font-size: 31rpx;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
line-height: 40rpx;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-29 17:30:30 +08:00
|
|
|
|
.profile-sub {
|
2026-07-30 16:37:11 +08:00
|
|
|
|
margin-top: 4rpx;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
font-size: 24rpx;
|
2026-07-30 16:37:11 +08:00
|
|
|
|
color: #9aa0a8;
|
|
|
|
|
|
line-height: 34rpx;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.profile-arrow {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
color: #b4b7bf;
|
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.month-bar {
|
2026-07-29 17:30:30 +08:00
|
|
|
|
display: flex;
|
2026-07-30 16:37:11 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 8rpx;
|
|
|
|
|
|
height: 70rpx;
|
|
|
|
|
|
padding: 0 24rpx;
|
|
|
|
|
|
background: #e2e6ec;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
border-bottom: 1rpx solid #d4d9e2;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.month-arrow {
|
|
|
|
|
|
font-size: 18rpx;
|
|
|
|
|
|
color: #333;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.record-list {
|
|
|
|
|
|
padding: 0rpx 10rpx 12rpx 10rpx;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.record-card {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
padding: 22rpx 24rpx 22rpx 34rpx;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-top: 14rpx solid #e9edf3;
|
|
|
|
|
|
border-bottom: 1rpx solid #d7dce5;
|
|
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.record-status {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 24rpx;
|
|
|
|
|
|
right: 24rpx;
|
|
|
|
|
|
color: #333;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-30 16:37:11 +08:00
|
|
|
|
.record-row {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
padding: 7rpx 112rpx 7rpx 0;
|
|
|
|
|
|
font-size: 27rpx;
|
|
|
|
|
|
line-height: 38rpx;
|
|
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-29 17:30:30 +08:00
|
|
|
|
.row-label {
|
|
|
|
|
|
flex-shrink: 0;
|
2026-07-30 16:37:11 +08:00
|
|
|
|
color: #6b7280;
|
|
|
|
|
|
font-weight: 700;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-29 17:30:30 +08:00
|
|
|
|
.row-value {
|
|
|
|
|
|
min-width: 0;
|
2026-07-30 16:37:11 +08:00
|
|
|
|
color: #333;
|
|
|
|
|
|
word-break: break-all;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-29 17:30:30 +08:00
|
|
|
|
.strong {
|
2026-07-30 16:37:11 +08:00
|
|
|
|
font-weight: 700;
|
2026-07-29 17:30:30 +08:00
|
|
|
|
}
|
2026-08-05 15:43:23 +08:00
|
|
|
|
|
2026-07-29 17:30:30 +08:00
|
|
|
|
.empty {
|
|
|
|
|
|
padding: 120rpx 0;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|