import axios from '@/libs/axios.js'
// 保存订单
export const saveOrder = (params) => {
  return axios.request({
    url: 'order/save',
    data: params,
    method: 'post'
  })
}
// 查询订单支付信息
export const findPayInfo = (params) => {
  return axios.request({
    url: `order/findPayInfo/${params.orderId}`,
    method: 'get'
  })
}
// 工单收款保存
export const orderPay = (params) => {
  return axios.request({
    url: `order/pay`,
    method: 'post',
    data: params
  })
}
// 工单详情查询
export const orderFind = (params) => {
  return axios.request({
    url: `order/find/${params.orderId}`,
    method: 'get'
  })
}
// 工单列表查询
export const orderQueryLike = (params) => {
  return axios.request({
    url: `order/queryLike/${params.pageNo}/${params.pageSize}`,
    data: {
			queryWord: params.queryWord,
			queryBeginDate: params.queryBeginDate,
			queryEndDate: params.queryEndDate,
			typeId: params.typeId,
			finishFlag: params.finishFlag,
			orderFlag: params.orderFlag,
			orderSource: params.orderSource,
			orderFlags: params.orderFlags
			},
    method: 'post'
  })
}
// 取消订单
export const cancelOrder = (params) => {
  return axios.request({
    url: `order/cancel/${params.orderId}`,
    method: 'get'
  })
}
// 删除订单
export const deleteOrder = (params) => {
  return axios.request({
    url: `order/delete/${params.orderId}`,
    method: 'get'
  })
}
// 订单完工
export const finishOrder = (params) => {
  return axios.request({
    url: `order/finish/${params.orderId}`,
    method: 'get'
  })
}
// 订单配件快速入库
export const savePartStack = (params) => {
  return axios.request({
    url: `purchase/quick`,
    method: 'post',
    data: params
  })
}
// 人员查询
export const listEmployee = (params) => {
  return axios.request({
    url: `employee/findAll`,
    data: params,
    method: 'post'
  })
}

// 工单看板列表查询
export const findOrderAndVehicle = (params) => {
  return axios.request({
    url: `index/findOrderAndVehicle`,
    method: 'get'
  })
}
// 判断工单中的车辆是否存在
export const findVehicle = (params) => {
  return axios.request({
    url: `index/findVehicle`,
    data: {'number': params.number},
    method: 'post'
  })
}
// 删除代开单
export const delVehicleAiMsg = (params) => {
  return axios.request({
    url: `vehicleAiMsg/delete`,
    data: {'id': params.id},
    method: 'post'
  })
}
// 轮询查看是否有车辆出入
export const findIdentityVehicle = (params) => {
  return axios.request({
    url: `index/findIdentityVehicle`,
    method: 'get'
  })
}
// 提成分配查询
export const getRoyalty = params => {
  return axios.request({
    url: `kpiList/splitList/${params.pageNo}/${params.pageSize}`,
    method: 'post',
    data: params
  })
}
// 提成分配设置
export const getSplit = params => {
  return axios.request({
    url: `kpiList/split`,
    method: 'post',
    data: params
  })
}
//  移动端完工添加服务人员
export const smAddSerPerson = (params) => {
  return axios.request({
    url: `order/addSerPerson`,
    method: 'post',
    data: params
  })
}
 // 订单详情中，查看订单使用的优惠券
export const getOrderUsedCoupon = (params) => {
  return axios.request({
    url: `zycar-mgr/coupon/queryByOrder`,
    method: 'post',
    data: params
  })
}