import request from '@/utils/request'

/**
 * 查询订单列表
 * @Author: Antigravity
 */
export function listOrder(query) {
  return request({
    url: '/erp/order/list',
    method: 'get',
    params: query
  })
}

/**
 * 查询我的订单列表（小程序端，按当前用户过滤，每页5条）
 * @Author: Antigravity
 */
export function listMyOrder(query) {
  return request({
    url: '/erp/order/myList',
    method: 'get',
    params: query
  })
}

/**
 * 查询订单详情
 * @Author: Antigravity
 */
export function getOrderDetail(rowId) {
  return request({
    url: '/erp/order/' + rowId,
    method: 'get'
  })
}

/**
 * 提交订单
 * @Author: Antigravity
 */
export function addOrder(data) {
  return request({
    url: '/erp/order/add',
    method: 'post',
    data: data
  })
}

/**
 * 撤销订单
 * @Author: Antigravity
 */
export function cancelOrder(rowId) {
  return request({
    url: '/erp/order/cancel/' + rowId,
    method: 'post'
  })
}

/**
 * 查询审核记录
 * @Author: Antigravity
 */
export function getAuditHistory(orderId) {
  return request({
    url: '/erp/orderAudit/history/' + orderId,
    method: 'get'
  })
}
