更新初级版本

This commit is contained in:
Your Name
2026-03-06 17:30:37 +08:00
parent 52bb80e2f1
commit 7b76671988
19 changed files with 1656 additions and 370 deletions
+181 -36
View File
@@ -1,6 +1,16 @@
<template>
<view class="container">
<view class="form-wrapper">
<view class="container">
<view v-if="!dingdan_ok">
<!-- 确认成功页面 -->
<view v-if="showSuccessPage" class="success-page">
<view class="success-icon"></view>
<view class="success-title">确认成功</view>
<view class="success-desc">诊单已确认感谢您的配合</view>
<button class="back-btn" @click="goBack">返回</button>
</view>
<!-- 诊单详情表单 -->
<view v-else class="form-wrapper">
<!-- 基本信息 -->
<view class="section">
<view class="section-title">基本信息</view>
@@ -189,6 +199,21 @@
<button class="confirm-btn" @click="handleConfirm">确认诊单</button>
</view>
</view>
<view v-else class="success-container">
<view class="success-content">
<view class="success-icon-wrapper">
<view class="success-icon-circle">
<text class="success-icon-check"></text>
</view>
</view>
<view class="success-title">确认成功</view>
<view class="success-message">诊单已确认感谢您的配合</view>
</view>
</view>
</view>
</template>
<script setup>
@@ -224,7 +249,7 @@ const formData = ref({
prescription: '',
doctor_advice: ''
});
let dingdan_ok=ref(false)
// 字典选项
const diagnosisTypeOptions = ref([]);
const syndromeTypeOptions = ref([]);
@@ -307,27 +332,52 @@ const getDictData = async (type) => {
}
};
// 解析页面参数(支持普通参数和scene参数)
const parsePageParams = (options) => {
const params = {};
// 如果有scene参数(扫码进入),解析scene
if (options.scene) {
try {
// URL解码scene参数
const decodedScene = decodeURIComponent(options.scene);
// 解析键值对:id=4&share_user=1
decodedScene.split('&').forEach(item => {
const [key, value] = item.split('=');
if (key && value) {
params[key] = value;
}
});
} catch (error) {
console.error('解析scene参数失败:', error);
}
}
// 合并普通参数(普通跳转进入)
Object.keys(options).forEach(key => {
if (key !== 'scene' && options[key]) {
params[key] = options[key];
}
});
// 获取当前登录用户ID(从本地存储或全局状态获取)
// TODO: 根据你的项目实际情况获取用户ID
// 例如: const userInfo = uni.getStorageSync('userInfo');
// params.user_id = userInfo?.id || 0;
return params;
};
// 加载诊单详情
const loadDiagnosisDetail = async () => {
// 从页面参数获取诊单ID
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
// 假设你的对象是 ai
const scene = currentPage.options.scene;
const params = parsePageParams(currentPage.options);
dingdan_ok.value=uni.getStorageSync('dingdan_ok');
const diagnosisId = params.id;
console.log('页面参数:', params, '诊单ID:', diagnosisId);
// 1. 先对 scene 进行 URL 解码
const decodedScene = decodeURIComponent(scene) ||currentPage.options;
// 得到 "id=4&share_user=1"
// 2. 解析成键值对对象
const params = {};
decodedScene.split('&').forEach(item => {
const [key, value] = item.split('=');
params[key] = value;
});
const diagnosisId = currentPage.options.id ||params.id|| 4;
console.log('nihhhhhh',pages,params,diagnosisId)
if (!diagnosisId) {
uni.showToast({ title: '缺少诊单ID', icon: 'none' });
return;
@@ -341,7 +391,9 @@ const loadDiagnosisDetail = async () => {
url: '/api/tcm/diagnosisDetail',
method: 'GET',
data: {
id: diagnosisId
id: diagnosisId,
user_id: params.user_id || 0,
share_user_id: params.share_user || 0
},
}, false); // 不显示加载中
@@ -469,25 +521,12 @@ const handleConfirm = () => {
// 提交确认诊单
const confirmDiagnosis = async () => {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
// 假设你的对象是 ai
const scene = currentPage.options.scene;
const params = parsePageParams(currentPage.options);
// 1. 先对 scene 进行 URL 解码
const decodedScene = decodeURIComponent(scene);
// 得到 "id=4&share_user=1"
console.log('确认诊单参数:', params);
// 2. 解析成键值对对象
const params = {};
decodedScene.split('&').forEach(item => {
const [key, value] = item.split('=');
params[key] = value;
});
const diagnosisId = currentPage.options.id ||params.id|| 4;
console.log('nihhhhhh',pages,params,diagnosisId)
if (!params.id) {
uni.showToast({ title: '缺少诊单ID', icon: 'none' });
return;
@@ -503,16 +542,19 @@ const confirmDiagnosis = async () => {
method: 'POST',
data: {
id: params.id,
share_user: params.share_user
user_id: params.user_id || 0,
share_user: params.share_user || 0
}
}, false);
if (res.code === 1) {
uni.showToast({
title: '确认成功',
icon: 'success',
icon: 'none',
duration: 2000
});
uni.setStorageSync('dingdan_ok', true);
dingdan_ok.value=true;
setTimeout(() => {
uni.navigateBack();
}, 2000);
@@ -636,4 +678,107 @@ const confirmDiagnosis = async () => {
border: none;
box-shadow: 0 8rpx 24rpx rgba(102, 126, 234, 0.3);
}
/* 确认成功页面样式 */
.success-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 40rpx;
}
.success-content {
width: 100%;
max-width: 600rpx;
background: #fff;
border-radius: 32rpx;
padding: 80rpx 40rpx 60rpx;
text-align: center;
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
animation: successFadeIn 0.5s ease-out;
}
@keyframes successFadeIn {
from {
opacity: 0;
transform: translateY(-40rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.success-icon-wrapper {
margin-bottom: 40rpx;
}
.success-icon-circle {
width: 160rpx;
height: 160rpx;
margin: 0 auto;
background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 12rpx 40rpx rgba(82, 196, 26, 0.3);
animation: successScale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes successScale {
0% {
transform: scale(0);
opacity: 0;
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
opacity: 1;
}
}
.success-icon-check {
font-size: 100rpx;
color: #fff;
font-weight: bold;
line-height: 1;
}
.success-title {
font-size: 48rpx;
font-weight: bold;
color: #333;
margin-bottom: 24rpx;
animation: successSlideIn 0.6s ease-out 0.2s both;
}
@keyframes successSlideIn {
from {
opacity: 0;
transform: translateY(20rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.success-message {
font-size: 28rpx;
color: #666;
line-height: 1.6;
margin-bottom: 16rpx;
animation: successSlideIn 0.6s ease-out 0.3s both;
}
.success-tips {
font-size: 24rpx;
color: #999;
animation: successSlideIn 0.6s ease-out 0.4s both;
}
</style>