/*
 * @Descripttion: HJ
 * @Company: 思宏科技
 * @version: v1.0
 * @Author: HJ
 * @Date: 2021-03-22 17:58:30
 * @LastEditors: HJ
 * @LastEditTime: 2021-07-27 15:37:41
 */
import request from '../../src/js/request'
import { _STORE } from '../base-api'
import { config } from '../index.js'
const { storeBaseUrl, clientStoreUrl, clientUrl, waimaiUrl } = config

// 获取门店信息
export const fhGetStoreInfo = params =>
  request({
    url: `${storeBaseUrl}`,
    params
  })

// 获取门店的轮播图
export const fhGetStoreBanners = () =>
  request({
    url: `${storeBaseUrl}/banners`
  })

// 获取门店菜品列表
export const fhGetDishes = () =>
  request({
    url: `${storeBaseUrl}/foods`
  })

// 获取门店满减活动
export const fhGetReductions = () =>
  request({
    url: `${clientStoreUrl}/overflow-reduction`
  })

// 获取门店招牌
export const fhGetStoreSignboard = params =>
  request({
    url: `${clientUrl}/store/active`,
    params
  })

// 店内优惠券
export const fhGetStoreCoupon = params =>
  request({
    url: `${waimaiUrl}/store-coupon-act/stores/_STOREID_`,
    params
  })

// 领取优惠券
export const fhReceivedCoupon = couponId =>
  request({
    url: `${waimaiUrl}/store-coupon-act/stores/_STOREID_/members/_MEMBERID_/coupons/${couponId}`,
    method: 'post'
  })

// 满减活动
export const fhGetOverflowReduction = () =>
  request({
    url: `${clientStoreUrl}/overflow-reduction`
  })

// 门店关注状态
export const fhGetStoreLike = () =>
  request({
    url: `${waimaiUrl}/client/members/_MEMBERID_/stores/_STOREID_/like`
  })

// 关注/取关门店
export const fhControlStoreLike = (method, data) =>
  request({
    url: `${waimaiUrl}/like-store/${method === 'post' ? 'like' : 'dislike'}`,
    method,
    data
  })

// 获取配送送费减免活动信息
export const fhGetReduceDelivery = () =>
  request({
    url: `${clientStoreUrl}/reduce-delivery`
  })

// 获取门店评价
export const fhGetEvaluation = params =>
  request({
    url: `${waimaiUrl}/client/store/_STOREID_/comments`,
    params
  })

// 获取一个菜品的sku
export const fhGetSku = storeFoodId =>
  request({
    url: `${storeBaseUrl}/store-foods/${storeFoodId}`
  })

// 获取护工费用规则说明
export const fhGetNurseFeeRule = storeId =>
  request({
    url: `${_STORE}/${storeId}/fee-rules`
  })
