From 27c8277d717b34b55f3ea967027b53b067f77df3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 16:58:49 +0800
Subject: [PATCH] feat 功能变更
---
src/views/crm/refund/data.ts | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 208 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/refund/data.ts b/src/views/crm/refund/data.ts
new file mode 100644
index 0000000..f239359
--- /dev/null
+++ b/src/views/crm/refund/data.ts
@@ -0,0 +1,208 @@
+import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { CrmCustomerApi } from '#/api/crm/customer';
+import type { CrmRefundApi } from '#/api/crm/refund';
+
+import { markRaw } from 'vue';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
+
+/** 鏂板/淇敼閫�璐瑰崟 */
+export function useFormSchema(
+ formApi?: VbenFormApi,
+): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'id',
+ component: 'Input',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'refundNo',
+ label: '閫�璐瑰崟鍙�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '涓嶅~鍒欒嚜鍔ㄧ敓鎴�',
+ },
+ },
+ {
+ fieldName: 'customerId',
+ label: '瀹㈡埛',
+ component: markRaw(CrmCustomerSelect),
+ componentProps: {
+ placeholder: '璇烽�夋嫨瀹㈡埛',
+ onChange: (item?: CrmCustomerApi.Customer) => {
+ formApi?.setFieldValue('customerName', item?.name);
+ },
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'customerName',
+ label: '瀹㈡埛鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '瀹㈡埛鍚嶇О',
+ readonly: true,
+ },
+ },
+ {
+ fieldName: 'refundType',
+ label: '閫�璐圭被鍨�',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.CRM_REFUND_TYPE),
+ placeholder: '璇烽�夋嫨閫�璐圭被鍨�',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'refundAmount',
+ label: '閫�璐归噾棰�',
+ component: 'InputNumber',
+ componentProps: {
+ class: 'w-full',
+ min: 0,
+ precision: 2,
+ placeholder: '璇疯緭鍏ラ��璐归噾棰濓紙鍏冿級',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'contractNo',
+ label: '鍚堝悓缂栧彿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ叧鑱斿悎鍚岀紪鍙�',
+ },
+ },
+ {
+ fieldName: 'applyUserName',
+ label: '鐢宠浜�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ョ敵璇蜂汉濮撳悕',
+ },
+ },
+ {
+ fieldName: 'applyTime',
+ label: '鐢宠鏃堕棿',
+ component: 'DatePicker',
+ componentProps: {
+ class: '!w-full',
+ format: 'YYYY-MM-DD HH:mm:ss',
+ showTime: true,
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ },
+ },
+ {
+ fieldName: 'refundReason',
+ label: '閫�璐瑰師鍥�',
+ component: 'Textarea',
+ formItemClass: 'col-span-2',
+ componentProps: {
+ placeholder: '璇疯緭鍏ラ��璐瑰師鍥�',
+ rows: 2,
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ formItemClass: 'col-span-2',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ娉�',
+ rows: 2,
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'refundNo',
+ label: '閫�璐瑰崟鍙�',
+ component: 'Input',
+ componentProps: {
+ allowClear: true,
+ placeholder: '璇疯緭鍏ラ��璐瑰崟鍙�',
+ },
+ },
+ {
+ fieldName: 'refundType',
+ label: '閫�璐圭被鍨�',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.CRM_REFUND_TYPE),
+ placeholder: '璇烽�夋嫨閫�璐圭被鍨�',
+ },
+ },
+ {
+ fieldName: 'auditStatus',
+ label: '瀹℃壒鐘舵��',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.CRM_AUDIT_STATUS, 'number'),
+ placeholder: '璇烽�夋嫨瀹℃壒鐘舵��',
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<CrmRefundApi.Refund>['columns'] {
+ return [
+ { field: 'refundNo', title: '閫�璐瑰崟鍙�', minWidth: 170 },
+ { field: 'customerName', title: '瀹㈡埛鍚嶇О', minWidth: 180 },
+ {
+ field: 'refundType',
+ title: '閫�璐圭被鍨�',
+ width: 110,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.CRM_REFUND_TYPE },
+ },
+ },
+ { field: 'refundAmount', title: '閫�璐归噾棰�', width: 120 },
+ { field: 'contractNo', title: '鍚堝悓缂栧彿', minWidth: 140 },
+ { field: 'applyUserName', title: '鐢宠浜�', width: 100 },
+ {
+ field: 'applyTime',
+ title: '鐢宠鏃堕棿',
+ width: 170,
+ formatter: 'formatDateTime',
+ },
+ {
+ field: 'auditStatus',
+ title: '瀹℃壒鐘舵��',
+ width: 110,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.CRM_AUDIT_STATUS },
+ },
+ },
+ {
+ field: 'createTime',
+ title: '鍒涘缓鏃堕棿',
+ width: 170,
+ formatter: 'formatDateTime',
+ },
+ {
+ title: '鎿嶄綔',
+ width: 200,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
--
Gitblit v1.9.3