fix: 药师审核处方、退款
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
2025-05-26 16:16:31 +08:00
parent 6445162b85
commit 3c9e64c242
24 changed files with 1485 additions and 29 deletions

View File

@@ -12,7 +12,7 @@ import { Button, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import PrescrtionDetail from '#/views/doctor/doctor-reception/components/PrescrtionDetail.vue';
import PrescriptionDetail from '#/views/doctor/doctor-reception/components/PrescriptionDetail.vue';
import PrescriptionSource from './components/source.vue';
import { formOptions } from './config/search';
@@ -39,8 +39,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
gridEvents,
});
const [PrescrtionDetailModal, PrescrtionDetailModalApi] = useVbenModal({
connectedComponent: PrescrtionDetail,
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
connectedComponent: PrescriptionDetail,
});
const [PrescriptionSourceModal, PrescriptionSourceModalApi] = useVbenModal({
@@ -48,10 +48,10 @@ const [PrescriptionSourceModal, PrescriptionSourceModalApi] = useVbenModal({
});
const openPrescriptionDetail = (values) => {
// 打开西药处方模态框逻辑
PrescrtionDetailModalApi.setData({
PrescriptionDetailModalApi.setData({
values,
});
PrescrtionDetailModalApi.open();
PrescriptionDetailModalApi.open();
};
const openPrescriptionSourceModal = (id) => {
// 打开西药处方模态框逻辑
@@ -64,7 +64,7 @@ const openPrescriptionSourceModal = (id) => {
<template>
<Page auto-content-height title="订单管理">
<PrescrtionDetailModal />
<PrescriptionDetailModal />
<PrescriptionSourceModal />
<Grid>
<template #toolbar-buttons>

View File

@@ -39,6 +39,14 @@ export async function createOrder(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}create`, data);
}
/**
* 退款
* @param data
*/
export async function refundApi(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}refund`, data);
}
/**
* 编辑订单
* @param data

View File

@@ -0,0 +1,61 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { refundApi } from '../api';
import { modalRefundFormProps } from '../config/form';
const isUpdate = ref(false);
const gridApi = ref();
const [Form, formApi] = useVbenForm(modalRefundFormProps);
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
formApi.validate().then(async (e: any) => {
if (e.valid) {
const values = await formApi.getValues();
modalApi.setState({ loading: true, confirmLoading: true });
refundApi(values)
.then(() => {
message.success('保存成功');
gridApi.value?.reload();
modalApi.close();
})
.finally(() => {
modalApi.setState({ loading: false, confirmLoading: false });
});
}
});
await formApi.validateAndSubmitForm();
},
onOpenChange(isOpen: boolean) {
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
if (isOpen) {
const { values, update } = modalApi.getData<Record<string, any>>();
if (values) {
isUpdate.value = update;
formApi.setValues(values);
}
}
},
});
</script>
<template>
<Modal
title="退款"
class="w-[30%]"
>
<Form />
</Modal>
</template>

View File

@@ -69,3 +69,36 @@ export const modalFormProps: VbenFormProps = {
],
showDefaultActions: false,
};
export const modalRefundFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12', // 24栅格,
commonConfig: {
formItemClass: 'col-span-12',
// 所有表单项
componentProps: {
class: 'w-full',
},
},
// handleSubmit: onSubmit,
layout: 'horizontal',
schema: [
{
component: 'VbenInput',
fieldName: 'order_id',
label: 'ID',
formItemClass: 'col-span-6',
dependencies: {
show: false,
triggerFields: ['order_id'],
},
},
{
component: 'Textarea',
componentProps: {
placeholder: '请输入退款备注',
},
fieldName: 'refund_reason',
label: '退款备注',
},
],
showDefaultActions: false,
};

View File

@@ -44,13 +44,16 @@ export const gridOptions: VxeGridProps<RowType> = {
},
{ field: 'items_price', title: '药品总价' },
{ field: 'total_pay_price', title: '支付总价' },
{ field: 'is_sync_erp', title: 'Erp状态', slots: { default: 'is-sync-erp' } },
{
field: 'is_sync_erp',
title: 'Erp状态',
slots: { default: 'is-sync-erp' },
},
{ field: 'pay_time', title: '支付时间', slots: { default: 'pay-time' } },
{ field: 'created_at', title: '下单时间' },
{
type: 'html',
title: '操作',
align: 'right',
slots: { default: 'action' },
width: 200,
},

View File

@@ -11,22 +11,23 @@ import {
} from '@vben/common-ui';
import { SvgCakeIcon } from '@vben/icons';
import {Button, Image, message, Tag} from 'ant-design-vue';
import { Button, Image, message, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import { downloadByData } from '#/util/tool';
import {
exportOrderApi,
getOrderList,
saleAmountApi,
} from '#/views/business/order/product-order/api';
import PrescrtionDetail from '#/views/doctor/doctor-reception/components/PrescrtionDetail.vue';
import PrescriptionDetail from '#/views/doctor/doctor-reception/components/PrescriptionDetail.vue';
import DetailModal from './components/detail.vue';
import FormModalDemo from './components/modal.vue';
import Refund from './components/refund.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';
import {downloadByData} from "#/util/tool";
const hasTopTableDropDownActions = ref(false);
@@ -73,6 +74,9 @@ const [FormModal, formModalApi] = useVbenModal({
const [Modal, modalApi] = useVbenModal({
connectedComponent: DetailModal,
});
const [RefundModal, RefundModalApi] = useVbenModal({
connectedComponent: Refund,
});
const infoModal = (data = {}) => {
modalApi.setData({
@@ -130,15 +134,15 @@ const saleAmount = () => {
});
};
const [PrescrtionDetailModal, PrescrtionDetailModalApi] = useVbenModal({
connectedComponent: PrescrtionDetail,
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
connectedComponent: PrescriptionDetail,
});
const openPrescriptionDetail = (values) => {
// 打开西药处方模态框逻辑
PrescrtionDetailModalApi.setData({
PrescriptionDetailModalApi.setData({
values,
});
PrescrtionDetailModalApi.open();
PrescriptionDetailModalApi.open();
};
/**
@@ -152,13 +156,24 @@ const passApplication = () => {
message.success('导出成功!');
});
};
const openRefundModal = (id) => {
RefundModalApi.setData({
values: {
order_id: id,
},
gridApi,
});
RefundModalApi.open();
};
</script>
<template>
<Page auto-content-height title="订单管理">
<FormModal />
<Modal />
<PrescrtionDetailModal />
<RefundModal />
<PrescriptionDetailModal />
<AnalysisOverview :items="overviewItems" :my-card="false" class="mt-5" />
<Grid>
<template #toolbar-buttons>
@@ -283,6 +298,18 @@ const passApplication = () => {
// confirm: wareSend.bind(null, row),
// },
},
{
label: '退款',
type: 'link',
icon: 'mingcute:refund-dollar-fill',
// auth: ['超级订单', 'sys:user:save'],
ifShow: row.is_pay === 1,
onClick: openRefundModal.bind(null, row.id),
// popConfirm: {
// title: '确定发货吗',
// confirm: wareSend.bind(null, row),
// },
},
]"
/>
</template>

View File

@@ -12,7 +12,7 @@ import { Button, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import PrescrtionDetail from '#/views/doctor/doctor-reception/components/PrescrtionDetail.vue';
import PrescriptionDetail from '#/views/doctor/doctor-reception/components/PrescriptionDetail.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';
@@ -38,21 +38,21 @@ const [Grid, gridApi] = useVbenVxeGrid({
gridEvents,
});
const [PrescrtionDetailModal, PrescrtionDetailModalApi] = useVbenModal({
connectedComponent: PrescrtionDetail,
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
connectedComponent: PrescriptionDetail,
});
const openPrescriptionDetail = (values) => {
// 打开西药处方模态框逻辑
PrescrtionDetailModalApi.setData({
PrescriptionDetailModalApi.setData({
values,
});
PrescrtionDetailModalApi.open();
PrescriptionDetailModalApi.open();
};
</script>
<template>
<Page auto-content-height title="订单管理">
<PrescrtionDetailModal />
<PrescriptionDetailModal />
<Grid>
<template #toolbar-buttons>
<TableAction

View File

@@ -104,7 +104,7 @@ const deleteApi = (row: any) => {
<Image :src="row.image" height="30" width="30" />
</template>
<template #instruction="{ row }">
<div class="div" style="width: 120px;height: 120px; overflow: scroll">
<div class="div" style="width: 120px; height: 120px; overflow: hidden">
<Image :src="row.instruction" height="30" width="30" />
</div>
</template>

View File

@@ -0,0 +1,53 @@
import { requestClient } from '#/api/request';
const prefix = 'doctor-article/';
/**
* 分页查询用户列表
* @param data
*/
export async function getDoctorArticleList(data: any) {
return requestClient.get<any>(`${prefix}list`, { params: data });
}
/**
* 分页查询用户列表
* @param data
*/
export async function getDoctorArticleOption(data: any) {
return requestClient.get<any>(`${prefix}option`, { params: data });
}
/**
* 获取文章详情
* @param id
*/
export async function getDoctorArticleInfo(id: number) {
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}
/**
* 新增文章
* @param data
*/
export async function createDoctorArticle(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}create`, data);
}
/**
* 编辑文章
* @param data
*/
export async function updateDoctorArticle(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}update`, data);
}
/**
* 删除文章
* @param data
*/
export async function deleteDoctorArticle(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}delete`, data);
}
export async function getDoctorArticleCategoryOption() {
return requestClient.get<any>(`article-categories/option`);
}

View File

@@ -0,0 +1,43 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
const data = ref();
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
modalApi.close();
},
onOpenChange(isOpen: boolean) {
if (isOpen) {
const { values } = modalApi.getData<Record<string, any>>();
if (values) {
data.value = values;
}
}
},
});
// 格式化内容,将换行符转换为<br>
const formatContent = (content) => {
return content ? content.replaceAll('\n', '<br>') : '';
};
</script>
<template>
<Modal v-if="data" :title="`${data.title}-文章详情`" class="w-[60%]">
<div
class="rounded-lg bg-gray-50 p-4 transition-colors dark:bg-gray-700"
>
<div
class="prose prose-sm dark:prose-invert max-w-none text-gray-700 transition-colors dark:text-gray-300"
v-html="formatContent(data.content)"
></div>
</div>
</Modal>
</template>

View File

@@ -0,0 +1,63 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { createDoctorArticle, updateDoctorArticle } from '../api';
import { modalFormProps } from '../config/form';
defineOptions({
name: 'FormModelDemo',
});
const isUpdate = ref(false);
const gridApi = ref();
const [Form, formApi] = useVbenForm(modalFormProps);
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
formApi.validate().then(async (e: any) => {
if (e.valid) {
const values = await formApi.getValues();
modalApi.setState({ loading: true, confirmLoading: true });
const submitApi = isUpdate.value ? updateDoctorArticle : createDoctorArticle;
submitApi(values)
.then(() => {
message.success('保存成功');
gridApi.value?.reload();
modalApi.close();
})
.finally(() => {
modalApi.setState({ loading: false, confirmLoading: false });
});
}
});
await formApi.validateAndSubmitForm();
},
onOpenChange(isOpen: boolean) {
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
if (isOpen) {
const { values, update } = modalApi.getData<Record<string, any>>();
if (values) {
isUpdate.value = update;
formApi.setValues(values);
}
}
},
});
</script>
<template>
<Modal :title="`${isUpdate === true ? '编辑' : '新增'}文章`" class="w-[60%]">
<Form />
</Modal>
</template>

View File

@@ -0,0 +1,122 @@
import type { VbenFormProps } from '#/adapter/form';
import {getDoctorArticleCategoryOption} from "#/views/doctor/doctor-article/api";
export const modalFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12', // 24栅格,
commonConfig: {
formItemClass: 'col-span-12',
// 所有表单项
componentProps: {
class: 'w-full',
},
},
// handleSubmit: onSubmit,
layout: 'horizontal',
schema: [
// {
// fieldName: 'baseinfo',
// component: 'Divider',
// label: '基础信息',
// formItemClass: 'col-span-12',
// componentProps: {},
// hideLabel: true,
// renderComponentContent: () => {
// return {
// default: () => {
// return '基础信息';
// },
// };
// },
// },
{
component: 'VbenInput',
fieldName: 'id',
label: 'ID',
formItemClass: 'col-span-6',
dependencies: {
show: false,
triggerFields: ['id'],
},
},
{
component: 'Avatar',
componentProps: {
placeholder: '请上传图片封面',
},
fieldName: 'cover',
label: '图片封面',
rules: 'required',
},
{
component: 'VbenInput',
componentProps: {
placeholder: '请输入文章标题',
},
fieldName: 'title',
label: '文章标题',
rules: 'required',
},
{
component: 'ApiSelect',
componentProps: {
placeholder: '请选择',
api: getDoctorArticleCategoryOption,
allowClear: true,
showSearch: true,
filterOption: (input: string, option: any) => {
// 自定义过滤逻辑,确保可以根据 name 进行搜索
return option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
// 菜单接口转options格式
afterFetch: (data: { id: number; name: string }[]) => {
return data.map((item: any) => ({
label: `${item.name}`,
value: item.id,
}));
},
},
fieldName: 'cid',
label: '文章分类',
rules: 'required',
},
{
component: 'RadioGroup',
componentProps: {
placeholder: '选择是否草稿',
options: [
{
label: '是',
value: 1,
},
{
label: '否',
value: 0,
},
],
},
fieldName: 'is_draft',
defaultValue: 0,
label: '文章草稿',
rules: 'required',
},
{
component: 'Textarea',
componentProps: {
placeholder: '请输入简介',
},
fieldName: 'intro',
label: '文章简介',
rules: 'required',
},
{
component: 'Editor',
componentProps: {
placeholder: '请输入文章介绍',
},
fieldName: 'content',
label: '文章内容',
rules: 'required',
},
],
showDefaultActions: false,
};

View File

@@ -0,0 +1,37 @@
import type { VbenFormProps } from '#/adapter/form';
// import dayjs from 'dayjs';
export const formOptions: VbenFormProps = {
// 默认展开
collapsed: false,
schema: [
{
component: 'VbenInput',
componentProps: {
placeholder: '输入名称',
},
defaultValue: '',
fieldName: 'name',
label: '文章名称',
},
// {
// component: 'RangePicker',
// componentProps: {
// format: 'YYYY-MM-DD', // 确保格式与你需要的一致
// },
// // defaultValue: [dayjs().startOf('month'), dayjs()],
// fieldName: 'search_time',
// label: '时间范围',
// },
],
// 控制表单是否显示折叠按钮
showCollapseButton: true,
submitButtonOptions: {
content: '查询',
},
// 是否在字段值改变时提交表单
submitOnChange: true,
// 按下回车时是否提交表单
submitOnEnter: false,
};

View File

@@ -0,0 +1,66 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDoctorArticleList } from '../api';
interface RowType {
id: string;
name: string;
logo: string;
introduce: string;
created_at: string;
}
export const gridOptions: VxeGridProps<RowType> = {
checkboxConfig: {
highlight: true,
labelField: '',
},
columnConfig: {
useKey: true,
},
rowConfig: {
useKey: true,
},
columns: [
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{ field: 'title', align: 'left', title: '文章名称' },
{ field: 'cover', align: 'left', title: '封面', slots: { default: 'cover' } },
{ field: 'content', title: '文章介绍', slots: { default: 'content' } },
{ field: 'created_at', title: '创建时间' },
{ type: 'html', title: '操作', slots: { default: 'action' } },
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
// 请求后端接口方法
query: async ({ page }, formValues) => {
return await getDoctorArticleList({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
// 是否显示搜索表单控制按钮
// @ts-ignore 正式环境时有完整的类型声明
search: true,
refresh: true, // 刷新
print: false, // 打印
export: false, // 导出
// custom: true, // 自定义列
zoom: true, // 最大化最小化
slots: {
buttons: 'toolbar-buttons',
},
custom: {
// 自定义列-图标
icon: 'vxe-icon-menu',
},
},
showOverflow: false,
};

View File

@@ -0,0 +1,160 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, Image } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import Detail from './components/detail.vue';
import FormModalDemo from './components/modal.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';
const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = {
checkboxChange() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
checkboxAll() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions,
gridEvents,
});
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: FormModalDemo,
});
const [DetailModal, DetailModalApi] = useVbenModal({
connectedComponent: Detail,
});
const showModal = (data = {}, isUpdate = false) => {
formModalApi.setData({
// 表单值
values: data,
update: isUpdate,
gridApi,
});
formModalApi.open();
};
const showDetail = (row: any) => {
DetailModalApi.setData({
// 表单值
values: row,
});
DetailModalApi.open();
};
</script>
<template>
<Page auto-content-height title="文章管理">
<FormModal />
<DetailModal />
<Grid>
<template #toolbar-buttons>
<TableAction
:actions="[
{
label: '新增',
type: 'primary',
icon: 'ant-design:plus-outlined',
// auth: ['超级文章', 'sys:user:save'],
onClick: showModal.bind(null),
},
]"
:drop-down-actions="[
]"
>
<template #more>
<Button style="margin-left: 16px">
批量操作
<Icon icon="ant-design:down-outlined" />
</Button>
</template>
</TableAction>
</template>
<template #cover="{ row }">
<div style="width: 60px;">
<Image :src="row.cover" height="30" width="30" />
</div>
</template>
<template #content="{ row }">
{{ row.content.substring(0, 50) }}...
</template>
<template #open_business_license="{ row }">
<Image :src="row.open_business_license" height="30" width="30" />
</template>
<template #business_license="{ row }">
<Image :src="row.business_license" height="30" width="30" />
</template>
<template #product_registration_certificate="{ row }">
<Image
:src="row.product_registration_certificate"
height="30"
width="30"
/>
</template>
<template #toolbar-tools></template>
<template #action="{ row }">
<TableAction
:actions="[
{
label: '查看',
type: 'link',
icon: 'marketeq:eye',
size: 'small',
// auth: ['doctor-article', 'sys:role:detail'],
onClick: showDetail.bind(null, row),
},
{
label: '编辑',
type: 'link',
icon: 'uil:edit',
size: 'small',
// auth: ['doctor-article', 'sys:role:detail'],
onClick: showModal.bind(null, row, true),
},
]"
:drop-down-actions="[
// {
// label: '编辑',
// type: 'link',
// icon: 'ant-design:delete-outlined',
// size: 'small',
// // auth: ['doctor-article', 'sys:role:detail'],
// onClick: showModal.bind(null, row, true),
// },
// {
// label: '删除',
// type: 'link',
// icon: 'ant-design:delete-outlined',
// size: 'small',
// // auth: ['doctor-article', 'sys:role:detail'],
// popConfirm: {
// title: '确定删除吗',
// confirm: showDetail.bind(null, row.id),
// },
// },
]"
/>
</template>
</Grid>
</Page>
</template>

View File

@@ -48,7 +48,7 @@ import {
import DiagnosisModal from './components/DiagnosisModal.vue';
import DoctorOrderModal from './components/DoctorOrderModal.vue';
import PrescrtionDetail from './components/PrescrtionDetail.vue';
import PrescriptionDetail from './components/PrescriptionDetail.vue';
import WesternModal from './components/WesternModal.vue';
interface Patient {
@@ -595,8 +595,8 @@ function updateDoctorOrder(values) {
medicalAdvice.value = values;
}
const [PrescrtionDetailModal, PrescrtionDetailModalApi] = useVbenModal({
connectedComponent: PrescrtionDetail,
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
connectedComponent: PrescriptionDetail,
});
const openWesternModal = () => {
// 打开西药处方模态框逻辑
@@ -609,10 +609,10 @@ const openWesternModal = () => {
};
const openPrescriptionDetail = (values) => {
// 打开西药处方模态框逻辑
PrescrtionDetailModalApi.setData({
PrescriptionDetailModalApi.setData({
values,
});
PrescrtionDetailModalApi.open();
PrescriptionDetailModalApi.open();
};
// 根据创制string来把字符串的逗号分开变成数组
@@ -1882,7 +1882,7 @@ watch(
<DiagnosisModals/>
<DoctorOrderModals/>
<WesternDrugModal/>
<PrescrtionDetailModal/>
<PrescriptionDetailModal/>
<Modal v-model:open="showNewDrugModal" @ok="newDrugModalOk">
要把【{{ newDrugInfo.name }}】添加到清单吗?
</Modal>

View File

@@ -0,0 +1,31 @@
import { requestClient } from '#/api/request';
const prefix = 'audit-prescription/';
/**
* 分页查询用户列表
* @param data
*/
export async function getPrescriptionListApi(data: any) {
return requestClient.get<any>(`${prefix}list`, { params: data });
}
/**
* 处方溯源
* @param data
*/
export async function getPrescriptionSourceApi(data: any) {
return requestClient.get<any>(`${prefix}source`, { params: data });
}
/**
* 通过审核
* @param data
*/
export async function passApi(data: any) {
return requestClient.get<any>(`${prefix}pass`, { params: data });
}
/**
* 通过审核
* @param data
*/
export async function rejectApi(data: any) {
return requestClient.post<any>(`${prefix}reject`, data);
}

View File

@@ -0,0 +1,64 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { createAdmin, updateAdmin } from '#/views/system/admin/api';
import { modalFormProps } from '../config/form';
import {rejectApi} from "#/views/pharmacist/audit-prescription/api";
const isUpdate = ref(false);
const gridApi = ref();
const [Form, formApi] = useVbenForm(modalFormProps);
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
formApi.validate().then(async (e: any) => {
if (e.valid) {
const values = await formApi.getValues();
modalApi.setState({ loading: true, confirmLoading: true });
rejectApi(values)
.then(() => {
message.success('保存成功');
gridApi.value?.reload();
modalApi.close();
})
.finally(() => {
modalApi.setState({ loading: false, confirmLoading: false });
});
}
});
await formApi.validateAndSubmitForm();
},
onOpenChange(isOpen: boolean) {
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
if (isOpen) {
const { values, update } = modalApi.getData<Record<string, any>>();
if (values) {
isUpdate.value = update;
formApi.setValues({
id: values,
});
}
}
},
});
</script>
<template>
<Modal
title="拒绝审核"
class="w-[30%]"
>
<Form />
</Modal>
</template>

View File

@@ -0,0 +1,312 @@
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Timeline, TimelineItem } from 'ant-design-vue';
import {
FileTextOutlined,
MedicineBoxOutlined,
ShopOutlined,
UserOutlined,
} from '@ant-design/icons-vue';
import { getPrescriptionSourceApi } from '../api';
defineOptions({ name: 'PrescriptionSource' });
// 处方溯源信息
const data = ref();
// 格式化时间戳
const formatTime = (timestamp) => {
if (!timestamp) return '--';
return new Date(timestamp * 1000).toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
});
};
// 处方类型
const prescriptionTypeMap = {
1: '西药处方',
2: '中成药处方',
3: '中药处方',
};
// 处方状态
const statusMap = {
0: '待审核',
1: '已审核',
2: '已驳回',
3: '已过期',
};
// 计算属性:处方类型文本
const prescriptionTypeText = computed(() => {
return data.value
? prescriptionTypeMap[data.value.prescription_type] || '未知'
: '--';
});
// 计算属性:处方状态文本
const statusText = computed(() => {
return data.value ? statusMap[data.value.status] || '未知' : '--';
});
// 计算属性:状态颜色
const statusColor = computed(() => {
if (!data.value) return 'gray';
const statusColors = {
0: 'orange',
1: 'green',
2: 'red',
3: 'gray',
};
return statusColors[data.value.status] || 'gray';
});
// 计算属性:过期时间
const expireTime = computed(() => {
return data.value ? formatTime(data.value.auto_expire_time) : '--';
});
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
modalApi.close();
},
onOpenChange(isOpen: boolean) {
const { id } = modalApi.getData<Record<string, any>>();
if (isOpen && id) {
getPrescriptionSourceApi({ id }).then((res) => {
data.value = res;
});
} else {
data.value = null; // Reset data when modal is closed or id is missing
}
},
});
</script>
<template>
<Modal class="w-[80%]" title="处方溯源">
<div v-if="data" class="prescription-source-container">
<!-- 药店信息 -->
<div
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
>
<div class="mb-4 flex items-center">
<ShopOutlined class="mr-2 text-xl text-purple-500" />
<h2 class="text-xl font-bold">药店信息</h2>
</div>
<div v-if="data.store" class="grid grid-cols-1 gap-4">
<div class="info-item">
<span class="label">药店名称:</span>
<span class="value">{{ data.store.name }}</span>
</div>
</div>
<div v-else class="italic text-gray-500">暂无药店信息</div>
</div>
<!-- 时间线 -->
<div
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
>
<div class="mb-4 flex items-center">
<FileTextOutlined class="mr-2 text-xl text-blue-500" />
<h2 class="text-xl font-bold">时间线</h2>
</div>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 mt-5">
<Timeline>
<TimelineItem v-if="data.pharmacist_view_time">
{{ data.pharmacist_view_time }}
<template v-if="data.pharmacist_info">
{{ data.pharmacist_info.name }} 审核
</template>
<template v-else> -- </template>
</TimelineItem>
<TimelineItem v-else>
{{ statusText }}
{{ data.cancel_remark }}
</TimelineItem>
<TimelineItem>
{{ data.created_at }}
<template v-if="data.doctor_info">
{{ data.doctor_info.name }} 开方诊断{{
data.clinical_diagnose
}}
</template>
<template v-else> -- </template>
</TimelineItem>
<TimelineItem>
{{ data.register.created_at }}
<template v-if="data.doctor_info">
{{ data.user_patient.name }} 挂号
</template>
<template v-else> -- </template>
</TimelineItem>
</Timeline>
</div>
</div>
<!-- 处方基本信息 -->
<div
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
>
<div class="mb-4 flex items-center">
<FileTextOutlined class="mr-2 text-xl text-blue-500" />
<h2 class="text-xl font-bold">处方基本信息</h2>
</div>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
<div class="info-item">
<span class="label">处方编号:</span>
<span class="value">{{ data.prescription_no }}</span>
</div>
<div class="info-item">
<span class="label">处方类型:</span>
<span class="value">{{ prescriptionTypeText }}</span>
</div>
<div class="info-item">
<span class="label">处方状态:</span>
<span :class="`text-${statusColor}-500`" class="value">{{
statusText
}}</span>
</div>
<div class="info-item">
<span class="label">总金额:</span>
<span class="value font-bold text-red-500">¥{{ data.total_pay_price }}</span>
</div>
<div class="info-item">
<span class="label">过期时间:</span>
<span class="value">{{ expireTime }}</span>
</div>
</div>
</div>
<!-- 医生信息 -->
<div
class="mb-6 transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
>
<div class="mb-4 flex items-center">
<MedicineBoxOutlined class="mr-2 text-xl text-green-500" />
<h2 class="text-xl font-bold">医生信息</h2>
</div>
<div
v-if="data.doctor_info"
class="grid grid-cols-1 gap-4 md:grid-cols-2"
>
<div class="info-item">
<span class="label">医生姓名:</span>
<span class="value">{{ data.doctor_info.name }}</span>
</div>
<div class="info-item">
<span class="label">所属科室:</span>
<span class="value">{{
data.doctor_info.depart?.name || '--'
}}</span>
</div>
</div>
<div v-else class="italic text-gray-500">暂无医生信息</div>
</div>
<!-- 患者信息 -->
<div
class="transform rounded-lg p-6 shadow-md transition-all duration-300 hover:shadow-lg"
>
<div class="mb-4 flex items-center">
<UserOutlined class="mr-2 text-xl text-amber-500" />
<h2 class="text-xl font-bold">患者信息</h2>
</div>
<div
v-if="data.user_patient"
class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"
>
<div class="info-item">
<span class="label">患者姓名:</span>
<span class="value">{{ data.user_patient.name }}</span>
</div>
<div class="info-item">
<span class="label">年龄:</span>
<span class="value">{{ data.user_patient.age }}</span>
</div>
<div class="info-item">
<span class="label">性别:</span>
<span class="value">{{
data.user_patient.sex === 1 ? '男' : '女'
}}</span>
</div>
</div>
<div v-else class="italic text-gray-500">暂无患者信息</div>
</div>
</div>
<!-- 加载状态 -->
<div v-else class="flex h-64 items-center justify-center">
<div
class="h-12 w-12 animate-spin rounded-full border-b-2 border-t-2 border-blue-500"
></div>
</div>
</Modal>
</template>
<style lang="scss" scoped>
.prescription-source-container {
@apply max-h-[70vh] overflow-auto p-4;
}
.info-item {
@apply flex flex-col rounded-md p-3 transition-all duration-300;
}
.label {
@apply mb-1 text-sm text-gray-500;
}
.value {
@apply font-medium;
}
/* 添加动感效果 */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.prescription-source-container > div {
animation: fadeIn 0.5s ease-out forwards;
}
.prescription-source-container > div:nth-child(1) {
animation-delay: 0.1s;
}
.prescription-source-container > div:nth-child(2) {
animation-delay: 0.2s;
}
.prescription-source-container > div:nth-child(3) {
animation-delay: 0.3s;
}
.prescription-source-container > div:nth-child(4) {
animation-delay: 0.4s;
}
</style>

View File

@@ -0,0 +1,36 @@
import type { VbenFormProps } from '#/adapter/form';
export const modalFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12', // 24栅格,
commonConfig: {
formItemClass: 'col-span-12',
// 所有表单项
componentProps: {
class: 'w-full',
},
},
// handleSubmit: onSubmit,
layout: 'horizontal',
schema: [
{
component: 'VbenInput',
fieldName: 'id',
label: 'ID',
formItemClass: 'col-span-6',
dependencies: {
show: false,
triggerFields: ['id'],
},
},
{
component: 'Textarea',
componentProps: {
placeholder: '请输入拒绝原因',
},
fieldName: 'reject_reason',
label: '拒绝原因',
rules: 'required',
},
],
showDefaultActions: false,
};

View File

@@ -0,0 +1,67 @@
import type { VbenFormProps } from '#/adapter/form';
// import dayjs from 'dayjs';
export const formOptions: VbenFormProps = {
// 默认展开
collapsed: false,
schema: [
{
component: 'VbenInput',
componentProps: {
placeholder: '输入订单号',
},
defaultValue: '',
fieldName: 'prescription_no',
label: '订单号',
},
{
component: 'VbenSelect',
componentProps: {
allowClear: true,
filterOption: true,
showSearch: true,
options: [
{
label: '中药',
value: 1,
},
{
label: '西药',
value: 2,
},
{
label: '中成药',
value: 3,
},
{
label: '产品服务包',
value: 5,
},
],
placeholder: '请选择',
},
fieldName: 'prescription_type',
label: '订单类型',
},
{
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD', // 确保格式与你需要的一致
},
// defaultValue: [dayjs().startOf('month'), dayjs()],
fieldName: 'search_time',
label: '时间范围',
},
],
// 控制表单是否显示折叠按钮
showCollapseButton: true,
submitButtonOptions: {
content: '查询',
},
// 是否在字段值改变时提交表单
// submitOnChange: true,
// submitOnChange: true,
// 按下回车时是否提交表单
submitOnEnter: false,
};

View File

@@ -0,0 +1,82 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getPrescriptionListApi } from '../api';
interface RowType {
id: string;
name: string;
logo: string;
introduce: string;
created_at: string;
}
export const gridOptions: VxeGridProps<RowType> = {
checkboxConfig: {
highlight: true,
labelField: '',
},
columns: [
// { type: 'checkbox', width: 60 },
{ field: 'id', align: 'left', title: 'ID' },
{ field: 'prescription_no', align: 'left', title: '处方订单号' },
{ field: 'doctor_info.name', align: 'left', title: '开方医生' },
{ field: 'user_patient.name', align: 'left', title: '就诊人名称' },
{ field: 'store.name', align: 'left', title: '开方诊所' },
{ field: 'status', title: '状态', slots: { default: 'status' } },
// { field: 'created_at', title: '下单时间' },
{
type: 'html',
title: '操作',
align: 'right',
slots: { default: 'action' },
width: 250,
},
],
keepSource: true,
pagerConfig: {},
columnConfig: {
useKey: true,
},
rowConfig: {
useKey: true,
},
// scrollY: {
// enabled: true,
// gt: 0,
// },
proxyConfig: {
ajax: {
// 请求后端接口方法
query: async ({ page }, formValues) => {
return await getPrescriptionListApi({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
// 是否显示搜索表单控制按钮
// @ts-ignore 正式环境时有完整的类型声明
search: true,
refresh: true, // 刷新
print: false, // 打印
export: false, // 导出
// custom: true, // 自定义列
zoom: true, // 最大化最小化
slots: {
buttons: 'toolbar-buttons',
},
custom: {
// 自定义列-图标
icon: 'vxe-icon-menu',
},
},
expandConfig: {
// expandAll: true,
},
showOverflow: false,
};

View File

@@ -0,0 +1,188 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { ref } from 'vue';
import {
Page,
useVbenModal,
} from '@vben/common-ui';
import {Button, message, Tag} from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import PrescriptionDetail from '#/views/doctor/doctor-reception/components/PrescriptionDetail.vue';
import PrescriptionSource from './components/source.vue';
import RejectionReason from './components/modal.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';
import {passApi} from "#/views/pharmacist/audit-prescription/api";
const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = {
checkboxChange() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
checkboxAll() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions,
gridEvents,
});
const [PrescriptionDetailModal, PrescriptionDetailModalApi] = useVbenModal({
connectedComponent: PrescriptionDetail,
});
const [RejectionReasonModal, RejectionReasonModalApi] = useVbenModal({
connectedComponent: RejectionReason,
});
const [PrescriptionSourceModal, PrescriptionSourceModalApi] = useVbenModal({
connectedComponent: PrescriptionSource,
});
const openPrescriptionDetail = (values) => {
// 打开西药处方模态框逻辑
PrescriptionDetailModalApi.setData({
values,
});
PrescriptionDetailModalApi.open();
};
const openPrescriptionSourceModal = (id) => {
// 打开西药处方模态框逻辑
PrescriptionSourceModalApi.setData({
id,
});
PrescriptionSourceModalApi.open();
};
const pass = (id) => {
passApi({
id,
}).then(() => {
gridApi.reload();
message.success('通过成功');
})
}
const reject = (id) => {
RejectionReasonModalApi.setData({
values: id,
gridApi,
});
RejectionReasonModalApi.open();
}
</script>
<template>
<Page auto-content-height title="订单管理">
<PrescriptionDetailModal />
<PrescriptionSourceModal />
<RejectionReasonModal />
<Grid>
<template #toolbar-buttons>
<TableAction :actions="[]" :drop-down-actions="[]"></TableAction>
</template>
<template #status="{ row }">
<div>
<Tag v-if="row.prescription_type === 1" color="orange">中药</Tag>
<Tag v-else-if="row.prescription_type === 2" color="blue">
商品西药
</Tag>
<Tag v-else-if="row.prescription_type === 3" color="purple">
商品非处方药
</Tag>
<Tag v-else-if="row.prescription_type === 4" color="green">
已退款
</Tag>
<Tag v-else-if="row.prescription_type === 5" color="pink">
产品服务包
</Tag>
</div>
<div class="mt-3">
<Tag v-if="row.status === 0" color="red">待审核</Tag>
<Tag v-else-if="row.status === 1" color="green">通过审核</Tag>
<Tag v-else-if="row.status === 2" color="red">拒绝审核</Tag>
<Tag v-else-if="row.status === 3" color="purple">无需审核</Tag>
<Tag v-else-if="row.status === 4" color="green">无需审核</Tag>
</div>
</template>
<template #toolbar-tools></template>
<template #action="{ row }">
<TableAction
:actions="[
{
label: '通过审核',
type: 'link',
// auth: ['超级订单', 'sys:user:save'],
onClick: pass.bind(null, row.id),
},
{
label: '拒绝审核',
type: 'link',
// auth: ['超级订单', 'sys:user:save'],
onClick: reject.bind(null, row.id),
},
]"
:drop-down-actions="[
{
label: '查看处方',
type: 'link',
icon: 'marketeq:eye',
// auth: ['超级订单', 'sys:user:save'],
onClick: openPrescriptionDetail.bind(null, row.id),
},
{
label: '处方溯源',
type: 'link',
icon: 'marketeq:eye',
// auth: ['超级订单', 'sys:user:save'],
onClick: openPrescriptionSourceModal.bind(null, row.id),
},
]"
/>
</template>
</Grid>
</Page>
</template>
<style scoped lang="scss">
.custom-list {
list-style-type: none;
padding-left: 0;
}
.custom-list-item {
background-color: rgba(64, 158, 255, 0.04);
border-radius: 4px;
margin-bottom: 8px;
padding: 8px 12px;
font-size: 14px;
transition: background-color 0.3s;
&:hover {
background-color: rgba(64, 158, 255, 0.1);
}
&::before {
content: '';
display: inline-block;
width: 6px;
height: 6px;
background-color: #409eff;
border-radius: 50%;
margin-right: 8px;
vertical-align: middle;
}
}
</style>