seckillActivity.data.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
  2. import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
  3. import { getListAllSimple } from '@/api/mall/promotion/seckill/seckillConfig'
  4. // 表单校验
  5. export const rules = reactive({
  6. spuId: [required],
  7. name: [required],
  8. startTime: [required],
  9. endTime: [required],
  10. sort: [required],
  11. configIds: [required],
  12. totalLimitCount: [required],
  13. singleLimitCount: [required],
  14. totalStock: [required]
  15. })
  16. // CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
  17. const crudSchemas = reactive<CrudSchema[]>([
  18. {
  19. label: '秒杀活动名称',
  20. field: 'name',
  21. isSearch: true,
  22. form: {
  23. colProps: {
  24. span: 24
  25. }
  26. },
  27. table: {
  28. width: 120
  29. }
  30. },
  31. {
  32. label: '活动开始时间',
  33. field: 'startTime',
  34. formatter: dateFormatter2,
  35. isSearch: true,
  36. search: {
  37. component: 'DatePicker',
  38. componentProps: {
  39. valueFormat: 'YYYY-MM-DD',
  40. type: 'daterange'
  41. }
  42. },
  43. form: {
  44. component: 'DatePicker',
  45. componentProps: {
  46. type: 'date',
  47. valueFormat: 'x'
  48. }
  49. },
  50. table: {
  51. width: 120
  52. }
  53. },
  54. {
  55. label: '活动结束时间',
  56. field: 'endTime',
  57. formatter: dateFormatter2,
  58. isSearch: true,
  59. search: {
  60. component: 'DatePicker',
  61. componentProps: {
  62. valueFormat: 'YYYY-MM-DD',
  63. type: 'daterange'
  64. }
  65. },
  66. form: {
  67. component: 'DatePicker',
  68. componentProps: {
  69. type: 'date',
  70. valueFormat: 'x'
  71. }
  72. },
  73. table: {
  74. width: 120
  75. }
  76. },
  77. {
  78. label: '秒杀时段',
  79. field: 'configIds',
  80. form: {
  81. component: 'Select',
  82. componentProps: {
  83. multiple: true,
  84. optionsAlias: {
  85. labelField: 'name',
  86. valueField: 'id'
  87. }
  88. },
  89. api: getListAllSimple
  90. },
  91. table: {
  92. width: 300
  93. }
  94. },
  95. {
  96. label: '新增订单数',
  97. field: 'orderCount',
  98. isForm: false,
  99. form: {
  100. component: 'InputNumber',
  101. value: 0
  102. },
  103. table: {
  104. width: 120
  105. }
  106. },
  107. {
  108. label: '付款人数',
  109. field: 'userCount',
  110. isForm: false,
  111. form: {
  112. component: 'InputNumber',
  113. value: 0
  114. },
  115. table: {
  116. width: 120
  117. }
  118. },
  119. {
  120. label: '订单实付金额',
  121. field: 'totalPrice',
  122. isForm: false,
  123. form: {
  124. component: 'InputNumber',
  125. value: 0
  126. },
  127. table: {
  128. width: 120
  129. }
  130. },
  131. {
  132. label: '总限购数量',
  133. field: 'totalLimitCount',
  134. form: {
  135. component: 'InputNumber',
  136. value: 0
  137. },
  138. table: {
  139. width: 120
  140. }
  141. },
  142. {
  143. label: '单次限够数量',
  144. field: 'singleLimitCount',
  145. form: {
  146. component: 'InputNumber',
  147. value: 0
  148. },
  149. table: {
  150. width: 120
  151. }
  152. },
  153. {
  154. label: '秒杀库存',
  155. field: 'stock',
  156. isForm: false,
  157. form: {
  158. component: 'InputNumber',
  159. value: 0
  160. },
  161. table: {
  162. width: 120
  163. }
  164. },
  165. {
  166. label: '秒杀总库存',
  167. field: 'totalStock',
  168. form: {
  169. component: 'InputNumber',
  170. value: 0
  171. },
  172. table: {
  173. width: 120
  174. }
  175. },
  176. {
  177. label: '秒杀活动商品',
  178. field: 'spuIds',
  179. isTable: false,
  180. isSearch: false,
  181. form: {
  182. colProps: {
  183. span: 24
  184. }
  185. },
  186. table: {
  187. width: 200
  188. }
  189. },
  190. {
  191. label: '创建时间',
  192. field: 'createTime',
  193. formatter: dateFormatter,
  194. search: {
  195. component: 'DatePicker',
  196. componentProps: {
  197. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  198. type: 'daterange',
  199. defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
  200. }
  201. },
  202. isForm: false,
  203. table: {
  204. width: 120
  205. }
  206. },
  207. {
  208. label: '排序',
  209. field: 'sort',
  210. form: {
  211. component: 'InputNumber',
  212. value: 0
  213. },
  214. table: {
  215. width: 80
  216. }
  217. },
  218. {
  219. label: '状态',
  220. field: 'status',
  221. dictType: DICT_TYPE.COMMON_STATUS,
  222. dictClass: 'number',
  223. isForm: false,
  224. isSearch: true,
  225. form: {
  226. component: 'Radio'
  227. },
  228. table: {
  229. width: 80
  230. }
  231. },
  232. {
  233. label: '备注',
  234. field: 'remark',
  235. isSearch: false,
  236. form: {
  237. component: 'Input',
  238. componentProps: {
  239. type: 'textarea',
  240. rows: 4
  241. },
  242. colProps: {
  243. span: 24
  244. }
  245. },
  246. table: {
  247. width: 300
  248. }
  249. },
  250. {
  251. label: '操作',
  252. field: 'action',
  253. isForm: false,
  254. table: {
  255. width: 120,
  256. fixed: 'right'
  257. }
  258. }
  259. ])
  260. export const { allSchemas } = useCrudSchemas(crudSchemas)