From b705a81eb096863a6592b7cdeb74a9d67b1b5d61 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 5 Jun 2025 19:39:11 +0800 Subject: [PATCH] chore: crm product detail --- apps/web-antd/src/views/crm/product/data.ts | 75 ++++++++++++++- .../views/crm/product/modules/detail-info.vue | 29 +++++- .../views/crm/product/modules/detail-list.vue | 4 - .../src/views/crm/product/modules/detail.vue | 95 ++++++++++++++++++- 4 files changed, 192 insertions(+), 11 deletions(-) delete mode 100644 apps/web-antd/src/views/crm/product/modules/detail-list.vue diff --git a/apps/web-antd/src/views/crm/product/data.ts b/apps/web-antd/src/views/crm/product/data.ts index 348afb372..78f095e02 100644 --- a/apps/web-antd/src/views/crm/product/data.ts +++ b/apps/web-antd/src/views/crm/product/data.ts @@ -1,11 +1,20 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { DescriptionItemSchema } from '#/components/description'; + +import { h } from 'vue'; import { handleTree } from '@vben/utils'; import { z } from '#/adapter/form'; import { getProductCategoryList } from '#/api/crm/product/category'; -import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; +import { DictTag } from '#/components/dict-tag'; +import { + CommonStatusEnum, + DICT_TYPE, + erpPriceInputFormatter, + getDictOptions, +} from '#/utils'; /** 新增/修改的表单 */ export function useFormSchema(): VbenFormSchema[] { @@ -174,3 +183,67 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { }, ]; } + +/** 详情页的字段 */ +export function useDetailSchema(): DescriptionItemSchema[] { + return [ + { + field: 'categoryName', + label: '产品类别', + }, + { + field: 'unit', + label: '产品单位', + content: (data) => + h(DictTag, { type: DICT_TYPE.CRM_PRODUCT_UNIT, value: data?.unit }), + }, + { + field: 'price', + label: '产品价格', + content: (data) => erpPriceInputFormatter(data.price), + }, + { + field: 'no', + label: '产品编码', + }, + ]; +} + +/** 详情页的基础字段 */ +export function useDetailBaseSchema(): DescriptionItemSchema[] { + return [ + { + field: 'name', + label: '产品名称', + }, + { + field: 'no', + label: '产品编码', + }, + { + field: 'price', + label: '价格(元)', + content: (data) => erpPriceInputFormatter(data.price), + }, + { + field: 'description', + label: '产品描述', + }, + { + field: 'categoryName', + label: '产品类型', + }, + { + field: 'status', + label: '是否上下架', + content: (data) => + h(DictTag, { type: DICT_TYPE.CRM_PRODUCT_STATUS, value: data?.status }), + }, + { + field: 'unit', + label: '产品单位', + content: (data) => + h(DictTag, { type: DICT_TYPE.CRM_PRODUCT_UNIT, value: data?.unit }), + }, + ]; +} diff --git a/apps/web-antd/src/views/crm/product/modules/detail-info.vue b/apps/web-antd/src/views/crm/product/modules/detail-info.vue index c6bcbfbcd..b04519795 100644 --- a/apps/web-antd/src/views/crm/product/modules/detail-info.vue +++ b/apps/web-antd/src/views/crm/product/modules/detail-info.vue @@ -1,4 +1,29 @@ - + + diff --git a/apps/web-antd/src/views/crm/product/modules/detail-list.vue b/apps/web-antd/src/views/crm/product/modules/detail-list.vue deleted file mode 100644 index 4a0fbfd34..000000000 --- a/apps/web-antd/src/views/crm/product/modules/detail-list.vue +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/apps/web-antd/src/views/crm/product/modules/detail.vue b/apps/web-antd/src/views/crm/product/modules/detail.vue index 99ad6b6f9..910538dbb 100644 --- a/apps/web-antd/src/views/crm/product/modules/detail.vue +++ b/apps/web-antd/src/views/crm/product/modules/detail.vue @@ -1,7 +1,94 @@ - +