import request from '@/utils/request';

/**
 * 获取当前位置
 * @returns
 */
export function getCurrentLocation(data) {
  return request({
    url: '/maintain/location',
    method: 'get',
    data: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * 获取首页
 * @returns
 */
export function getHomePageApi(data) {
  return request({
    url: '/maintain/customer/index',
    method: 'get',
    data: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 *@description 轮播图
 */

export function getSwiperListApi() {
  return request({
    url: '/maintain/listCarouselImages/',
    method: 'get',
    headers: {
      'content-type': 'application/json',
    },
  });
}

/**
 *@description 获取首页分类的数据
 */
export function getCategoriesApi() {
  return request({
    url: '/maintain/categories',
    methods: 'get',
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}

// 热门搜索商家
export function listHotMerchant(data) {
  return request({
    url: `/maintain/listHotMerchant/`,
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

// 猜你喜欢的商家
export function likeMerchant(data) {
  return request({
    url: `/maintain/likeMerchant/`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 *@description 热门搜索接口 - 添加用户点击埋点
 */

export function hotMerchant(id) {
  return request({
    url: `/maintain/hotMerchant/${id}`,
    method: 'get',
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}


/**
 *@description 首页接口 - 分页获取附近商家
 */

export function indexMerchantPaging(data) {
  return request({
    url: `/maintain/merchant/indexMerchantPaging`,
    data,
    method: 'get',
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}
