import request from '@/utils/request'

// 查询订单列表
export function listLiveOrder(query) {
  return request({
    url: '/live/liveOrder/list',
    method: 'get',
    params: query
  })
}

// 查询订单列表
export function listLiveOrderZm(query) {
  return request({
    url: '/live/liveOrder/listZm',
    method: 'get',
    params: query
  })
}

// 查询订单详细
export function getLiveOrder(orderId) {
  return request({
    url: '/live/liveOrder/info/' + orderId,
    method: 'get'
  })
}

// 推广金额
export function tuiMoneyLogs(orderId){
  return request({
    url: '/live/liveOrder/tuiMoneyLogs?orderId='+orderId,
    method: 'get',
  })
}
// 获取订单支付记录
export function getOrderPayments(orderId){
  return request({
    url: '/live/liveOrder/payments/'+orderId,
    method: 'get'
  })
}


// 新增订单
export function addLiveOrder(data) {
  return request({
    url: '/live/liveOrder',
    method: 'post',
    data: data
  })
}

// 修改订单
export function updateLiveOrder(data) {
  return request({
    url: '/live/liveOrder/update',
    method: 'put',
    data: data
  })
}

// 删除订单
export function delLiveOrder(orderId) {
  return request({
    url: '/live/liveOrder/' + orderId,
    method: 'delete'
  })
}

// 导出订单
export function exportLiveOrder(query) {
  return request({
    url: '/live/liveOrder/export',
    method: 'get',
    params: query
  })
}

// 导出订单
export function exportLiveOrderZm(query) {
  return request({
    url: '/live/liveOrder/exportZm',
    method: 'get',
    params: query
  })
}
export function exportZmNew(query) {
  return request({
    url: '/live/liveOrder/exportZmNew',
    method: 'get',
    params: query
  })
}


export function getExpress(data) {
  return request({
    url: '/live/liveOrder/getExpressByDeliverId',
    method: 'post',
    data: data
  })
}

export function editDeliveryId(data){
  return request({
    url: '/live/liveOrder/editDeliveryId',
    method: 'put',
    data: data
  })
}

// 获取表格 时间粒度
export function getLiveOrderTimeGranularity(query) {
  return request({
    url: '/live/liveOrder/getLiveOrderTimeGranularity',
    method: 'get',
    params: query
  })
}


// 同步快递信息
export function syncExpress(orderId) {
  return request({
    url: '/live/liveOrder/syncExpress/' + orderId,
    method: 'get'
  })
}



export function listOrderitem(orderId) {
  return request({
    url: '/live/liveOrder/ltemlist/' + orderId,
    method: 'get'
  })
}

export function tuiOrder(data) {
  return request({
    url: '/live/liveOrder/tuiOrder',
    method: 'put',
    data: data
  })
}

export function refundOrderMoney(data) {
  return request({
    url: '/live/liveOrder/refundOrderMoney',
    method: 'post',
    data: data
  })
}


export function getExpressByDeliverId(param) {
  return request({
    url: '/live/liveOrder/getExpressByDeliverId',
    method: 'post',
    data: param
  })
}

/**
 * 根据订单获取物流信息
 * @param orderId
 * @returns {*}
 */
export function getByOrderId(orderId){
  return request({
    url: '/live/liveOrder/getByOrderId/'+orderId,
    method: 'get'
  })
}

/**
 * 获取订单日志
 * @param orderId
 * @returns {*}
 */
export function getOrderLog(orderId){
  return request({
    url: '/live/liveOrder/logs/'+orderId,
    method: 'get'
  })
}
export function getOrderExpress(orderId){
  return request({
    url: '/live/liveOrder/express/'+orderId,
    method: 'get'
  })
}
export function bindCustomer(data) {
  return request({
    url: '/live/liveOrder/bindCustomer',
    method: 'post',
    data: data
  })
}
// 查询订单详细
export function getLiveOrderAll(id) {
  return request({
    url: '/live/liveOrder/' + id,
    method: 'get'
  })
}
// 查询订单详细
export function getLiveOrderAddress(id) {
  return request({
    url: '/live/liveOrder/queryAddress/' + id,
    method: 'get'
  })
}
// 查询电话
export function getUserPhone(id) {
  return request({
    url: '/live/liveOrder/queryPhone/' + id,
    method: 'get'
  })
}

//审核
export function auditPayRemain(data) {
  return request({
    url: '/live/liveOrder/auditPayRemain',
    method: 'post',
    data: data
  })
}

export function addTuiMoney(data) {
  return request({
    url: '/live/liveOrder/addTuiMoney',
    method: 'post',
    data: data
  })
}

export function syncExpressB(data) {
  return request({
    url: '/live/liveOrder/syncExpress',
    method: 'post',
    data: data
  })
}

export function updateExpress(data) {
  return request({
    url: '/live/liveOrder/updateExpress',
    method: 'post',
    data: data
  })
}

export function getEroOrder(query) {
  return request({
    url: '/live/liveOrder/getEroOrder',
    method: 'get',
    params: query
  })
}

export function editTuiMoney(data) {
  return request({
    url: '/live/liveOrder/editTuiMoney',
    method: 'post',
    data: data
  })
}

export function finishOrder(data) {
  return request({
    url: '/live/liveOrder/finishOrder',
    method: 'post',
    data: data
  })
}

// 修改物流编号
export function updateDeliveryId(data) {
  return request({
    url: '/live/liveOrder/editDeliveryId',
    method: 'put',
    data: data
  })
}

export function createErpOrder(query) {
  return request({
    url: '/live/liveOrder/createErpOrder',
    method: 'get',
    params: query
  })
}

export function updateErp(data) {
  return request({
    url: '/live/liveOrder/updateErpOrder',
    method: 'post',
    data: data
  })
}


// 导出发货单
export function healthExportShippingOrder(query) {
  return request({
    url: '/live/liveOrder/healthExportShippingOrder',
    method: 'get',
    params: query
  })
}

export function importDeliveryNoteExpressTemplate() {
  return request({
    url: '/live/liveOrder/importDeliveryNoteExpressTemplate',
    method: 'get'
  })
}
