import request from '@/utils/request'

// 查询分成明细列表
export function listBonus(query) {
  return request({
    url: '/ss/bonus/list',
    method: 'get',
    params: query
  })
}

// 查询分成明细详细
export function getBonus(id) {
  return request({
    url: '/ss/bonus/' + id,
    method: 'get'
  })
}

// 新增分成明细
export function addBonus(data) {
  return request({
    url: '/ss/bonus',
    method: 'post',
    data: data
  })
}

// 修改分成明细
export function updateBonus(data) {
  return request({
    url: '/ss/bonus',
    method: 'put',
    data: data
  })
}

// 删除分成明细
export function delBonus(id) {
  return request({
    url: '/ss/bonus/' + id,
    method: 'delete'
  })
}

// 根据订单ID查询分成明细
export function listBonusByBill(billId) {
  return request({
    url: '/ss/bonus/byBill',
    method: 'get',
    params: {
      billId
    }
  })
}

// 支付分成
export function payBonus(id) {
  return request({
    url: `/ss/bonus/${id}/pay`,
    method: 'put'
  })
}
