import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderReturnItemVO, OrderReturnItemForm, OrderReturnItemQuery } from '@/api/order/orderReturnItem/types';

/**
 * 查询退货商品明细列表
 * @param query
 * @returns {*}
 */

export const listOrderReturnItem = (query?: OrderReturnItemQuery): AxiosPromise<OrderReturnItemVO[]> => {
  return request({
    url: '/order/orderReturnItem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询退货商品明细详细
 * @param id
 */
export const getOrderReturnItem = (id: string | number): AxiosPromise<OrderReturnItemVO> => {
  return request({
    url: '/order/orderReturnItem/' + id,
    method: 'get'
  });
};

/**
 * 新增退货商品明细
 * @param data
 */
export const addOrderReturnItem = (data: OrderReturnItemForm) => {
  return request({
    url: '/order/orderReturnItem',
    method: 'post',
    data: data
  });
};

/**
 * 修改退货商品明细
 * @param data
 */
export const updateOrderReturnItem = (data: OrderReturnItemForm) => {
  return request({
    url: '/order/orderReturnItem',
    method: 'put',
    data: data
  });
};

/**
 * 删除退货商品明细
 * @param id
 */
export const delOrderReturnItem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/orderReturnItem/' + id,
    method: 'delete'
  });
};
