// 订单模块

// 订单列表
// 查询订单列表
export const getOrderList = {
  url: '/order/orderPermission/list',
  method: 'GET',
  dealReqData: ({ pageNum, pageSize, oid, uid, orderState }) => {
    return { pageNum, pageSize, oid, uid, orderState }
  }
}
// 修改商品价格
export const consultDiscount = {
  url: '/order/orderPermission/consultDiscount',
  method: 'PUT',
  dealUrl: (url, { consultDiscountAmount, consultDiscountType, oid, updateTime }) => {
    return `${url}?consultDiscountAmount=${consultDiscountAmount}&consultDiscountType=${consultDiscountType}&oid=${oid}&updateTime=${updateTime}`
  }
}

// 订单详情
export const getOrderDetail = {
  url: '/order/orderPermission',
  method: 'GET',
  dealUrl: (url, oid) => {
    return `${url}/${oid}`
  }
}

// 查询退款订单列表
export const getRefundOrderList = {
  url: '/order/refundOrder/page',
  method: 'GET',
  dealReqData: ({ pageNum, pageSize, timeHead, timeTail, oid, uid, orderState }) => {
    return { pageNum, pageSize, timeHead, timeTail, oid, uid, orderState }
  }
}

// 商品订单退款处理
export const orderRefund = {
  url: '/order/orderPermission/refund/examine',
  method: 'PUT',
  dealUrl: (url, { oid, isApproved, remark, updateTime }) => {
    return `${url}?oid=${oid}&isApproved=${Boolean(isApproved)}&remark=${remark}&updateTime=${updateTime}`
  }
}

// 查询提货记录
export const getPickUpList = {
  url: '/delivery/deliveryPermission/list',
  method: 'GET',
  dealReqData: ({ pageNum, pageSize, orderDeliveryId, gid, uid, deliveryState }) => {
    return { pageNum, pageSize, orderDeliveryId, gid, uid, deliveryState }
  }
}

// 提货订单退货审核
export const deliveryCheck = {
  url: '/delivery/deliveryPermission/examine',
  method: 'PUT',
  dealUrl: (url, { orderDeliveryId, isApproved, remark, updateTime, addressId }) => {
    return `${url}?orderDeliveryId=${orderDeliveryId}&isApproved=${Boolean(isApproved)}&remark=${remark}&updateTime=${updateTime}&addressId=${addressId}`
  }
}

// 提货订单退货审核
export const deliveryCheckToBeSigned = {
  url: '/delivery/deliveryPermission/returnReceiptExamine',
  method: 'PUT',
  dealUrl: (url, { orderDeliveryId, isApproved, remark, updateTime }) => {
    return `${url}?orderDeliveryId=${orderDeliveryId}&isApproved=${Boolean(isApproved)}&remark=${remark}&updateTime=${updateTime}`
  }
}
// 发货
export const pickUpGood = {
  url: '/delivery/deliveryPermission/send',
  method: 'PUT',
  dealUrl: (url, { expressType, expressNo, orderDeliveryId, updateTime }) => {
    return `${url}?expressType=${expressType}&expressNo=${expressNo}&orderDeliveryId=${orderDeliveryId}&updateTime=${updateTime}`
  }
}

// 提货订单详情
export const deliveryDetail = {
  url: '/delivery/deliveryPermission',
  method: 'GET',
  dealUrl: (url, orderDeliveryId) => {
    return `${url}/${orderDeliveryId}`
  }
}

// 查询物流
export const queryExpress = {
  url: '/order/drawGoods/logistics',
  method: 'GET',
  dealReqData: ({ expressNo }) => {
    return { expressNo }
  }
}

// 订单设置
export const orderConfig = {
  url: '/config/configPermission/list',
  method: 'GET'
}

// 编辑订单设置
export const editOrderConfig = {
  url: '/config/configPermission/update',
  method: 'PUT',
  dealReqData: (form) => {
    return form
  }
}

// 订单投诉列表

export const getComplaintList = {
  url: '/complaint/complaintPermission/list',
  method: 'GET',
  dealReqData: ({ pageNum, pageSize, complaintId, complaintStatus, uid }) => {
    return { pageNum, pageSize, complaintId, complaintStatus, uid }
  }
}

// 处理订单投诉
export const checkComplaint = {
  url: '/complaint/complaintPermission/update',
  method: 'PUT',
  dealReqData: (form) => {
    return form
  }
}
export const complaintDetail = {
  url: '/complaint/complaintPermission',
  method: 'GET',
  dealUrl: (url, complaintId) => {
    return `${url}/${complaintId}`
  }
}
