eight
2024-08-28 2bc74ebfec4a30beddc66fd55be4947e5f7cf498
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import request from '@/config/axios'
import { Sku, Spu } from '@/api/mall/product/spu'
 
export interface SeckillActivityVO {
  id?: number
  spuId?: number
  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
  products?: SeckillProductVO[]
}
 
// 秒杀活动所需属性
export interface SeckillProductVO {
  skuId: number
  seckillPrice: number
  stock: number
}
 
// 扩展 Sku 配置
export type SkuExtension = Sku & {
  productConfig: SeckillProductVO
}
 
export interface SpuExtension extends Spu {
  skus: SkuExtension[] // 重写类型
}
 
// 查询秒杀活动列表
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 closeSeckillActivity = async (id: number) => {
  return await request.put({ url: '/promotion/seckill-activity/close?id=' + id })
}
 
// 删除秒杀活动
export const deleteSeckillActivity = async (id: number) => {
  return await request.delete({ url: '/promotion/seckill-activity/delete?id=' + id })
}