import BaseAPI from '@/api/base_api'

const httpRequest = new BaseAPI(webConf)

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

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

/**
 * 生成订单
 */
export function genOrder(data) {
  return httpRequest.post('/zy/v2/mall/order/pre', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

/**
 * 获取订单
 */
export function getOrder(orderId) {
  return httpRequest.get(`/zy/v2/mall/order/${orderId}`)
}

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