Sfoglia il codice sorgente

feat: 审核管理接口

赖奇 1 anno fa
parent
commit
f1853475c2

+ 2 - 2
apps/web-ele/src/locales/langs/en-US/page.json

@@ -25,7 +25,7 @@
     "orderManage": "Order",
     "couponManage": "Coupon",
     "examineManage": "Examine",
-    "examineScqy": "Supplier",
-    "examineOrder": "Order"
+    "examineSubsidy": "Subsidy",
+    "examineCoupon": "Coupon"
   }
 }

+ 2 - 2
apps/web-ele/src/locales/langs/zh-CN/page.json

@@ -25,7 +25,7 @@
     "orderManage": "订单管理",
     "couponManage": "优惠券管理",
     "examineManage": "审核管理",
-    "examineScqy": "生产企业审核",
-    "examineOrder": "订单审核"
+    "examineSubsidy": "补贴审核",
+    "examineCoupon": "优惠劵审核"
   }
 }

+ 190 - 0
apps/web-ele/src/views/examine-manage/examine-coupon/form.vue

@@ -0,0 +1,190 @@
+<script lang="ts" setup>
+import type { Coupon2Entity } from '@vben/types';
+
+import { computed, ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { ElMessage } from 'element-plus';
+
+import { useVbenForm, z } from '#/adapter/form';
+import {
+  addCoupon2Api,
+  editCoupon2Api,
+  getCoupon2DetailApi,
+} from '#/api/coupon/coupon2';
+import { $t } from '#/locales';
+
+const emit = defineEmits(['finish']);
+const data = ref();
+const formType = ref<'create' | 'detail' | 'edit'>('create');
+
+const titleMap = {
+  create: '新增优惠券',
+  detail: '优惠券详情',
+  edit: '编辑优惠券',
+} as const;
+
+const getTitle = computed(() => titleMap[formType.value]);
+
+const [BaseForm, baseFormApi] = useVbenForm({
+  showDefaultActions: false,
+  // 所有表单项共用,可单独在表单内覆盖
+  commonConfig: {
+    labelWidth: 140,
+    // 所有表单项
+    componentProps: {
+      class: 'w-full',
+    },
+  },
+  wrapperClass: 'grid-cols-1 lg:grid-cols-2',
+  schema: [
+    // { title: '优惠券代码', field: 'coupon2code' },
+    // { title: '审核时间', field: 'coupon2reviewdatetime' },
+    // { title: '优惠券状态', field: 'coupon2sype' },
+    // { title: '使用状态', field: 'coupon2isused' },
+    // { title: '可用产品', field: 'coupon2productids' },
+    // { title: '关联主券ID', field: 'coupon2coupon1id' },
+    {
+      component: 'Input',
+      fieldName: 'coupon2code',
+      label: '优惠券代码',
+      componentProps: {
+        placeholder: $t('ui.placeholder.input'),
+        allowClear: true,
+      },
+      rules: z.string().min(1, { message: '请输入优惠券代码' }),
+    },
+    {
+      component: 'DatePicker',
+      fieldName: 'coupon2reviewdatetime',
+      label: '审核时间',
+      componentProps: {
+        placeholder: $t('ui.placeholder.select'),
+        allowClear: true,
+      },
+      rules: z.string().min(1, { message: '请选择审核时间' }),
+    },
+    {
+      component: 'Select',
+      fieldName: 'coupon2sype',
+      label: '优惠券状态',
+      componentProps: {
+        placeholder: $t('ui.placeholder.select'),
+        allowClear: true,
+        options: [
+          { label: '申请中', value: 0 },
+          { label: '审核通过', value: 1 },
+          { label: '审核失败', value: 2 },
+        ],
+      },
+      rules: z.number().min(0, { message: '请选择优惠券状态' }),
+    },
+    {
+      component: 'Select',
+      fieldName: 'coupon2isused',
+      label: '使用状态',
+      componentProps: {
+        placeholder: $t('ui.placeholder.select'),
+        allowClear: true,
+        options: [
+          { label: '未使用', value: 0 },
+          { label: '已使用', value: 1 },
+        ],
+      },
+      rules: z.number().min(0, { message: '请选择使用状态' }),
+    },
+    {
+      component: 'Input',
+      fieldName: 'coupon2productids',
+      label: '可用产品',
+      componentProps: {
+        placeholder: $t('ui.placeholder.input'),
+        allowClear: true,
+      },
+      rules: z.string().min(1, { message: '请输入可用产品' }),
+    },
+    {
+      component: 'Input',
+      fieldName: 'coupon2coupon1id',
+      label: '关联主券ID',
+      componentProps: {
+        placeholder: $t('ui.placeholder.input'),
+        allowClear: true,
+      },
+      rules: z.string().min(1, { message: '请输入关联主券ID' }),
+    },
+  ],
+});
+
+const [Modal, modalApi] = useVbenModal({
+  class: 'w-7/12',
+  onCancel() {
+    modalApi.close();
+  },
+  async onConfirm() {
+    // 校验输入的数据
+    const validate = await baseFormApi.validate();
+    if (!validate.valid) {
+      return;
+    }
+
+    try {
+      // 调用新增或编辑接口
+      const apiMap = {
+        create: () => addCoupon2Api(validate.values as Coupon2Entity),
+        edit: () =>
+          editCoupon2Api({
+            ...validate.values,
+            'coupon2sid.value': data.value.row.coupon2sid,
+          } as any),
+      };
+
+      if (formType.value === 'detail') {
+        modalApi.close();
+        return;
+      }
+
+      await apiMap[formType.value]();
+      ElMessage.success('操作成功');
+
+      emit('finish');
+      modalApi.close();
+    } catch {}
+  },
+  async onOpenChange(isOpen) {
+    if (isOpen) {
+      data.value = modalApi.getData();
+
+      formType.value = data.value.formType;
+
+      baseFormApi.setState({
+        commonConfig: { disabled: formType.value === 'detail' },
+      });
+
+      if (data.value.formType === 'create') {
+        return;
+      }
+
+      try {
+        modalApi.setState({ loading: true });
+        const detailData = await getCoupon2DetailApi({
+          coupon2sid: data.value.row.coupon2sid,
+        });
+
+        baseFormApi.setValues(detailData);
+      } catch {
+        // console.log(error);
+      }
+
+      modalApi.setState({ loading: false });
+    }
+  },
+});
+</script>
+
+<template>
+  <Modal :title="getTitle">
+    <BaseForm />
+  </Modal>
+</template>

+ 34 - 41
apps/web-ele/src/views/examine-manage/examine-scqy/index.vue → apps/web-ele/src/views/examine-manage/examine-coupon/index.vue

@@ -7,10 +7,10 @@ import { Page, useVbenModal } from '@vben/common-ui';
 import { MdiDetail, MdiEdit } from '@vben/icons';
 
 import { useVbenVxeGrid } from '#/adapter/vxe-table';
-// import { getCustomerListApi } from '#/api/customer-manage';
+import { getCoupon2ListApi } from '#/api/coupon/coupon2';
 import { $t } from '#/locales';
 
-import CustomerForm from './form.vue';
+import Coupon1Form from './form.vue';
 
 const formOptions: VbenFormProps = {
   // 默认展开
@@ -22,23 +22,15 @@ const formOptions: VbenFormProps = {
   schema: [
     {
       component: 'Input',
-      fieldName: 'usersname',
-      label: '用户名称',
-      componentProps: {
-        placeholder: $t('ui.placeholder.input'),
-        allowClear: true,
-      },
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersphone',
-      label: '用户手机号',
+      fieldName: 'couponmc',
+      label: '优惠券名称',
       componentProps: {
         placeholder: $t('ui.placeholder.input'),
         allowClear: true,
       },
     },
   ],
+  wrapperClass: 'grid-cols-1 md:grid-cols-3 lg:grid-cols-5',
 };
 
 const gridOptions: VxeGridProps<any> = {
@@ -62,29 +54,27 @@ const gridOptions: VxeGridProps<any> = {
       result: 'Data',
       total: 'Total',
     },
-    // ajax: {
-    //   query: async ({ page }, formValues) => {
-    //     return await getCustomerListApi({
-    //       pageindex: page.currentPage,
-    //       rows: page.pageSize,
-    //       ...formValues,
-    //     });
-    //   },
-    // },
+    ajax: {
+      query: async ({ page }, formValues) => {
+        return await getCoupon2ListApi({
+          pageindex: page.currentPage,
+          rows: page.pageSize,
+          ...formValues,
+        });
+      },
+    },
   },
 
   columns: [
-    { title: '用户名称', field: 'usersname' },
-    { title: '用户性质', field: 'usersnature' },
-    { title: '用户证件号码', field: 'usersidcardnumber' },
-    { title: '用户开户银行名称', field: 'usersbankname' },
-    { title: '用户开户银行账号', field: 'usersbanknumber' },
-    { title: '用户手机号', field: 'usersphone' },
-    { title: '用户邮箱', field: 'usersemail' },
-    { title: '用户地址', field: 'usersaddress' },
-    { title: '用户联系手机号', field: 'userscontactphone' },
-    { title: '用户联系邮箱', field: 'userscontactemail' },
-    { title: '用户联系地址', field: 'userscontactaddress' },
+    { title: '优惠券ID', field: 'coupon2sid' },
+    { title: '优惠券代码', field: 'coupon2code' },
+    { title: '申请时间', field: 'coupon2adddatetime' },
+    { title: '审核时间', field: 'coupon2reviewdatetime' },
+    { title: '申请人ID', field: 'coupon2userid' },
+    { title: '优惠券状态', field: 'coupon2sype' },
+    { title: '使用状态', field: 'coupon2isused' },
+    { title: '可用产品', field: 'coupon2productids' },
+    { title: '关联主券ID', field: 'coupon2coupon1id' },
     {
       title: '操作',
       field: 'action',
@@ -95,35 +85,38 @@ const gridOptions: VxeGridProps<any> = {
   ],
 };
 
-const [Grid] = useVbenVxeGrid({ gridOptions, formOptions });
+const [Grid, gridApi] = useVbenVxeGrid({ gridOptions, formOptions });
 
 const [Modal, modalApi] = useVbenModal({
   fullscreenButton: false,
   closeOnClickModal: false,
   closeOnPressEscape: false,
-  connectedComponent: CustomerForm,
+  connectedComponent: Coupon1Form,
 });
 
 /* 创建 */
 function handleCreate() {
-  modalApi.setData({ create: true }).open();
+  modalApi.setData({ formType: 'create' }).open();
 }
 
 /* 编辑 */
 function handleEdit(row: any) {
-  modalApi.setData({ row }).open();
+  modalApi.setData({ formType: 'edit', row }).open();
 }
 
 /* 详情 */
 function handleDetail(row: any) {
-  modalApi.setData({ row }).open();
-  // router.push(`/system/users/detail/${row.userName}`);
+  modalApi.setData({ formType: 'detail', row }).open();
+}
+
+function handleFinish() {
+  gridApi.reload();
 }
 </script>
 
 <template>
   <Page auto-content-height>
-    <Grid table-title="商户审核">
+    <Grid table-title="优惠券列表">
       <template #toolbar-tools>
         <el-button type="primary" @click="handleCreate"> 新增 </el-button>
       </template>
@@ -142,6 +135,6 @@ function handleDetail(row: any) {
         />
       </template>
     </Grid>
-    <Modal />
+    <Modal @finish="handleFinish" />
   </Page>
 </template>

+ 0 - 193
apps/web-ele/src/views/examine-manage/examine-order/form.vue

@@ -1,193 +0,0 @@
-<script lang="ts" setup>
-import { computed, ref } from 'vue';
-
-import { useVbenModal } from '@vben/common-ui';
-
-import { useVbenForm, z } from '#/adapter/form';
-import { getCustomerDetailApi } from '#/api/customer-manage';
-
-const data = ref();
-
-const getTitle = computed(() => (data.value?.create ? '新增客户' : '编辑客户'));
-
-const [BaseForm, baseFormApi] = useVbenForm({
-  showDefaultActions: false,
-  // 所有表单项共用,可单独在表单内覆盖
-  commonConfig: {
-    labelWidth: 120,
-    // 所有表单项
-    componentProps: {
-      class: 'w-full',
-    },
-  },
-  schema: [
-    // { title: '用户名称', field: 'usersname' },
-    // { title: '用户性质', field: 'usersnature' },
-    // { title: '用户证件号码', field: 'usersidcardnumber' },
-    // { title: '用户开户银行名称', field: 'usersbankname' },
-    // { title: '用户开户银行账号', field: 'usersbanknumber' },
-    // { title: '用户手机号', field: 'usersphone' },
-    // { title: '用户邮箱', field: 'usersemail' },
-    // { title: '用户地址', field: 'usersaddress' },
-    // { title: '用户联系手机号', field: 'userscontactphone' },
-    // { title: '用户联系邮箱', field: 'userscontactemail' },
-    // { title: '用户联系地址', field: 'userscontactaddress' },
-    {
-      component: 'Input',
-      fieldName: 'usersname',
-      label: '用户名称',
-      componentProps: {
-        placeholder: '请输入用户名称',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户名称' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersnature',
-      label: '用户性质',
-      componentProps: {
-        placeholder: '请输入用户性质',
-        allowClear: true,
-      },
-      rules: z.number().min(1, { message: '请输入用户性质' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersidcardnumber',
-      label: '用户证件号码',
-      componentProps: {
-        placeholder: '请输入用户证件号码',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户证件号码' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersbankname',
-      label: '用户开户银行名称',
-      componentProps: {
-        placeholder: '请输入用户开户银行名称',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户开户银行名称' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersbanknumber',
-      label: '用户开户银行账号',
-      componentProps: {
-        placeholder: '请输入用户开户银行账号',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户开户银行账号' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersphone',
-      label: '用户手机号',
-      componentProps: {
-        placeholder: '请输入用户手机号',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户手机号' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersemail',
-      label: '用户邮箱',
-      componentProps: {
-        placeholder: '请输入用户邮箱',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户邮箱' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersaddress',
-      label: '用户地址',
-      componentProps: {
-        placeholder: '请输入用户地址',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户地址' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'userscontactphone',
-      label: '用户联系手机号',
-      componentProps: {
-        placeholder: '请输入用户联系手机号',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户联系手机号' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'userscontactemail',
-      label: '用户联系邮箱',
-      componentProps: {
-        placeholder: '请输入用户联系邮箱',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户联系邮箱' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'userscontactaddress',
-      label: '用户联系地址',
-      componentProps: {
-        placeholder: '请输入用户联系地址',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户联系地址' }),
-    },
-  ],
-});
-
-const [Modal, modalApi] = useVbenModal({
-  onCancel() {
-    modalApi.close();
-  },
-  async onConfirm() {
-    // 校验输入的数据
-    const validate = await baseFormApi.validate();
-    if (!validate.valid) {
-      return;
-    }
-
-    modalApi.close();
-    // const values = await baseFormApi.getValues();
-
-    // console.log(Object.keys(values));
-  },
-  async onOpenChange(isOpen) {
-    if (isOpen) {
-      data.value = modalApi.getData();
-
-      if (data.value.create) {
-        return;
-      }
-
-      try {
-        modalApi.setState({ loading: true });
-        const detailData = await getCustomerDetailApi({
-          usersid: data.value.row.usersid,
-        });
-
-        baseFormApi.setValues(detailData);
-      } catch {
-        // console.log(error);
-      }
-
-      modalApi.setState({ loading: false });
-    }
-  },
-});
-</script>
-
-<template>
-  <Modal :title="getTitle">
-    <BaseForm />
-  </Modal>
-</template>

+ 0 - 193
apps/web-ele/src/views/examine-manage/examine-scqy/form.vue

@@ -1,193 +0,0 @@
-<script lang="ts" setup>
-import { computed, ref } from 'vue';
-
-import { useVbenModal } from '@vben/common-ui';
-
-import { useVbenForm, z } from '#/adapter/form';
-import { getCustomerDetailApi } from '#/api/customer-manage';
-
-const data = ref();
-
-const getTitle = computed(() => (data.value?.create ? '新增客户' : '编辑客户'));
-
-const [BaseForm, baseFormApi] = useVbenForm({
-  showDefaultActions: false,
-  // 所有表单项共用,可单独在表单内覆盖
-  commonConfig: {
-    labelWidth: 120,
-    // 所有表单项
-    componentProps: {
-      class: 'w-full',
-    },
-  },
-  schema: [
-    // { title: '用户名称', field: 'usersname' },
-    // { title: '用户性质', field: 'usersnature' },
-    // { title: '用户证件号码', field: 'usersidcardnumber' },
-    // { title: '用户开户银行名称', field: 'usersbankname' },
-    // { title: '用户开户银行账号', field: 'usersbanknumber' },
-    // { title: '用户手机号', field: 'usersphone' },
-    // { title: '用户邮箱', field: 'usersemail' },
-    // { title: '用户地址', field: 'usersaddress' },
-    // { title: '用户联系手机号', field: 'userscontactphone' },
-    // { title: '用户联系邮箱', field: 'userscontactemail' },
-    // { title: '用户联系地址', field: 'userscontactaddress' },
-    {
-      component: 'Input',
-      fieldName: 'usersname',
-      label: '用户名称',
-      componentProps: {
-        placeholder: '请输入用户名称',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户名称' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersnature',
-      label: '用户性质',
-      componentProps: {
-        placeholder: '请输入用户性质',
-        allowClear: true,
-      },
-      rules: z.number().min(1, { message: '请输入用户性质' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersidcardnumber',
-      label: '用户证件号码',
-      componentProps: {
-        placeholder: '请输入用户证件号码',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户证件号码' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersbankname',
-      label: '用户开户银行名称',
-      componentProps: {
-        placeholder: '请输入用户开户银行名称',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户开户银行名称' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersbanknumber',
-      label: '用户开户银行账号',
-      componentProps: {
-        placeholder: '请输入用户开户银行账号',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户开户银行账号' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersphone',
-      label: '用户手机号',
-      componentProps: {
-        placeholder: '请输入用户手机号',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户手机号' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersemail',
-      label: '用户邮箱',
-      componentProps: {
-        placeholder: '请输入用户邮箱',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户邮箱' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersaddress',
-      label: '用户地址',
-      componentProps: {
-        placeholder: '请输入用户地址',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户地址' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'userscontactphone',
-      label: '用户联系手机号',
-      componentProps: {
-        placeholder: '请输入用户联系手机号',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户联系手机号' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'userscontactemail',
-      label: '用户联系邮箱',
-      componentProps: {
-        placeholder: '请输入用户联系邮箱',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户联系邮箱' }),
-    },
-    {
-      component: 'Input',
-      fieldName: 'userscontactaddress',
-      label: '用户联系地址',
-      componentProps: {
-        placeholder: '请输入用户联系地址',
-        allowClear: true,
-      },
-      rules: z.string().min(1, { message: '请输入用户联系地址' }),
-    },
-  ],
-});
-
-const [Modal, modalApi] = useVbenModal({
-  onCancel() {
-    modalApi.close();
-  },
-  async onConfirm() {
-    // 校验输入的数据
-    const validate = await baseFormApi.validate();
-    if (!validate.valid) {
-      return;
-    }
-
-    modalApi.close();
-    // const values = await baseFormApi.getValues();
-
-    // console.log(Object.keys(values));
-  },
-  async onOpenChange(isOpen) {
-    if (isOpen) {
-      data.value = modalApi.getData();
-
-      if (data.value.create) {
-        return;
-      }
-
-      try {
-        modalApi.setState({ loading: true });
-        const detailData = await getCustomerDetailApi({
-          usersid: data.value.row.usersid,
-        });
-
-        baseFormApi.setValues(detailData);
-      } catch {
-        // console.log(error);
-      }
-
-      modalApi.setState({ loading: false });
-    }
-  },
-});
-</script>
-
-<template>
-  <Modal :title="getTitle">
-    <BaseForm />
-  </Modal>
-</template>

+ 169 - 0
apps/web-ele/src/views/examine-manage/examine-subsidy/form.vue

@@ -0,0 +1,169 @@
+<script lang="ts" setup>
+import { computed, ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { ElMessage } from 'element-plus';
+
+import { useVbenForm, z } from '#/adapter/form';
+import {
+  addSubsidyApplicationsApi,
+  editSubsidyApplicationsApi,
+  getSubsidyApplicationsDetailApi,
+} from '#/api/subsidyapplications';
+import { $t } from '#/locales';
+
+const emit = defineEmits(['finish']);
+const data = ref();
+const formType = ref<'create' | 'detail' | 'edit'>('create');
+
+const titleMap = {
+  create: '新增补贴申请',
+  detail: '补贴申请详情',
+  edit: '编辑补贴申请',
+} as const;
+
+const getTitle = computed(() => titleMap[formType.value]);
+
+const [BaseForm, baseFormApi] = useVbenForm({
+  showDefaultActions: false,
+  // 所有表单项共用,可单独在表单内覆盖
+  commonConfig: {
+    labelWidth: 140,
+    // 所有表单项
+    componentProps: {
+      class: 'w-full',
+    },
+  },
+  wrapperClass: 'grid-cols-1 lg:grid-cols-2',
+  schema: [
+    // { title: '渠道商ID', field: 'subsidyapplicationsmerchantid' },
+    // { title: '补贴金额', field: 'subsidyapplicationssubsidyamount' },
+    // { title: '审批状态', field: 'subsidyapplicationsapprovalstatus' },
+    // { title: '申请日期', field: 'subsidyapplicationsapplydate' },
+    {
+      component: 'Input',
+      fieldName: 'subsidyapplicationsmerchantid',
+      label: '渠道商ID',
+      componentProps: {
+        placeholder: $t('ui.placeholder.input'),
+        allowClear: true,
+      },
+      rules: z.string().min(1, { message: '请输入渠道商ID' }),
+    },
+    {
+      component: 'Input',
+      fieldName: 'subsidyapplicationssubsidyamount',
+      label: '补贴金额',
+      componentProps: {
+        placeholder: $t('ui.placeholder.input'),
+        allowClear: true,
+      },
+      rules: z.string().min(1, { message: '请输入补贴金额' }),
+    },
+    {
+      component: 'Input',
+      fieldName: 'subsidyapplicationsapprovalstatus',
+      label: '审批状态',
+      componentProps: {
+        placeholder: $t('ui.placeholder.input'),
+        allowClear: true,
+      },
+      rules: z.string().min(1, { message: '请输入审批状态' }),
+    },
+  ],
+});
+
+const [Modal, modalApi] = useVbenModal({
+  class: 'w-7/12',
+  onCancel() {
+    modalApi.close();
+  },
+  async onConfirm() {
+    // 校验输入的数据
+    const validate = await baseFormApi.validate();
+    if (!validate.valid) {
+      return;
+    }
+
+    try {
+      // 调用新增或编辑接口
+      const apiMap = {
+        create: () => {
+          const params = {
+            ...validate?.values,
+            'subsidyapplicationsmerchantid.value':
+              validate?.values?.subsidyapplicationsmerchantid,
+            'subsidyapplicationstotalsales.value':
+              validate?.values?.subsidyapplicationstotalsales,
+            'subsidyapplicationssubsidyamount.value':
+              validate?.values?.subsidyapplicationssubsidyamount,
+            'subsidyapplicationsapprovalstatus.value':
+              validate?.values?.subsidyapplicationsapprovalstatus,
+          } as any;
+
+          return addSubsidyApplicationsApi(params);
+        },
+        edit: () =>
+          editSubsidyApplicationsApi({
+            ...validate.values,
+            'subsidyapplicationsmerchantid.value':
+              data.value.row.subsidyapplicationsmerchantid,
+            'subsidyapplicationsid.value': data.value.row.subsidyapplicationsid,
+            'subsidyapplicationstotalsales.value':
+              data.value.row.subsidyapplicationstotalsales,
+            'subsidyapplicationssubsidyamount.value':
+              data.value.row.subsidyapplicationssubsidyamount,
+            'subsidyapplicationsapprovalstatus.value':
+              data.value.row.subsidyapplicationsapprovalstatus,
+          } as any),
+      };
+
+      if (formType.value === 'detail') {
+        modalApi.close();
+        return;
+      }
+
+      await apiMap[formType.value]();
+      ElMessage.success('操作成功');
+
+      emit('finish');
+      modalApi.close();
+    } catch {}
+  },
+  async onOpenChange(isOpen) {
+    if (isOpen) {
+      data.value = modalApi.getData();
+
+      formType.value = data.value.formType;
+
+      baseFormApi.setState({
+        commonConfig: { disabled: formType.value === 'detail' },
+      });
+
+      if (data.value.formType === 'create') {
+        return;
+      }
+
+      try {
+        modalApi.setState({ loading: true });
+        const detailData = await getSubsidyApplicationsDetailApi({
+          subsidyapplicationsid: data.value.row.subsidyapplicationsid,
+        });
+
+        baseFormApi.setValues(detailData);
+      } catch {
+        // console.log(error);
+      }
+
+      modalApi.setState({ loading: false });
+    }
+  },
+});
+</script>
+
+<template>
+  <Modal :title="getTitle">
+    <BaseForm />
+  </Modal>
+</template>

+ 30 - 41
apps/web-ele/src/views/examine-manage/examine-order/index.vue → apps/web-ele/src/views/examine-manage/examine-subsidy/index.vue

@@ -7,10 +7,10 @@ import { Page, useVbenModal } from '@vben/common-ui';
 import { MdiDetail, MdiEdit } from '@vben/icons';
 
 import { useVbenVxeGrid } from '#/adapter/vxe-table';
-// import { getCustomerListApi } from '#/api/customer-manage';
+import { getSubsidyApplicationsListApi } from '#/api/subsidyapplications';
 import { $t } from '#/locales';
 
-import CustomerForm from './form.vue';
+import SubsidyApplicationsForm from './form.vue';
 
 const formOptions: VbenFormProps = {
   // 默认展开
@@ -22,23 +22,15 @@ const formOptions: VbenFormProps = {
   schema: [
     {
       component: 'Input',
-      fieldName: 'usersname',
-      label: '用户名称',
-      componentProps: {
-        placeholder: $t('ui.placeholder.input'),
-        allowClear: true,
-      },
-    },
-    {
-      component: 'Input',
-      fieldName: 'usersphone',
-      label: '用户手机号',
+      fieldName: 'subsidyapplicationsmerchantid',
+      label: '渠道商ID',
       componentProps: {
         placeholder: $t('ui.placeholder.input'),
         allowClear: true,
       },
     },
   ],
+  wrapperClass: 'grid-cols-1 md:grid-cols-3 lg:grid-cols-5',
 };
 
 const gridOptions: VxeGridProps<any> = {
@@ -62,29 +54,23 @@ const gridOptions: VxeGridProps<any> = {
       result: 'Data',
       total: 'Total',
     },
-    // ajax: {
-    //   query: async ({ page }, formValues) => {
-    //     return await getCustomerListApi({
-    //       pageindex: page.currentPage,
-    //       rows: page.pageSize,
-    //       ...formValues,
-    //     });
-    //   },
-    // },
+    ajax: {
+      query: async ({ page }, formValues) => {
+        return await getSubsidyApplicationsListApi({
+          pageindex: page.currentPage,
+          rows: page.pageSize,
+          ...formValues,
+        });
+      },
+    },
   },
 
   columns: [
-    { title: '用户名称', field: 'usersname' },
-    { title: '用户性质', field: 'usersnature' },
-    { title: '用户证件号码', field: 'usersidcardnumber' },
-    { title: '用户开户银行名称', field: 'usersbankname' },
-    { title: '用户开户银行账号', field: 'usersbanknumber' },
-    { title: '用户手机号', field: 'usersphone' },
-    { title: '用户邮箱', field: 'usersemail' },
-    { title: '用户地址', field: 'usersaddress' },
-    { title: '用户联系手机号', field: 'userscontactphone' },
-    { title: '用户联系邮箱', field: 'userscontactemail' },
-    { title: '用户联系地址', field: 'userscontactaddress' },
+    { title: '补贴申请ID', field: 'subsidyapplicationsid' },
+    { title: '渠道商ID', field: 'subsidyapplicationsmerchantid' },
+    { title: '补贴金额', field: 'subsidyapplicationssubsidyamount' },
+    { title: '审批状态', field: 'subsidyapplicationsapprovalstatus' },
+    { title: '申请日期', field: 'subsidyapplicationsapplydate' },
     {
       title: '操作',
       field: 'action',
@@ -95,35 +81,38 @@ const gridOptions: VxeGridProps<any> = {
   ],
 };
 
-const [Grid] = useVbenVxeGrid({ gridOptions, formOptions });
+const [Grid, gridApi] = useVbenVxeGrid({ gridOptions, formOptions });
 
 const [Modal, modalApi] = useVbenModal({
   fullscreenButton: false,
   closeOnClickModal: false,
   closeOnPressEscape: false,
-  connectedComponent: CustomerForm,
+  connectedComponent: SubsidyApplicationsForm,
 });
 
 /* 创建 */
 function handleCreate() {
-  modalApi.setData({ create: true }).open();
+  modalApi.setData({ formType: 'create' }).open();
 }
 
 /* 编辑 */
 function handleEdit(row: any) {
-  modalApi.setData({ row }).open();
+  modalApi.setData({ formType: 'edit', row }).open();
 }
 
 /* 详情 */
 function handleDetail(row: any) {
-  modalApi.setData({ row }).open();
-  // router.push(`/system/users/detail/${row.userName}`);
+  modalApi.setData({ formType: 'detail', row }).open();
+}
+
+function handleFinish() {
+  gridApi.reload();
 }
 </script>
 
 <template>
   <Page auto-content-height>
-    <Grid table-title="订单审核">
+    <Grid table-title="补贴申请列表">
       <template #toolbar-tools>
         <el-button type="primary" @click="handleCreate"> 新增 </el-button>
       </template>
@@ -142,6 +131,6 @@ function handleDetail(row: any) {
         />
       </template>
     </Grid>
-    <Modal />
+    <Modal @finish="handleFinish" />
   </Page>
 </template>