import request, { getBlob } from '@/utils/request'

// 获取个人信息
export function getUserInfo(params) {
  return request({
    url: '/admin/user/detail',
    method: 'get',
    params
  })
}

// 修改密码
export function changePassword(params) {
  return request({
    url: '/admin/user/password/update',
    method: 'post',
    params
  })
}

// 获取账户列表
export function getAccountList(params) {
  return request({
    url: '/admin/user/list',
    method: 'get',
    params
  })
}

// 获取角色列表
export function getRoleList(params) {
  return request({
    url: '/admin/role/list',
    method: 'get',
    params
  })
}

// 重置密码
export function resetPassword(params) {
  return request({
    url: '/admin/user/password/reset',
    method: 'post',
    params
  })
}

// 更改账户状态
export function changeAccountStatus(params) {
  return request({
    url: '/admin/user/status/update',
    method: 'post',
    params
  })
}

// 新增账户
export function addAccount(params) {
  return request({
    url: '/admin/user/add',
    method: 'post',
    data: params
  })
}

// 编辑账户
export function editAccount(params) {
  return request({
    url: '/admin/user/user/update',
    method: 'post',
    data: params
  })
}

// 获取账户详情
export function getAccountDetail(params) {
  return request({
    url: '/admin/user/detail',
    method: 'get',
    params
  })
}

// 获取字段列表
export function getFieldList(params) {
  return request({
    url: '/sys/dict/list/page',
    method: 'get',
    params
  })
}

// 更改字段状态
export function changeFieldStatus(params) {
  return request({
    url: '/sys/dict/status/update',
    method: 'post',
    params
  })
}

// 删除字段
export function deleteField(params) {
  return request({
    url: '/sys/dict/delete',
    method: 'post',
    params
  })
}

// 新增字段
export function addField(params) {
  return request({
    url: '/sys/dict/add',
    method: 'post',
    params
  })
}

// 编辑字段
export function editField(params) {
  return request({
    url: '/sys/dict/update',
    method: 'post',
    params
  })
}

// 获取字段详情
export function getFieldDetail(params) {
  return request({
    url: '/sys/dict/detail',
    method: 'get',
    params
  })
}

// 获取操作日志列表
export function getOplogList(params) {
  return request({
    url: '/admin/operation/log/list',
    method: 'get',
    params
  })
}

// 检查工程机帐号是否有效
export function checkEngineAccount() {
  return request({
    url: '/admin/user/engin/checkuser',
    method: 'post'
  })
}

// 绑定工程机帐号
export function bindEngineAccount(params) {
  return request({
    url: '/admin/user/engin/bind',
    method: 'post',
    params
  })
}

// 删除工程机帐号
export function delEngineAccount(params) {
  return request({
    url: '/admin/user/engin/account/del',
    method: 'post',
    params
  })
}

// 更改轮播图状态
export function changeBannerStatus(params) {
  return request({
    url: '/carouselMap/state/update',
    method: 'post',
    params
  })
}

// 删除轮播图
export function deleteBanner(params) {
  return request({
    url: '/carouselMap/delete',
    method: 'post',
    params
  })
}

// 新增轮播图
export function addBanner(params) {
  return request({
    url: '/carouselMap/add',
    method: 'post',
    data: params
  })
}

// 编辑轮播图
export function editBanner(params) {
  return request({
    url: '/carouselMap/update',
    method: 'post',
    data: params
  })
}

// 获取轮播图详情
export function getBannerDetail(params) {
  return request({
    url: '/carouselMap/detail',
    method: 'get',
    params
  })
}

// 新增角色
export function addRole(params) {
  return request({
    url: '/admin/role/add',
    method: 'post',
    data: params
  })
}

// 编辑角色
export function editRole(params) {
  return request({
    url: '/admin/role/update',
    method: 'post',
    data: params
  })
}

// 删除角色
export function deleteRole(params) {
  return request({
    url: '/admin/role/delete',
    method: 'post',
    params
  })
}

// 获取角色详情
export function getRoleDetail(params) {
  return request({
    url: '/admin/role/detail',
    method: 'get',
    params
  })
}

// 获取权限列表
export function getMenuRoleList(params) {
  return request({
    url: '/admin/user/module/all',
    method: 'get',
    params
  })
}

// 获取已选权限数组
export function getMenuRoleIds(params) {
  return request({
    url: '/admin/user/module/id/checked',
    method: 'get',
    params
  })
}

// 提交设置权限
export function setMenuRole(params) {
  return request({
    url: '/admin/user/module/grant',
    method: 'post',
    params
  })
}

// 获取商品列表
export function getGoodsList(params) {
  return request({
    url: '/carouselMap/list/goods',
    method: 'get',
    params
  })
}

// 批量删除轮播图
export function batchDeleteBanner(params) {
  return request({
    url: '/carouselMap/batch/delete',
    method: 'post',
    data: params
  })
}

// 获取通告
export function getNotice(params) {
  return request({
    url: '/notice/mini/select',
    method: 'get',
    params
  })
}

// 新增通告
export function addNotice(params) {
  return request({
    url: '/notice/mini/add',
    method: 'post',
    data: params
  })
}

// 编辑通告
export function editNotice(params) {
  return request({
    url: '/notice/mini/update',
    method: 'post',
    data: params
  })
}

// 获取菜单列表
export function getMenuList(params) {
  return request({
    url: '/admin/user/module/list',
    method: 'get',
    params
  })
}

// 添加菜单
export function addMenu(params) {
  return request({
    url: '/admin/module/add',
    method: 'post',
    data: params
  })
}

// 编辑菜单
export function editMenu(params) {
  return request({
    url: '/admin/module/update',
    method: 'post',
    data: params
  })
}

// 删除菜单
export function deleteMenu(params) {
  return request({
    url: '/admin/module/delete',
    method: 'post',
    params
  })
}

// 获取菜单详情
export function getMenuDetail(params) {
  return request({
    url: '/admin/module/detail',
    method: 'get',
    params
  })
}

// 获取商户列表
export function getMerchantList(params) {
  return request({
    url: '/admin/user/mch/list',
    method: 'get',
    params
  })
}

// 获取经销商列表
export function getDealerList(params) {
  return request({
    url: '/customer/list',
    method: 'get',
    params
  })
}

// 获取用户协议
export function getAgreement(params) {
  return request({
    url: '/admin/company/other/getOne',
    method: 'get',
    params
  })
}

// 更新用户协议
export function editAgreement(params) {
  return request({
    url: '/admin/company/other/update',
    method: 'post',
    params
  })
}

// 获取部门列表
export function getDepartmentList(params) {
  return request({
    url: '/admin/websit/tree',
    method: 'get',
    params
  })
}

// 添加部门
export function addDepartment(params) {
  return request({
    url: '/admin/websit/add',
    method: 'post',
    data: params
  })
}

// 修改部门
export function editDepartment(params) {
  return request({
    url: '/admin/websit/update',
    method: 'post',
    data: params
  })
}

// 删除部门
export function deleteDepartment(params) {
  return request({
    url: '/admin/websit/delete',
    method: 'post',
    params
  })
}

// 获取部门详情
export function getDepartmentDetail(params) {
  return request({
    url: '/admin/websit/detail',
    method: 'get',
    params
  })
}

// 获取接口状态列表
export function getApiList(params) {
  return request({
    url: '/common/interface/list',
    method: 'get',
    params
  })
}

// 仓库仓位对应关系列表
export function getStockListStock(params) {
  return request({
    url: '/stock/listStock',
    method: 'get',
    params
  })
}

// 新建经销商子账号
export function addSubAccount(params) {
  return request({
    url: '/admin/user/user/child/add',
    method: 'post',
    params
  })
}
// 新建经销商子账号
export function editSubAccount(params) {
  return request({
    url: '/admin/user/user/child/update',
    method: 'post',
    params
  })
}

// 新建经销商子账号
export function getRoleChecked(params) {
  return request({
    url: '/admin/user/user/child/module/checked',
    method: 'get',
    params
  })
}

// 切换账号权限
export function setUserChanging(params) {
  return request({
    url: '/admin/user/changing',
    method: 'post',
    params
  })
}

// 嘉贤子帐号列表
export function getJiaXianUserList(params) {
  return request({
    url: '/admin/user/listJiaXian',
    method: 'get',
    params
  })
}

// 新建嘉贤经销商子账号
export function addJiaXianUser(params) {
  return request({
    url: '/admin/user/user/child/addJiaXian',
    method: 'post',
    params
  })
}

// 工程子帐号列表
export function getEngineeringUserList(params) {
  return request({
    url: '/admin/user/listGongCheng',
    method: 'get',
    params
  })
}

// 新建工程子账号
export function addEngineeringUser(params) {
  return request({
    url: '/admin/user/user/child/addGongCheng',
    method: 'post',
    params
  })
}
// 编辑工程子账号
export function editEngineeringUser(params) {
  return request({
    url: '/admin/user/user/child/updateGongCheng',
    method: 'post',
    params
  })
}

// 工程子详情
export function getDetailGongCheng(params) {
  return request({
    url: '/admin/user/detailGongCheng',
    method: 'get',
    params
  })
}

// 删除程经销商子账号
export function delUserGongCheng(params) {
  return request({
    url: '/admin/user/child/delGongCheng',
    method: 'post',
    params
  })
}

// 导出
export function exportListGongCheng(data, name) {
  return getBlob({
    url: '/admin/user/listGongCheng/export',
    data,
    name
  })
}

// 仓库品类选择列表
export function stockForceUserList(params) {
  return request({
    url: '/stock/forceUser/list',
    method: 'get',
    params
  })
}

// 添加账号强制仓
export function stockForceUserAdd(data) {
  return request({
    url: '/stock/forceUser/add',
    method: 'post',
    data
  })
}

// 
export function stockForceUserForceStockList(params) {
  return request({
    url: '/stock/forceUser/forceStockList',
    method: 'get',
    params
  })
}
