diff --git a/src/api/mall/promotion/seckill/seckillConfig.ts b/src/api/mall/promotion/seckill/seckillConfig.ts
new file mode 100644
index 00000000..d941ed4d
--- /dev/null
+++ b/src/api/mall/promotion/seckill/seckillConfig.ts
@@ -0,0 +1,41 @@
+import request from '@/config/axios'
+
+export interface SeckillConfigVO {
+ id: number
+ name: string
+ startTime: Date
+ endTime: Date
+ seckillActivityCount: number
+ picUrl: string
+ status: number
+}
+
+// 查询秒杀时段配置列表
+export const getSeckillConfigPage = async (params) => {
+ return await request.get({ url: '/promotion/seckill-config/page', params })
+}
+
+// 查询秒杀时段配置详情
+export const getSeckillConfig = async (id: number) => {
+ return await request.get({ url: '/promotion/seckill-config/get?id=' + id })
+}
+
+// 新增秒杀时段配置
+export const createSeckillConfig = async (data: SeckillConfigVO) => {
+ return await request.post({ url: '/promotion/seckill-config/create', data })
+}
+
+// 修改秒杀时段配置
+export const updateSeckillConfig = async (data: SeckillConfigVO) => {
+ return await request.put({ url: '/promotion/seckill-config/update', data })
+}
+
+// 删除秒杀时段配置
+export const deleteSeckillConfig = async (id: number) => {
+ return await request.delete({ url: '/promotion/seckill-config/delete?id=' + id })
+}
+
+// 导出秒杀时段配置 Excel
+export const exportSeckillConfigApi = async (params) => {
+ return await request.download({ url: '/promotion/seckill-config/export-excel', params })
+}
diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts
index 0d68e362..b27cabdf 100644
--- a/src/utils/formatTime.ts
+++ b/src/utils/formatTime.ts
@@ -155,7 +155,7 @@ export const dateFormatter = (row, column, cellValue) => {
* @returns 带时间00:00:00的日期
*/
export function beginOfDay(param: Date) {
- return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 0, 0, 0, 0)
+ return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 0, 0, 0)
}
/**
@@ -164,7 +164,7 @@ export function beginOfDay(param: Date) {
* @returns 带时间23:59:59的日期
*/
export function endOfDay(param: Date) {
- return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 23, 59, 59, 999)
+ return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 23, 59, 59)
}
/**
diff --git a/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue b/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue
new file mode 100644
index 00000000..a4675f71
--- /dev/null
+++ b/src/views/mall/promotion/seckill/config/SeckillConfigForm.vue
@@ -0,0 +1,70 @@
+
+
+
+
diff --git a/src/views/mall/promotion/seckill/config/index.vue b/src/views/mall/promotion/seckill/config/index.vue
new file mode 100644
index 00000000..8c7dee8d
--- /dev/null
+++ b/src/views/mall/promotion/seckill/config/index.vue
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+ {{ format(row.startTime) }}
+
+
+ {{ format(row.endTime) }}
+
+
+
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+
+
+
+
diff --git a/src/views/mall/promotion/seckill/config/seckillConfig.data.ts b/src/views/mall/promotion/seckill/config/seckillConfig.data.ts
new file mode 100644
index 00000000..65c35611
--- /dev/null
+++ b/src/views/mall/promotion/seckill/config/seckillConfig.data.ts
@@ -0,0 +1,93 @@
+import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
+import { dateFormatter } from '@/utils/formatTime'
+
+// 表单校验
+export const rules = reactive({
+ name: [required],
+ startTime: [required],
+ endTime: [required],
+ seckillActivityCount: [required],
+ picUrl: [required],
+ status: [required]
+})
+
+// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
+const crudSchemas = reactive([
+ {
+ label: '秒杀时段名称',
+ field: 'name',
+ isSearch: true
+ },
+ {
+ label: '开始时间点',
+ field: 'startTime',
+ isSearch: false,
+ search: {
+ component: 'TimePicker'
+ },
+ form: {
+ component: 'TimePicker',
+ componentProps: {
+ valueFormat: 'HH:mm:ss'
+ }
+ }
+ },
+ {
+ label: '结束时间点',
+ field: 'endTime',
+ isSearch: false,
+ search: {
+ component: 'TimePicker'
+ },
+ form: {
+ component: 'TimePicker',
+ componentProps: {
+ valueFormat: 'HH:mm:ss'
+ }
+ }
+ },
+ {
+ label: '秒杀主图',
+ field: 'picUrl',
+ isSearch: false,
+ form: {
+ component: 'UploadImg'
+ }
+ },
+ {
+ label: '状态',
+ field: 'status',
+ dictType: DICT_TYPE.COMMON_STATUS,
+ dictClass: 'number',
+ isSearch: true,
+ form: {
+ component: 'Radio'
+ }
+ },
+ {
+ label: '创建时间',
+ field: 'createTime',
+ isForm: false,
+ isSearch: false,
+ formatter: dateFormatter
+ },
+ {
+ label: '操作',
+ field: 'action',
+ isForm: false
+ }
+])
+export const { allSchemas } = useCrudSchemas(crudSchemas)
+
+/**
+ * 添加这个函数呢是因为数据库表使用 time 类型存的时分秒信息,对应实体类字段使用的 LocalTime,然后返回给前端的就数据是
+ * '00:05:00' 会变成 [0,5],所以才使用此方法转一道。我想着或许直接后台返回字符串格式的
+ * @param data
+ */
+export const format = (data: number[]): string => {
+ if (typeof data === 'undefined') {
+ return ''
+ }
+ const paddedData = data.length >= 3 ? data.slice(0, 3) : [...data, 0, 0].slice(0, 3)
+ return paddedData.map((num) => num.toString().padStart(2, '0')).join(':')
+}