combinationActivity.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import request from '@/config/axios'
  2. import { Sku, Spu } from '@/api/mall/product/spu'
  3. export interface CombinationActivityVO {
  4. id?: number
  5. name?: string
  6. spuId?: number
  7. totalLimitCount?: number
  8. singleLimitCount?: number
  9. startTime?: Date
  10. endTime?: Date
  11. userSize?: number
  12. totalCount?: number
  13. successCount?: number
  14. orderUserCount?: number
  15. virtualGroup?: number
  16. status?: number
  17. limitDuration?: number
  18. combinationPrice?: number
  19. products: CombinationProductVO[]
  20. }
  21. // 拼团活动所需属性
  22. export interface CombinationProductVO {
  23. spuId: number
  24. skuId: number
  25. combinationPrice: number // 拼团价格
  26. }
  27. // 扩展 Sku 配置
  28. export type SkuExtension = Sku & {
  29. productConfig: CombinationProductVO
  30. }
  31. export interface SpuExtension extends Spu {
  32. skus: SkuExtension[] // 重写类型
  33. }
  34. // 查询拼团活动列表
  35. export const getCombinationActivityPage = async (params: any) => {
  36. return await request.get({ url: '/promotion/combination-activity/page', params })
  37. }
  38. // 查询拼团活动详情
  39. export const getCombinationActivity = async (id: number) => {
  40. return await request.get({ url: '/promotion/combination-activity/get?id=' + id })
  41. }
  42. // 获得拼团活动列表,基于活动编号数组
  43. export const getCombinationActivityListByIds = (ids: number[]) => {
  44. return request.get({ url: `/promotion/combination-activity/list-by-ids?ids=${ids}` })
  45. }
  46. // 新增拼团活动
  47. export const createCombinationActivity = async (data: CombinationActivityVO) => {
  48. return await request.post({ url: '/promotion/combination-activity/create', data })
  49. }
  50. // 修改拼团活动
  51. export const updateCombinationActivity = async (data: CombinationActivityVO) => {
  52. return await request.put({ url: '/promotion/combination-activity/update', data })
  53. }
  54. // 关闭拼团活动
  55. export const closeCombinationActivity = async (id: number) => {
  56. return await request.put({ url: '/promotion/combination-activity/close?id=' + id })
  57. }
  58. // 删除拼团活动
  59. export const deleteCombinationActivity = async (id: number) => {
  60. return await request.delete({ url: '/promotion/combination-activity/delete?id=' + id })
  61. }