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/index.vue |  184 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 184 insertions(+), 0 deletions(-)

diff --git a/src/views/crm/refund/index.vue b/src/views/crm/refund/index.vue
new file mode 100644
index 0000000..bb053b4
--- /dev/null
+++ b/src/views/crm/refund/index.vue
@@ -0,0 +1,184 @@
+<script lang="ts" setup>
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { CrmRefundApi } from '#/api/crm/refund';
+
+import { Page, useVbenModal } from '@vben/common-ui';
+import { downloadFileFromBlobPart } from '@vben/utils';
+
+import { message } from 'ant-design-vue';
+
+import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+  auditRefund,
+  deleteRefund,
+  exportRefund,
+  getRefundPage,
+} from '#/api/crm/refund';
+import { $t } from '#/locales';
+
+import { useGridColumns, useGridFormSchema } from './data';
+import Form from './modules/form.vue';
+
+const [FormModal, formModalApi] = useVbenModal({
+  connectedComponent: Form,
+  destroyOnClose: true,
+});
+
+/** 鍒锋柊琛ㄦ牸 */
+function handleRefresh() {
+  gridApi.query();
+}
+
+/** 瀵煎嚭琛ㄦ牸 */
+async function handleExport() {
+  const formValues = await gridApi.formApi.getValues();
+  const data = await exportRefund(formValues);
+  downloadFileFromBlobPart({ fileName: '閫�璐瑰崟.xls', source: data });
+}
+
+/** 鏂板 */
+function handleCreate() {
+  formModalApi.setData(null).open();
+}
+
+/** 缂栬緫 */
+function handleEdit(row: CrmRefundApi.Refund) {
+  formModalApi.setData({ refund: row }).open();
+}
+
+/** 鍒犻櫎 */
+async function handleDelete(row: CrmRefundApi.Refund) {
+  const hideLoading = message.loading({
+    content: $t('ui.actionMessage.deleting', [row.refundNo ?? '']),
+    duration: 0,
+  });
+  try {
+    await deleteRefund(row.id!);
+    message.success($t('ui.actionMessage.deleteSuccess', [row.refundNo ?? '']));
+    handleRefresh();
+  } finally {
+    hideLoading();
+  }
+}
+
+/** 瀹℃壒锛堥�氳繃/椹冲洖锛� */
+async function handleAudit(row: CrmRefundApi.Refund, pass: boolean) {
+  const hideLoading = message.loading({
+    content: pass ? '瀹℃壒閫氳繃涓�...' : '瀹℃壒椹冲洖涓�...',
+    duration: 0,
+  });
+  try {
+    await auditRefund({ id: row.id!, auditStatus: pass ? 20 : 30 });
+    message.success(pass ? '瀹℃壒閫氳繃' : '瀹℃壒椹冲洖');
+    handleRefresh();
+  } finally {
+    hideLoading();
+  }
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
+  formOptions: {
+    schema: useGridFormSchema(),
+  },
+  gridOptions: {
+    columns: useGridColumns(),
+    height: 'auto',
+    keepSource: true,
+    proxyConfig: {
+      ajax: {
+        query: async ({ page }, formValues) =>
+          await getRefundPage({
+            pageNo: page.currentPage,
+            pageSize: page.pageSize,
+            ...formValues,
+          }),
+      },
+    },
+    rowConfig: {
+      keyField: 'id',
+      isHover: true,
+    },
+    toolbarConfig: {
+      refresh: true,
+      search: true,
+    },
+  } as VxeTableGridOptions<CrmRefundApi.Refund>,
+});
+</script>
+
+<template>
+  <Page auto-content-height>
+    <FormModal @success="handleRefresh" />
+    <Grid table-title="閫�璐瑰崟鍒楄〃">
+      <template #toolbar-tools>
+        <TableAction
+          :actions="[
+            {
+              label: $t('ui.actionTitle.create', ['閫�璐瑰崟']),
+              type: 'primary',
+              icon: ACTION_ICON.ADD,
+              auth: ['crm:refund:create'],
+              onClick: handleCreate,
+            },
+            {
+              label: $t('ui.actionTitle.export'),
+              type: 'primary',
+              icon: ACTION_ICON.DOWNLOAD,
+              auth: ['crm:refund:export'],
+              onClick: handleExport,
+            },
+          ]"
+        />
+      </template>
+      <template #actions="{ row }">
+        <TableAction
+          :actions="[
+            {
+              label: '閫氳繃',
+              type: 'link',
+              icon: ACTION_ICON.AUDIT,
+              auth: ['crm:refund:update'],
+              ifShow: row.auditStatus === 0 || row.auditStatus === 10,
+              popConfirm: {
+                title: '纭瀹℃壒閫氳繃璇ラ��璐瑰崟锛�',
+                confirm: handleAudit.bind(null, row, true),
+              },
+            },
+            {
+              label: '椹冲洖',
+              type: 'link',
+              danger: true,
+              icon: ACTION_ICON.AUDIT,
+              auth: ['crm:refund:update'],
+              ifShow: row.auditStatus === 0 || row.auditStatus === 10,
+              popConfirm: {
+                title: '纭椹冲洖璇ラ��璐瑰崟锛�',
+                confirm: handleAudit.bind(null, row, false),
+              },
+            },
+            {
+              label: $t('common.edit'),
+              type: 'link',
+              icon: ACTION_ICON.EDIT,
+              auth: ['crm:refund:update'],
+              onClick: handleEdit.bind(null, row),
+            },
+            {
+              label: $t('common.delete'),
+              type: 'link',
+              danger: true,
+              icon: ACTION_ICON.DELETE,
+              auth: ['crm:refund:delete'],
+              popConfirm: {
+                title: $t('ui.actionMessage.deleteConfirm', [
+                  row.refundNo ?? '',
+                ]),
+                confirm: handleDelete.bind(null, row),
+              },
+            },
+          ]"
+        />
+      </template>
+    </Grid>
+  </Page>
+</template>

--
Gitblit v1.9.3