40 lines
878 B
JavaScript
40 lines
878 B
JavaScript
/**
|
||
* 优惠券相关 API
|
||
*/
|
||
import { get, post } from '@/utils/request'
|
||
|
||
/**
|
||
* 获取可兑换优惠券列表
|
||
*/
|
||
export function getAvailable() {
|
||
return get('/api/coupons/available')
|
||
}
|
||
|
||
/**
|
||
* 兑换优惠券
|
||
* @param {Object} data
|
||
* @param {number} data.templateId - 优惠券模板ID
|
||
*/
|
||
export function exchange(data) {
|
||
return post('/api/coupons/exchange', data)
|
||
}
|
||
|
||
/**
|
||
* 获取我的优惠券
|
||
* @param {Object} [params]
|
||
* @param {string} [params.status] - 状态筛选:unused/used/expired
|
||
* @param {number} [params.storeId] - 门店筛选
|
||
* @param {string} [params.type] - 类型筛选:free/discount
|
||
*/
|
||
export function getMyCoupons(params) {
|
||
return get('/api/coupons/my', params)
|
||
}
|
||
|
||
/**
|
||
* 获取门店可用优惠券
|
||
* @param {number} storeId - 门店ID
|
||
*/
|
||
export function getStoreCoupons(storeId) {
|
||
return get(`/api/coupons/store/${storeId}`)
|
||
}
|