import $http from '../../utils/httpRequest'

// 修改密码
export const password = (password, newPassword) => {
  return $http({
    url: '/sys/user/password',
    method: 'post',
    data: $http.adornData({
      password: password,
      newPassword: newPassword
    })
  })
}

// 退出登录
export const logout = () => {
  return $http({
    url: '/merchant-api/auth/logout',
    method: 'post',
    data: $http.adornData()
  })
}

// 获取用户信息
export const getUserInfo = () => {
  return $http({
    url: '/merchant-api/auth/info',
    method: 'get',
    params: $http.adornParams()
  })
}

//登录接口
export const login = (username, password, uuid, captcha) => {
  return $http({
    url: '/auth/login',
    method: 'post',
    data: $http.adornData({
      username: username,
      password: password,
      code: captcha,
      uuid: uuid
      //   'captcha': captcha
    })
  })
}

// 获取市场购物须知
export const getMarketPayNotice = marketId => {
  return $http({
    url: '/merchant-api/pay-notice/market/' + marketId,
    method: 'get'
  })
}

// 获取店铺购物须知
export const getShopPayNotice = shopId => {
  return $http({
    url: '/merchant-api/pay-notice/shop/' + shopId,
    method: 'get'
  })
}

// 修改菜市场须知
export const updateMarketPayNotice = data => {
  return $http({
    url: '/merchant-api/pay-notice/market',
    method: 'put',
    data: $http.adornData({
      ...data
    })
  })
}

// 创建菜市场须知
export const createMarketPayNotice = data => {
  return $http({
    url: '/merchant-api/pay-notice/market',
    method: 'post',
    data: $http.adornData({
      ...data
    })
  })
}

// 修改店铺须知
export const updateShopPayNotice = data => {
  return $http({
    url: '/merchant-api/pay-notice/shop',
    method: 'put',
    data: $http.adornData({
      ...data
    })
  })
}

// 创建店铺须知
export const createShopPayNotice = data => {
  return $http({
    url: '/merchant-api/pay-notice/shop',
    method: 'post',
    data: $http.adornData({
      ...data
    })
  })
}
