import request from '@/utils/request';

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

/**
 * 审核
 * @param params
 */
export async function checkSubsidy(params) {
  const res = await request.post('/receiver/subsidy/check', params);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

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

/**
 * 审核
 * @param params
 */
export async function editSubsidyStatus(params) {
  const res = await request.post('/receiver/subsidy/status', params);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

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