import request from '@/utils/request'

// 查询联系人列表
export function listContact(query) {
  return request({
    url: '/business/contact/list',
    method: 'get',
    params: query
  })
}

// 查询相关联系人
export function getRelatedContact(query) {
  return request({
    url: '/business/contact/contactlist',
    method: 'get',
    params: query
  })
}

// 查询联系人详细
export function getContact(contactId) {
  return request({
    url: '/business/contact/' + contactId,
    method: 'get'
  })
}

// 新增联系人
export function addContact(data) {
  return request({
    url: '/business/contact',
    method: 'post',
    data: data
  })
}

// 修改联系人
export function updateContact(data) {
  return request({
    url: '/business/contact',
    method: 'put',
    data: data
  })
}

// 删除联系人
export function delContact(contactId) {
  return request({
    url: '/business/contact/' + contactId,
    method: 'delete'
  })
}

// 根据 条件 查询联系人是否已经存在
// export function getSameContactLib(query) {
//   return request({
//     url: '/business/contact/getSameContactLib',
//     method: 'get',
//     params: query
//   })
// }

export function getSameContactLib(query) {
  return request({
    url: '/business/contact/getSameContactLib',
    method: 'post',
    data: query  // 将参数放在请求体中
  });
}
