1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeGridProps } from '#/adapter/vxe-table';
|
| import {
| discountFormat,
| remainedCountFormat,
| usePriceFormat,
| validityTypeFormat,
| } from '../formatter';
|
| /** 搜索表单的 schema */
| export function useFormSchema(): VbenFormSchema[] {
| return [
| {
| component: 'Input',
| fieldName: 'name',
| label: '优惠券名称',
| componentProps: {
| placeholder: '请输入优惠券名称',
| allowClear: true,
| },
| },
| ];
| }
|
| /** 表格列配置 */
| export function useGridColumns(): VxeGridProps['columns'] {
| return [
| {
| title: '优惠券名称',
| field: 'name',
| minWidth: 120,
| },
| {
| title: '优惠金额 / 折扣',
| field: 'discount',
| minWidth: 120,
| formatter: ({ row }) => discountFormat(row),
| },
| {
| title: '最低消费',
| field: 'usePrice',
| minWidth: 100,
| formatter: ({ row }) => usePriceFormat(row),
| },
| {
| title: '有效期限',
| field: 'validityType',
| minWidth: 140,
| formatter: ({ row }) => validityTypeFormat(row),
| },
| {
| title: '剩余数量',
| minWidth: 100,
| formatter: ({ row }) => remainedCountFormat(row),
| },
| {
| title: '操作',
| width: 100,
| fixed: 'right',
| slots: { default: 'actions' },
| },
| ];
| }
|
|