import request from '@/utils/request'

// 查询订单列表
export function listStoreOrder(query) {
  return request({
    url: '/store/store/storeOrder/list',
    method: 'get',
    params: query
  })
}


export function listAllStoreOrder(query) {
  return request({
    url: '/store/store/storeOrder/allList',
    method: 'get',
    params: query
  })
}

export function listPickStoreOrder(query) {
  return request({
    url: '/store/store/storeOrder/pickList',
    method: 'get',
    params: query
  })
}
export function getCustomerOrderList(query) {
  return request({
    url: '/store/store/storeOrder/getCustomerOrderList',
    method: 'get',
    params: query
  })
}


export function myListStoreOrder(query) {
  return request({
    url: '/store/store/storeOrder/myList',
    method: 'get',
    params: query
  })
}

// 查询订单详细
export function getStoreOrder(id) {
  return request({
    url: '/store/store/storeOrder/' + id,
    method: 'get'
  })
}
// 查询电话
export function getUserPhone(id) {
  return request({
    url: '/store/store/storeOrder/queryPhone/' + id,
    method: 'get'
  })
}

// 查询订单详细
export function getStoreOrderAddress(id) {
  return request({
    url: '/store/store/storeOrder/queryAddress/' + id,
    method: 'get'
  })
}

export function getExpress(id) {
  return request({
    url: '/store/store/storeOrder/getExpress/' + id,
    method: 'get'
  })
}


// 新增订单
export function addStoreOrder(data) {
  return request({
    url: '/store/store/storeOrder',
    method: 'post',
    data: data
  })
}




// 修改订单
export function updateStoreOrder(data) {
  return request({
    url: '/store/store/storeOrder',
    method: 'put',
    data: data
  })
}

// 修改物流编号/发货人手机号
export function updateDeliveryId(data) {
  return request({
    url: '/store/store/storeOrder/editDeliveryId',
    method: 'put',
    data: data
  })
}

// 删除订单
export function delStoreOrder(id) {
  return request({
    url: '/store/store/storeOrder/' + id,
    method: 'delete'
  })
}

// 导出订单
export function exportStoreOrder(query) {
  return request({
    url: '/store/store/storeOrder/export',
    method: 'get',
    params: query
  })
}

export function exportStoreOrderItems(query) {
  return request({
    url: '/store/store/storeOrder/exportItems',
    method: 'get',
    params: query
  })
}


export function createUserOrder(data) {
  return request({
    url: '/store/store/storeOrder/createUserOrder',
    method: 'post',
    data: data
  })
}

export function editPayPrice(data) {
  return request({
    url: '/store/store/storeOrder/editPayPrice',
    method: 'post',
    data: data
  })
}


export function bindCustomer(data) {
  return request({
    url: '/store/store/storeOrder/bindCustomer',
    method: 'post',
    data: data
  })
}

export function uploadCredentials(data) {
  return request({
    url: '/store/store/storeOrder/uploadCredentials',
    method: 'post',
    data: data
  })
}

//获取制单类型
export function getCreateOrderType() {
  return request({
    url: '/store/store/storeOrder/getCreateOrderType',
    method: 'get'
  })
}

// 订单确认审核
export function auditStoreOrder(data) {
  return request({
    url: '/store/store/storeOrder/batchAudit',
    method: 'post',
    data: data
  })
}
// 修改订单ItemJson
export function updateStoreOrderItemJson(id,backendEditProductType) {
  return request({
    url: '/store/store/storeOrder/updateStoreOrderItemJson/'+id + "/" + backendEditProductType,
    method: 'get'
  })
}

// 修改订单代收金额
export function editPayDelivery(data) {
  return request({
    url: '/store/store/storeOrder/editPayDelivery',
    method: 'put',
    data: data
  })
}
// 查询其余订单列表
export function queryUserOtherOrderPage(query) {
  return request({
    url: '/store/store/storeOrder/queryUserOtherOrderPage',
    method: 'get',
    params: query
  })
}

// 查询直播订单列表（仅 orderType=2，分公司负责人查全公司，销售查自己）- fs-company 接口
export function listHealthLiveStoreOrder(data) {
  return request({
    url: '/store/storeOrder/healthLiveList',
    method: 'post',
    data: data
  })
}

// 以下为健康商城/直播订单页所需接口（可走网关到 store 或 company）
export function importTemplate() {
  return request({
    url: '/store/store/storeOrder/importTemplate',
    method: 'get'
  })
}

export function importDeliveryNoteExpressTemplate() {
  return request({
    url: '/store/store/storeOrder/importDeliveryNoteExpressTemplate',
    method: 'get'
  })
}

export function exportHealthStoreOrderItems(query) {
  return request({
    url: '/store/storeOrder/healthExportItems',
    method: 'get',
    params: query
  })
}

export function exportHealthStoreOrder(data) {
  return request({
    url: '/store/storeOrder/healthExport',
    method: 'post',
    data: data
  })
}

export function exportHealthStoreOrderDetails(data) {
  return request({
    url: '/store/storeOrder/healthExportDetails',
    method: 'post',
    data: data
  })
}

export function exportHealthStoreOrderItemsDetails(query) {
  return request({
    url: '/store/storeOrder/healthExportItemsDetails',
    method: 'get',
    params: query
  })
}

export function getErpAccount() {
  return request({
    url: '/store/store/storeOrder/getErpAccount',
    method: 'get'
  })
}

export function healthExportShippingOrder(query) {
  return request({
    url: '/store/store/storeOrder/healthExportShippingOrder',
    method: 'get',
    params: query
  })
}

export function queryErpPhone(query) {
  return request({
    url: '/store/store/storeOrder/queryErpPhone',
    method: 'get',
    params: query
  })
}

export function saveErpPhone(data) {
  return request({
    url: '/store/store/storeOrder/saveErpPhone',
    method: 'post',
    data: data
  })
}

export function editErpPhone(data) {
  return request({
    url: '/store/store/storeOrder/editErpPhone',
    method: 'post',
    data: data
  })
}

export function batchCreateErpOrder(data) {
  return request({
    url: '/store/store/storeOrder/batchCreateErpOrder',
    method: 'post',
    data: data
  })
}

export function batchSetErpOrder(data) {
  return request({
    url: '/store/store/storeOrder/batchSetErpOrder',
    method: 'post',
    data: data
  })
}

export function refundStorePayment(data) {
  return request({
    url: '/store/store/storePayment/refundStorePayment',
    method: 'post',
    data: data
  })
}

export function redeemStoreOrder(data) {
  return request({
    url: '/store/store/storeOrder/redeem',
    method: 'post',
    data: data
  })
}

