diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/ConfirmShipAddressBeforeSendModal.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/ConfirmShipAddressBeforeSendModal.vue new file mode 100644 index 00000000..249f7b2c --- /dev/null +++ b/apps/web-antd/src/views/doctor/doctor-reception/components/ConfirmShipAddressBeforeSendModal.vue @@ -0,0 +1,216 @@ + + + + + + + + 就诊人 + {{ patientName || '—' }} + 由医生创建,请确认收货地址后发送。地址选填,可不填直接发送。 + + + + 当前收货地址 + + + {{ shipText }} + + + + 暂无收货地址(选填)。可一键填入诊所地址,或手动填写后再发送。 + + + 诊所地址:{{ clinicAddressText }} + + + + 使用诊所地址 + + + {{ hasShip ? '修改地址' : '填写地址' }} + + + + + diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/PatientPrescriptionHistoryDrawer.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/PatientPrescriptionHistoryDrawer.vue index ec411a1d..9cad95fb 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/components/PatientPrescriptionHistoryDrawer.vue +++ b/apps/web-antd/src/views/doctor/doctor-reception/components/PatientPrescriptionHistoryDrawer.vue @@ -33,6 +33,8 @@ type DrawerData = { onReuse?: (prescriptionId: number) => void | Promise; /** 点击处方号打开详情 */ onDetail?: (prescriptionId: number) => void; + /** 查看商品订单详情(有 order_id 时) */ + onOrderDetail?: (orderId: number) => void; /** 是否允许撤回(线下接诊) */ allowWithdraw?: boolean; /** 撤回成功后刷新 */ @@ -178,6 +180,20 @@ function handleOpenDetail(row: Record) { message.warning('暂无法打开处方详情'); } +/** 打开商品订单详情(父级挂载 OrderDetail 弹窗) */ +function handleOpenOrderDetail(row: Record) { + const orderId = Number(row.order_id || 0); + if (!orderId) { + message.warning('暂无关联订单'); + return; + } + if (typeof meta.value.onOrderDetail === 'function') { + meta.value.onOrderDetail(orderId); + return; + } + message.warning('暂无法打开订单详情'); +} + async function handleWithdraw(row: Record) { const prescriptionId = Number(row.id || 0); const registerId = Number(row.register_id || meta.value.registerId || 0); @@ -302,8 +318,16 @@ defineExpose({ drawerApi }); 开方时间:{{ row.created_at || '—' }} 金额:¥{{ row.total_pay_price ?? '—' }} - 订单号:{{ row.order_no }} - 订单ID:{{ row.order_id }} + + 订单号: + + {{ row.order_no }} + + + + 查看订单 + { }); return; }; +/** 发送前确认弹窗带回的收货快照,成功页展示用 */ +const pendingShipForSuccess = ref | null>(null); + /** - * 发送处方 + * 发送处方:校验通过后,医生创建就诊人先确认收货地址(选填 / 可一键诊所地址) */ const sendPrescription = () => { if (currentDrugs.value.length === 0) { @@ -1585,6 +1595,29 @@ const sendPrescription = () => { message.error('医嘱不能为空'); return; } + const up = activePatient.value as any; + const upId = Number(up?.id || 0); + const isDoctorCreated = Number(up?.created_by_doctor_id || 0) > 0; + if (isDoctorCreated && upId > 0) { + ConfirmShipAddressBeforeSendModalApi.setData({ + user_patient_id: upId, + patient_name: String(up?.name || ''), + onConfirm: (ship: Record) => { + pendingShipForSuccess.value = ship || {}; + doSendPrescription(); + }, + }); + ConfirmShipAddressBeforeSendModalApi.open(); + return; + } + pendingShipForSuccess.value = null; + doSendPrescription(); +}; + +/** + * 真正调用开方接口(确认地址后或非医生创建就诊人直接走这里) + */ +const doSendPrescription = () => { // 发送处方逻辑 addWestPrescription({ // 当前活动患者的个人信息 @@ -1647,6 +1680,9 @@ const sendPrescription = () => { message.success('处方已发送'); // 处方已提交,重置 AI 关联,避免下一张处方误关联 aiRxGenerationId.value = 0; + const shipText = formatShipAddressCopyText( + pendingShipForSuccess.value || {}, + ); // 先记录本次发送结果(下面会清空诊断/购物车,成功页要用的数据在这里先落住) sentPrescriptionInfo.value = { order_id: Number(res?.order_id || 0), @@ -1655,7 +1691,11 @@ const sendPrescription = () => { is_pay: Number(res?.is_pay || 0), patient_name: activePatient.value?.name || '', diagnosis: diagnosis.value, + // 医生创建就诊人发送前确认过的收货地址(选填时可为空) + ship_address_text: shipText, + has_ship_confirm: pendingShipForSuccess.value !== null, }; + pendingShipForSuccess.value = null; // 有 VIP 时同步保存病历(诊断/医嘱已与处方同源) if (canUseMedicalRecord.value) { try { @@ -1818,15 +1858,44 @@ const [DoctorCreatedPatientModals, DoctorCreatedPatientModalApi] = useVbenModal( }, ); +/** 医生创建就诊人:发送前确认收货地址(选填 / 一键诊所地址) */ +const [ + ConfirmShipAddressBeforeSendModals, + ConfirmShipAddressBeforeSendModalApi, +] = useVbenModal({ + connectedComponent: ConfirmShipAddressBeforeSendModal, +}); + /** 医生代支付码弹窗 */ const [ProxyPayQrcodeModals, ProxyPayQrcodeModalApi] = useVbenModal({ connectedComponent: ProxyPayQrcodeModal, }); +/** 商品订单详情(开方成功 / 处方记录入口,复用订单管理详情弹窗) */ +const [ProductOrderDetailModal, ProductOrderDetailModalApi] = useVbenModal({ + connectedComponent: OrderDetail, +}); const [ApplyPublicAccountPayModals, ApplyPublicAccountPayModalApi] = useVbenModal({ connectedComponent: ApplyPublicAccountPayModal, }); +/** + * 打开商品订单详情 + * 为什么用 NESTED:处方记录是抽屉,详情需盖在抽屉之上 + */ +function openProductOrderDetail(orderId: number) { + const id = Number(orderId || 0); + if (!id) { + message.warning('暂无关联订单'); + return; + } + openOrderPopup( + ProductOrderDetailModalApi, + { id }, + ORDER_POPUP_Z_INDEX.NESTED, + ); +} + // ==================== 常用方弹窗 ==================== const [CommonPrescriptionModals, CommonPrescriptionModalApi] = useVbenModal({ connectedComponent: CommonPrescriptionModal, @@ -3354,6 +3423,8 @@ async function openPatientRxHistoryDrawer() { // 点击处方号打开详情(与医生名片/患者管理一致) onDetail: (prescriptionId: number) => openPrescriptionDetail(prescriptionId), + // 查看关联商品订单详情 + onOrderDetail: (orderId: number) => openProductOrderDetail(orderId), publicAccountPayEnabled: publicAccountPayEnabled.value, publicAccountPayTrigger: publicAccountPayTrigger.value, publicAccountBillMode: publicAccountBillMode.value, @@ -4254,7 +4325,9 @@ function onStoreSelectOpenChange(open: boolean) { + + @@ -5761,13 +5834,25 @@ function onStoreSelectOpenChange(open: boolean) { 处方已发送 已推送到患者微信 · 支付完成后门店按方发药 + + 查看订单 + -处方记录 - + > + 处方记录 + 订单号 - {{ sentPrescriptionInfo?.order_no || '—' }} + + {{ sentPrescriptionInfo?.order_no || '—' }} + + {{ sentPrescriptionInfo?.order_no || '—' }} 患者 {{ sentPrescriptionInfo?.patient_name || '—' }} + + 收货地址 + {{ + sentPrescriptionInfo?.ship_address_text || '未填写' + }} + 诊断 {{ sentPrescriptionInfo.diagnosis }}
+ 就诊人 + {{ patientName || '—' }} + 由医生创建,请确认收货地址后发送。地址选填,可不填直接发送。 +
已推送到患者微信 · 支付完成后门店按方发药