import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReceivePlanRecordVO, ReceivePlanRecordForm, ReceivePlanRecordQuery } from '@/api/finance/receivePlanRecord/types';

/**
 * 查询回款计划列表
 * @param query
 * @returns {*}
 */

export const listReceivePlanRecord = (query?: ReceivePlanRecordQuery): AxiosPromise<ReceivePlanRecordVO[]> => {
  return request({
    url: '/finance/receive/list_page',
    method: 'post',
    data: query
  });
};

/**
 * 查询回款计划详细
 * @param id
 */
export const getReceivePlanRecord = (id: string | number): AxiosPromise<ReceivePlanRecordVO> => {
  return request({
    url: '/finance/receivePlanRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增回款计划
 * @param data
 */
export const addReceivePlanRecord = (data: ReceivePlanRecordForm) => {
  return request({
    url: '/finance/receivePlanRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改回款计划
 * @param data
 */
export const updateReceivePlanRecord = (data: ReceivePlanRecordForm) => {
  return request({
    url: '/finance/receivePlanRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除回款计划
 * @param id
 */
export const delReceivePlanRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/finance/receivePlanRecord/' + id,
    method: 'delete'
  });
};
