import request from '@/config/axios'

// 分销来源 VO
export interface SourceVO {
  // 用户编号
  id: number
  // 来源名称
  name: string
}

// 分销来源 API
export const SourceApi = {
  // 查询分销来源分页
  getSourcePage: async (params: any) => {
    return await request.get({ url: `/distri/source/page`, params })
  },

  // 查询分销来源详情
  getSource: async (id: number) => {
    return await request.get({ url: `/distri/source/get?id=` + id })
  },

  // 新增分销来源
  createSource: async (data: SourceVO) => {
    return await request.post({ url: `/distri/source/create`, data })
  },

  // 修改分销来源
  updateSource: async (data: SourceVO) => {
    return await request.put({ url: `/distri/source/update`, data })
  },

  // 删除分销来源
  deleteSource: async (id: number) => {
    return await request.delete({ url: `/distri/source/delete?id=` + id })
  },

  // 导出分销来源 Excel
  exportSource: async (params) => {
    return await request.download({ url: `/distri/source/export-excel`, params })
  }
}