import request from '@/utils/request'

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

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

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

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

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

// 预览设备分成信息
export function previewBonus(deviceId) {
  return request({
    url: '/bst/bonus/preview',
    method: 'get',
    params: { deviceId }
  })
}

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