import request from '@/utils/request'

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


// 查询商家分类列表
export function businessCategoryRelationPage(query) {
  return request({
    url: '/business/businessCategoryRelation/list',
    method: 'get',
    params: query
  })
}

// 新增商家分类关联
export function businessCategoryRelationAdd(data) {
  return request({
    url: `/business/businessCategoryRelation/add`,
    method: 'post',
    data
  })
}

// 新增商家
export function businessAdd(data) {
  return request({
    url: `/business/business/add`,
    method: 'post',
    data
  })
}
// 分页查询商家列表
export function businessPage(query) {
  return request({
    url: `/business/business/page`,
    method: 'get',
    params: query
  })
}
// 修改商家
export function businessEdit(data) {
  return request({
    url: `/business/business/edit`,
    method: 'post',
    data
  })
}
// 设置商家上下架
export function businessStatus(businessId) {
  return request({
    url: `/business/business/shelvedStatus/${businessId}`,
    method: 'post',
  })
}
// 删除商家
export function businessDel(businessId) {
  return request({
    url: `/business/business/del/${businessId}`,
    method: 'post',
  })
}
// 获取商家详细信息
export function businessInfo(businessId) {
  return request({
    url: `/business/business/info/${businessId}`,
    method: 'get',
  })
}
// 查询商家分类列表
export function businessCategoryList(query) {
  return request({
    url: `/business/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: `/business/business/list`,
    method: 'get',
    params: query
  })
}
// 轻量级查询商家商品分类
export function businessProductCategoryList(businessId) {
  return request({
    url: `/business/business/productCategory/list/${businessId}`,
    method: 'get',
  })
}
// 新增商家管理员
export function systemUserAdd(businessId, data) {
  return request({
    url: `/business/business/systemUser/add/${businessId}`,
    method: 'post',
    data
  })
}
// 根据用户编号获取详细信息
export function businessSystemUser(businessId) {
  return request({
    url: `/business/business/systemUser/${businessId}`,
    method: 'get',
  })
}
// 修改商家管理员
export function systemUserEdit(businessId, data) {
  return request({
    url: `/business/business/systemUser/edit/${businessId}`,
    method: 'post',
    data
  })
}
// 商家管理员密码重置
export function systemUserResetPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: `/business/business/systemUser/resetPwd`,
    method: 'put',
    data: data
  })
}
// 批量推荐商家
export function businessSuggest(data) {
  return request({
    url: `/business/business/suggest`,
    method: 'post',
    data
  })
}
// 移除推荐商家
export function businessSuggestCancel(data) {
  return request({
    url: `/business/business/suggest-cancel`,
    method: 'post',
    data
  })
}


// 查询商家申请待审核列表
export function businessApplyWaitPage(query) {
  return request({
    url: `/business/businessApply/waitPage`,
    method: 'get',
    params: query
  })
}
// 查询商家申请已审核列表
export function getBusinessAuditPageApi(params) {
  return request({
    url: `/business/businessApply/auditPage`,
    method: 'get',
    params
  })
}

// 获取商家申请详细信息
export function businessApplyInfo(businessAuditId) {
  return request({
    url: `/business/businessApply/info/${businessAuditId}`,
    method: 'get',
  })
}
// 审核商家申请
export function businessApplyAudit(data) {
  return request({
    url: `/business/businessApply/audit`,
    method: 'post',
    data
  })
}

// 商家类型
export function businessApplyBusinessType(query) {
  return request({
    url: `/business/businessApply/businessType`,
    method: 'get',
    params: query

  })
}

// 查询商家修改商家信息申请待审核列表
export function businessUpdateRecordPage(query) {
  return request({
    url: `/business/businessUpdateRecord/waitPage`,
    method: 'get',
    params: query
  })
}

// 获取商家修改商家信息申请记录详细信息
export function businessUpdateRecordInfo(recordId) {
  return request({
    url: `/business/businessUpdateRecord/info/${recordId}`,
    method: 'get',
  })
}

// 审核商家修改商家信息申请
export function businessUpdateRecordAudit(data) {
  return request({
    url: `/business/businessUpdateRecord/audit`,
    method: 'post',
    data
  })
}

// 店铺设置付贝参数
export function businessSetPayParamsPage(data) {
  return request({
    url: `/business/business/setPayParams`,
    method: 'post',
    data
  })
}

// 获取商家结算信息详细信息
export function businessSettlementInfo(businessId) {
  return request({
    url: `/business/businessSettlement/info`,
    method: 'get',
  })
}

// 获取商家详细信息
export function businessInfoBase() {
  return request({
    url: `/business/business/infoBase`,
    method: 'get',
  })
}
// 获取连锁店铺列表
export function getChainBusinessPageApi(params) {
  return request({
    url: `/business/business/chainPage`,
    method: 'get',
    params
  })
}

// 平台迁移店铺的排队数据
export function moveSubsidyQueueApi(data) {
  return request({
    url: `/subsidy/subsidyQueue/move`,
    method: 'post',
    data
  })
}
// 导出商家列表
export const exportBusinessApi = "/business/business/export";


// 店铺关闭
export function closeBusinessApi(businessId) {
  return request({
    url: `/business/business/close/${businessId}`,
    method: 'post'
  })
}

// 平台分页查询迁移补贴排队列表
export function getSubsidyQueueMovePageApi(params) {
  return request({
    url: `/subsidy/subsidyQueue/movePage`,
    method: 'get',
    params
  })
}

// 导入补贴列表
export function importSubsidyQueueApi(row, file) {
  return request({
    url: `/subsidy/subsidyQueue/importData/${row.businessId}`,
    method: 'post',
    data: file
  })
} 