From 206f0aaa508fdd6d3ab599af544ffd042018f654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Sun, 9 Aug 2026 14:36:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.=20=E5=8C=BB=E7=94=9F=E7=BA=BF?= =?UTF-8?q?=E4=B8=8B=E6=8E=A5=E8=AF=8A=E5=88=9B=E5=BB=BA=E5=B0=B1=E8=AF=8A?= =?UTF-8?q?=E4=BA=BA=E3=80=81=E6=82=A3=E8=80=85=E7=AB=AF=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E8=AE=A4=E9=A2=86=E5=B0=B1=E8=AF=8A=E4=BA=BA=202.=20=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=A4=84=E6=96=B9=E5=90=8E=E5=8C=BB=E7=94=9F=E4=BB=A3?= =?UTF-8?q?=E4=BB=98=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 92 +++++++---- .../claim-patient-modal.vue | 147 ++++++++++++++++++ .../proxy-pay-confirm-modal.vue | 83 ++++++++++ pages.json | 2 + pages/home/home.vue | 32 +++- pages/home/index.vue | 30 +++- request/api/api.js | 58 ++++--- request/api/patient.js | 5 + subPackages/my/my-drug/drug-info.vue | 72 ++++----- subPackages/my/record-pay.vue | 139 +++++++++++++---- .../components/RegisterConfirmStep.vue | 13 +- subPackages/register/register-info.vue | 4 +- 12 files changed, 558 insertions(+), 119 deletions(-) create mode 100644 components/claim-patient-modal/claim-patient-modal.vue create mode 100644 components/proxy-pay-confirm-modal/proxy-pay-confirm-modal.vue diff --git a/App.vue b/App.vue index af455c4..ca2ce57 100644 --- a/App.vue +++ b/App.vue @@ -15,6 +15,7 @@ silentLogin().then((loginResult) => { if (loginResult.success) { + this.tryHandlePendingSceneActions() } else { console.error('静默登录失败:', loginResult.message); } @@ -158,22 +159,28 @@ if (e === undefined) return {}; - const scene = decodeURIComponent(e.query.scene) + const rawScene = e.query && e.query.scene + ? decodeURIComponent(e.query.scene) + : '' // 这里接收扫码参数 - if (scene) { + if (rawScene) { + // 就诊人认领:cup={user_patient_id} + this.parseClaimPatientScene(rawScene) + // 医生代支付:ppay={order_id} + this.parseProxyPayScene(rawScene) + // 判断scene中是否包含sal_id - let isSalespersonId = decodeURIComponent(e.query.scene).includes('sal_id'); - const scene = decodeURIComponent(e.query.scene).split('STORE_QR_CODE_') + let isSalespersonId = rawScene.includes('sal_id'); + const scene = rawScene.split('STORE_QR_CODE_') if (scene[1]) { uni.setStorageSync('stores_id', scene[1]) uni.setStorageSync('store_id', scene[1]) } - // uni.setStorageSync('stores_id', scene[1]) - const st_id = decodeURIComponent(e.query.scene).split('&') - let store_id = decodeURIComponent(e.query.scene).split('STORE_QR_CODE_') - store_id = decodeURIComponent(store_id[1]).split('&') - const doctors_id = decodeURIComponent(e.query.scene).split('=') - if (store_id[0] !== 'undefined') { + const st_id = rawScene.split('&') + let store_id = rawScene.split('STORE_QR_CODE_') + store_id = decodeURIComponent(store_id[1] || '').split('&') + const doctors_id = rawScene.split('=') + if (store_id[0] && store_id[0] !== 'undefined') { uni.setStorageSync('stores_id', store_id[0]) uni.setStorageSync('store_id', store_id[0]) } @@ -192,25 +199,9 @@ console.log('userId', userId, st_id[0].split('su_id=')[1], res); }) } - // 5.3 处理门店切换/设置 - // const storeId = uni.getStorageSync('store_id'); - // if (storeId) { - // storeChange({ - // method: "post", - // data: { - // store_id: storeId - // } - // }).catch((err) => { - // console.error('切换门店失败:', err); - // }); - // } else { - // uni.setStorageSync('store_id', res.data.data.data.store_id); - // } - // console.log(st_id, '4444111111111'); - // console.log(scene, '4444'); } - // const scene = decodeURIComponent(e.query.scene).split('STORE_QR_CODE_') - // console.log(scene, '11111'); + // 登录后触发认领弹窗 / 代付跳转 + this.tryHandlePendingSceneActions() }, onHide: function() { // console.log('App Hide') @@ -221,6 +212,51 @@ // uni.removeStorageSync('token') }, methods: { + /** + * 解析就诊人认领 scene:cup=123 或 up_id=123 + */ + parseClaimPatientScene(rawScene) { + const cupMatch = String(rawScene).match(/(?:^|&)cup=(\d+)/) + const upMatch = String(rawScene).match(/(?:^|&)up_id=(\d+)/) + const id = Number((cupMatch && cupMatch[1]) || (upMatch && upMatch[1]) || 0) + if (id > 0) { + uni.setStorageSync('claim_user_patient_id', id) + } + }, + /** + * 解析医生代支付 scene:ppay=订单ID + * 新扫码时重置「已确认」标记,以便重新弹出确认框 + */ + parseProxyPayScene(rawScene) { + const match = String(rawScene).match(/(?:^|&)ppay=(\d+)/) + const orderId = Number((match && match[1]) || 0) + if (orderId > 0) { + uni.setStorageSync('proxy_pay_order_id', orderId) + uni.removeStorageSync('proxy_pay_confirmed') + } + }, + /** + * 登录后:弹出认领模态 / 代付确认模态(不再直接跳转代付页) + */ + tryHandlePendingSceneActions() { + const token = uni.getStorageSync('token') + if (!token) return + const claimId = Number(uni.getStorageSync('claim_user_patient_id') || 0) + if (claimId > 0) { + // 通知首页等挂载了认领弹窗的页面打开 + setTimeout(() => { + uni.$emit('open-claim-patient-modal') + }, 400) + } + const proxyOrderId = Number(uni.getStorageSync('proxy_pay_order_id') || 0) + const proxyConfirmed = Number(uni.getStorageSync('proxy_pay_confirmed') || 0) === 1 + // 有代付扫码且尚未确认:弹确认框;已确认过则不自动跳(避免反复打断) + if (proxyOrderId > 0 && !proxyConfirmed) { + setTimeout(() => { + uni.$emit('open-proxy-pay-confirm-modal') + }, 500) + } + }, initWebSocket() { webSocketManager.connect(); diff --git a/components/claim-patient-modal/claim-patient-modal.vue b/components/claim-patient-modal/claim-patient-modal.vue new file mode 100644 index 0000000..467aa83 --- /dev/null +++ b/components/claim-patient-modal/claim-patient-modal.vue @@ -0,0 +1,147 @@ + + + diff --git a/components/proxy-pay-confirm-modal/proxy-pay-confirm-modal.vue b/components/proxy-pay-confirm-modal/proxy-pay-confirm-modal.vue new file mode 100644 index 0000000..16ba49a --- /dev/null +++ b/components/proxy-pay-confirm-modal/proxy-pay-confirm-modal.vue @@ -0,0 +1,83 @@ + + + diff --git a/pages.json b/pages.json index f4627d4..c2c409e 100644 --- a/pages.json +++ b/pages.json @@ -7,6 +7,8 @@ "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue", // 消息通知组件 "^MessageNotification": "@/components/MessageNotification/MessageNotification.vue", + "^ClaimPatientModal$": "@/components/claim-patient-modal/claim-patient-modal.vue", + "^ProxyPayConfirmModal$": "@/components/proxy-pay-confirm-modal/proxy-pay-confirm-modal.vue", "^FollowUpDrugDrawer$": "@/subPackages/doctor/components/FollowUpDrugDrawer.vue", // 列表骨架屏(分包组件,主包页需配合 componentPlaceholder) "^ListSkeleton$": "@/subPackages/common/components/ListSkeleton.vue", diff --git a/pages/home/home.vue b/pages/home/home.vue index 5ce3641..df655a4 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -2,6 +2,8 @@ + + @@ -330,6 +332,8 @@ import { getSpecialPrescriptionHomeApi } from '@/request/api/specialPrescription import { fetchUnpaidRegisterListApi } from '@/request/api/register'; import request from "@/request/api/request"; import MessageNotification from "@/components/MessageNotification/MessageNotification.vue"; +import ClaimPatientModal from "@/components/claim-patient-modal/claim-patient-modal.vue"; +import ProxyPayConfirmModal from "@/components/proxy-pay-confirm-modal/proxy-pay-confirm-modal.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'; @@ -338,6 +342,8 @@ import {silentLogin} from "@/utils/login"; export default { components: { MessageNotification, + ClaimPatientModal, + ProxyPayConfirmModal, ImageCompressPopup, }, data() { @@ -931,7 +937,21 @@ export default { } catch (error) { console.error('获取默认医生ID失败:', error); } - } + }, + /** 打开扫码认领就诊人弹窗 */ + openClaimPatientModal() { + const modal = this.$refs.claimPatientModal; + if (modal && modal.openFromStorage) { + modal.openFromStorage(); + } + }, + /** 打开医生代付确认弹窗 */ + openProxyPayConfirmModal() { + const modal = this.$refs.proxyPayConfirmModal; + if (modal && modal.openFromStorage) { + modal.openFromStorage(); + } + }, }, onShow() { this.storeId = uni.getStorageSync('store_id'); @@ -945,6 +965,16 @@ export default { this.getDefaultDoctorId(); this.fetchUnpaidCounts(); this.fetchSpecialPrescriptionHome(); + this.openClaimPatientModal(); + this.openProxyPayConfirmModal(); + }, + mounted() { + uni.$on('open-claim-patient-modal', this.openClaimPatientModal); + uni.$on('open-proxy-pay-confirm-modal', this.openProxyPayConfirmModal); + }, + onUnload() { + uni.$off('open-claim-patient-modal', this.openClaimPatientModal); + uni.$off('open-proxy-pay-confirm-modal', this.openProxyPayConfirmModal); }, } diff --git a/pages/home/index.vue b/pages/home/index.vue index a02d802..1e94020 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -1,6 +1,8 @@