import request from '@/utils/request'

// 查询积分商品订单列表
export function listIntegralOrder(query) {
  return request({
    url: '/his/integralOrder/list',
    method: 'get',
    params: query
  })
}

// 查询积分商品订单详细
export function getIntegralOrder(orderId) {
  return request({
    url: '/his/integralOrder/' + orderId,
    method: 'get'
  })
}
export function getExpress(orderId) {
  return request({
    url: '/his/integralOrder/getExpress/' + orderId,
    method: 'get'
  })
}
export function importTemplate() {
  return request({
    url: '/his/integralOrder/importTemplate',
    method: 'get'
  })
}
export function sendgoods(data) {
  return request({
    url: '/his/integralOrder/sendGoods',
    method: 'put',
    data: data
  })
}
// 新增积分商品订单
export function addIntegralOrder(data) {
  return request({
    url: '/his/integralOrder',
    method: 'post',
    data: data
  })
}

// 修改积分商品订单
export function updateIntegralOrder(data) {
  return request({
    url: '/his/integralOrder',
    method: 'put',
    data: data
  })
}

// 删除积分商品订单
export function delIntegralOrder(orderId) {
  return request({
    url: '/his/integralOrder/' + orderId,
    method: 'delete'
  })
}

// 导出积分商品订单
export function exportIntegralOrder(query) {
  return request({
    url: '/his/integralOrder/export',
    method: 'get',
    params: query
  })
}


// 查询收货人电话
export function getOrderUserPhone(orderId) {
  return request({
    url: '/his/integralOrder/queryPhone/' + orderId,
    method: 'get'
  })
}

//取消订单
export function cancelOrder(orderCode) {
  return request({
    url: '/his/integralOrder/cancelOrder',
    method: 'post',
    data: {orderCode}
  })
}
//申请退款
export function mandatoryRefunds(orderCode) {
  return request({
    url: '/his/integralOrder/mandatoryRefunds',
    method: 'post',
    data: {orderCode}
  })
}

// 确认收货
export function finishOrder(orderCode) {
  return request({
    url: '/his/integralOrder/finishOrder/' + orderCode,
    method: 'get'
  })
}
//数据分捡
export function batchSetErpOrder(params) {
  return request({
    url: '/his/integralOrder/batchSetErpOrder',
    method: 'post',
    data: params
  })
}
//数据分捡
export function batchCreateErpOrder(params) {
  return request({
    url: '/his/integralOrder/batchCreateErpOrder',
    method: 'post',
    data: params
  })
}
//获取城市
export function getCitys(){
  return request({
    url: '/his/city/getCitys',
    method: 'get'
  })
}
//获取模版
export function getIntegralTemplate(){
  return request({
    url: '/his/integralOrder/importUpdateOrderTemplate',
    method: 'get'
  })
}

// 获取订单操作记录
export function getOrderLogs(orderId) {
  return request({
    url: '/his/logs/order/' + orderId,
    method: 'get'
  })
}