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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
| import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
| import { dateFormatter2 } from '@/utils/formatTime'
|
| // 表单校验
| export const rules = reactive({
| name: [required],
| startTime: [required],
| endTime: [required],
| helpMaxCount: [required],
| bargainCount: [required],
| singleLimitCount: [required]
| })
|
| // CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
| const crudSchemas = reactive<CrudSchema[]>([
| {
| label: '砍价活动名称',
| field: 'name',
| isSearch: true,
| isTable: false,
| form: {
| colProps: {
| span: 24
| }
| }
| },
| {
| label: '活动开始时间',
| field: 'startTime',
| formatter: dateFormatter2,
| isSearch: true,
| search: {
| component: 'DatePicker',
| componentProps: {
| valueFormat: 'YYYY-MM-DD',
| type: 'daterange'
| }
| },
| form: {
| component: 'DatePicker',
| componentProps: {
| type: 'date',
| valueFormat: 'x'
| }
| },
| table: {
| width: 120
| }
| },
| {
| label: '活动结束时间',
| field: 'endTime',
| formatter: dateFormatter2,
| isSearch: true,
| search: {
| component: 'DatePicker',
| componentProps: {
| valueFormat: 'YYYY-MM-DD',
| type: 'daterange'
| }
| },
| form: {
| component: 'DatePicker',
| componentProps: {
| type: 'date',
| valueFormat: 'x'
| }
| },
| table: {
| width: 120
| }
| },
| {
| label: '砍价人数',
| field: 'helpMaxCount',
| isSearch: false,
| form: {
| component: 'InputNumber',
| labelMessage: '参与人数不能少于两人',
| value: 2
| }
| },
| {
| label: '最大帮砍次数',
| field: 'bargainCount',
| isSearch: false,
| form: {
| component: 'InputNumber',
| labelMessage: '参与人数不能少于两人',
| value: 2
| }
| },
| {
| label: '总限购数量',
| field: 'totalLimitCount',
| isSearch: false,
| form: {
| component: 'InputNumber',
| labelMessage: '用户最大能发起砍价的次数',
| value: 0
| }
| },
| {
| label: '砍价的最小金额',
| field: 'randomMinPrice',
| isSearch: false,
| isTable: false,
| form: {
| component: 'InputNumber',
| componentProps: {
| min: 0,
| precision: 2,
| step: 0.1
| },
| labelMessage: '用户每次砍价的最小金额',
| value: 0
| }
| },
| {
| label: '砍价的最大金额',
| field: 'randomMaxPrice',
| isSearch: false,
| isTable: false,
| form: {
| component: 'InputNumber',
| componentProps: {
| min: 0,
| precision: 2,
| step: 0.1
| },
| labelMessage: '用户每次砍价的最大金额',
| value: 0
| }
| },
| {
| label: '砍价商品',
| field: 'spuId',
| isSearch: false,
| form: {
| colProps: {
| span: 24
| }
| }
| }
| ])
| export const { allSchemas } = useCrudSchemas(crudSchemas)
|
|