import request from '@/utils/request';

/*  费用申请  */


// 列表
export async function driverBookPageListAPI(data) {
  let par = new URLSearchParams(data);
  const res = await request.get(`/eom/logistictrakdriverledger/page?` + par, {});
  if (res.data.code == 0) {
    return res.data.data.list;
  }
  return Promise.reject(new Error(res.data.message));
}


// 新增
export async function driverBookSaveAPI(data) {
  const res = await request.post(`/eom/logistictrakdriverledger/save`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 编辑
export async function driverUpdateAPI(data) {
  const res = await request.put(`/eom/logistictrakdriverledger/update`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 信息
export async function driverInfoAPI(id) {
  const res = await request.get(`/eom/logistictrakdriverledger/getById/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 删除
export async function driverRemoveAPI(data) {
  const res = await request.delete('/eom/logistictrakdriverledger/delete', {data});
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 提交-开启流程
export async function driverSubmit(data) {
  const res = await request.post('/bpm/logistictrakdriverledger/submit', data);
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
