import request from '@/utils/request';

/**
 * 列表
 */
 export async function getList (data) {
    const res = await request.post('/eom/market_management/page', 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('/eom/market_management/'+(data.id?'update':'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('/eom/market_management/getById/'+id);
    if (res.data.code == 0) {
      return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
  }
/**
 * 删除
 */
 export async function del(data) {
  const res = await request.delete('/eom/market_management/delete', {data});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
