import request from '@/utils/request';


// 资质列表查询
export async function getProfessionCertificationPageList(params) {
  const res = await request.get(`/main/professionCertification/page`, {
    params
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 新增资质
export async function saveProfessionCertification(data) {
  const res = await request.post(`/main/professionCertification/save`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 通过id查询资质详情
export async function getProfessionCertificationById(id) {
  const res = await request.get(`/main/professionCertification/getById/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 删除资质
export async function deleteProfessionCertificationById(data) {
  const res = await request.delete(`/main/professionCertification/delete`, {
    data
  });
  if (res.data.code == 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

// 修改资质
export async function updateProfessionCertificationById(data) {
  const res = await request.put(`/main/professionCertification/update`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 * 提交客户证书资质信息  开启流程
 */
export async function contactQcSubmit(data) {
  const res = await request.post(`/bpm/ProfessionCertification/submit`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
