import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SalesInfoVO, SalesInfoForm, SalesInfoQuery } from '@/api/customer/customerFile/salesInfo/types';

/**
 * 查询客户销售信息列表
 * @param query
 * @returns {*}
 */

export const listSalesInfo = (query?: SalesInfoQuery): AxiosPromise<SalesInfoVO[]> => {
  return request({
    url: '/customer/salesInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户销售信息详细
 * @param id
 */
export const getSalesInfo = (id: string | number): AxiosPromise<SalesInfoVO> => {
  return request({
    url: '/customer/salesInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增客户销售信息
 * @param data
 */
export const addSalesInfo = (data: SalesInfoForm) => {
  return request({
    url: '/customer/salesInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户销售信息
 * @param data
 */
export const updateSalesInfo = (data: SalesInfoForm) => {
  return request({
    url: '/customer/salesInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户销售信息
 * @param id
 */
export const delSalesInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/salesInfo/' + id,
    method: 'delete'
  });
};
