import request from '@/utils/request';

/*  费用申请  */

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

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

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

/**
 * 流程作废
 */
export async function cancel(data) {
  const res = await request.put(`/bpm/finFeeApply/notPass`, data);
  if (res.data.code == 0) {
    return Promise.resolve(res.data);
  }
  return Promise.reject(new Error(res.data.message));
}
