import request from '@/utils/request';



// 导入待发货订单
export function importShopOrderApi(row, file) {
  return request({
    url: `/order/shopOrder/import_ship`,
    method: 'post',
    data: file
  })
}
// 商家分页查询订单列表
export function shopOrderPage(query) {
  return request({
    url: '/order/shopOrder/page',
    method: 'get',
    params: query
  })
}
// 备货
export function shopOrderPackageStockUp(data) {
  return request({
    url: '/order/shopOrderPackage/stockUp',
    method: 'post',
    data
  })
}
// 发货
export function shopOrderPackageShip(data) {
  return request({
    url: '/order/shopOrderPackage/ship',
    method: 'post',
    data
  })
}
// 通过核销码查询订单
export function getOrderByVerificationCode(query) {
  return request({
    url: `/order/shopOrderPackage/getOrderByVerificationCode`,
    method: 'get',
    params: query
  })
}
// 自提订单包裹进行核销
export function pickUpVerification(data) {
  return request({
    url: '/order/shopOrderPackage/pickUpVerification',
    method: 'post',
    data
  })
}

// 导出订单列表
// export function shopOrderExport (query) {
//   return request({
//     url: `/order/shopOrder/export`,
//     method: 'get',
//     params: query
//   })
// }
// 商家发起自动退款
export function saleRightsOrderLaunch(orderId) {
  return request({
    url: `/rights/saleRightsOrder/launch/${orderId}`,
    method: 'post',
  })
}
// 新增订单商品评论回复
export function shopOrderCommentReplyAdd(data) {
  return request({
    url: `/order/shopOrderCommentReply/add`,
    method: 'post',
    data
  })
}
// 查询订单评论列表
export function shopOrderCommentPage(query) {
  return request({
    url: `/order/shopOrderComment/page`,
    method: 'get',
    params: query
  })
}
// 获取订单评论详细信息
export function shopOrderCommentInfo(commentId) {
  return request({
    url: `/order/shopOrderComment/info/${commentId}`,
    method: 'get',
  })
}
// 删除订单评论
export function shopOrderCommentDel(commentIds) {
  return request({
    url: `/order/shopOrderComment/del/${commentIds}`,
    method: 'post',
  })
}

/**
 * 平台查询商城订单分页查询
 * @param {*} params 
 * @returns 
 */
export function getPlatformShopOrderPageApi(params) {
  return request({
    url: '/order/shopOrder/platform-page',
    method: 'get',
    params
  })
}



// ---------------------------------

/*
  售后维权订单
*/

// 查询维权单列表
export function shopOrderAfterSalePage(query) {
  return request({
    url: '/rights/saleRightsOrder/page',
    method: 'get',
    params: query
  })
}

/**
 * 平台订单售后列表
 * @param {*} params 
 * @returns 
 */
export function getPlatformAfterSalePageApi(params) {
  return request({
    url: '/rights/saleRightsOrder/platform-page',
    method: 'get',
    params
  })
}

export const exportPlatformAfterSaleApi = '/rights/saleRightsOrder/platform-export'

// 获取维权单详细信息
export function shopOrderAfterSaleInfo(id) {
  return request({
    url: `/rights/saleRightsOrder/info/${id}`,
    method: 'get',
  })
}

// 商家发起自动退款
export function shopOrderAfterSaleAutoRefund(orderId) {
  return request({
    url: `/rights/saleRightsOrder/launch/${orderId}`,
    method: 'post',
  })
}

// 商家同意维权
export function shopOrderAfterSaleAgree(data) {
  return request({
    url: '/rights/saleRightsOrder/agree',
    method: 'post',
    data
  })
}

// 商家拒绝维权
export function shopOrderAfterSaleReject(data) {
  return request({
    url: '/rights/saleRightsOrder/refuse',
    method: 'post',
    data
  })
}

// 商家退款
export function shopOrderAfterSaleRefund(data) {
  return request({
    url: '/rights/saleRightsOrder/refund',
    method: 'post',
    data
  })
}

// 物流跟踪
export function shopOrderAfterSaleLogisticsTrace(rightsId) {
  return request({
    url: `/rights/saleRightsOrder/express/select/${rightsId}`,
    method: 'get',
  })
}

// 商家收货
export function shopOrderAfterSaleReceive(data) {
  return request({
    url: `/rights/saleRightsOrder/receipt`,
    method: 'post',
    data
  })
}
// 获取订单详细信息
export function shopOrderInfo(orderId) {
  return request({
    url: `/order/shopOrder/info/${orderId}`,
    method: 'get',
  })
}
// 商家对订单进行备注
export function shopOrderRemark(data) {
  return request({
    url: `/order/shopOrder/remark`,
    method: 'post',
    data
  })
}
// 修改物流
export function shopOrderPackageUpdateShip(data) {
  return request({
    url: `/order/shopOrderPackage/updateShip`,
    method: 'post',
    data
  })
}
// 查看物流跟踪
export function shopOrderPackageSelectExpress(packageId) {
  return request({
    url: `/order/shopOrderPackage/selectExpress/${packageId}`,
    method: 'post',
  })
}



