import request from '@/utils/request'
import Qs from 'qs'

export function listOrder(query) {
    return request({
        url: '/order/list',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}


export function detailOrder(id) {
    return request({
        url: '/order/detail',
        method: 'get',
        params: { id }
    })
}

export function shipOrder(data) {
    return request({
        url: '/order/ship',
        method: 'post',
        data
    })
}

export function refundOrder(data) {
    return request({
        url: '/order/refund',
        method: 'post',
        data
    })
}

export function deleteOrder(data) {
    return request({
        url: '/order/delete',
        method: 'post',
        data
    })
}

export function editOrder(data) {
    return request({
        url: '/order/edit',
        method: 'post',
        data
    })
}

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

export function replyComment(data) {
    return request({
        url: '/order/reply',
        method: 'post',
        data
    })
}

export function listChannel(id) {
    return request({
        url: '/order/channel',
        method: 'get'
    })
}

export function importOrder(data, config) {
    return request({
        url: '/order/import',
        method: 'post',
        config: config,
        data
    })
}
export function orderBookList(query) {
    return request({
        url: '/orderbook/list',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
export function orderBookDetail(orderId) {
    return request({
        url: '/orderbook/detail',
        method: 'get',
        params: { orderId }
    })
}
export function cancelBook(query) {
    return request({
        url: '/orderbook/cancelBook',
        method: 'get',
        params: query
    })
}

export function getAssignmentPerson(query) {
    return request({
        url: '/orderbook/getAssignmentPerson',
        method: 'get',
        params: query
    })
}
export function orderBookReassign(data, config) {
    return request({
        url: '/orderbook/reassign',
        method: 'post',
        config: config,
        data
    })
}
//单次
export function oncelist(query) {
    return request({
        url: '/orderbook/oncelist',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}

//周期
export function categorylist(query) {
    return request({
        url: '/orderbook/categorylist',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}

//品类
export function cyclelist(query) {
    return request({
        url: '/orderbook/cyclelist',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
export function getGoods(query) {
    return request({
        url: 'goods/getDefaultCityGoods',
        method: 'get',
        params: query,
    })
}
export function orderCreate(data) {
    return request({
        url: '/order/create',
        method: 'post',
        data
    })
}
export function orderBook(data) {
    return request({
        url: '/orderbook/book',
        method: 'post',
        data
    })
}

export function getAssignmentPersonTime(data) {
    return request({
        url: '/orderbook/getAssignmentPersonTime',
        method: 'post',
        data
    })
}


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

export function applyRefundOrder(data) {
    return request({
        url: '/order/applyRefund',
        method: 'post',
        data
    })
}
export function orderBookFinish(query) {
    return request({
        url: '/orderbook/finish',
        method: 'get',
        params: query,
    })
}
export function commission(query) {
    return request({
        url: '/order/commission',
        method: 'get',
        params: query,
    })
}

export function cancelOrde(query) {
    return request({
        url: '/order/cancelOrde',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
export function qgOrderlist(query) {
    return request({
        url: '/qgOrder/list',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
//导出
export function exportQgData(query) {
    return request({
        url: '/qgOrder/export',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        },
        responseType: 'blob',
    })
}
export function createMemo(data) {
    return request({
        url: '/order/createMemo',
        method: 'post',
        data
    })
}
export function readMemo(query) {
    return request({
        url: '/order/readMemo',
        method: 'get',
        params: query,
    })
}
//权益单列表
export function hmInterst(query) {
    return request({
        url: '/hmInterst/getPageList',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
//取消权益单
export function cancelInterst(query) {
    return request({
        url: '/hmInterst/cancelInterst',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
//查询订单号是否已存在权益单
export function checkInterst(query) {
    return request({
        url: '/hmInterst/checkInterst',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
//同步权益单
export function syncInterst(query) {
    return request({
        url: '/hmInterst/syncInterst',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
//添加权益单
export function addInterst(data) {
    return request({
        url: '/hmInterst/addInterst',
        method: 'post',
        data
    })
}
//获取盒马供应商，门店信息
export function getHmSuppliersShop(query) {
    return request({
        url: '/hmInterst/getHmSuppliersShop',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}
// 查询盒马商品的服务项 /admin/hmInterst/getHmSkuItem
export function getHmSkuItem(query) {
    return request({
        url: '/hmInterst/getHmSkuItem',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
}


export function orderIsHandle(id) {
    return request({
        url: '/order/ishandle',
        method: 'get',
        params: { id }
    })
}
export function onceReassign(orderId) {
    return request({
        url: '/orderbook/onceReassign',
        method: 'get',
        params: {orderId}
    })
}

// 获取用户拥有的城市，驿站，服务站
export function getUserAuthData(data) {
    return request({
        url: '/workerOccupy/getUserAuthData',
        method: 'get',
        params: data
    })
}

// 条件查询档期与占用
export function selectOccupyByQuery(data) {
    return request({
        url: '/workerOccupy/selectOccupyByQuery',
        method: 'post',
        data
    })
}
// 修改订单地址
export function updateOrderAddress(data) {
    return request({
        url: '/order/updateOrderAddress',
        method: 'post',
        data
    })
}

// 查询要抖音订单核销情况
export function getDyOrderList(data) {
    return request({
        url: '/dyOrderVerify/getList',
        method: 'get',
        params: data
    })
}

// 手动核销抖音订单，传入订单id
export function douyinVerifyOrder(data) {
    return request({
        url: '/dyOrderVerify/douyinVerifyOrder',
        method: 'get',
        params: data
    })
}
export function getCalendarStock(data, config) {
    return request({
        url: '/orderbook/getCalendarStock',
        method: 'post',
        config: config,
        data
    })
}
// 时间段
export function getTimeRange(data) {
    return request({
        url: '/serviceTimeRange/all',
        method: 'get',
        params: data
    })
}
export function getScheduleCalendarStock(data, config) {
    return request({
        url: 'workerOccupy/getCalendarStock',
        method: 'post',
        config: config,
        data
    })
}

//获取订单加盟商信息
export function getOrderFraId(query) {
    return request({
        url: '/order/fraInfo',
        method: 'get',
        params: query
    })
}

// 修改订单地址v2
export function updateOrderAddressV2(data) {
    return request({
        url: '/order/updateOrderAddressV2',
        method: 'post',
        data
    })
}

export function getAllFras(query) {
    return request({
        url: '/order/getAllFras',
        method: 'get',
        params: query
    })
}

//获取订单商品的服务时间段
export function getGoodsTimeRange(query) {
    return request({
        url: '/order/getGoodsTimeRange',
        method: 'get',
        params: query
    })
  }

  /**
   * 根据加盟商id 获取所有兼职阿姨
   * @param {} query
   * @returns
   */
  export function  getWorkerByFraId(query) {
    return request({
        url: '/order/getWorkerByFraId',
        method: 'get',
        params: query
    })
}

//获取订单核销信息
export function getOrderVerifyInfo(data) {
    return request({
        url: '/order/getVerifyInfo',
        method: 'get',
        params: data
    })
}

//操作日志
export function getOpLog(query) {
    return request({
        url: '/orderbookdetail/serviceOrderOpLog',
        method: 'get',
        params: query
    })
  }
//   品类
  export function getProduct(query) {
    return request({
        url: '/goods/getProduct',
        method: 'get',
        params: query
    })
  }
//添加工单提醒
export function addOrderRemind(data) {
    return request({
        url: '/order/addOrderRemind',
        method: 'post',
        data
    })
}

export function bucha(query) {
  return request({
    url: '/order/createMakeUpQRCode',
    method: 'get',
    params: query
  })
}

//修改订单类型
export function mtOrderTypeChange(data) {
    return request({
        url: '/order/mtOrderTypeChange',
        method: 'post',
        data
    })
}


export function getAftersaleLog(id) {
  return request({
    url: '/aftersale/getAftersaleLog',
    method: 'get',
    params: { id }
  })
}


export function sendOrdersCheck(query) {
    return request({
      url: '/orderbook/sendOrdersCheck',
      method: 'get',
      params: query
    })
  }
  export function selectAddress(data) {
    return request({
        url: '/orderbook/selectAddress',
        method: 'post',
        data
    })
}
export function getStock(data) {
    return request({
        url: '/orderbook/getStock',
        method: 'post',
        data
    })
}
export function sendOrders(data) {
    return request({
      url: '/orderbook/sendOrders',
      method: 'post',
      data
    })
  }

    //取消代客下单
    export function cancelOrder(data) {
        return request({
            url: '/order/cancelOrder',
            method: 'post',
            data
        })
    }

//美团手动同步履约状态（已完成）
export function mtOrderComplete(data) {
    return request({
      url: '/order/mtOrderComplete',
      method: 'get',
      params:  data
    })
  }
//   生成客户预约二维码
  export function createCustomerBookQrCode(query) {
    return request({
        url: '/orderbookdetail/createCustomerBookQrCode',
        method: 'get',
        params: query
    })
  }


// 原生卷加解锁
export function addToUnlock(query) {
  return request({
    url: '/order/addToUnlock',
    method: 'get',
    params: query
  })
}

// 原生卷加解锁
export function queryWorkerAssignFail(query) {
  return request({
    url: '/helpSelfCheck/checkWorker',
    method: 'get',
    params: query
  })
}

export function getPageList(data) {
  return request({
    url: '/telecomCardOrder/getPageList',
    method: 'post',
    data
  })
}

export function getCommodity(query) {
  return request({
    url: '/telecomCardOrder/getCommodity',
    method: 'get',
    params: query
  })
}

export function getTelecomCardCommodity(query) {
  return request({
    url: '/telecomCardOrder/getTelecomCardCommodity',
    method: 'get',
    params: query
  })
}

export function create(data) {
  return request({
    url: '/telecomCardOrder/create',
    method: 'post',
    data
  })
}

export function selectNumber(query) {
  return request({
    url: '/telecomCardOrder/selectNumber',
    method: 'get',
    params: query
  })
}

export function createOrder(data) {
  return request({
    url: '/telecomCardOrder/saveOrder',
    method: 'post',
    data
  })
}

export function sendH5(query) {
  return request({
    url: '/telecomCardOrder/sendH5',
    method: 'get',
    params: query
  })
}

export function getState(query) {
  return request({
    url: '/telecomCardOrder/getState',
    method: 'get',
    params: query
  })
}

export function update(data) {
  return request({
    url: '/telecomCardOrder/update',
    method: 'post',
    data
  })
}

