Vue_US/src/api/mall/promotion/seckill/seckillActivity.ts

65 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-06-22 17:31:36 +08:00
import request from '@/config/axios'
import { Sku, Spu } from '@/api/mall/product/spu'
2023-06-22 17:31:36 +08:00
export interface SeckillActivityVO {
id: number
2023-06-24 01:48:07 +08:00
spuIds: number[]
2023-06-22 17:31:36 +08:00
name: string
status: number
remark: string
startTime: Date
endTime: Date
sort: number
configIds: string
orderCount: number
userCount: number
totalPrice: number
totalLimitCount: number
singleLimitCount: number
stock: number
totalStock: number
2023-06-24 01:48:07 +08:00
products: SeckillProductVO[]
}
// 秒杀活动所需属性
2023-06-24 01:48:07 +08:00
export interface SeckillProductVO {
spuId: number
skuId: number
seckillPrice: number
stock: number
}
// 扩展 Sku 配置
2023-06-24 01:48:07 +08:00
type SkuExtension = Sku & {
productConfig: SeckillProductVO
}
export interface SpuExtension extends Spu {
2023-06-24 01:48:07 +08:00
skus: SkuExtension[] // 重写类型
2023-06-22 17:31:36 +08:00
}
// 查询秒杀活动列表
export const getSeckillActivityPage = async (params) => {
return await request.get({ url: '/promotion/seckill-activity/page', params })
}
// 查询秒杀活动详情
export const getSeckillActivity = async (id: number) => {
return await request.get({ url: '/promotion/seckill-activity/get?id=' + id })
}
// 新增秒杀活动
export const createSeckillActivity = async (data: SeckillActivityVO) => {
return await request.post({ url: '/promotion/seckill-activity/create', data })
}
// 修改秒杀活动
export const updateSeckillActivity = async (data: SeckillActivityVO) => {
return await request.put({ url: '/promotion/seckill-activity/update', data })
}
// 删除秒杀活动
export const deleteSeckillActivity = async (id: number) => {
return await request.delete({ url: '/promotion/seckill-activity/delete?id=' + id })
}