seckillActivity.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import request from '@/config/axios'
  2. import { Sku, Spu } from '@/api/mall/product/spu'
  3. export interface SeckillActivityVO {
  4. id?: number
  5. spuId?: number
  6. name?: string
  7. status?: number
  8. remark?: string
  9. startTime?: Date
  10. endTime?: Date
  11. sort?: number
  12. configIds?: string
  13. orderCount?: number
  14. userCount?: number
  15. totalPrice?: number
  16. totalLimitCount?: number
  17. singleLimitCount?: number
  18. stock?: number
  19. totalStock?: number
  20. products?: SeckillProductVO[]
  21. }
  22. // 秒杀活动所需属性
  23. export interface SeckillProductVO {
  24. skuId: number
  25. spuId: number
  26. seckillPrice: number
  27. stock: number
  28. }
  29. // 扩展 Sku 配置
  30. export type SkuExtension = Sku & {
  31. productConfig: SeckillProductVO
  32. }
  33. export interface SpuExtension extends Spu {
  34. skus: SkuExtension[] // 重写类型
  35. }
  36. // 查询秒杀活动列表
  37. export const getSeckillActivityPage = async (params) => {
  38. return await request.get({ url: '/promotion/seckill-activity/page', params })
  39. }
  40. // 查询秒杀活动详情
  41. export const getSeckillActivity = async (id: number) => {
  42. return await request.get({ url: '/promotion/seckill-activity/get?id=' + id })
  43. }
  44. // 新增秒杀活动
  45. export const createSeckillActivity = async (data: SeckillActivityVO) => {
  46. return await request.post({ url: '/promotion/seckill-activity/create', data })
  47. }
  48. // 修改秒杀活动
  49. export const updateSeckillActivity = async (data: SeckillActivityVO) => {
  50. return await request.put({ url: '/promotion/seckill-activity/update', data })
  51. }
  52. // 关闭秒杀活动
  53. export const closeSeckillActivity = async (id: number) => {
  54. return await request.put({ url: '/promotion/seckill-activity/close?id=' + id })
  55. }
  56. // 删除秒杀活动
  57. export const deleteSeckillActivity = async (id: number) => {
  58. return await request.delete({ url: '/promotion/seckill-activity/delete?id=' + id })
  59. }