import request from '@/assets/js/utils/request'

/**
 * 退货申请
 * @param params
 */
export function applyBack(data) {
  return request({
    url: '/example/backgoods',
    method: 'post',
    data
  })
}
/**
 * 订单列表
 */
export function getOrderList(params) {
  return request({
    url: '/example/backgoods',
    method: 'get',
    params
  })
}

/**
 * 订单详情
 */
export function getOrderDetatils(id, status) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/getOrderDetails?id=' + id + '&status=' + status,
    method: 'get'
  })
}
/**
 * 订单在审核前，采购人主动取消订单
 */
export function buyerCancelOrder(orderId) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/buyerCancelOrder?orderId=' + orderId,
    method: 'post'
  })
}
/* -----购物车接口start-----*/
/* -----购物车接口end-----*/
// 获取购物车信息
export function getMyCartList() {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptCartController/getMyCartList',
    method: 'post'
  })
}
// 删除购物车信息
export function deleteShoppingCart(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptCartController/deleteShoppingCart',
    method: 'post',
    data
  })
}
// 订单添加
export function saveOrders(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/saveOrders',
    method: 'post',
    data
  })
}
// 更新购物车购买数量
export function updateNumberForCart(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptCartController/updateNumberForCart',
    method: 'post',
    data
  })
}

/**
 * 我的订单分页列表
 * @param params
 */
export function getOrders(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/getOrders',
    method: 'post',
    data
  })
}

/**
 * 供应商订单管理列表
 */
export function supplierOrderList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/supplierOrderList',
    method: 'post',
    data
  })
}
/**
 * 订单审核
 */
export function auditOrders(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/auditOrders',
    method: 'post',
    data
  })
}
/**
 * 订单审核记录
 */
export function getOrderAuditRecord(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/getOrderAuditRecord?orderId=' + id,
    method: 'get'
  })
}

/**
 * 供应商订单详情
 */
export function getsupllierOrderDetatils(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/getsupllierOrderDetatils',
    method: 'get',
    params: {
      id
    }
  })
}

/**
 * 订单物理信息接口
 */
export function logistics(orderNo, type, cOrderNo) {
  type = encodeURI(type)
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/logistics?orderNo=' +
            orderNo +
            '&type=' +
            type + '&cOrderNo=' + cOrderNo,
    method: 'get'
  })
}

/**
 * 删除订单接口
 */
export function deleteOrders(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/deleteOrders?id=' + id,
    method: 'get'
  })
}

/**
 * 订单再次购买
 */
export function repurchase(orderId, status) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/repurchase?orderId=' +
            orderId +
            '&status=' +
            status,
    method: 'get'
  })
}

/* -----发票管理接口start-----*/

/**
 * 发票管理列表详情
 */
export function getList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/getInvoices?status=' + data,
    method: 'get'
  })
}

/**
 * 添加发票
 */
export function saveInvoice(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/saveInvoice',
    method: 'post',
    data
  })
}

/**
 * 发票管理详情信息
 */
export function getInvoiceInfo(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/getInvoiceInfo/' + id,
    method: 'get'
  })
}

/**
 * 发票信息删除
 */
export function deleteInvoice(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/deleteInvoice/' + id,
    method: 'get'
  })
}

/**
 * 编辑管理详情信息
 */
export function editInvoice(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/editInvoice',
    method: 'post',
    data
  })
}
/* -----发票管理接口end-----*/
/* -----采购计划-----*/
/**
 * 采购项目信息
 */
export function getTenderProjectList(data) {
  return request({
    url: 'bidprocurement/shoppingmall-product/product/shptTenderProjectController/tenderProjectList',
    method: 'post',
    data
  })
}
/* -----退款分页列表-----*/
export function getOrdersBack(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/getOrdersBack',
    method: 'post',
    data
  })
}
/* -----订单退回申请处理 订单退回的id，auditStatus:  0审核驳回  1审核通过,auditOptions:审核意见-----*/
export function dealOrderBack(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/dealOrderBack',
    method: 'post',
    data
  })
}
/* -----供应商确认是否收到退货-----*/
export function confirmProductBack(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/confirmProductBack',
    method: 'post',
    data
  })
}
/* -----查看退货详情-----*/
export function getOrderBackDetail(id, orderBackId) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/getOrderBackDetail?orderDetailId=' + id + '&orderBackId=' + orderBackId,
    method: 'post'
  })
}
/* -----采购人取消退货申请-----*/
export function cancelOrderBack(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/cancelOrderBack?orderDetailId=' + id,
    method: 'post'
  })
}
/* -----订单状态退款状态操作-----*/
export function confirmOrderBack(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/confirmOrderBack',
    method: 'post',
    data
  })
}
/* -----查询对账列表-----*/
export function listReconciliation(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/listReconciliation',
    method: 'post',
    data
  })
}
/* -----多个查询对账-----*/
export function doReconciliation(ids) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/doReconciliation?ids=' + ids,
    method: 'get'
  })
}
/* -----导出对账-----*/
export function exportReconciliation(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/exportReconciliation',
    method: 'post',
    data
  })
}
/* -----对账单明细-订单添加操作-添加订单到对账列表中-----*/
export function addOrderToReconciliation(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/addOrderToReconciliation',
    method: 'post',
    data
  })
}
/* -----对账明细-添加订单查询订单-----*/
export function getOrdersOfStatement(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/getOrdersOfStatement',
    method: 'post',
    data
  })
}
/* -----查询对账明细列表-----*/
export function reconciliationDetails(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/reconciliationDetails',
    method: 'post',
    data
  })
}
/* -----对账单明细-订单添加操作-添加订单查询列表-订单详情-----*/
export function reconciliationOfOrderDetails(id, status) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/reconciliationOfOrderDetails?id=' + id + '&status=' + status,
    method: 'get'
  })
}
/* -----我的订单-待评价-----*/
export function getAssessInfo(id, status) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderAssessController/getAssessInfo?id=' + id + '&status=' + status,
    method: 'get'
  })
}
/* -----我的订单-评价详情-----*/
export function getAssess(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderAssessController/getAssess?orderId=' + id,
    method: 'get'
  })
}
/* -----我的订单-待评价-保存评价-----*/
export function orderAssess(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderAssessController/orderAssess',
    method: 'post',
    data
  })
}
/* -----查询京东对账订单差异-----*/
export function getOrderDiff(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/getOrderDiff',
    method: 'post',
    data
  })
}
/* -----查询对账列表-----*/
export function reconciliations(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/reconciliations',
    method: 'post',
    data
  })
}
// 查询对账列表数量
export function reconciliationNums(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/reconciliationNums',
    method: 'post',
    data
  })
}
/* -----对账明细-发送对账单-----*/
export function sendReconciliation(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/sendReconciliation',
    method: 'post',
    data
  })
}
/* -----订单确认收货-----*/
// 非必填参数（skip true或者false）,skip 在确认取消未受理的退货时传ture,后端默认false
export function orderCompletion(id, skip) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/orderCompletion?id=' + id + '&skip=' + skip,
    method: 'get'
  })
}
/* -----发票审核-发票审核列表-----*/
export function getAuditInvoices(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/getAuditInvoices',
    method: 'post',
    data
  })
}
/* -----发票审核-发票审核详情-----*/
export function auditInvocieInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/auditInvocieInfo',
    method: 'post',
    data
  })
}
/* -----发票审核-发票审核操作-----*/
export function auditInvocie(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/auditInvocie',
    method: 'post',
    data
  })
}

export function getUsableAccountList() {
  return request({
    url: '/bidprocurement/shoppingmall-user/user/shptInvoiceController/getUsableAccountList',
    method: 'get'
  })
}
/* -----收件管理-添加发票收件人信息-----*/
export function addBilings(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/addBilings',
    method: 'post',
    data
  })
}
/* -----收件管理-编辑发票收件人信息-----*/
export function editBilings(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/editBilings',
    method: 'post',
    data
  })
}
/* -----收件管理-删除发票收件人信息-----*/
export function deleteBilings(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/deleteBilings/' + id,
    method: 'get'
  })
}
/* -----收件管理-编辑发票收件人信息-----*/
export function getBilingInfo(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/getBilingInfo/' + id,
    method: 'get'
  })
}
/* -----收件管理-获取发票收件人列表-----*/
export function getBilings() {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptInvoiceController/getBilings',
    method: 'get'
  })
}
/* ----我的订单-验证售后服务防止重复提交-----*/
export function hasOrderBack(id, prod) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/hasOrderBack/id=' + id + '&prod=' + prod,
    method: 'get'
  })
}
/* -----评价汇总-----*/
export function assessReckon(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderAssessController/assessReckon',
    method: 'post',
    data
  })
}
/* -----评价汇总-----*/
export function getAssessReckonBySupplier(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderAssessController/getAssessReckonBySupplier',
    method: 'post',
    data
  })
}
/* -----根据订单评价id查询产品评价-----*/
export function getProductAssessByAssessId(id, supplierName) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderAssessController/getProductAssessByAssessId?assessId=' + id + '&supplierName=' + supplierName,
    method: 'post'
  })
}
/* -----我的订单分页列表订单总数-----*/
export function getOrdersNums(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/getOrdersNums',
    method: 'post',
    data
  })
}
// 获取商品的赠品信息
export function getSkuGift(skuId, address) {
  return request({
    url: '/bidprocurement/shoppingmall-task/taskProductClient/getSkuGift?skuId=' + skuId + '&address=' + address,
    method: 'get'
  })
}
// 删除商品的赠品信息
export function abandonOfGift(skuId) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shopmallCart/abandonOfGift?id=' + skuId,
    method: 'get'
  })
}
// 查询支持的商品返回京东方式
export function returnJdComp(jdOrderId, skuId) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderBackController/returnJdComp?jdOrderId=' + jdOrderId + '&skuId=' + skuId,
    method: 'get'
  })
}
// 订单导出功能
export function orderInfoExport(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/orderInfoExport',
    method: 'post',
    responseType: 'blob',
    data
  })
}
// 供应商订单发货接口
export function orderShipping(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/orderShipping',
    method: 'post',
    data
  })
}
// 查询对账人信息列表
export function quaryBilingAccounts(data) {
  return request({
    url: '/bidprocurement/shoppingmall-task/task/shptTaskBillingAccountController/quaryBilingAccounts',
    method: 'post',
    data
  })
}
// 添加对账人信息
export function addBilingAccountInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-task/task/shptTaskBillingAccountController/addBilingAccountInfo',
    method: 'post',
    data
  })
}
// 更新对账人信息
export function updateBilingAccountInfo(data) {
  return request({
    url: '/bidprocurement/shoppingmall-task/task/shptTaskBillingAccountController/updateBilingAccountInfo',
    method: 'post',
    data
  })
}
// 删除对账人信息详情信息
export function deleteBilingAccountInfo(id) {
  return request({
    url: '/bidprocurement/shoppingmall-task/task/shptTaskBillingAccountController/deleteBilingAccountInfo?id=' + id,
    method: 'get'
  })
}
// 订单对账 -》待对账。往期对账的  账单导出
export function exportStatementData(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/exportStatementData',
    method: 'post',
    data,
    responseType: 'blob'
  })
}
/* -----查询对账开票列表-----*/
export function getStatementInvoiceList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/getStatementInvoiceList',
    method: 'post',
    data
  })
}
/* -----查询对账开票列表-----*/
export function logisticsKp(orderNo, type) {
  type = encodeURI(type)
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/logistics?orderNo=' +
        orderNo +
        '&type=' +
        type,
    method: 'get'
  })
}
/* -----普通电子发票下载----*/
export function getJdInvoiceInfo(orderNo, type, orderMarkId) {
  type = encodeURI(type)
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/getJdInvoiceInfo?orderNo=' +
        orderNo +
        '&type=' +
        type + '&markId=' + orderMarkId,
    method: 'get'
  })
}
// 提交未对账原因说明
export function saveStatementReason(id, statementReason) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/saveStatementReason?id=' + id + '&statementReason=' + statementReason,
    method: 'get'
  })
}
// 获取未对账原因说明
export function getStatementReason(id) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptStatementController/getStatementReason?id=' + id,
    method: 'get'
  })
}
// 获取订单汇总列表
export function getOrderCollectionList(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/getOrderCollectionList',
    method: 'post',
    data
  })
}
// 我的汇总列表 汇总金额
export function getOrderCollectionTotalMoney(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/getOrderCollectionTotalMoney',
    method: 'post',
    data
  })
}
// 订单汇总列表打印并提交
export function orderCollectionListExport(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/orderCollectionListExport',
    method: 'post',
    responseType: 'blob',
    data
  })
}
// 我的汇总列表 我的申购 打印
export function orderCollectionListExportByTabType(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/orderCollectionListExportByTabType',
    method: 'post',
    responseType: 'blob',
    data
  })
}
// 购物车/再次申购伪购物车/结算页/伪结算页 打印
export function shopCarExport(data) {
  return request({
    url: '/bidprocurement/shoppingmall-product/product/shptCartController/shopCarExport',
    method: 'post',
    responseType: 'blob',
    data
  })
}
// 汇总列表-待下单tab的下单与退回操作
export function auditCollectionOrders(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/auditCollectionOrders',
    method: 'post',
    data
  })
}
// 汇总列表-再次申购
export function buyAgainFromBackCollections(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/buyAgainFromBackCollections',
    method: 'post',
    data
  })
}
// 我的申购-取消申购单
export function buyerCancelCollectionOrders(data) {
  return request({
    url: '/bidprocurement/shoppingmall-order/order/shptOrderController/buyerCancelCollectionOrders',
    method: 'post',
    data
  })
}

// 查询vop账号列表
export function getVopAccounts(data) {
  return request({
    url: '/bidprocurement/shoppingmall-task/task/shptTaskBillingAccountController/getVopAccounts',
    method: 'post',
    data
  })
}
// 查询vop账号列表
export function selectDepartListByUserName(userName) {
  return request({
    url: '/bidprocurement/common-user/user/user/selectDepartListByUserName?userName=' + userName,
    method: 'post'
  })
}
