import axios from "@/utils/request";

export function changeOrderPage(query) {
  return axios(
    {
      url: "/udi/device/changeOrder/page",
      method: "POST",
      data: query
    }
  )
}

export function saveDraftOrder(query) {
  return axios(
    {
      url: "/udi/device/changeOrder/draft/save",
      method: "POST",
      data: query
    }
  )
}


export function generateOrderId(query) {
  return axios(
    {
      url: "/udi/device/changeOrder/generateOrderId",
      method: "get",
      params: query
    }
  )
}


export function delDraftOrder(query) {
  return axios(
    {
      url: "/udi/device/changeOrder/del",
      method: "POST",
      data: query
    }
  )
}


export function saveChangeOrder(query) {
  return axios(
    {
      url: "/udi/device/changeOrder/save",
      method: "POST",
      data: query
    }
  )
}

export function changeOrderDetailByUser(query) {
  return axios(
    {
      url: "/udi/device/changeOrder/detailByUser",
      method: "POST",
      data: query
    }
  )
}

export function cancelChangeOrder(orderId, query) {
  return axios(
    {
      url: `/udi/device/changeOrder/cancel/${orderId}`,
      method: "GET",
      params: query
    }
  )
}

export function confirmChangeOrder(orderId, query) {
  return axios(
    {
      url: `/udi/device/changeOrder/confirm/${orderId}`,
      method: "GET",
      params: query
    }
  )
}

export function rejectChangeOrder(orderId, query) {
  return axios(
    {
      url: `/udi/device/changeOrder/reject/${orderId}`,
      method: "GET",
      params: query
    }
  )
}


export function delOrderItem(deviceCode) {
  return axios(
    {
      url: `/udi/device/changeOrderItem/del/${deviceCode}`,
      method: "DELETE"
    }
  )
}

export function entryOrderItem(query) {
  return axios(
    {
      url: "/udi/device/changeOrderItem/entry",
      method: "POST",
      data: query
    }
  )
}

export function entryOrderItemChange(query) {
  return axios(
    {
      url: "/udi/device/changeOrderItem/entryChange",
      method: "POST",
      data: query
    }
  )
}


export function updateOrderItem(data) {
  return axios(
    {
      url: "/udi/device/changeOrderItem/update",
      method: "POST",
      data: data
    }
  )
}
