2024-09-19 07:20:14 +08:00
|
|
|
|
"use strict";
|
2024-10-01 09:15:35 +08:00
|
|
|
|
const modules_mall_sheep_request_index = require("../../request/index.js");
|
2024-09-19 07:20:14 +08:00
|
|
|
|
const CouponApi = {
|
|
|
|
|
// 获得优惠劵模板列表
|
|
|
|
|
getCouponTemplateListByIds: (ids) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon-template/list-by-ids",
|
|
|
|
|
method: "GET",
|
|
|
|
|
params: { ids },
|
|
|
|
|
custom: {
|
|
|
|
|
showLoading: false,
|
|
|
|
|
// 不展示 Loading,避免领取优惠劵时,不成功提示
|
|
|
|
|
showError: false
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获得优惠劵模版列表
|
|
|
|
|
getCouponTemplateList: (spuId, productScope, count) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon-template/list",
|
|
|
|
|
method: "GET",
|
|
|
|
|
params: { spuId, productScope, count }
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获得优惠劵模版分页
|
|
|
|
|
getCouponTemplatePage: (params) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon-template/page",
|
|
|
|
|
method: "GET",
|
|
|
|
|
params
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获得优惠劵模版
|
|
|
|
|
getCouponTemplate: (id) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon-template/get",
|
|
|
|
|
method: "GET",
|
|
|
|
|
params: { id }
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 我的优惠劵列表
|
|
|
|
|
getCouponPage: (params) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon/page",
|
|
|
|
|
method: "GET",
|
|
|
|
|
params
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 领取优惠券
|
|
|
|
|
takeCoupon: (templateId) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon/take",
|
|
|
|
|
method: "POST",
|
|
|
|
|
data: { templateId },
|
|
|
|
|
custom: {
|
|
|
|
|
auth: true,
|
|
|
|
|
showLoading: true,
|
|
|
|
|
loadingMsg: "领取中",
|
|
|
|
|
showSuccess: true,
|
|
|
|
|
successMsg: "领取成功"
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获得优惠劵
|
|
|
|
|
getCoupon: (id) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon/get",
|
|
|
|
|
method: "GET",
|
|
|
|
|
params: { id }
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获得未使用的优惠劵数量
|
|
|
|
|
getUnusedCouponCount: () => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon/get-unused-count",
|
|
|
|
|
method: "GET",
|
|
|
|
|
custom: {
|
|
|
|
|
showLoading: false,
|
|
|
|
|
auth: true
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获得匹配指定商品的优惠劵列表
|
|
|
|
|
getMatchCouponList: (price, spuIds, skuIds, categoryIds) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
|
return modules_mall_sheep_request_index.request({
|
2024-09-19 07:20:14 +08:00
|
|
|
|
url: "/promotion/coupon/match-list",
|
|
|
|
|
method: "GET",
|
|
|
|
|
params: {
|
|
|
|
|
price,
|
|
|
|
|
spuIds: spuIds.join(","),
|
|
|
|
|
skuIds: skuIds.join(","),
|
|
|
|
|
categoryIds: categoryIds.join(",")
|
|
|
|
|
},
|
|
|
|
|
custom: {
|
|
|
|
|
showError: false,
|
|
|
|
|
showLoading: false
|
|
|
|
|
// 避免影响 settlementOrder 结算的结果
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
exports.CouponApi = CouponApi;
|