import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderReturnVO, OrderReturnForm, OrderReturnQuery } from '@/api/order/orderReturn/types';

/**
 * 查询退货主列表
 * @param query
 * @returns {*}
 */

export const listOrderReturn = (query?: OrderReturnQuery): AxiosPromise<OrderReturnVO[]> => {
  return request({
    url: '/order/orderReturn/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询退货主详细
 * @param id
 */
export const getOrderReturn = (id: string | number): AxiosPromise<OrderReturnVO> => {
  return request({
    url: '/order/orderReturn/' + id,
    method: 'get'
  });
};

/**
 * 新增退货主
 * @param data
 */
export const addOrderReturn = (data: OrderReturnForm) => {
  return request({
    url: '/order/orderReturn',
    method: 'post',
    data: data
  });
};

/**
 * 修改退货主
 * @param data
 */
export const updateOrderReturn = (data: OrderReturnForm) => {
  return request({
    url: '/order/orderReturn',
    method: 'put',
    data: data
  });
};

/**
 * 删除退货主
 * @param id
 */
export const delOrderReturn = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/orderReturn/' + id,
    method: 'delete'
  });
};
