import { requestUtil } from '@/utils/request'

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

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

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

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

/**
 * 根据ids获取优惠券列表
 * @param data
 * @returns {*}
 */
export const getCouponListById = (data) => requestUtil.get(`/product/coupon/canvas-list`, data)
