activity.ts 741 B

123456789101112131415161718192021222324252627
  1. // 活动服务 - 优惠券等
  2. import { post, postL } from './http';
  3. const apis = {
  4. COUPON_LIST_VALID: '/api/coupon/listValidCoupon',
  5. COUPON_BATCH_RECEIVE: '/api/coupon/batchReceive',
  6. };
  7. // 获取可领优惠券列表
  8. export interface CouponItem {
  9. id: string;
  10. amount: number;
  11. fullAmount: number;
  12. endTime: string;
  13. name?: string;
  14. }
  15. export const listValidCoupon = async (scene: string, targetObj?: any) => {
  16. const res = await post<CouponItem[]>(apis.COUPON_LIST_VALID, { scene, targetObj });
  17. return res.success && res.data ? res.data : [];
  18. };
  19. // 一键领取优惠券
  20. export const batchReceiveCoupon = async (ids: string[]) => {
  21. const res = await postL<any>(apis.COUPON_BATCH_RECEIVE, { ids });
  22. return res.success;
  23. };