import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RevenueDetailVO, RevenueDetailForm, RevenueDetailQuery } from '@/api/order/revenueDetail/types';

/**
 * 查询收入单明细列表
 * @param query
 * @returns {*}
 */

export const listRevenueDetail = (query?: RevenueDetailQuery): AxiosPromise<RevenueDetailVO[]> => {
  return request({
    url: '/order/revenueDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询收入单明细详细
 * @param id
 */
export const getRevenueDetail = (id: string | number): AxiosPromise<RevenueDetailVO> => {
  return request({
    url: '/order/revenueDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增收入单明细
 * @param data
 */
export const addRevenueDetail = (data: RevenueDetailForm) => {
  return request({
    url: '/order/revenueDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改收入单明细
 * @param data
 */
export const updateRevenueDetail = (data: RevenueDetailForm) => {
  return request({
    url: '/order/revenueDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除收入单明细
 * @param id
 */
export const delRevenueDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/revenueDetail/' + id,
    method: 'delete'
  });
};
