import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { XfConsumeDetailVO, XfConsumeDetailForm, XfConsumeDetailQuery } from '@/api/consumption/XfConsumeDetail/types';

/**
 * 查询消费明细列表
 * @param query
 * @returns {*}
 */
export const listXfConsumeDetail = (query?: XfConsumeDetailQuery): AxiosPromise<XfConsumeDetailVO[]> => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询消费明细详细
 * @param consumeId
 */
export const getXfConsumeDetail = (consumeId: string | number): AxiosPromise<XfConsumeDetailVO> => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail/' + consumeId,
    method: 'get'
  });
};

/**
 * 新增消费明细
 * @param data
 */
export const addXfConsumeDetail = (data: XfConsumeDetailForm) => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改消费明细
 * @param data
 */
export const updateXfConsumeDetail = (data: XfConsumeDetailForm) => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除消费明细
 * @param consumeId
 */
export const delXfConsumeDetail = (consumeId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail/' + consumeId,
    method: 'delete'
  });
};
/**
 * 错扣补款提交
 * @param data
 */
export const recompenseConsumeDetail = (data: XfConsumeDetailForm) => {
  return request({
    url: '/backstage/payment/ptBag/err-fill',
    method: 'post',
    data: data
  });
};
// /backstage/payment/ptBag/err-fill

export default {
  listXfConsumeDetail,
  getXfConsumeDetail,
  addXfConsumeDetail,
  updateXfConsumeDetail,
  delXfConsumeDetail,
  recompenseConsumeDetail
};
