import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderItemVO, OrderItemForm, OrderItemQuery } from '@/api/system/physical/orderItem//types';

/**
 * 查询商城订单明细列表
 * @param query
 * @returns {*}
 */

export const listOrderItem = (query?: OrderItemQuery): AxiosPromise<OrderItemVO[]> => {
  return request({
    url: '/physical/orderItem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商城订单明细详细
 * @param id
 */
export const getOrderItem = (id: string | number): AxiosPromise<OrderItemVO> => {
  return request({
    url: '/physical/orderItem/' + id,
    method: 'get'
  });
};

/**
 * 新增商城订单明细
 * @param data
 */
export const addOrderItem = (data: OrderItemForm) => {
  return request({
    url: '/physical/orderItem',
    method: 'post',
    data: data
  });
};

/**
 * 修改商城订单明细
 * @param data
 */
export const updateOrderItem = (data: OrderItemForm) => {
  return request({
    url: '/physical/orderItem',
    method: 'put',
    data: data
  });
};

/**
 * 删除商城订单明细
 * @param id
 */
export const delOrderItem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/orderItem/' + id,
    method: 'delete'
  });
};
