import request from '@/utils/request';

/**
 * 获取信息列表
 */
export async function getTableList(params) {
  const res = await request.get(`/eom/businessopportunityfollowup/page`, { params });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 获取信息详情
 */
export async function getDetail(id) {
  const res = await request.get(`/eom/businessopportunityfollowup/getById/${id}`, {});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 更新信息
 */
export async function UpdateInformation(data) {
  const res = await request.put(`/eom/businessopportunityfollowup/update`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

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

/**
 * 删除事项
 */
export async function deleteInformation(data) {
  const res = await request.delete('/eom/businessopportunityfollowup/delete', {data});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}




/**
 * 更新状态
 */
export async function updateStatus(id, status) {
  const res = await request.get(`/eom/businessopportunity/updateStatus?id=` + id + '&status=' + status);
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 查询客户联系人列表
 */
export async function getcontactlink(params) {
  const res = await request.get(`/eom/contactlink/list/`, {params});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
