import request from '@/utils/request'

// 新增商家分类
export function businessCategoryAdd (data) {
  return request({
    url: '/ticket/businessCategory/add',
    method: 'post',
    data
  })
}
// 修改商家分类
export function businessCategoryEdit (data) {
  return request({
    url: '/ticket/businessCategory/edit',
    method: 'post',
    data
  })
}
// 查询商家分类列表
export function businessCategoryPage (query) {
  return request({
    url: '/ticket/businessCategory/page',
    method: 'get',
    params: query
  })
}
// 获取商家分类详细信息
export function businessCategoryInfo (categoryId) {
  return request({
    url: `/ticket/businessCategory/info/${categoryId}`,
    method: 'get',
  })
}
// 删除商家分类
export function businessCategoryDel (categoryId) {
  return request({
    url: `/ticket/businessCategory/del/${categoryId}`,
    method: 'post',
  })
}
// 设置商家分类上下架
export function businessCategoryStatus (categoryId) {
  return request({
    url: `/ticket/businessCategory/shelvedStatus/${categoryId}`,
    method: 'post',
  })
}


// 新增商家
export function businessAdd (data) {
  return request({
    url: `/ticket/business/add`,
    method: 'post',
    data
  })
}
// 分页查询商家列表
export function businessPage (query) {
  return request({
    url: `/ticket/business/page`,
    method: 'get',
    params: query
  })
}
// 修改商家
export function businessEdit (data) {
  return request({
    url: `/ticket/business/edit`,
    method: 'post',
    data
  })
}
// 设置商家上下架
export function businessStatus (businessId) {
  return request({
    url: `/ticket/business/shelvedStatus/${businessId}`,
    method: 'post',
  })
}
// 删除商家
export function businessDel (businessId) {
  return request({
    url: `/ticket/business/del/${businessId}`,
    method: 'post',
  })
}
// 获取商家详细信息
export function businessInfo (businessId) {
  return request({
    url: `/ticket/business/info/${businessId}`,
    method: 'get',
  })
}
// 查询商家分类列表
export function businessCategoryList (query) {
  return request({
    url: `/ticket/businessCategory/list`,
    method: 'get',
    params: query
  })
}
// 获得省市区三级数据
export function cnAreaTree (query) {
  return request({
    url: `/base/cnArea/tree-lbs`,
    method: 'get',
    params: query
  })
}
// 根据坐标获取位置详情信息
export function getLocation (location) {
  return request({
    url: `/base/cnArea/get-address/${location}`,
    method: 'get',
  })
}
export function getAddress (address) {
  return request({
    url: `/base/cnArea/get-address/${address}`,
    method: 'get',
  })
}
// 轻量级查询商家列表
export function businessList (query) {
  return request({
    url: `/ticket/business/list`,
    method: 'get',
    params: query
  })
}
// 轻量级查询商家商品分类
export function businessProductCategoryList (businessId) {
  return request({
    url: `/ticket/business/productCategory/list/${businessId}`,
    method: 'get',
  })
}
// 新增商家管理员
export function systemUserAdd (businessId, data) {
  return request({
    url: `/ticket/business/systemUser/add/${businessId}`,
    method: 'post',
    data
  })
}
// 根据用户编号获取详细信息
export function businessSystemUser (businessId) {
  return request({
    url: `/ticket/business/systemUser/${businessId}`,
    method: 'get',
  })
}
// 修改商家管理员
export function systemUserEdit (businessId, data) {
  return request({
    url: `/ticket/business/systemUser/edit/${businessId}`,
    method: 'post',
    data
  })
}
// 商家管理员密码重置
export function systemUserResetPwd (userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/ticket/business/systemUser/resetPwd',
    method: 'put',
    data: data
  })
}
// 批量推荐商家
export function businessSuggest (data) {
  return request({
    url: `/ticket/business/suggest`,
    method: 'post',
    data
  })
}
// 移除推荐商家
export function businessSuggestCancel (data) {
  return request({
    url: `/ticket/business/suggest-cancel`,
    method: 'post',
    data
  })
}