mall-uniapp/sheep/api/promotion/coupon.js

85 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

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({
url: '/promotion/coupon-template/list-by-ids',
2023-12-13 03:35:02 +00:00
method: 'GET',
params: { ids },
2024-01-20 09:28:04 +00:00
custom: {
showLoading: false, // 不展示 Loading避免领取优惠劵时不成功提示
showError: false,
},
2023-12-13 03:35:02 +00:00
});
},
// 获得优惠劵模版列表
getCouponTemplateList: (spuId, productScope, count) => {
return request({
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({
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({
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({
url: '/promotion/coupon/page',
2023-12-16 02:40:04 +00:00
method: 'GET',
params,
});
},
// 领取优惠券
takeCoupon: (templateId) => {
return request({
url: '/promotion/coupon/take',
2023-12-16 02:40:04 +00:00
method: 'POST',
data: { templateId },
2024-01-20 09:28:04 +00:00
custom: {
auth: true,
showLoading: true,
loadingMsg: '领取中',
showSuccess: true,
successMsg: '领取成功',
},
2023-12-16 02:40:04 +00:00
});
},
2023-12-16 04:46:11 +00:00
// 获得优惠劵
getCoupon: (id) => {
return request({
url: '/promotion/coupon/get',
2023-12-16 04:46:11 +00:00
method: 'GET',
params: { id },
});
},
// 获得未使用的优惠劵数量
getUnusedCouponCount: () => {
return request({
url: '/promotion/coupon/get-unused-count',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
2024-01-10 14:57:06 +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;