import request from '@/utils/request'

//云洗订单分配工厂
export function orderClothSelectOrg(data) {
  return request({
    url: '/mapi/order/cloth/selectOrg',
    method: 'post',
    data: data
  })
}

export function getOrderStatusByOrderNo(data) {
  return request({
    url: '/mapi/order/cloth/getOrderStatusByOrderNo',
    method: 'get',
    params: data
  })
}

export function confirmSend(data) {
  return request({
    url: '/mapi/order/cloth/confirmSend',
    method: 'get',
    params: data
  })
}

export function orderClothSetThirdDelivery(data) {
  return request({
    url: '/mapi/order/cloth/setThirdDelivery',
    method: 'post',
    data: data
  })
}


export function setSendDelivery(data) {
  return request({
    url: '/mapi/order/cloth/setSendDelivery',
    method: 'get',
    params: data
  })
}

export function setIntracityExpress(data) {
  return request({
    url: '/mapi/order/cloth/setIntracityExpress',
    method: 'get',
    params: data
  })
}


export async function getInfoByOrderNo(query){
  return request({
    url: '/mapi/order/cloth/getInfoByOrderNo',
    method: 'get',
    params: query
  })
}

export function takeCloth(data) {
  return request({
    url: '/mapi/order/cloth/takeCloth',
    method: 'get',
    params: data
  })
}

// 收衣
export function collectCloth(data) {
  return request({
    url: '/mapi/order/cloth/collectCloth',
    method: 'post',
    data: data
  })
}

getSendClothOrderList

// 查询洗衣订单列表
export function getSendClothOrderList(query) {
  return request({
    url: '/mapi/order/cloth/getSendClothOrderList',
    method: 'post',
    data: query
  })
}

// 查询洗衣订单列表
export function listOrderCloth(query) {
  return request({
    url: '/mapi/order/cloth/list',
    method: 'post',
    data: query
  })
}

export async function refundOrderCloth(query){
  return request({
    url: '/mapi/order/cloth/refund',
    method: 'get',
    params: query
  })
}

// 查询洗衣订单详细
export function getCloth(id) {
  return request({
    url: '/mapi/order/cloth/' + id,
    method: 'get'
  })
}

// 新增洗衣订单
export function addCloth(data) {
  return request({
    url: '/mapi/order/cloth',
    method: 'post',
    data: data
  })
}

// 修改洗衣订单
export function updateCloth(data) {
  return request({
    url: '/mapi/order/cloth',
    method: 'put',
    data: data
  })
}

// 删除洗衣订单
export function delCloth(id) {
  return request({
    url: '/mapi/order/cloth/' + id,
    method: 'delete'
  })
}


// 修改洗衣订单状态
export function updateClothStatus(id,status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/mapi/order/cloth/updateStatus',
    method: 'post',
    data: data
  })
}

// 查询门店预约订单列表
export function getAppointmentClothOrderList(data) {
  return request({
    url: '/mapi/order/cloth/getAppointmentClothOrderList',
    method: 'post',
    data: data
  })
}

//  预约订单，设置派送员
export function setDeliveryManByAppointment(data) {
  return request({
    url: '/mapi/order/cloth/setDeliveryManByAppointment',
    method: 'get',
    params: data
  })
}

//  预约订单，取消预约
export function cancelAppointmentOrderByAppointment(data) {
  return request({
    url: '/mapi/order/cloth/cancelAppointmentOrderByAppointment',
    method: 'get',
    params: data
  })
}


// 查询门店消费统计
export function listCountConsumeByClothOrder(data) {
  return request({
    url: '/mapi/order/cloth/listCountConsumeByClothOrder',
    method: 'post',
    data: data
  })
}

// 查询门店未付款统计
export function listCountNoConsumeByClothOrder(data) {
  return request({
    url: '/mapi/order/cloth/listCountNoConsumeByClothOrder',
    method: 'post',
    data: data
  })
}

// 财务统计-日报
export function listFinancialStatisticsByClothOrderDay(data) {
  return request({
    url: '/mapi/order/cloth/listFinancialStatisticsByClothOrderDay',
    method: 'post',
    data: data
  })
}

// 财务统计-月报
export function listFinancialStatisticsByClothOrderMonth(data) {
  return request({
    url: '/mapi/order/cloth/listFinancialStatisticsByClothOrderMonth',
    method: 'post',
    data: data
  })
}

// 财务统计-支付宝微信统计
export function listFinancialStatisticsByOnlinePay(data) {
  return request({
    url: '/mapi/order/cloth/listFinancialStatisticsByOnlinePay',
    method: 'post',
    data: data
  })
}

// 财务统计-工厂洗衣明细统计
export function listFinancialStatisticsByClothOrderFactory(data) {
  return request({
    url: '/mapi/order/cloth/listFinancialStatisticsByClothOrderFactory',
    method: 'post',
    data: data
  })
}


// 工厂财务统计-经营日报-今日统计
export function countFinancialStatisticsByFactoryWithToday(data) {
  return request({
    url: '/mapi/order/cloth/countFinancialStatisticsByFactoryWithToday',
    method: 'get',
    params: data
  })
}


// 工厂财务统计-经营日报-列表查询
export function listFinancialStatisticsByFactoryWithToday(data) {
  return request({
    url: '/mapi/order/cloth/listFinancialStatisticsByFactoryWithToday',
    method: 'post',
    data: data
  })
}


// 工厂财务统计-经营统计
export function countFinancialStatisticsByFactoryOperate(data) {
  return request({
    url: '/mapi/order/cloth/countFinancialStatisticsByFactoryOperate',
    method: 'post',
    data: data
  })
}

// 工厂财务统计-经营明细
export function countFinancialStatisticsByFactoryOperateDetail(data) {
  return request({
    url: '/mapi/order/cloth/countFinancialStatisticsByFactoryOperateDetail',
    method: 'post',
    data: data
  })
}

// 支付
export function clothOrderPay(data) {
  return request({
    url: '/mapi/order/cloth/clothOrderPay',
    method: 'post',
    data: data
  })
}

// 支付结果
export function getOrderPayResult(params) {
  return request({
    url: '/mapi/order/cloth/getOrderPayResult',
    method: 'get',
    params: params
  })
}
