diff --git a/apps/web-antd/src/views/mall/promotion/seckill/config/data.ts b/apps/web-antd/src/views/mall/promotion/seckill/config/data.ts new file mode 100644 index 000000000..db00e64ca --- /dev/null +++ b/apps/web-antd/src/views/mall/promotion/seckill/config/data.ts @@ -0,0 +1,150 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MallSeckillConfigApi } from '#/api/mall/promotion/seckill/seckillConfig'; + +import { DICT_TYPE, getDictOptions, getIntDictOptions } from '#/utils'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'name', + label: '秒杀时段名称', + component: 'Input', + rules: 'required', + }, + { + fieldName: 'startTime', + label: '开始时间点', + component: 'TimePicker', + componentProps: { + format: 'HH:mm', + valueFormat: 'HH:mm', + placeholder: '请选择开始时间点', + }, + rules: 'required', + }, + { + fieldName: 'endTime', + label: '结束时间点', + component: 'TimePicker', + componentProps: { + format: 'HH:mm', + valueFormat: 'HH:mm', + placeholder: '请选择结束时间点', + }, + rules: 'required', + }, + { + fieldName: 'sliderPicUrls', + label: '秒杀轮播图', + component: 'ImageUpload', + componentProps: { + multiple: true, + maxNumber: 5, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: 'required', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '秒杀时段名称', + component: 'Input', + componentProps: { + placeholder: '请输入秒杀时段名称', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS), + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns( + onStatusChange?: ( + newStatus: number, + row: T, + ) => PromiseLike, +): VxeTableGridOptions['columns'] { + return [ + { + title: '秒杀时段名称', + field: 'name', + width: 200, + }, + { + title: '开始时间点', + field: 'startTime', + width: 120, + }, + { + title: '结束时间点', + field: 'endTime', + width: 120, + }, + { + title: '秒杀轮播图', + field: 'sliderPicUrls', + cellRender: { + name: 'CellImages', + }, + }, + { + title: '活动状态', + field: 'status', + width: 100, + cellRender: { + attrs: { beforeChange: onStatusChange }, + name: 'CellSwitch', + props: { + checkedValue: 1, + checkedChildren: '启用', + unCheckedValue: 0, + unCheckedChildren: '禁用', + }, + }, + }, + { + title: '创建时间', + field: 'createTime', + width: 180, + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 180, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue b/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue index 9e2d46335..c6b7a45bd 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue +++ b/apps/web-antd/src/views/mall/promotion/seckill/config/index.vue @@ -1,32 +1,159 @@ diff --git a/apps/web-antd/src/views/mall/promotion/seckill/config/modules/form.vue b/apps/web-antd/src/views/mall/promotion/seckill/config/modules/form.vue new file mode 100644 index 000000000..151cde54f --- /dev/null +++ b/apps/web-antd/src/views/mall/promotion/seckill/config/modules/form.vue @@ -0,0 +1,90 @@ + + +