import request from '@/utils/request';

/**
 * 分页查询
 * @param params 查询条件
 */
export async function pageCustomer(params) {
  const res = await request.get('/receiver/customer/page', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function getCustomer(params) {
  const res = await request.get('/receiver/customer', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function pageCustomerOptLog(params) {
  const res = await request.get('/receiver/customer/opt', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function getSearch(params) {
  const res = await request.get('/receiver/customer/search', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 分页查询
 * @param params 查询条件
 */
export async function pageCustomerMobile(params) {
  const res = await request.get('/receiver/customer/mobileList', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
