/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许，不可做商业用途！
*
* 版权所有，侵权必究！
*/
import request from '@/utils/request'
import excelRequest from '@/utils/excelRequest'

export function page (pageParam) {
  return request({
    url: '/mall4cloud_order/s/order/page',
    method: 'get',
    params: pageParam
  })
}

export function changeAmount (data) {
  return request({
    url: '/mall4cloud_order/s/order/change_amount',
    method: 'put',
    data
  })
}

export function orderInfo (orderId) {
  return request({
    url: '/mall4cloud_order/s/order/order_info/' + orderId,
    method: 'get'
  })
}

// 原/order/delivery/getOrderItemUnDelivery
export function getOrderItemAndAddress (orderId) {
  return request({
    url: '/mall4cloud_order/s/order/order_item_and_address/' + orderId,
    method: 'get'
  })
}

//
export function delivery (data) {
  return request({
    url: '/mall4cloud_order/s/order/delivery',
    method: 'post',
    data
  })
}

// 获取订单物流信息
export function getOrderDeliveries (pageParam) {
  return request({
    url: '/mall4cloud_order/mp/order_delivery/info',
    method: 'get',
    params: pageParam
  })
}

// 提交订单物流包裹修改信息
export function updateOrderDeliveries (data) {
  return request({
    url: '/mall4cloud_order/mp/order_delivery/update',
    method: 'put',
    data
  })
}

// 导出订单
export function soldExcel (param) {
  return excelRequest({
    url: '/mall4cloud_search/s/order/search/sold_excel',
    method: 'GET',
    params: param
  })
}
// 导出待发货订单
export function deliverySoldExcel (param) {
  return excelRequest({
    url: '/mall4cloud_order/s/order/un_delivery_sold_excel',
    method: 'GET',
    params: param
  })
}

// 修改订单收货地址
export function updateOrderAddr (data) {
  return request({
    url: '/mall4cloud_order/s/order/change_user_addr',
    method: 'put',
    data
  })
}

// 获取改价后的价格
export function getChangeAmount (params) {
  return request({
    url: '/mall4cloud_order/s/order/get_change_amount',
    method: 'get',
    params
  })
}

// 通过订单用户收货地址
export function getOrderAddr (orderAddrId) {
  return request({
    url: '/mall4cloud_order/s/order/order_addr/' + orderAddrId,
    method: 'get'
  })
}

/**
 * 查询订单物流包裹信息
 * @param {*} param 当前筛选条件
 */
export function deliveryExpresseInfo (param) {
  return request({
    url: '/mall4cloud_order/mp/order_delivery/info',
    method: 'GET',
    params: param
  })
}
