页面优化

This commit is contained in:
zhanchao 2026-08-11 10:24:25 +08:00
parent c0f51f8370
commit e3631a61a7
7 changed files with 1954 additions and 1330 deletions

View File

@ -110,6 +110,13 @@
"disableScroll": true "disableScroll": true
} }
}, },
{
"path": "benefit-entry",
"style": {
"navigationBarTitleText": "权益生成",
"disableScroll": true
}
},
{ {
"path": "index", "path": "index",
"style": { "style": {

View File

@ -0,0 +1,591 @@
<template>
<full-page pageStyle="background:#f5f6f8" pageClass="benefit-page-shell">
<view class="benefit-page">
<view class="patient-card">
<view class="patient-card-accent"></view>
<view class="patient-card-main">
<view class="patient-card-top">
<view class="patient-name-wrap">
<text class="patient-name">{{ patientName || "当前患者" }}</text>
<text class="patient-badge">患者档案</text>
</view>
<text class="patient-status">会话已关联</text>
</view>
<view class="patient-meta">
<view class="patient-meta-item">
<text class="patient-meta-label">团队</text>
<text class="patient-meta-value">{{ teamName || "未关联团队" }}</text>
</view>
</view>
</view>
</view>
<view class="section-title">权益项目</view>
<view v-for="(entry, index) in entries" :key="entry.key" class="entry-card">
<view class="field-label">项目名称</view>
<view class="project-input" @click="openProjectPicker(index)">
<text :class="entry.project ? 'value-text' : 'placeholder-text'">
{{ entry.project?.projectName || "请选择权益项目" }}
</text>
<uni-icons type="right" size="18" color="#999" />
</view>
<view class="field-row">
<view class="field-block">
<view class="field-label">数量</view>
<input class="number-input" type="number" v-model="entry.usageCount" />
</view>
<view class="field-block field-block-wide">
<view class="field-label">有效期</view>
<picker mode="date" :value="entry.validTime" @change="changeValidTime($event, entry)">
<view class="picker-value" :class="entry.validTime ? 'value-text' : 'placeholder-text'">
{{ entry.validTime || "请选择日期" }}
</view>
</picker>
</view>
</view>
<view class="field-label">治疗科室</view>
<picker :range="deptList" range-key="deptName" @change="changeDept($event, entry)">
<view class="project-input">
<text :class="entry.dept ? 'value-text' : 'placeholder-text'">
{{ entry.dept?.deptName || "请选择治疗科室" }}
</text>
<uni-icons type="right" size="18" color="#999" />
</view>
</picker>
<view v-if="entries.length > 1" class="remove-entry" @click="removeEntry(index)">删除此项目</view>
</view>
<view class="add-entry" @click="addEntry">
<uni-icons type="plusempty" size="18" color="#0877f1" />
<text>添加权益项目</text>
</view>
<view v-if="projectPickerVisible" class="picker-mask" @click="closeProjectPicker">
<view class="project-picker" @click.stop>
<view class="picker-header">
<text class="picker-title">选择权益项目</text>
<uni-icons type="closeempty" size="22" color="#666" @click="closeProjectPicker" />
</view>
<view class="search-box">
<uni-icons type="search" size="18" color="#999" />
<input v-model="projectKeyword" class="search-input" placeholder="输入项目名称搜索" @input="searchProjects" />
</view>
<scroll-view scroll-y class="project-list">
<view v-for="project in projectList" :key="project._id" class="project-item" @click="selectProject(project)">
<view class="project-name">{{ project.projectName }}</view>
<view class="project-price">¥{{ Number(project.price || 0).toFixed(2) }}</view>
</view>
<view v-if="!projectLoading && !projectList.length" class="empty-text">暂无可用权益项目</view>
<view v-if="projectLoading" class="empty-text">加载中...</view>
</scroll-view>
</view>
</view>
</view>
<template #footer>
<view class="footer-bar">
<button class="cancel-button" @click="goBack">取消</button>
<button class="submit-button" :loading="saving" @click="submitEntries">生成权益</button>
</view>
</template>
</full-page>
</template>
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js";
import fullPage from "@/components/full-page.vue";
const accountStore = useAccountStore();
const patientId = ref("");
const patientName = ref("");
const teamId = ref("");
const teamName = ref("");
const corpId = ref("");
const deptList = ref([]);
const entries = ref([]);
const saving = ref(false);
const projectPickerVisible = ref(false);
const projectPickerIndex = ref(-1);
const projectKeyword = ref("");
const projectList = ref([]);
const projectLoading = ref(false);
let searchTimer = null;
let entryKey = 0;
function createEntry() {
return { key: ++entryKey, project: null, usageCount: 1, validTime: "", dept: null };
}
function decodeRouteParam(value = "") {
try {
return decodeURIComponent(value || "");
} catch (error) {
return value || "";
}
}
onLoad((options = {}) => {
patientId.value = decodeRouteParam(options.patientId);
patientName.value = decodeRouteParam(options.patientName);
teamId.value = decodeRouteParam(options.teamId);
teamName.value = decodeRouteParam(options.teamName);
corpId.value = decodeRouteParam(options.corpId) || accountStore.account?.corpId || "";
entries.value = [createEntry()];
loadDepartments();
});
async function loadDepartments() {
try {
const res = await api("getTreatmentDeptList", { corpId: corpId.value }, false);
deptList.value = Array.isArray(res?.data?.list) ? res.data.list : (res?.data || res?.list || []);
} catch (error) {
console.error("加载治疗科室失败", error);
}
}
function openProjectPicker(index) {
projectPickerIndex.value = index;
projectPickerVisible.value = true;
projectKeyword.value = "";
loadProjects();
}
function closeProjectPicker() {
projectPickerVisible.value = false;
projectKeyword.value = "";
}
function searchProjects() {
clearTimeout(searchTimer);
searchTimer = setTimeout(loadProjects, 300);
}
async function loadProjects() {
projectLoading.value = true;
try {
const res = await api("getProjectList", {
corpId: corpId.value,
page: 1,
pageSize: 30,
projectName: projectKeyword.value.trim(),
projectStatus: "enable",
showDepts: true,
}, false);
const list = res?.data?.list || res?.list || res?.data || [];
projectList.value = Array.isArray(list) ? list : [];
} catch (error) {
projectList.value = [];
uni.showToast({ title: "项目加载失败", icon: "none" });
} finally {
projectLoading.value = false;
}
}
function selectProject(project) {
const entry = entries.value[projectPickerIndex.value];
if (!entry) return;
entry.project = project;
closeProjectPicker();
}
function changeDept(event, entry) {
entry.dept = deptList.value[Number(event.detail.value)] || null;
}
function changeValidTime(event, entry) {
entry.validTime = event.detail.value;
}
function addEntry() {
entries.value.push(createEntry());
}
function removeEntry(index) {
entries.value.splice(index, 1);
if (!entries.value.length) entries.value.push(createEntry());
}
function goBack() {
uni.navigateBack();
}
function validateEntries() {
for (let index = 0; index < entries.value.length; index += 1) {
const entry = entries.value[index];
const label = `${index + 1}个权益项目`;
if (!entry.project?._id) return `${label}请选择项目`;
if (!Number(entry.usageCount) || Number(entry.usageCount) <= 0) return `${label}数量必须大于0`;
if (!entry.dept?._id) return `${label}请选择治疗科室`;
if (!entry.validTime) return `${label}请选择有效期`;
}
if (!patientId.value) return "当前会话缺少患者档案关联";
return "";
}
async function submitEntries() {
if (saving.value) return;
const errorMessage = validateEntries();
if (errorMessage) {
uni.showToast({ title: errorMessage, icon: "none" });
return;
}
saving.value = true;
const userId = accountStore.doctorInfo?.userid || accountStore.account?.userid || "";
try {
for (const entry of entries.value) {
const count = Number(entry.usageCount);
const price = Number(entry.project.price || 0);
const treatmentData = {
customerId: patientId.value,
customerName: patientName.value,
projectId: entry.project._id,
projectName: entry.project.projectName,
usageCount: count,
restUsageCount: count,
price,
totalPrice: price * count,
discount: 10,
isFree: false,
treatmentDeptName: entry.dept.deptName,
treatmentDeptId: entry.dept._id,
treatmentDept_id: entry.dept._id,
treatmentDoctorUserId: userId,
treatmentStatus: "init",
deductUsageCount: 0,
billType: "门诊",
billdCreator: userId,
createTreatementTime: Date.now(),
billTime: Date.now(),
validTime: new Date(`${entry.validTime} 23:59:59`).getTime(),
teamId: teamId.value,
corpId: corpId.value,
};
const res = await api("addTreatmentRecord", { params: treatmentData }, false);
if (!res?.success) throw new Error(res?.message || "权益生成失败");
}
uni.showToast({ title: "权益生成成功", icon: "success" });
setTimeout(goBack, 500);
} catch (error) {
uni.showToast({ title: error.message || "权益生成失败", icon: "none" });
} finally {
saving.value = false;
}
}
</script>
<style scoped lang="scss">
.benefit-page-shell {
background: #f5f6f8;
}
.benefit-page {
min-height: 100%;
padding: 20rpx 24rpx 220rpx;
box-sizing: border-box;
}
.patient-card {
position: relative;
display: flex;
align-items: stretch;
background: #fff;
border: 1rpx solid #e5e7eb;
border-radius: 20rpx;
padding: 24rpx;
margin-bottom: 20rpx;
overflow: hidden;
box-shadow: 0 10rpx 28rpx rgba(15, 23, 42, 0.06);
}
.patient-card-accent {
width: 8rpx;
border-radius: 999rpx;
background: #d1d5db;
margin-right: 18rpx;
flex-shrink: 0;
}
.patient-card-main {
flex: 1;
min-width: 0;
}
.patient-card-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16rpx;
}
.patient-name-wrap {
min-width: 0;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12rpx;
}
.patient-name {
color: #1f2937;
font-size: 36rpx;
font-weight: 700;
line-height: 1.2;
max-width: 420rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.patient-badge {
display: inline-flex;
align-items: center;
height: 36rpx;
padding: 0 14rpx;
border-radius: 999rpx;
background: #f3f4f6;
color: #6b7280;
font-size: 22rpx;
}
.patient-status {
flex-shrink: 0;
height: 36rpx;
line-height: 36rpx;
padding: 0 12rpx;
border-radius: 999rpx;
background: #f3f4f6;
color: #6b7280;
font-size: 22rpx;
}
.patient-meta {
display: block;
margin-top: 20rpx;
}
.patient-meta-item {
min-width: 0;
padding: 14rpx 16rpx;
border-radius: 12rpx;
background: #f8f9fb;
}
.patient-meta-label {
display: block;
color: #9ca3af;
font-size: 20rpx;
line-height: 1.2;
}
.patient-meta-value {
display: block;
margin-top: 6rpx;
color: #6b7280;
font-size: 24rpx;
font-weight: 500;
line-height: 1.35;
word-break: break-all;
}
.section-title {
margin: 12rpx 4rpx 16rpx;
color: #1f2937;
font-size: 28rpx;
font-weight: 700;
}
.entry-card {
background: #fff;
border-radius: 18rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 10rpx 28rpx rgba(15, 23, 42, 0.05);
}
.field-label {
margin-bottom: 12rpx;
color: #374151;
font-size: 26rpx;
font-weight: 600;
}
.project-input,
.number-input,
.picker-value {
min-height: 76rpx;
box-sizing: border-box;
border: 1rpx solid #e5e7eb;
border-radius: 12rpx;
padding: 0 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
}
.value-text {
color: #111827;
font-size: 28rpx;
font-weight: 500;
}
.placeholder-text {
color: #9ca3af;
font-size: 28rpx;
}
.field-row {
display: flex;
gap: 20rpx;
margin-top: 20rpx;
}
.field-block {
flex: 1;
}
.field-block-wide {
flex: 1.5;
}
.number-input {
width: 100%;
color: #111827;
font-size: 28rpx;
}
.add-entry {
height: 80rpx;
border: 1rpx dashed #0877f1;
border-radius: 14rpx;
display: flex;
justify-content: center;
align-items: center;
gap: 8rpx;
color: #0877f1;
font-size: 28rpx;
background: #fff;
margin-top: 8rpx;
}
.remove-entry {
margin-top: 20rpx;
color: #fa5151;
font-size: 26rpx;
text-align: right;
}
.footer-bar {
display: flex;
gap: 20rpx;
padding: 24rpx 24rpx calc(28rpx + env(safe-area-inset-bottom));
background: rgba(245, 246, 248, 0.96);
border-top: 1rpx solid #eef2f7;
backdrop-filter: blur(12px);
box-sizing: border-box;
}
.footer-bar button {
flex: 1;
min-height: 88rpx;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 14rpx;
font-size: 30rpx;
line-height: 1.2;
}
.cancel-button {
color: #0877f1;
background: #fff;
border: 1rpx solid #0877f1;
}
.submit-button {
color: #fff;
background: linear-gradient(135deg, #0f84ff 0%, #0877f1 100%);
box-shadow: 0 10rpx 24rpx rgba(8, 119, 241, 0.22);
}
.picker-mask {
position: fixed;
inset: 0;
z-index: 20;
background: rgba(0, 0, 0, 0.4);
display: flex;
align-items: flex-end;
}
.project-picker {
width: 100%;
max-height: 75vh;
background: #fff;
border-radius: 24rpx 24rpx 0 0;
padding: 24rpx;
box-sizing: border-box;
}
.picker-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.picker-title {
color: #222;
font-size: 32rpx;
font-weight: 600;
}
.search-box {
display: flex;
align-items: center;
gap: 12rpx;
background: #f5f6f8;
border-radius: 10rpx;
padding: 0 20rpx;
margin: 20rpx 0;
}
.search-input {
flex: 1;
height: 72rpx;
font-size: 28rpx;
}
.project-list {
max-height: 55vh;
}
.project-item {
display: flex;
justify-content: space-between;
padding: 24rpx 8rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.project-name {
color: #333;
font-size: 28rpx;
}
.project-price {
color: #fa5151;
font-size: 26rpx;
}
.empty-text {
text-align: center;
color: #999;
padding: 60rpx 0;
font-size: 28rpx;
}
</style>

View File

@ -11,15 +11,13 @@
<uni-icons v-else type="mic" size="28" color="#666" /> <uni-icons v-else type="mic" size="28" color="#666" />
</view> </view>
<view class="input-area"> <view class="input-area">
<!-- :hold-keyboard="true" --> <!-- :hold-keyboard="true" -->
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..." <textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput" @confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput" :auto-height="true"
:auto-height="true" :show-confirm-bar="false" :cursor-spacing="40" :show-confirm-bar="false" :cursor-spacing="40" ref="textareaRef" />
ref="textareaRef"
/>
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord" <input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
@touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord" :placeholder="isRecording ? '松开发送' : '按住说话'" disabled> @touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord"
</input> :placeholder="isRecording ? '松开发送' : '按住说话'" disabled />
</view> </view>
<button v-if="inputText.trim() && !props.isGenerating" class="send-btn" @click="sendTextMessage"> <button v-if="inputText.trim() && !props.isGenerating" class="send-btn" @click="sendTextMessage">
发送 发送
@ -87,6 +85,7 @@ const props = defineProps({
groupId: { type: String, default: "" }, groupId: { type: String, default: "" },
userId: { type: String, default: "" }, userId: { type: String, default: "" },
teamId: { type: String, default: "" }, teamId: { type: String, default: "" },
teamName: { type: String, default: "" },
patientId: { type: String, default: "" }, patientId: { type: String, default: "" },
corpId: { type: String, default: "" }, corpId: { type: String, default: "" },
orderStatus: { type: String, default: "" }, orderStatus: { type: String, default: "" },
@ -409,6 +408,14 @@ const goToArticleList = () => {
}); });
}; };
//
const goToBenefitEntry = () => {
showMorePanel.value = false;
uni.navigateTo({
url: `/pages/message/benefit-entry?patientId=${encodeURIComponent(props.patientId)}&patientName=${encodeURIComponent(props.patientInfo.name || "")}&teamId=${encodeURIComponent(props.teamId)}&teamName=${encodeURIComponent(props.teamName)}&corpId=${encodeURIComponent(props.corpId)}`,
});
};
// //
const goToSurveyList = () => { const goToSurveyList = () => {
uni.navigateTo({ uni.navigateTo({
@ -474,6 +481,11 @@ const morePanelButtons = computed(() => {
icon: "/static/icon/xuanjiaowenzhang.png", icon: "/static/icon/xuanjiaowenzhang.png",
action: goToArticleList, action: goToArticleList,
}, },
{
text: "权益生成",
icon: "/static/icon/quanyi.svg",
action: goToBenefitEntry,
},
{ {
text: "问卷", text: "问卷",
icon: "/static/icon/wenjuan.png", icon: "/static/icon/wenjuan.png",

View File

@ -151,6 +151,7 @@
" "
:userId="openid" :userId="openid"
:teamId="teamId" :teamId="teamId"
:teamName="teamName"
:patientId="patientId" :patientId="patientId"
:corpId="corpId" :corpId="corpId"
:patientInfo="patientInfo" :patientInfo="patientInfo"
@ -354,6 +355,7 @@ const patientInfo = ref({
// ID // ID
const patientId = ref(""); const patientId = ref("");
const teamId = ref(""); const teamId = ref("");
const teamName = ref("");
// - pending // - pending
const showConsultAccept = computed(() => orderStatus.value === "pending"); const showConsultAccept = computed(() => orderStatus.value === "pending");
@ -415,9 +417,10 @@ const fetchGroupOrderStatus = async () => {
if (result.success && result.data) { if (result.success && result.data) {
orderStatus.value = result.data.orderStatus || ""; orderStatus.value = result.data.orderStatus || "";
// const resolvedTeamName = result.data.team?.name || "";
const teamName = result.data.team?.name || "群聊"; const navigationTeamName = resolvedTeamName || "群聊";
updateNavigationTitle(teamName); teamName.value = resolvedTeamName;
updateNavigationTitle(navigationTeamName);
teamId.value = teamId.value =
result.data.teamId || result.data.teamId ||
@ -441,7 +444,7 @@ const fetchGroupOrderStatus = async () => {
console.log("获取群组订单状态:", { console.log("获取群组订单状态:", {
orderStatus: orderStatus.value, orderStatus: orderStatus.value,
teamName: teamName, teamName: teamName.value,
patientInfo: patientInfo.value, patientInfo: patientInfo.value,
groupId: groupId.value, groupId: groupId.value,
}); });

BIN
static/icon/quanyi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

9
static/icon/quanyi.svg Normal file
View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="104" height="104" viewBox="0 0 104 104">
<rect width="104" height="104" fill="#ffffff"/>
<g fill="none" stroke="#7d8e9e" stroke-width="4.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M33 31.5h27.5a3 3 0 0 1 3 3v29a3 3 0 0 1-3 3H33a3 3 0 0 1-3-3v-29a3 3 0 0 1 3-3Z"/>
<path d="M39 42h15M39 49h15M39 56h8"/>
<circle cx="62.5" cy="63" r="12.5" fill="#ffffff"/>
<path d="m62.5 56.8 1.8 3.7 4.1.6-3 2.9.7 4.1-3.6-1.9-3.7 1.9.7-4.1-3-2.9 4.1-.6 1.8-3.7Z" fill="#7d8e9e" stroke="none"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 575 B

View File

@ -17,6 +17,7 @@ const urlsConfig = {
getTemplateListByTemptype: 'getTemplateListByTemptype', getTemplateListByTemptype: 'getTemplateListByTemptype',
wxAppLogin: 'wxAppLogin', wxAppLogin: 'wxAppLogin',
getDeptList: 'getRealDeptList', getDeptList: 'getRealDeptList',
getTreatmentDeptList: "getDeptList",
getHospitalList: 'getRealHospital', getHospitalList: 'getRealHospital',
addCorpMember: 'addCorpMember', addCorpMember: 'addCorpMember',
getCorpMemberData: 'getCorpMemberData', getCorpMemberData: 'getCorpMemberData',
@ -26,6 +27,7 @@ const urlsConfig = {
submitCertProfile: 'submitCertProfile', submitCertProfile: 'submitCertProfile',
getMemberVerifyStatus: "getMemberVerifyStatus", getMemberVerifyStatus: "getMemberVerifyStatus",
getJoinedTeams: "getJoinedTeams", getJoinedTeams: "getJoinedTeams",
getProjectList: "getProjectList",
updateTeamInfo: "updateTeamInfo", updateTeamInfo: "updateTeamInfo",
createOwnTeam: 'createOwnTeam', createOwnTeam: 'createOwnTeam',
removeTeammate: "removeTeammate", removeTeammate: "removeTeammate",
@ -91,6 +93,7 @@ const urlsConfig = {
unbindMiniAppArchive: 'unbindMiniAppArchive', unbindMiniAppArchive: 'unbindMiniAppArchive',
// 健康档案相关接口 // 健康档案相关接口
addMedicalRecord: 'addMedicalRecord', addMedicalRecord: 'addMedicalRecord',
addTreatmentRecord: "addTreatmentRecord",
getMedicalRecordById: 'getMedicalRecordById', getMedicalRecordById: 'getMedicalRecordById',
updateMedicalRecord: 'updateMedicalRecord', updateMedicalRecord: 'updateMedicalRecord',
removeMedicalRecord: 'removeMedicalRecord', removeMedicalRecord: 'removeMedicalRecord',
@ -104,7 +107,6 @@ const urlsConfig = {
im: { im: {
getUserSig: 'getUserSig', getUserSig: 'getUserSig',
sendSystemMessage: "sendSystemMessage", sendSystemMessage: "sendSystemMessage",
getChatRecordsByGroupId: "getChatRecordsByGroupId",
sendConsultRejectedMessage: "sendConsultRejectedMessage", sendConsultRejectedMessage: "sendConsultRejectedMessage",
endConsultation: "endConsultation", endConsultation: "endConsultation",
openConsultation: "openConsultation", openConsultation: "openConsultation",