更新
This commit is contained in:
@@ -519,51 +519,15 @@ 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];
|
||||
const params = parsePageParams(currentPage.options);
|
||||
const params = proxy.$parsePageParams(currentPage.options);
|
||||
dingdan_ok.value=uni.getStorageSync('dingdan_ok');
|
||||
const diagnosisId = params.id;
|
||||
console.log('页面参数:', params, '诊单ID:', diagnosisId);
|
||||
console.log('进入onMounted:', params, '诊单ID:', diagnosisId);
|
||||
|
||||
if (!diagnosisId) {
|
||||
uni.showToast({ title: '缺少诊单ID', icon: 'none' });
|
||||
@@ -724,7 +688,7 @@ const handleConfirm = () => {
|
||||
const confirmDiagnosis = async () => {
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const params = parsePageParams(currentPage.options);
|
||||
const params = proxy.$parsePageParams(currentPage.options);
|
||||
|
||||
console.log('确认诊单参数:', params);
|
||||
|
||||
|
||||
@@ -100,36 +100,13 @@ onMounted(() => {
|
||||
loadOrderDetail()
|
||||
})
|
||||
|
||||
const parsePageParams = (options) => {
|
||||
const params = {}
|
||||
if (options.scene) {
|
||||
try {
|
||||
const decodedScene = decodeURIComponent(options.scene)
|
||||
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]
|
||||
}
|
||||
})
|
||||
return params
|
||||
}
|
||||
|
||||
const loadOrderDetail = async () => {
|
||||
loading.value = true
|
||||
errorMsg.value = ''
|
||||
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const params = parsePageParams(currentPage.options || {})
|
||||
const params = proxy.$parsePageParams(currentPage.options || {})
|
||||
orderNo.value = params.order_no || ''
|
||||
|
||||
if (!orderNo.value) {
|
||||
|
||||
Reference in New Issue
Block a user