| 12345678910111213141516171819202122232425262728293031323334 |
- // 活动服务 - 新人大礼包、优惠券等
- import { get, post, postL } from './http';
- const apis = {
- NEWBIE_GIFT_BAG: '/api/activity/newbieGiftBag/info',
- COUPON_LIST_VALID: '/api/coupon/listValidCoupon',
- COUPON_BATCH_RECEIVE: '/api/coupon/batchReceive',
- };
- // 新人大礼包信息
- export const getNewbieGiftBagInfo = async () => {
- const res = await get<any>(apis.NEWBIE_GIFT_BAG);
- return res.success && res.data ? res.data : null;
- };
- // 获取可领优惠券列表
- export interface CouponItem {
- id: string;
- amount: number;
- fullAmount: number;
- endTime: string;
- name?: string;
- }
- export const listValidCoupon = async (scene: string, targetObj?: any) => {
- const res = await post<CouponItem[]>(apis.COUPON_LIST_VALID, { scene, targetObj });
- return res.success && res.data ? res.data : [];
- };
- // 一键领取优惠券
- export const batchReceiveCoupon = async (ids: string[]) => {
- const res = await postL<any>(apis.COUPON_BATCH_RECEIVE, { ids });
- return res.success;
- };
|