diff --git a/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts b/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts index 77124baed..a5c5a8450 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts +++ b/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts @@ -4,6 +4,9 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; +import { z } from '#/adapter/form'; +import { getSimpleSeckillConfigList } from '#/api/mall/promotion/seckill/seckillConfig'; + /** 列表的搜索表单 */ export function useGridFormSchema(): VbenFormSchema[] { return [ @@ -29,6 +32,115 @@ export function useGridFormSchema(): VbenFormSchema[] { ]; } +/** 新增/编辑的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + // 隐藏的 ID 字段 + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'name', + label: '秒杀活动名称', + component: 'Input', + componentProps: { + placeholder: '请输入活动名称', + }, + rules: 'required', + formItemClass: 'col-span-2', + }, + { + fieldName: 'startTime', + label: '活动开始时间', + component: 'DatePicker', + componentProps: { + placeholder: '请选择活动开始时间', + showTime: false, + format: 'YYYY-MM-DD', + valueFormat: 'x', + class: 'w-full', + }, + rules: 'required', + }, + { + fieldName: 'endTime', + label: '活动结束时间', + component: 'DatePicker', + componentProps: { + placeholder: '请选择活动结束时间', + showTime: false, + format: 'YYYY-MM-DD', + valueFormat: 'x', + class: 'w-full', + }, + rules: 'required', + }, + { + fieldName: 'configIds', + label: '秒杀时段', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择秒杀时段', + mode: 'multiple', + api: getSimpleSeckillConfigList, + labelField: 'name', + valueField: 'id', + class: 'w-full', + }, + rules: 'required', + formItemClass: 'col-span-2', + }, + { + fieldName: 'totalLimitCount', + label: '总限购数量', + component: 'InputNumber', + componentProps: { + placeholder: '请输入总限购数量', + min: 0, + class: 'w-full', + }, + rules: z.number().min(0).default(0), + }, + { + fieldName: 'singleLimitCount', + label: '单次限购数量', + component: 'InputNumber', + componentProps: { + placeholder: '请输入单次限购数量', + min: 0, + class: 'w-full', + }, + rules: z.number().min(0).default(0), + }, + { + fieldName: 'sort', + label: '排序', + component: 'InputNumber', + componentProps: { + placeholder: '请输入排序', + min: 0, + class: 'w-full', + }, + rules: z.number().min(0).default(0), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + rows: 4, + }, + formItemClass: 'col-span-2', + }, + ]; +} + /** 列表的字段 */ export function useGridColumns(): VxeTableGridOptions['columns'] { return [ diff --git a/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue b/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue index 83538bdd1..dfed233c2 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue +++ b/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue @@ -5,7 +5,6 @@ import type { MallSeckillActivityApi } from '#/api/mall/promotion/seckill/seckil import { onMounted } from 'vue'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { $t } from '@vben/locales'; import { message, Tag } from 'ant-design-vue'; @@ -16,6 +15,7 @@ import { getSeckillActivityPage, } from '#/api/mall/promotion/seckill/seckillActivity'; import { getSimpleSeckillConfigList } from '#/api/mall/promotion/seckill/seckillConfig'; +import { $t } from '#/locales'; import { useGridColumns, useGridFormSchema } from './data'; import { formatConfigNames, formatTimeRange, setConfigList } from './formatter'; diff --git a/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue b/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue index 7aef17ae8..ceef1485b 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue +++ b/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue @@ -1,11 +1,11 @@ - - + + + + + + + + 秒杀活动商品: + + 选择商品 + + + 已选择: {{ spuName }} + + + + + + + + + 商品图片 + SKU 名称 + 原价(元) + 秒杀库存 + 秒杀价格(元) + + + + + + + + + {{ sku.skuName }} + + + ¥{{ (sku.price / 100).toFixed(2) }} + + + + + + + + + + + + +