combinationActivity.data.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
  2. import { dateFormatter, getNowDateTime } from '@/utils/formatTime'
  3. // 表单校验
  4. export const rules = reactive({
  5. name: [required],
  6. totalLimitCount: [required],
  7. singleLimitCount: [required],
  8. startTime: [required],
  9. endTime: [required],
  10. userSize: [required],
  11. limitDuration: [required]
  12. })
  13. // CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
  14. const crudSchemas = reactive<CrudSchema[]>([
  15. {
  16. label: '拼团名称',
  17. field: 'name',
  18. isSearch: true,
  19. isTable: false,
  20. form: {
  21. colProps: {
  22. span: 24
  23. }
  24. }
  25. },
  26. {
  27. label: '活动时间',
  28. field: 'activityTime',
  29. formatter: dateFormatter,
  30. search: {
  31. show: true,
  32. component: 'DatePicker',
  33. componentProps: {
  34. valueFormat: 'x',
  35. type: 'datetimerange',
  36. rangeSeparator: '至'
  37. }
  38. },
  39. form: {
  40. component: 'DatePicker',
  41. componentProps: {
  42. valueFormat: 'x',
  43. type: 'datetimerange',
  44. rangeSeparator: '至'
  45. },
  46. value: [getNowDateTime().valueOf(), getNowDateTime().valueOf()],
  47. colProps: {
  48. span: 24
  49. }
  50. }
  51. },
  52. {
  53. label: '参与人数',
  54. field: 'userSize',
  55. isSearch: false,
  56. form: {
  57. component: 'InputNumber',
  58. labelMessage: '参与人数不能少于两人',
  59. value: 2
  60. }
  61. },
  62. {
  63. label: '限制时长',
  64. field: 'limitDuration',
  65. isSearch: false,
  66. isTable: false,
  67. form: {
  68. component: 'InputNumber',
  69. labelMessage: '限制时长(小时)',
  70. componentProps: {
  71. placeholder: '请输入限制时长(小时)'
  72. }
  73. }
  74. },
  75. {
  76. label: '总限购数量',
  77. field: 'totalLimitCount',
  78. isSearch: false,
  79. isTable: false,
  80. form: {
  81. component: 'InputNumber',
  82. value: 0
  83. }
  84. },
  85. {
  86. label: '单次限购数量',
  87. field: 'singleLimitCount',
  88. isSearch: false,
  89. isTable: false,
  90. form: {
  91. component: 'InputNumber',
  92. value: 0
  93. }
  94. },
  95. {
  96. label: '购买人数',
  97. field: 'userSize',
  98. isSearch: false,
  99. isForm: false
  100. },
  101. {
  102. label: '开团组数',
  103. field: 'totalNum',
  104. isSearch: false,
  105. isForm: false
  106. },
  107. {
  108. label: '成团组数',
  109. field: 'successNum',
  110. isSearch: false,
  111. isForm: false
  112. },
  113. {
  114. label: '活动状态',
  115. field: 'status',
  116. dictType: DICT_TYPE.COMMON_STATUS,
  117. dictClass: 'number',
  118. isSearch: true,
  119. isForm: false
  120. },
  121. {
  122. label: '拼团商品',
  123. field: 'spuId',
  124. isSearch: false,
  125. form: {
  126. colProps: {
  127. span: 24
  128. }
  129. }
  130. },
  131. {
  132. label: '操作',
  133. field: 'action',
  134. isForm: false
  135. }
  136. ])
  137. export const { allSchemas } = useCrudSchemas(crudSchemas)