import api from './api'

/**
 * 获取优惠券列表
 * @param data
 * @returns {*}
 */
export const getCouponList = (type) => api.get(`/product/coupon/relation/searchUserCoupon/${type}`, {}, {login: false})

/**
 * 领取优惠券
 * @param data
 * @returns {*}
 */
export const receiveACoupon = (id) => api.get(`/product/coupon/relation/receive/${id}`, {}, {login: false})

/**
 * 查询当前商品优惠券
 * @param data
 * @returns {*}
 */
export const getProductCoupon = (productId) => api.get(`/product/coupon/receive-list/${productId}`, {}, {login: false})

/**
 * 查询当前提交订单商品优惠券
 * @param data
 * @returns {*}
 */
export const getCartCoupon = (productId) => api.get(`/cart/coupon/?cartIds=${productId}`, {}, {login: false})
