diff --git a/components/c-upload/c-upload.vue b/components/c-upload/c-upload.vue new file mode 100644 index 0000000..74c356e --- /dev/null +++ b/components/c-upload/c-upload.vue @@ -0,0 +1,539 @@ + + + + + diff --git a/components/image-compress-popup/image-compress-popup.vue b/components/image-compress-popup/image-compress-popup.vue new file mode 100644 index 0000000..eac1661 --- /dev/null +++ b/components/image-compress-popup/image-compress-popup.vue @@ -0,0 +1,676 @@ + + + + + + + + + + diff --git a/pages.json b/pages.json index 1e9607f..0e7d2e0 100644 --- a/pages.json +++ b/pages.json @@ -3,6 +3,7 @@ // 下载安装方式 // "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" // npm安装方式 +// "^u-upload$": "@/components/c-upload/c-upload.vue", "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue", // 消息通知组件 "^MessageNotification": "@/components/MessageNotification/MessageNotification.vue", diff --git a/pages/home/home.vue b/pages/home/home.vue index 6a5af27..2e4f0c9 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -2,6 +2,7 @@ + - 查看 + @@ -214,12 +215,15 @@ import { getPlatformQualificationsApi } from '../../request/api/platform' import { getStoreDrugListBySalespersonApi, getHomeTopProductsApi, getHomeZonesApi, checkOnlineConsultationConfigApi } from "@/request/api/product"; import request from "@/request/api/request"; import MessageNotification from "@/components/MessageNotification/MessageNotification.vue"; +import ImageCompressPopup from '@/components/image-compress-popup/image-compress-popup.vue'; +import { registerImageCompressPopup } from '@/utils/image-compress-modal.js'; import { setGuestMode, isGuestMode, isLoggedIn } from '@/common/utils/auth.js'; import {silentLogin} from "@/utils/login"; export default { components: { - MessageNotification + MessageNotification, + ImageCompressPopup, }, data() { return { @@ -275,6 +279,9 @@ export default { } }, onReady() { + if (this.$refs.imageCompressPopup) { + registerImageCompressPopup(this.$refs.imageCompressPopup); + } // console.log('调试静默登陆', isLoggedIn()); // 判断是否已登录 diff --git a/request/api/api.js b/request/api/api.js index b605932..d043d70 100644 --- a/request/api/api.js +++ b/request/api/api.js @@ -1,4 +1,5 @@ import http from './request' +import { get } from './http' // 登录 授权 其他手机号授权 export async function getsLogin(params) { @@ -106,7 +107,19 @@ export async function userInfo(params) { // 就诊人保存 export async function userAdd(params) { - let data = await http('/oldApi/v1/patient/save', params) + let data = await http('/xkApi/patient/save', params) + return data +} + +// 就诊人监护人信息(编辑回显) +export async function userGuardianInfo(params) { + const query = params.data || params + return await get('/patient/guardian-info', query, 3) +} + +// 删除就诊人 +export async function userPatientDel(params) { + let data = await http('/xkApi/patient/delete', params) return data } diff --git a/request/api/request.js b/request/api/request.js index a970b39..dcedba5 100644 --- a/request/api/request.js +++ b/request/api/request.js @@ -14,12 +14,66 @@ const arr = [ 'password' ] -// 敏感数据 +// 敏感数据:响应解密后保留明文原字段,脱敏值写入 {field}_tm const sensitiveData = [ 'id_card', - 'idcard' + 'idcard', + 'guardian_id_card' ] +// 仅展示脱敏、编辑需明文的字段 +const displayMaskFields = [ + 'mobile', + 'express_mobile', + 'patient_mobile', +] + +/** + * 脱敏展示值(写入 field_tm) + */ +function maskFieldValue(key, plainText) { + if (plainText == null || plainText === '') { + return plainText + } + const str = String(plainText) + switch (key) { + case 'express_name': + case 'express_region': + case 'accept_name': + case 'patient': + return str.slice(0, 1).padEnd(str.length, '*') + case 'mobile': + case 'express_mobile': + case 'patient_mobile': + case 'guardian_mobile': + if (str.length <= 7) { + return str + } + return str.slice(0, 3).padEnd(str.length - 4, '*') + str.slice(-4) + case 'id_card': + case 'idcard': + case 'guardian_id_card': + if (str.length <= 10) { + return str + } + return str.slice(0, 6).padEnd(str.length - 4, '*') + str.slice(-4) + default: + return str + } +} + +/** 只读展示:优先 field_tm */ +export function displayTm(obj, field) { + if (obj == null) { + return '' + } + const tm = obj[field + '_tm'] + if (tm != null && tm !== '') { + return tm + } + return obj[field] ?? '' +} + const isDev = checkDev('dev'); // 环境URL配置 @@ -254,56 +308,39 @@ function request(url, params, method = 0) { function getRes(obj, isDecode = true) { try { + if (obj == null || typeof obj !== 'object') { + return obj + } for (const key in obj) { + if (key.endsWith('_tm')) { + continue + } if (Array.isArray(obj[key])) { - obj[key] = getRes(obj[key]) - } else if (typeof obj[key] === 'object') { - obj[key] = getRes(obj[key]) - } else { - // 判断obj[key]是否在arr中 - if (arr.indexOf(key) !== -1) { - let aseFile = '' - if (isDecode === true) { - aseFile = customBase64Decode(obj[key]) - } else { - aseFile = customBase64Encode(obj[key]) + obj[key] = getRes(obj[key], isDecode) + } else if (obj[key] !== null && typeof obj[key] === 'object') { + obj[key] = getRes(obj[key], isDecode) + } else if (arr.indexOf(key) !== -1) { + let plainValue = '' + if (isDecode === true) { + plainValue = customBase64Decode(obj[key]) + } else { + plainValue = customBase64Encode(obj[key]) + } + const isGarbled = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\xFF]|[\u{E000}-\u{F8FF}]/u.test( + typeof plainValue === 'string' ? plainValue : '' + ) + if (isGarbled) { + plainValue = obj[key] + } + if (isDecode === true) { + const needTm = sensitiveData.indexOf(key) !== -1 + || displayMaskFields.indexOf(key) !== -1 + obj[key] = plainValue + if (needTm) { + obj[key + '_tm'] = maskFieldValue(key, plainValue) } - const isGarbled = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\xFF]|[\u{E000}-\u{F8FF}]/u.test( - typeof aseFile === 'string' ? aseFile : '' - ) - if (isGarbled) { - aseFile = obj[key] - } - // 为了修改,暂时不脱敏 - if (isDecode === true) { - - if (sensitiveData.indexOf(key) !== -1) { - // 数据脱敏,自动匹配姓名、手机号、身份证 - switch (key) { - case 'express_name': - case 'express_region': - case 'accept_name': - case 'patient': - // 保留前两个字符,其余用星号代替 - aseFile = aseFile.slice(0, 1).padEnd(aseFile.length, '*'); - break; - case 'mobile': - case 'express_mobile': - // 保留前三位和后四位,中间用星号代替 - aseFile = aseFile.slice(0, 3).padEnd(aseFile.length - 4, '*') + aseFile.slice(-4); - break; - case 'id_card': - case 'idcard': - // 保留前六位和后四位,中间用星号代替 - aseFile = aseFile.slice(0, 6).padEnd(aseFile.length - 4, '*') + aseFile.slice(-4); - break; - default: - // 默认情况下,全部用星号代替 - break; - } - } - } - obj[key] = aseFile + } else { + obj[key] = plainValue } } } diff --git a/subPackages/chat/chat.vue b/subPackages/chat/chat.vue index ce1e202..6735802 100644 --- a/subPackages/chat/chat.vue +++ b/subPackages/chat/chat.vue @@ -199,6 +199,7 @@ import { ChatManager } from '@/store/chat/chat.js'; import {getChatRegisterInfoApi, sendToUserApi, upLoadChatFileApi, getDoctorInfoApi, getRoomStatusApi} from "@/request/api/im"; import {getTransferAssistantConfigApi, getTransferConsultationAgreementInfoApi, getAgreementDetailApi} from "@/request/api/transferPrescription"; import { checkDev } from '@/utils/utils'; +import { prepareImagePath } from '@/utils/image-compress.js'; // 根据环境获取上传URL const isDev = checkDev('dev'); @@ -941,6 +942,23 @@ export default { success: res => { res.tempFilePaths.forEach(file => { this.uploadAndSendFile(file, 'image'); }); } }); } + // if (type === 'image') { + // uni.chooseImage({ + // count: 9, + // sourceType: ['album', 'camera'], + // success: async (res) => { + // for (let index = 0; index < res.tempFiles.length; index++) { + // const tempFile = res.tempFiles[index]; + // const prepared = await prepareImagePath({ + // path: tempFile.path, + // size: tempFile.size, + // }); + // if (!prepared) continue; + // this.uploadAndSendFile(prepared.path, 'image'); + // } + // }, + // }); + // } }, uploadAndSendFile(filePath, type) { diff --git a/subPackages/doctor/doctor-userinfo.vue b/subPackages/doctor/doctor-userinfo.vue index 67fd0c5..cd45e74 100644 --- a/subPackages/doctor/doctor-userinfo.vue +++ b/subPackages/doctor/doctor-userinfo.vue @@ -521,12 +521,18 @@ export default { // const storeId = ((this.registerType === '3' || this.registerType == '2') && this.delegateStoreId) // ? this.delegateStoreId // : (uni.getStorageSync('store_id') || '11001'); + const originStoreId = uni.getStorageSync('store_id') || ''; + const shouldSendOriginStoreId = + this.registerType === '2' || + this.registerType === '3' || + (this.registerType !== '0' && !!this.delegateStoreId); registe({ method: "post", data: { user_id: uni.getStorageSync('user_id'), user_patient_id: this.actived, store_id: storeId, + origin_store_id: shouldSendOriginStoreId ? originStoreId : 0, service_user_id: this.Did, register_type: this.registerType // 新增:挂号类型参数 } diff --git a/subPackages/my/my-drug/drug-info.vue b/subPackages/my/my-drug/drug-info.vue index 0995876..a458057 100644 --- a/subPackages/my/my-drug/drug-info.vue +++ b/subPackages/my/my-drug/drug-info.vue @@ -75,9 +75,15 @@ - {{item.drug_name}}{{item.drug.function}} - - {{item.drug.usage}} + + {{ item.drug_name }} + {{ item.drug.specification }} + {{ item.drug.function }} + + + {{ item.drug.usage }} @@ -624,8 +630,8 @@ export default { }).then((res) => { if (res.data && (res.data.code == 0 || res.data.errcode == 0)) { const data = res.data.data || res.data.result || {}; - // 假设 status = 2 表示审核通过 - this.prescriptionStatus = data.status === true || data.status === 2 || data.status == 2; + const ps = data.prescription_status ?? data.status; + this.prescriptionStatus = data.status === true || ps === 1 || ps === '1' || ps === 3 || ps === '3' || ps === 4 || ps === '4'; } else { this.prescriptionStatus = false; } @@ -658,8 +664,6 @@ export default { onShow() { this.getInfo() this.getList() - // 查询处方状态 - this.getPrescriptionStatus() }, onUnload() { uni.removeStorageSync('userWay_order_id') @@ -902,6 +906,13 @@ export default { text-overflow: ellipsis; overflow: hidden; margin-bottom: 20rpx; + + .drug-spec { + font-size: 24rpx; + color: #999; + margin-left: 10rpx; + font-weight: normal; + } } .it_info { diff --git a/subPackages/my/myinfo-add.vue b/subPackages/my/myinfo-add.vue index 8f33469..6b6d5d9 100644 --- a/subPackages/my/myinfo-add.vue +++ b/subPackages/my/myinfo-add.vue @@ -64,6 +64,53 @@ + + + 监护人信息 + + 填写方式 + + 选择已有就诊人 + 填写监护人信息 + + + + 监护人 + + + + + + + + @@ -218,6 +265,7 @@ diff --git a/subPackages/my/myinfo-edit.vue b/subPackages/my/myinfo-edit.vue index 5923779..8692ac3 100644 --- a/subPackages/my/myinfo-edit.vue +++ b/subPackages/my/myinfo-edit.vue @@ -10,13 +10,13 @@ 姓名 - 身份证号 - @@ -53,6 +53,53 @@ + + + 监护人信息 + + 填写方式 + + 选择已有就诊人 + 填写监护人信息 + + + + 监护人 + + + + + + + + @@ -194,6 +241,7 @@ import { userAdd, userEidtPatient, + userGuardianInfo, userList, userRelation } from '../../request/api/api'; @@ -347,12 +395,39 @@ person_history: [], family_history: [], heathList: [], // 健康信息 + guardianType: '1', + guardianPatientName: '', + guardianUserPatientId: 0, + guardianRelations: '', + guardianRelation: '', + showGuardianPatient: false, + showGuardianRelat: false, + allPatientList: [], + guardianForm: { + name: '', + idCard: '', + mobile: '', + }, } }, + computed: { + showGuardianSection() { + const age = Number(this.form.age); + return this.form.age !== '' && !isNaN(age) && age <= 6; + }, + guardianPickerList() { + const currentId = Number(this.addid) || 0; + return this.allPatientList + .filter((item) => Number(item.id) !== currentId) + .map((item) => ({ + text: `${item.name}(${item.age}岁)`, + key: item.id, + })); + }, + }, onLoad(e) { - // console.log(e); this.id = e.id - this.getAction() + this.getAction() }, watch: { // 默认就诊人 @@ -507,7 +582,10 @@ 1 : 0); this.form.sex = sex; this.form.age = age; - this.sex = org_gender; + this.sex = org_gender % 2 == 1 ? 1 : 2; + if (age > 6) { + this.resetGuardian(); + } } else { this.form.sex = ""; return false; @@ -522,10 +600,10 @@ store_id: uni.getStorageSync('store_id') || '11001', } }).then((res) => { - // console.log(res, 'relation'); if (res.data.errcode == 0) { this.actionSheetList = res.data.data } + this.getInfolist() }) }, @@ -538,14 +616,12 @@ store_id: uni.getStorageSync('store_id') || '11001', } }).then((res) => { - // console.log(res, 'info'); - if (res.data.errcode == 0) { - that.infoList = res.data.data.filter((item) => item.id == that.id) + that.allPatientList = res.data.data || []; + that.infoList = that.allPatientList.filter((item) => item.id == that.id) that.actived = that.infoList[0].id; that.names = that.infoList[0].name - // that.relations = that.infoList[0].relations that.phone = that.infoList[0].mobile that.form.sex = (that.infoList[0].sex) % 2 == 0 ? '女' : '男' that.form.age = that.infoList[0].age @@ -554,40 +630,225 @@ that.actionSheetCallback(that.infoList[0].relation) that.getHeath() + that.loadGuardianInfo() } }) }, + loadGuardianInfo() { + if (!this.showGuardianSection) { + return; + } + userGuardianInfo({ + user_patient_id: this.addid, + }).then((res) => { + if (!(res.data.code === 0 || res.data.errcode == 0)) { + return; + } + const info = res.data.result || res.data.data || {}; + if (!info.guardian_type) { + return; + } + this.guardianType = String(info.guardian_type); + if (this.guardianType == '1') { + this.guardianUserPatientId = info.guardian_user_patient_id; + if (info.guardian_patient_preview) { + this.guardianPatientName = `${info.guardian_patient_preview.name}(${info.guardian_patient_preview.age}岁)`; + } + } else { + this.guardianForm.name = info.guardian_name || ''; + this.guardianForm.idCard = info.guardian_id_card || ''; + this.guardianForm.mobile = info.guardian_mobile || ''; + this.guardianRelation = info.guardian_relation; + const relationItem = this.actionSheetList.find((item) => item.key == info.guardian_relation); + if (relationItem) { + this.guardianRelations = relationItem.text; + } + } + }); + }, + resetGuardian() { + this.guardianType = '1'; + this.guardianPatientName = ''; + this.guardianUserPatientId = 0; + this.guardianRelations = ''; + this.guardianRelation = ''; + this.guardianForm = { + name: '', + idCard: '', + mobile: '', + }; + }, + onGuardianTypeChange() { + this.guardianPatientName = ''; + this.guardianUserPatientId = 0; + this.guardianRelations = ''; + this.guardianRelation = ''; + this.guardianForm = { + name: '', + idCard: '', + mobile: '', + }; + }, + guardianPatientCallback(index) { + const item = this.guardianPickerList[index]; + if (!item) { + return; + } + this.guardianPatientName = item.text; + this.guardianUserPatientId = item.key; + }, + guardianRelationCallback(index) { + this.guardianRelations = this.actionSheetList[index].text; + this.guardianRelation = this.actionSheetList[index].key; + }, + isAgeInRange(age) { + const n = Number(age); + return age !== '' && !isNaN(n) && n >= 1 && n <= 200; + }, + calcAgeFromIdCard(idCard) { + const reg = + /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + if (!reg.test(idCard)) { + return false; + } + const orgBirthday = idCard.substring(6, 14); + const birthday = + orgBirthday.substring(0, 4) + + '-' + + orgBirthday.substring(4, 6) + + '-' + + orgBirthday.substring(6, 8); + const birthdays = new Date(birthday.replace(/-/g, '/')); + const d = new Date(); + return ( + d.getFullYear() - + birthdays.getFullYear() - + (d.getMonth() < birthdays.getMonth() || + (d.getMonth() === birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? + 1 : + 0) + ); + }, + validatePatientAge() { + if (!this.isAgeInRange(this.form.age)) { + uni.showToast({ + title: '就诊人年龄需在1-200岁之间', + icon: 'none', + }); + return false; + } + return true; + }, + validateGuardian() { + if (!this.showGuardianSection) { + return true; + } + if (this.guardianType == '1') { + if (!this.guardianUserPatientId) { + uni.showToast({ + title: '请选择监护人就诊人', + icon: 'none', + }); + return false; + } + const guardianPatient = this.allPatientList.find( + (item) => Number(item.id) === Number(this.guardianUserPatientId) + ); + if (guardianPatient && !this.isAgeInRange(guardianPatient.age)) { + uni.showToast({ + title: '监护人年龄需在1-200岁之间', + icon: 'none', + }); + return false; + } + return true; + } + if (!this.guardianForm.name || !this.guardianForm.idCard || !this.guardianForm.mobile) { + uni.showToast({ + title: '请填写完整监护人信息', + icon: 'none', + }); + return false; + } + if (!/^\d{11}$/.test(this.guardianForm.mobile)) { + uni.showToast({ + title: '监护人手机号格式不正确', + icon: 'none', + }); + return false; + } + const guardianAge = this.calcAgeFromIdCard(this.guardianForm.idCard); + if (guardianAge === false) { + uni.showToast({ + title: '监护人身份证无效', + icon: 'none', + }); + return false; + } + if (!this.isAgeInRange(guardianAge)) { + uni.showToast({ + title: '监护人年龄需在1-200岁之间', + icon: 'none', + }); + return false; + } + return true; + }, + buildGuardianPayload(data) { + if (!this.showGuardianSection) { + return data; + } + data.guardian_type = Number(this.guardianType); + if (this.guardianType == '1') { + data.guardian_user_patient_id = this.guardianUserPatientId; + } else { + data.guardian_name = this.guardianForm.name; + data.guardian_id_card = this.guardianForm.idCard; + data.guardian_mobile = this.guardianForm.mobile; + data.guardian_relation = this.guardianRelation; + } + return data; + }, + isSaveSuccess(res) { + return res.data.code === 0 || res.data.errcode == 0; + }, + getSaveErrorMsg(res) { + return res.data.message || res.data.msg || '保存失败'; + }, // 添加就诊人 getAdduser() { + if (!this.validatePatientAge() || !this.validateGuardian()) { + return; + } + const payload = this.buildGuardianPayload({ + store_id: uni.getStorageSync('store_id') || '11001', + id: this.addid, + name: this.names, + id_card: this.form.identityCardNo, + sex: (this.form.sex) == '女' ? '2' : '1', + age: this.form.age, + mobile: this.phone, + relation: this.relation, + is_visit: this.isVisit == '是' ? '1' : '0', + liver_function: this.liver == '正常' ? '0' : '1', + renal_function: this.renal == '正常' ? '0' : '1', + allergic_status: this.allergic == '无' ? '0' : '1', + person_status: this.person == '无' ? '0' : '1', + family_status: this.family == '无' ? '0' : '1', + allergic_history: this.allergic_history, + person_history: this.person_history, + family_history: this.family_history, + }); userAdd({ method: "post", - data: { - store_id: uni.getStorageSync('store_id') || '11001', - id: this.addid, - name: this.names, - id_card: this.form.identityCardNo, - sex: (this.form.sex) == '女' ? '2' : '1', - age: this.form.age, - mobile: this.phone, - relation: this.relation, - is_visit: this.isVisit == '是' ? '1' : '0', - liver_function: this.liver == '正常' ? '0' : '1', - renal_function: this.renal == '正常' ? '0' : '1', - allergic_status: this.allergic == '无' ? '0' : '1', - person_status: this.person == '无' ? '0' : '1', - family_status: this.family == '无' ? '0' : '1', - allergic_history: this.allergic_history, - person_history: this.person_history, - family_history: this.family_history, - } + data: payload, }) .then((res) => { - console.log(res, 'res'); - if (res.data.errcode == 0) { + if (this.isSaveSuccess(res)) { uni.showToast({ - title: "添加成功", + title: "保存成功", duration: 1500, icon: "success", mask: false @@ -599,15 +860,9 @@ }); }, 400) - } else if (res.data.errcode != 0) { - // uni.showToast({ - // title: res.data.msg, - // icon: "error", - // duration: 1500, - // mask: false - // }) + } else { this.$refs.uToast.show({ - title: res.data.msg, + title: this.getSaveErrorMsg(res), type: 'default', icon: false }) @@ -675,9 +930,6 @@ }) } }, - mounted() { - this.getInfolist() - } } diff --git a/subPackages/my/myinfo.vue b/subPackages/my/myinfo.vue index 9295546..dd761ad 100644 --- a/subPackages/my/myinfo.vue +++ b/subPackages/my/myinfo.vue @@ -24,13 +24,14 @@ [{{item.text}}] 默认 - - 编辑 + + 编辑 + 删除 - {{item.id_card.replace(/(\w{6})\w*(\w{4})/,'$1********$2')}} - {{item.mobile.replace(/(\d{3})\d*(\d{4})/, '$1****$2')}} + {{item.id_card_tm || item.id_card}} + {{item.mobile_tm || item.mobile}} @@ -66,6 +67,7 @@ import { userList, userPatientChoose, + userPatientDel, userRelation } from '../../request/api/api' export default { @@ -142,6 +144,45 @@ }) }, + confirmDelete(id, name) { + uni.showModal({ + title: '确认删除', + content: `删除后「${name}」的就诊人信息将无法恢复,是否继续?`, + confirmText: '确认删除', + cancelText: '取消', + success: (res) => { + if (res.confirm) { + this.deletePatient(id); + } + }, + }); + }, + + deletePatient(id) { + userPatientDel({ + method: 'post', + data: { + id, + store_id: uni.getStorageSync('store_id') || '11001', + }, + }).then((res) => { + if (res.data.code === 0 || res.data.errcode == 0) { + uni.showToast({ + title: '删除成功', + icon: 'success', + duration: 1500, + }); + this.getInfolist(); + } else { + uni.showToast({ + title: res.data.message || res.data.msg || '删除失败', + icon: 'none', + duration: 1500, + }); + } + }); + }, + // 默认就诊人 choose(e) { userPatientChoose({ @@ -307,11 +348,23 @@ } } - .info_sex { + .info_actions { + display: flex; + align-items: center; + gap: 24rpx; + } + + .info_action_edit { color: #1777FF; font-size: 28rpx; font-weight: 400; } + + .info_action_del { + color: #EF4444; + font-size: 28rpx; + font-weight: 400; + } } .info_list_bottom { diff --git a/subPackages/my/myrecord-detail.vue b/subPackages/my/myrecord-detail.vue index b247456..e5fb303 100644 --- a/subPackages/my/myrecord-detail.vue +++ b/subPackages/my/myrecord-detail.vue @@ -69,7 +69,7 @@ 电话: - {{infoList.patient.mobile}} + {{infoList.patient.mobile_tm || infoList.patient.mobile}} @@ -82,6 +82,26 @@ + + + + 中医证候: + {{ data.online_tcm_print.tcm_syndrome }} + + + + + 中医治法: + {{ data.online_tcm_print.tcm_method }} + + + + + 中医疾病: + {{ data.online_tcm_print.tcm_disease }} + + + @@ -115,13 +135,14 @@ - + - {{ it.content.drug_name}} + {{ (it.content && it.content.drug_name) || '' }} {{ it.content.specification }} + v-if="it.content && it.content.specification" + class="drug-spec">{{ it.content.specification }} x{{ it.number}} @@ -246,7 +267,7 @@ 电话: - {{infoList.patient.mobile}} + {{infoList.patient.mobile_tm || infoList.patient.mobile}} 开具日期: @@ -258,6 +279,50 @@ + + + Rp + + + + + + + {{ it.name}} + [{{useWay[it.order]}}] + + {{ it.number }}{{it.unit?it.unit.name:'g'}} + + + + + 用法:煎服,每天 {{item.consumption}} 次 , + {{' 每次 '+item.volume+' ml '}} , + 共 {{item.dosage}} 剂 + + + + + + + + + + {{ (it.content && it.content.drug_name) || '' }} + {{ it.content.specification }} + + x{{ it.number}} + + + 用法:{{ it.instruction }} + + + + + + 您的处方正在审核中 @@ -378,6 +443,25 @@ url: "/subPackages/my/record-pay?id=" + this.data.id }) }, + normalizeRepice(list) { + return (list || []).map((it) => { + let content = it.content + if (typeof content === 'string') { + try { + content = JSON.parse(content || '{}') + } catch (e) { + content = {} + } + } + if (!content || typeof content !== 'object' || Array.isArray(content)) { + content = Array.isArray(content) ? content : {} + } + return { + ...it, + content, + } + }) + }, getInfo() { getPrescriptInfo({ method: "post", @@ -389,7 +473,9 @@ // console.log(res, 'deta'); if (res.data.errcode === 0) { - this.infoList = res.data.data.content + const content = res.data.data.content + content.repice = this.normalizeRepice(content.repice) + this.infoList = content this.rpList = res.data.data.pharmacistInfo this.status = res.data.data.status this.data = res.data.data @@ -657,6 +743,12 @@ display: flex; justify-content: space-between; align-items: center; + + .drug-spec { + font-size: 24rpx; + color: #999; + margin-left: 10rpx; + } } .details { diff --git a/subPackages/my/record-pay.vue b/subPackages/my/record-pay.vue index ab9da86..b386cdb 100644 --- a/subPackages/my/record-pay.vue +++ b/subPackages/my/record-pay.vue @@ -100,6 +100,13 @@ {{item.content.usage}} + + 查看说明书 + ¥{{item.total_price}} @@ -198,6 +205,7 @@ } from '../../request/api/api' // 导入 getOrderTextApi 接口方法 import { getOrderTextApi } from '../../request/api/product' + import { getPrescriptionStatusApi } from '../../request/api/order' export default { data() { @@ -266,7 +274,8 @@ color: '#111000', fontWeight: '540', fontSize: '33rpx' - } + }, + prescriptionStatus: false, } }, onLoad(e) { @@ -496,9 +505,36 @@ this.isshow = true } } + this.getPrescriptionStatus() } }) }, + getPrescriptionStatus() { + if (!this.order_id) { + return + } + getPrescriptionStatusApi({ + order_id: this.order_id + }).then((res) => { + if (res.data && (res.data.code == 0 || res.data.errcode == 0)) { + const data = res.data.data || res.data.result || {} + const ps = data.prescription_status ?? data.status + this.prescriptionStatus = data.status === true || ps === 1 || ps === '1' || ps === 3 || ps === '3' || ps === 4 || ps === '4' + } else { + this.prescriptionStatus = false + } + }).catch(() => { + this.prescriptionStatus = false + }) + }, + previewInstruction(instructionImage) { + if (instructionImage) { + uni.previewImage({ + urls: [instructionImage], + current: instructionImage + }) + } + }, // 代煎费 getServe() { getUseWayPay({ @@ -915,6 +951,26 @@ margin-bottom: 20rpx; } + .instruction-btn { + margin-top: 16rpx; + margin-bottom: 16rpx; + padding: 12rpx 24rpx; + background: #ECF5FF; + border-radius: 8rpx; + display: inline-flex; + align-items: center; + justify-content: center; + + text { + font-size: 26rpx; + color: #2B85E4; + } + + &:active { + opacity: 0.7; + } + } + .it_price { display: flex; align-items: center; diff --git a/subPackages/product/symptoms.vue b/subPackages/product/symptoms.vue index 4866756..000503d 100644 --- a/subPackages/product/symptoms.vue +++ b/subPackages/product/symptoms.vue @@ -61,6 +61,10 @@ 批准文号 {{ productDetail.guozi_no }} + + 厂家 + {{ manufacturerName }} + @@ -78,7 +82,7 @@ - + @@ -262,7 +266,8 @@ export default { bar_code: '', indications: '', indications_array: [], - compliance_tip: '' // 合规提示文案,由后端返回 + compliance_tip: '', // 合规提示文案,由后端返回 + supplier: null }, formData: { id: '', @@ -298,6 +303,14 @@ export default { // 合规提示文案 - 从后端返回的 compliance_tip 字段获取 complianceTip() { return this.productDetail.compliance_tip || ''; + }, + manufacturerName() { + return (this.productDetail.supplier && this.productDetail.supplier.name) || ''; + }, + showFunctionSection() { + if (this.productDetail.category_type === 'health_food') return false; + if (this.productDetail.type == 2 && this.productDetail.is_otc === 0) return false; + return true; } }, onLoad(options) { diff --git a/subPackages/register/register-info.vue b/subPackages/register/register-info.vue index 3374a03..47f0f35 100644 --- a/subPackages/register/register-info.vue +++ b/subPackages/register/register-info.vue @@ -125,7 +125,7 @@ 身份证号 - {{registList.idcard.replace(/(\w{6})\w*(\w{4})/,'$1********$2')}} + {{registList.idcard_tm || registList.idcard}} @@ -133,7 +133,7 @@ 手机号 - {{registList.mobile.replace(/(\d{3})\d*(\d{4})/, '$1****$2')}} + {{registList.mobile_tm || registList.mobile}} diff --git a/subPackages/register/register.vue b/subPackages/register/register.vue index a3d00eb..ad1fe06 100644 --- a/subPackages/register/register.vue +++ b/subPackages/register/register.vue @@ -86,7 +86,7 @@ 身份证号 - {{registList.idcard.replace(/(\w{6})\w*(\w{4})/,'$1********$2')}} + {{registList.idcard_tm || registList.idcard}} @@ -94,7 +94,7 @@ 手机号 - {{registList.mobile.replace(/(\d{3})\d*(\d{4})/, '$1****$2')}} + {{registList.mobile_tm || registList.mobile}} diff --git a/subPackages/setup/area-list.vue b/subPackages/setup/area-list.vue index e64fd82..2d187dd 100644 --- a/subPackages/setup/area-list.vue +++ b/subPackages/setup/area-list.vue @@ -16,7 +16,7 @@ 收货信息 - {{ item.name }} {{ item.mobile }} + {{ item.name }} {{ item.mobile_tm || item.mobile }} {{ item.region }}{{ item.detail_address }} diff --git a/subPackages/shop/logistics.vue b/subPackages/shop/logistics.vue index cc51e5c..8af6a5c 100644 --- a/subPackages/shop/logistics.vue +++ b/subPackages/shop/logistics.vue @@ -5,7 +5,7 @@ - {{logisticsList.express_name}} {{logisticsList.express_mobile}} + {{logisticsList.express_name}} {{logisticsList.express_mobile_tm || logisticsList.express_mobile}} {{logisticsList.express_region}}{{logisticsList.express_address}} diff --git a/subPackages/shop/paied-detail.vue b/subPackages/shop/paied-detail.vue index f617186..f29c221 100644 --- a/subPackages/shop/paied-detail.vue +++ b/subPackages/shop/paied-detail.vue @@ -20,7 +20,7 @@ 收货地址 - {{orderDetailList.express_name}} {{orderDetailList.express_mobile}} + {{orderDetailList.express_name}} {{orderDetailList.express_mobile_tm || orderDetailList.express_mobile}} {{orderDetailList.express_region}}{{orderDetailList.express_address}} diff --git a/subPackages/shop/shop-pay.vue b/subPackages/shop/shop-pay.vue index 4d9b57a..1656d5d 100644 --- a/subPackages/shop/shop-pay.vue +++ b/subPackages/shop/shop-pay.vue @@ -13,7 +13,7 @@ 收货地址 - {{addList[0].name}} {{addList[0].mobile}} + {{addList[0].name}} {{addList[0].mobile_tm || addList[0].mobile}} {{addList[0].region}}{{addList[0].detail_address}} diff --git a/utils/image-compress-modal.js b/utils/image-compress-modal.js new file mode 100644 index 0000000..2652de6 --- /dev/null +++ b/utils/image-compress-modal.js @@ -0,0 +1,23 @@ +let popupInstance = null; + +export function registerImageCompressPopup(instance) { + popupInstance = instance; +} + +export function openImageCompressModal({ path, size }) { + if (!popupInstance || typeof popupInstance.open !== 'function') { + console.warn('image-compress-popup 未注册,将直接使用原图'); + return Promise.resolve({ + path, + size, + usedCompress: false, + }); + } + + return popupInstance.open({ path, size }).then((result) => { + if (!result) { + return null; + } + return result; + }); +} diff --git a/utils/image-compress.js b/utils/image-compress.js new file mode 100644 index 0000000..6e77943 --- /dev/null +++ b/utils/image-compress.js @@ -0,0 +1,95 @@ +import { openImageCompressModal } from '@/utils/image-compress-modal.js'; + +export const IMAGE_COMPRESS_THRESHOLD = 1 * 1024 * 1024; + +export function formatFileSize(bytes) { + if (bytes === 0) return '0 B'; + const k = 1024; + const sizes = ['B', 'KB', 'MB', 'GB']; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + const value = bytes / k ** i; + return `${Number.parseFloat(value.toFixed(2))} ${sizes[i]}`; +} + +/** 压缩节省比例文案,如「(约节省 42%)」 */ +export function formatSavingsPercent(originalBytes, compressedBytes) { + if (originalBytes <= 0 || compressedBytes >= originalBytes) { + return ''; + } + const percent = Math.round( + ((originalBytes - compressedBytes) / originalBytes) * 100, + ); + return percent > 0 ? `(约节省 ${percent}%)` : ''; +} + +function getFileInfo(filePath) { + return new Promise((resolve, reject) => { + uni.getFileInfo({ + filePath, + success: resolve, + fail: reject, + }); + }); +} + +export function compressImagePath(src, quality) { + return new Promise((resolve, reject) => { + uni.compressImage({ + src, + quality, + success: async (res) => { + try { + const info = await getFileInfo(res.tempFilePath); + resolve({ + path: res.tempFilePath, + size: info.size, + }); + } catch (error) { + reject(error); + } + }, + fail: reject, + }); + }); +} + +export async function tryCompressImage( + src, + qualities = [80, 60, 40], + onProgress, +) { + let result = null; + for (const quality of qualities) { + onProgress && onProgress(quality); + result = await compressImagePath(src, quality); + if (result.size <= IMAGE_COMPRESS_THRESHOLD) { + break; + } + } + return result; +} + +export function isGifPath(path) { + return /\.gif$/i.test(path || ''); +} + +export async function prepareImagePath({ path, size }) { + if (size <= IMAGE_COMPRESS_THRESHOLD) { + return { + path, + size, + usedCompress: false, + }; + } + + const result = await openImageCompressModal({ path, size }); + if (!result) { + return null; + } + + return { + path: result.path, + size: result.size, + usedCompress: !!result.usedCompress, + }; +} diff --git a/utils/utils.js b/utils/utils.js index 62c7394..d0b9d95 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -6,8 +6,8 @@ export function checkDev(key = '') { // 判断某些模块是否开启 switch (key) { case 'dev': - return false; - // return true; + // return false; + return true; case 'open-im': // return false; return true;