import request, { postBlob, getBlob, handleImport } from '@/utils/request'

// 获取订单列表
export function getList(params) {
  return request({
    url: '/order/list',
    method: 'get',
    params
  })
}

// 编辑备注
export function saveRemark(params) {
  return request({
    url: '/order/remark',
    method: 'post',
    params
  })
}

// 获取订单详情
export function getOrderDetail(params) {
  return request({
    url: '/order/detail',
    method: 'get',
    params
  })
}

//发货条码详情
export function getCodeDetail(params) {
  return request({
    url: '/jx/goods/detail',
    method: 'post',
    params
  })
}

//退货条码详情
export function getCodeDetail2(params) {
  return request({
    url: '/jx/goods/detailRefund',
    method: 'post',
    params
  })
}

//保存发货条码
export function saveCode(data) {
  return request({
    url: '/jx/goods/save',
    method: 'post',
    data
  })
}

//保存退货条码
export function saveCode2(data) {
  return request({
    url: '/jx/goods/saveRefund',
    method: 'post',
    data
  })
}

//删除发货条码
export function delCode(params) {
  return request({
    url: '/jx/goods/remove',
    method: 'post',
    params
  })
}

//删除退货条码
export function delCode2(data) {
  return request({
    url: '/jx/goods/removeRefund',
    method: 'post',
    data
  })
}

//导入发货条码
export function listImport(data) {
	return handleImport('/jx/goods/import', data.formdata, data.id || '')
}

//导入退货条码
export function listImport2(data) {
	return handleImport('/jx/goods/importRefund', data.formdata, data.id || '')
}

//规格型号
export function getMaterialList(params) {
  return request({
    url: '/goods/material/item/list',
    method: 'post',
    params
  })
}

// 取消订单
export function cancelOrder(params) {
  return request({
    url: '/order/cancel',
    method: 'post',
    params
  })
}

// 确认订单
export function confirm2Order(params) {
  return request({
    url: '/order/ackOrder',
    method: 'post',
    params
  })
}

// 确认收款
export function confirmOrder(params) {
  return request({
    url: '/order/ack',
    method: 'post',
    params
  })
}

// 修改价格
export function changePrice(params) {
  return request({
    url: '/order/price/update',
    method: 'post',
    params
  })
}

// 修改收货信息
export function changeReceiveInfo(params) {
  return request({
    url: '/order/rece/info/update',
    method: 'post',
    data: params
  })
}

// 发货
export function goodsDeliver(data) {
  return request({
    url: '/order/goods/deliverV2',
    method: 'post',
    data
  })
}

// 发货2
export function orderDeliver(data) {
  return request({
    url: '/orderDelivery/goods/deliverV2',
    method: 'post',
    data
  })
}

// 发货单列表
export function getDeliverList(data) {
  return request({
    url: '/orderDelivery/list',
    method: 'post',
    data
  })
}

// 获取维权订单列表
export function getRefundList(params) {
  return request({
    url: '/order/refund/list',
    method: 'get',
    params
  })
}

// 编辑维权备注
export function saveRefundRemark(params) {
  return request({
    url: '/order/refund/remark',
    method: 'post',
    params
  })
}

// 变更维权处理状态
export function changeExamineStatus(data) {
  return request({
    url: '/jx/goods/goods/refundV2',
    method: 'post',
    data
  })
}

// 变更维权处理状态
export function receiveProd(params) {
  return request({
    url: '/order/refund/ack',
    method: 'post',
    params
  })
}

// 获取维权订单详情
export function getOrderRefundDetail(params) {
  return request({
    url: '/order/refund/refund/detail',
    method: 'get',
    params
  })
}

// 退款
export function orderRefund(params) {
  return request({
    url: '/order/detail/refund',
    method: 'post',
    params
  })
}

// 理赔
export function orderCompensate(params) {
  return request({
    url: '/order/cliaims/refund',
    method: 'post',
    params
  })
}

// 获取理赔列表
export function getCompensateList(params) {
  return request({
    url: '/order/cliaims/list',
    method: 'get',
    params
  })
}

// 卖家批量设置备注
export function batchRemark(params) {
  return request({
    url: '/order/batch/remark',
    method: 'post',
    data: params
  })
}

export function getWebsiteList(params) {
  return request({
    url: '/admin/websit/list',
    method: 'get',
    params
  })
}

// 修改快递单号
export function editLogistics(params) {
  return request({
    url: '/order/express/update',
    method: 'post',
    params
  })
}

// 获取地区树
export function getRegion(params) {
  return request({
    url: '/common/region/list',
    method: 'get',
    params
  })
}

// 修改收货地址
export function editAddress(params) {
  return request({
    url: '/order/rece/info/update',
    method: 'post',
    data: params
  })
}

// 获取工单
export function getWorkOrder(params) {
  return request({
    url: '/order/work/list',
    method: 'get',
    params
  })
}

// 新增标签
export function changeShow(params) {
  return request({
    url: '/order/comment/show',
    method: 'post',
    params
  })
}


// 获取线下订单列表
export function getOfflineOrderList(data) {
  return request({
    url: `/order/offline/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

// 导出线下订单列表
export function offlineOrderListExport(data, name) {
  return postBlob({
    url: '/order/offline/list/export',
    data,
    name
  })
}

// 线下订单保存
export function offlineOrderSave(params) {
  return request({
    url: '/order/offline/save',
    method: 'post',
    data: params
  })
}

// 线下订单详情
export function getOfflineOrderDetail(params) {
  return request({
    url: '/order/offline/detail',
    method: 'post',
    params
  })
}

// 线下订单审批
export function offlineOrderExamine(params) {
  return request({
    url: '/order/offline/examine',
    method: 'post',
    params
  })
}

// 工单类型列表
export function getOrderTypeList(data) {
  return request({
    url: `/order/smalltype/list`,
    method: 'post',
    data
  })
}

// 记录打印次数
export function recordPrint(params) {
  return request({
    url: '/order/print/count',
    method: 'post',
    params
  })
}

// 查询打印记录列表
export function getPrintList(params) {
  return request({
    url: '/order/query/print/record',
    method: 'post',
    params
  })
}



// 获取销售退货单列表
export function getSalesReturnOrderList(data) {
  return request({
    url: `/order/offline/refund/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

// 销售退货单详情
export function getSalesReturnOrderDetail(params) {
  return request({
    url: '/order/offline/refund/detail',
    method: 'post',
    params
  })
}

// 导出销售退货单列表
export function salesReturnOrderListExport(data, name) {
  return postBlob({
    url: '/order/offline/refund/list/export',
    data,
    name
  })
}

// 销售退货单保存
export function salesReturnOrderSave(params) {
  return request({
    url: '/order/offline/refund/save',
    method: 'post',
    data: params
  })
}

// 销售退货单审批
export function salesReturnOrderExamine(params) {
  return request({
    url: '/order/offline/refund/examine',
    method: 'post',
    params
  })
}

// 订单条码列表
export function getOrderCodeList(params) {
  return request({
    url: '/order/offline/refund/code/list',
    method: 'post',
    params
  })
}

// 获取类别列表
export function getCategoryList(params) {
  return request({
    url: '/trade/list',
    method: 'get',
    params
  })
}

// 获取规格/属性列表
export function getAttrList(data) {
  return request({
    url: `/trade/list/page`,
    method: 'post',
    data
  })
}

// 获取销售发货单列表
export function getSalesDeliverOrderList(data) {
  return request({
    url: `/orderDelivery/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

// 销售发货单详情
export function getSalesDeliverOrderDetail(params) {
  return request({
    url: '/orderDelivery/detail',
    method: 'post',
    params
  })
}

// 导出销售发货单列表
export function salesDeliverOrderListExport(data, name) {
  return postBlob({
    url: '/orderDelivery/list/export',
    data,
    name
  })
}

// 销售发货单退货
export function salesDeliverOrderRefund(params) {
  return request({
    url: '/orderDelivery/refundBatch',
    method: 'post',
    params
  })
}