import request from '@/utils/request';


/**
 * 列表
 */
export async function returnPage(params) {
  const res = await request.get('/mes/returnmaterials/page', {
    params
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}


// 可以退还列表

export async function refundable(data) {
  const res = await request.post('/mes/returnmaterials/refundable', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}


// 保存

export async function save(data) {
  const res = await request.post('/mes/returnmaterials/save', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function getById(id) {
  const res = await request.get(`/mes/returnmaterials/getById/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
