feat:诊所问题优化,气泡卡片优化,修复了导入药品的时候无法打开开方组件并且切换tab的问题
This commit is contained in:
@@ -3,8 +3,9 @@ import { computed, nextTick, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Button, Descriptions, Image, Tabs, Tag, Timeline } from 'ant-design-vue';
|
||||
import { Button, Descriptions, Image, Space, Tabs, Tag, Timeline } from 'ant-design-vue';
|
||||
|
||||
import PrescriptionDetail from '#/views/doctor/doctor-reception/components/PrescriptionDetail.vue';
|
||||
import { getDeliveryWarehouseOrderDetail } from '#/views/system/delivery-warehouse-order/api';
|
||||
|
||||
defineOptions({
|
||||
@@ -25,6 +26,18 @@ const canShip = computed(() => {
|
||||
Number(data.value.status) === 1;
|
||||
return (mineUnsent || legacy) && typeof onShipFn.value === 'function';
|
||||
});
|
||||
|
||||
/** 详情内是否可查看处方:有 p_id 且非商城类订单 */
|
||||
const canViewPrescription = computed(() => {
|
||||
const pId = Number(data.value.p_id ?? 0);
|
||||
const orderType = Number(data.value.order_type ?? 0);
|
||||
return pId > 0 && orderType !== 2 && orderType !== 3;
|
||||
});
|
||||
|
||||
/** 顶部操作栏:有发货或查看处方任一即可显示 */
|
||||
const showToolbar = computed(
|
||||
() => canShip.value || canViewPrescription.value,
|
||||
);
|
||||
/** 仅使用仓侧详情返回的本仓 packages,避免平台物流接口带出他仓商品 */
|
||||
const packageTabs = computed(() => {
|
||||
return Array.isArray(data.value.packages) ? data.value.packages : [];
|
||||
@@ -91,6 +104,21 @@ function handleShip() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 详情内打开处方详情弹窗 */
|
||||
function openPrescriptionDetail() {
|
||||
const pId = Number(data.value.p_id ?? 0);
|
||||
if (!pId) {
|
||||
return;
|
||||
}
|
||||
PrescriptionDetailModalApi.setData({ values: pId });
|
||||
PrescriptionDetailModalApi.open();
|
||||
}
|
||||
|
||||
/** 复用医生端处方详情,详情内自建避免与列表页耦合 */
|
||||
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
|
||||
connectedComponent: PrescriptionDetail,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
@@ -119,9 +147,15 @@ const [Modal, modalApi] = useVbenModal({
|
||||
|
||||
<template>
|
||||
<Modal title="订单详情" class="w-[720px]">
|
||||
<PrescriptionDetailModal />
|
||||
<div class="wh-order-detail space-y-5">
|
||||
<div v-if="canShip" class="flex justify-end">
|
||||
<Button type="primary" @click="handleShip">发货</Button>
|
||||
<div v-if="showToolbar" class="flex justify-end">
|
||||
<Space>
|
||||
<Button v-if="canViewPrescription" @click="openPrescriptionDetail">
|
||||
查看处方
|
||||
</Button>
|
||||
<Button v-if="canShip" type="primary" @click="handleShip">发货</Button>
|
||||
</Space>
|
||||
</div>
|
||||
<section>
|
||||
<h3 class="section-title">收货人信息</h3>
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getDeliveryWarehouseOrderList } from '#/views/system/delivery-warehouse-order/api';
|
||||
import PrescriptionDetail from '#/views/doctor/doctor-reception/components/PrescriptionDetail.vue';
|
||||
|
||||
import DetailModalDemo from './components/detail-modal.vue';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
@@ -63,6 +64,11 @@ const [DetailModal, detailModalApi] = useVbenModal({
|
||||
connectedComponent: DetailModalDemo,
|
||||
});
|
||||
|
||||
/** 复用医生端处方详情弹窗,按 p_id 打开 */
|
||||
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
|
||||
connectedComponent: PrescriptionDetail,
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载当前 Tab 订单卡片列表
|
||||
*/
|
||||
@@ -111,6 +117,26 @@ function wareSend(row: Record<string, any>) {
|
||||
formModalApi.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开处方详情:与商品订单一致,values 传处方主键 p_id
|
||||
* 无处方或商城/非处方单不打开
|
||||
*/
|
||||
function openPrescriptionDetail(row: Record<string, any>) {
|
||||
const pId = Number(row?.p_id ?? 0);
|
||||
if (!pId) {
|
||||
return;
|
||||
}
|
||||
PrescriptionDetailModalApi.setData({ values: pId });
|
||||
PrescriptionDetailModalApi.open();
|
||||
}
|
||||
|
||||
/** 是否展示「查看处方」:有 p_id,且排除商城类 order_type */
|
||||
function canViewPrescription(row: Record<string, any>) {
|
||||
const pId = Number(row?.p_id ?? 0);
|
||||
const orderType = Number(row?.order_type ?? 0);
|
||||
return pId > 0 && orderType !== 2 && orderType !== 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开详情;scrollToLogistics=true 时详情加载后滚到物流区块
|
||||
* 待发货时传入 onShip,详情内可直接打开发货弹窗
|
||||
@@ -159,6 +185,7 @@ onMounted(() => {
|
||||
<Page auto-content-height class="bg-[#f7f8fa] dark:bg-[#0a0a0a] transition-colors duration-300" title="我的订单">
|
||||
<FormModal/>
|
||||
<DetailModal/>
|
||||
<PrescriptionDetailModal/>
|
||||
|
||||
<div class="flex flex-col gap-6 p-2 md:p-4">
|
||||
<!-- 顶部操作栏 -->
|
||||
@@ -243,7 +270,14 @@ onMounted(() => {
|
||||
<Button @click="openDetail(row, false)" shape="round" size="middle">
|
||||
订单详情
|
||||
</Button>
|
||||
<!-- 修复了此处的 v-if 闭合错误 -->
|
||||
<Button
|
||||
v-if="canViewPrescription(row)"
|
||||
shape="round"
|
||||
size="middle"
|
||||
@click="openPrescriptionDetail(row)"
|
||||
>
|
||||
查看处方
|
||||
</Button>
|
||||
<Button
|
||||
v-if="Number(row.is_send) === 1 || Number(row.status) >= 2 || !!row.waybill_no"
|
||||
shape="round"
|
||||
|
||||
Reference in New Issue
Block a user