import httpRequest from '@/utils/axios'

// const httpRequest = new BaseAPI(webConf)

/**
 * 获取openid
 */
export function getOpenId(params) {
  return httpRequest({
    url: '/api/usercenter/user/get-user-openid',
    method: 'get',
    params
  })
}

/**
 * 获取订单状态
 */
export function getOrderStatus() {
  return httpRequest.get('/api/pay/v1/mall/order/status')
}

/**
 * 获取订单
 */
export function getOrder(orderId) {
  return httpRequest.get(`/api/pay/v1/wechat/order/${orderId}`)
}

// upload 支付状态
export function uploadPay(id, data) {
  return httpRequest({
    url: `/api/alumni/v1/certification/change/${id}`,
    method: 'post',
    data
  })
}

/**
 * 生成订单
 */
export function genOrder(data) {
  return httpRequest({
    url: '/api/pay/v1/wechat/order/pre',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data
  })
}

/**
 * 获取商品
 */
export function getProduct(productId) {
  return httpRequest.get(`/api/pay/v2/mall/product/${productId}`)
}
