2023-12-13 03:35:02 +00:00
|
|
|
import request from '@/sheep/request';
|
|
|
|
|
2023-12-16 02:40:04 +00:00
|
|
|
const CouponApi = {
|
2023-12-13 03:35:02 +00:00
|
|
|
// 获得优惠劵模板列表
|
|
|
|
getCouponTemplateListByIds: (ids) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon-template/list-by-ids',
|
2023-12-13 03:35:02 +00:00
|
|
|
method: 'GET',
|
|
|
|
params: { ids },
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 获得优惠劵模版列表
|
|
|
|
getCouponTemplateList: (spuId, productScope, count) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon-template/list',
|
2023-12-13 03:35:02 +00:00
|
|
|
method: 'GET',
|
|
|
|
params: { spuId, productScope, count },
|
|
|
|
});
|
|
|
|
},
|
2023-12-16 02:40:04 +00:00
|
|
|
// 获得优惠劵模版分页
|
|
|
|
getCouponTemplatePage: (params) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon-template/page',
|
2023-12-16 02:40:04 +00:00
|
|
|
method: 'GET',
|
|
|
|
params,
|
|
|
|
});
|
|
|
|
},
|
2023-12-16 04:46:11 +00:00
|
|
|
// 获得优惠劵模版
|
|
|
|
getCouponTemplate: (id) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon-template/get',
|
2023-12-16 04:46:11 +00:00
|
|
|
method: 'GET',
|
|
|
|
params: { id },
|
|
|
|
});
|
|
|
|
},
|
2023-12-16 02:40:04 +00:00
|
|
|
// 我的优惠劵列表
|
|
|
|
getCouponPage: (params) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon/page',
|
2023-12-16 02:40:04 +00:00
|
|
|
method: 'GET',
|
|
|
|
params,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 领取优惠券
|
|
|
|
takeCoupon: (templateId) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon/take',
|
2023-12-16 02:40:04 +00:00
|
|
|
method: 'POST',
|
|
|
|
data: { templateId },
|
|
|
|
});
|
|
|
|
},
|
2023-12-16 04:46:11 +00:00
|
|
|
// 获得优惠劵
|
|
|
|
getCoupon: (id) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon/get',
|
2023-12-16 04:46:11 +00:00
|
|
|
method: 'GET',
|
|
|
|
params: { id },
|
|
|
|
});
|
|
|
|
},
|
2023-12-28 14:00:07 +00:00
|
|
|
// 获得未使用的优惠劵数量
|
|
|
|
getUnusedCouponCount: () => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon/get-unused-count',
|
2023-12-28 14:00:07 +00:00
|
|
|
method: 'GET',
|
|
|
|
custom: {
|
|
|
|
showLoading: false,
|
|
|
|
auth: true,
|
|
|
|
},
|
|
|
|
});
|
2024-01-10 14:57:06 +00:00
|
|
|
},
|
|
|
|
// 获得匹配指定商品的优惠劵列表
|
|
|
|
getMatchCouponList: (price, spuIds, skuIds, categoryIds) => {
|
|
|
|
return request({
|
2024-01-20 05:13:28 +00:00
|
|
|
url: '/promotion/coupon/match-list',
|
2024-01-10 14:57:06 +00:00
|
|
|
method: 'GET',
|
|
|
|
params: {
|
|
|
|
price,
|
|
|
|
spuIds: spuIds.join(','),
|
|
|
|
skuIds: skuIds.join(','),
|
|
|
|
categoryIds: categoryIds.join(','),
|
|
|
|
},
|
|
|
|
});
|
2023-12-28 14:00:07 +00:00
|
|
|
}
|
2023-12-13 03:35:02 +00:00
|
|
|
};
|
2023-12-16 02:40:04 +00:00
|
|
|
|
2024-01-10 14:57:06 +00:00
|
|
|
export default CouponApi;
|