import request from '@/config/axios'

// 后代分区 VO
export interface PartitionSonVO {
  // 用户编号
  id: number
  // 用户ID
  userId: number
  // 分区编号
  partNo: string
  // 业绩
  price: number
  // 是否碰撞 0为未碰撞 1为已碰撞
  hasHit: number
  // 碰撞后额度
  afterHitQuota: number
  // 是否是大区 0为小区 1为大区
  size: number
}

// 后代分区 API
export const PartitionSonApi = {
  // 查询后代分区分页
  getPartitionSonPage: async (params: any) => {
    return await request.get({ url: `/distri/partition-son/page`, params })
  },

  // 查询后代分区详情
  getPartitionSon: async (id: number) => {
    return await request.get({ url: `/distri/partition-son/get?id=` + id })
  },

  // 新增后代分区
  createPartitionSon: async (data: PartitionSonVO) => {
    return await request.post({ url: `/distri/partition-son/create`, data })
  },

  // 修改后代分区
  updatePartitionSon: async (data: PartitionSonVO) => {
    return await request.put({ url: `/distri/partition-son/update`, data })
  },

  // 删除后代分区
  deletePartitionSon: async (id: number) => {
    return await request.delete({ url: `/distri/partition-son/delete?id=` + id })
  },

  // 导出后代分区 Excel
  exportPartitionSon: async (params) => {
    return await request.download({ url: `/distri/partition-son/export-excel`, params })
  }
}