seckillActivity.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import request from '@/config/axios'
  2. import { Sku, Spu } from '@/api/mall/product/spu'
  3. export interface SeckillActivityVO {
  4. id: number
  5. spuIds: 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. seckillPrice: number
  26. stock: number
  27. }
  28. // 扩展 Sku 配置
  29. export type SkuExtension = Sku & {
  30. productConfig: SeckillProductVO
  31. }
  32. export interface SpuExtension extends Spu {
  33. skus: SkuExtension[] // 重写类型
  34. }
  35. // 查询秒杀活动列表
  36. export const getSeckillActivityPage = async (params) => {
  37. return await request.get({ url: '/promotion/seckill-activity/page', params })
  38. }
  39. // 查询秒杀活动详情
  40. export const getSeckillActivity = async (id: number) => {
  41. return await request.get({ url: '/promotion/seckill-activity/get?id=' + id })
  42. }
  43. // 新增秒杀活动
  44. export const createSeckillActivity = async (data: SeckillActivityVO) => {
  45. return await request.post({ url: '/promotion/seckill-activity/create', data })
  46. }
  47. // 修改秒杀活动
  48. export const updateSeckillActivity = async (data: SeckillActivityVO) => {
  49. return await request.put({ url: '/promotion/seckill-activity/update', data })
  50. }
  51. // 删除秒杀活动
  52. export const deleteSeckillActivity = async (id: number) => {
  53. return await request.delete({ url: '/promotion/seckill-activity/delete?id=' + id })
  54. }