import { axios } from '@/utils/request'

// 获取菜单树数据
export const getMenuList = params => {
  const url = `/menu/findAll`
  return axios({
    url: url,
    data: params,
    method: 'POST',
    headers:{
        'module': encodeURIComponent('菜单树数据查询')
    }
  })
}

// 保存
export const saveMenu = params => {
  const url = `/menu/save`
  return axios({
    url: url,
    data: params,
    method: 'POST',
    headers:{
        'module': encodeURIComponent('新增菜单')
    }
  })
}

// 删除
export const deleteMenu = params => {
  const url = `/menu/delete/${params.id}`
  return axios({
    url: url,
    method: 'get',
    headers:{
        'module': encodeURIComponent('删除菜单')
    }
  })
}

// 获取门店菜单树数据
export const getMdMenuList = params => {
  const url = `/mdmenu/findAll`
  return axios({
    url: url,
    data: params,
    method: 'POST',
    headers:{
        'module': encodeURIComponent('获取门店菜单树数据')
    }
  })
}

// 门店菜单保存
export const saveMdMenu = params => {
  const url = `/mdmenu/save`
  return axios({
    url: url,
    data: params,
    method: 'POST',
    headers:{
        'module': encodeURIComponent('新增/编辑菜单')
    }
  })
}
// 门店菜单删除
export const deleteMdMenu = params => {
  const url = `/mdmenu/delete/${params.id}`
  return axios({
    url: url,
    method: 'get',
    headers:{
        'module': encodeURIComponent('删除菜单')
    }
  })
}

// 获取运营菜单树数据
export const getYyMenuList = params => {
  const url = `/yymenu/findAll`
  return axios({
    url: url,
    data: params,
    method: 'POST',
    headers:{
        'module': encodeURIComponent('菜单列表查询')
    }
  })
}

// 运营菜单保存
export const saveYyMenu = params => {
  const url = `/yymenu/save`
  return axios({
    url: url,
    data: params,
    method: 'POST',
    headers:{
        'module': encodeURIComponent('新增/编辑菜单')
    }
  })
}
// 运营菜单删除
export const deleteYyMenu = params => {
  const url = `/yymenu/delete/${params.id}`
  return axios({
    url: url,
    method: 'get',
    headers:{
        'module': encodeURIComponent('删除菜单')
    }
  })
}
