import request from '@/config/axios'

// 佣金相关计算浮动百分比设置 VO
export interface OrderPercentageVO {
  // 用户编号
  id: number
  // 毛利 = 成本 * 0.38... (推广费用)
  grossProfitPerc: number
  // 推广-用户额度 百分比
  grossProfitUserQuotaPerc: number
  // 推广-推荐人额度 百分比
  grossProfitAncestorQuotaPerc: number
  // 推广-合赢奖额度(浮动) 百分比
  grossProfitBonusQuotaPerc: number
  // 推广-平台分成额度(浮动) 百分比
  grossProfitPlatformQuotaPerc: number
  // 分成百分比
  divideIntoPerc: number
}

// 佣金相关计算浮动百分比设置 API
export const OrderPercentageApi = {
  // 查询佣金相关计算浮动百分比设置分页
  getOrderPercentagePage: async (params: any) => {
    return await request.get({ url: `/distri/order-percentage/page`, params })
  },

  // 查询佣金相关计算浮动百分比设置详情
  getOrderPercentage: async (id: number) => {
    return await request.get({ url: `/distri/order-percentage/get?id=` + id })
  },

  // 新增佣金相关计算浮动百分比设置
  createOrderPercentage: async (data: OrderPercentageVO) => {
    return await request.post({ url: `/distri/order-percentage/create`, data })
  },

  // 修改佣金相关计算浮动百分比设置
  updateOrderPercentage: async (data: OrderPercentageVO) => {
    return await request.put({ url: `/distri/order-percentage/update`, data })
  },

  // 删除佣金相关计算浮动百分比设置
  deleteOrderPercentage: async (id: number) => {
    return await request.delete({ url: `/distri/order-percentage/delete?id=` + id })
  },

  // 导出佣金相关计算浮动百分比设置 Excel
  exportOrderPercentage: async (params) => {
    return await request.download({ url: `/distri/order-percentage/export-excel`, params })
  }
}