diff --git a/apps/web-antd/src/components/drug-search-select/drug-search-select.vue b/apps/web-antd/src/components/drug-search-select/drug-search-select.vue index 53e39816..02d13d36 100644 --- a/apps/web-antd/src/components/drug-search-select/drug-search-select.vue +++ b/apps/web-antd/src/components/drug-search-select/drug-search-select.vue @@ -17,6 +17,10 @@ import { debounce } from 'lodash-es'; import { getProductListDoctorReception } from '#/views/doctor/doctor-reception/api'; +/** 中药无图时与仓库列表一致的占位图 */ +const TCM_PLACEHOLDER_IMAGE = + 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk_upload_20250510/cd470ebf97e31c4048ba502ba71b66a3.jpg'; + // ==================== Props 定义 ==================== interface Props { @@ -88,6 +92,12 @@ const containerRef = ref(null); */ const highlightIndex = ref(-1); +function resolveDropdownImage(item: any): string { + if (item._image) return item._image; + if (props.type === 1) return TCM_PLACEHOLDER_IMAGE; + return ''; +} + // ==================== 方法定义 ==================== /** @@ -296,8 +306,8 @@ watch(
+/** + * 超级仓库 Admin:选品字段,与常用方「药品搜索」一致(DrugSearchSelect) + */ +import { computed, ref, watch } from 'vue'; + +import { useUserStore } from '@vben/stores'; + +import { Button } from 'ant-design-vue'; + +import { DrugSearchSelect } from '#/components/drug-search-select'; + +const props = withDefaults( + defineProps<{ + /** vben-form:药品 ID */ + value?: number; + /** 列表筛选类型:1 中药,2 西药 */ + productType?: number; + }>(), + { + productType: 1, + }, +); + +const emit = defineEmits<{ + 'update:value': [value: number | undefined]; +}>(); + +const userStore = useUserStore(); + +const selectedLabel = ref(''); + +const searchType = computed(() => (props.productType === 2 ? 2 : 1)); + +const storeId = computed(() => userStore.userInfo?.store_id ?? 2); + +const placeholder = computed(() => { + const name = props.productType === 2 ? '西药' : '中药'; + return `输入${name}名称搜索(显示图片、供应商、规格、价格)`; +}); + +watch( + () => props.value, + (v) => { + if (v == null || v === undefined) { + selectedLabel.value = ''; + } + }, + { immediate: true }, +); + +function onSelect(drug: any) { + const id = drug._drugId ?? drug.drug?.id ?? drug.drug_id; + selectedLabel.value = + drug._drugName || drug.drug?.drug_name || drug.drug_name || ''; + emit('update:value', id); +} + +function clearSelection() { + selectedLabel.value = ''; + emit('update:value', undefined); +} + + + diff --git a/apps/web-antd/src/components/form/types/index.d.ts b/apps/web-antd/src/components/form/types/index.d.ts index c67d6ac9..02dae881 100644 --- a/apps/web-antd/src/components/form/types/index.d.ts +++ b/apps/web-antd/src/components/form/types/index.d.ts @@ -4,4 +4,5 @@ export type CustomComponentType = | 'ApiRadioGroup' | 'ApiSelect' | 'ApiTreeSelect' - | 'IconPicker'; + | 'IconPicker' + | 'WarehouseAdminDrugSearch'; diff --git a/apps/web-antd/src/views/business/order/product-order/components/detail.vue b/apps/web-antd/src/views/business/order/product-order/components/detail.vue index e2715885..a9f68030 100644 --- a/apps/web-antd/src/views/business/order/product-order/components/detail.vue +++ b/apps/web-antd/src/views/business/order/product-order/components/detail.vue @@ -188,16 +188,28 @@ const orderTypeMap = {

订单商品

-
    -
  • 药品明细 +
    +
    - 【{{ item.drug.drug_number }}】 {{ item.drug_name }} (* - {{ item.number * (item.dosage > 0 ? item.dosage : 1) }}) -
  • -
+
+ 【{{ item.drug?.drug_number }}】{{ item.drug_name }} +
+
+ 数量:*{{ item.number * (item.dosage > 0 ? item.dosage : 1) }} +
+
+ 供货价:{{ + item.buy_price != null && item.buy_price !== '' + ? `${item.buy_price} 元` + : '—' + }} +
+
+
diff --git a/apps/web-antd/src/views/business/order/register/index.vue b/apps/web-antd/src/views/business/order/register/index.vue index da691654..66ed1eaa 100644 --- a/apps/web-antd/src/views/business/order/register/index.vue +++ b/apps/web-antd/src/views/business/order/register/index.vue @@ -1,7 +1,8 @@ + + diff --git a/apps/web-antd/src/views/finance/reconciliation/config/search.ts b/apps/web-antd/src/views/finance/reconciliation/config/search.ts deleted file mode 100644 index f1de4d45..00000000 --- a/apps/web-antd/src/views/finance/reconciliation/config/search.ts +++ /dev/null @@ -1,84 +0,0 @@ -import type { VbenFormProps } from '#/adapter/form'; - -import dayjs from 'dayjs'; - -export const reconciliationStoreSearch: VbenFormProps = { - // 默认展开 - collapsed: false, - schema: [ - { - component: 'VbenInput', - componentProps: { - placeholder: '请输入诊所名称', - }, - defaultValue: '', - fieldName: 'store_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, -}; - -export const reconciliationDrugSearch: VbenFormProps = { - // 默认展开 - collapsed: false, - schema: [ - { - component: 'InputNumber', - componentProps: { - placeholder: '请输入诊所ID', - }, - defaultValue: '', - fieldName: 'store_id', - dependencies: { - show: false, - triggerFields: ['store_id'], - }, - label: '诊所ID', - }, - { - component: 'VbenInput', - componentProps: { - placeholder: '请输入药品名称', - }, - defaultValue: '', - fieldName: 'drug_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, -}; diff --git a/apps/web-antd/src/views/finance/reconciliation/config/table.ts b/apps/web-antd/src/views/finance/reconciliation/config/table.ts deleted file mode 100644 index e0d0a476..00000000 --- a/apps/web-antd/src/views/finance/reconciliation/config/table.ts +++ /dev/null @@ -1,134 +0,0 @@ -import type { VxeGridProps } from '#/adapter/vxe-table'; - - -interface RowType { - id: string; - nick_name: string; - email: string; - avatar: string; - roles: { name: string }[]; - open_id: string; - code: string; - platform_id: string; - phone: string; - desc: string; - created_at: string; -} - -export const storeReconciliationTable: VxeGridProps = { - checkboxConfig: { - highlight: true, - labelField: '', - }, - columnConfig: { - useKey: true, - }, - rowConfig: { - useKey: true, - }, - columns: [ - { field: 'name', title: '诊所名称' }, - { - field: 'reconciliation.herbal_sales', - title: '草药', - slots: { default: 'herbal' }, - }, - // { field: 'reconciliation.herbal_sales', title: '草药销售数量' }, - // { field: 'reconciliation.herbal_sales_price', title: '草药销售总价' }, - // { field: 'reconciliation.herbal_supply_price', title: '草药供货总价' }, - { - field: 'reconciliation.medicine_sales', - title: '西药', - slots: { default: 'medicine' }, - }, - // { field: 'reconciliation.medicine_sales', title: '西药销售数量' }, - // { field: 'reconciliation.medicine_sales_price', title: '西药销售总价' }, - // { field: 'reconciliation.medicine_supply_price', title: '西药供货总价' }, - { - field: 'reconciliation.service_package_sales', - title: '服务包销售数量', - slots: { default: 'service-package' }, - }, - // { field: 'reconciliation.service_package_sales', title: '服务包销售数量' }, - // { - // field: 'reconciliation.service_package_sales_price', - // title: '服务包销售总价', - // }, - // { - // field: 'reconciliation.service_package_supply_price', - // title: '服务包供货总价', - // }, - { field: 'reconciliation.express_price', title: '其他费用', slots: { default: 'other'} }, - { field: 'reconciliation.total_sales_price', title: '总销售总价' }, - { field: 'reconciliation.total_supply_price', title: '总供货总价' }, - // { field: 'reconciliation.express_price', title: '快递费用' }, - // { field: 'reconciliation.process_price', title: '加工费用' }, - // { field: 'reconciliation.treatment_price', title: '治疗费用' }, - // { field: 'reconciliation.outpatient_price', title: '门诊费用' }, - { field: 'reconciliation.registration_price', title: '挂号费用' }, - { type: 'html', title: '操作', slots: { default: 'action' } }, - ], - keepSource: true, - pagerConfig: {}, - 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, -}; - -export const drugReconciliationTable: VxeGridProps = { - checkboxConfig: { - highlight: true, - labelField: '', - }, - columnConfig: { - useKey: true, - }, - rowConfig: { - useKey: true, - }, - columns: [ - { field: 'drug_name', title: '药名' }, - { field: 'type_txt', title: '药品类型' }, - { field: 'number', title: '出售数量' }, - { field: 'total_sales_price', title: '总销售金额' }, - { field: 'total_supply_price', title: '总供货金额' }, - // { type: 'html', title: '操作', slots: { default: 'action' } }, - ], - keepSource: true, - pagerConfig: {}, - 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, -}; diff --git a/apps/web-antd/src/views/finance/reconciliation/index.vue b/apps/web-antd/src/views/finance/reconciliation/index.vue index 7af5f8a4..26a65887 100644 --- a/apps/web-antd/src/views/finance/reconciliation/index.vue +++ b/apps/web-antd/src/views/finance/reconciliation/index.vue @@ -1,191 +1,352 @@