import { get, post } from '@/utils/request';
import { GroupBuyBean, RecordBean } from '@/api/groupbuy/types';
import { GoodsBean } from '@/api/goods/types';

export const getGroupBuyList = (data: {
  pageNum: number,
  pageSize: number,
  obj: {
    status: number,
  }
}) => post({ url: '/group/coupons/wx_query', data });

export const getGroupBuyDetail = (
  id: string) => get<GroupBuyBean>({ url: `wechat/coupons/group/get/${id}` });

export const getGroupBuyRecordList = (groupId: string, pageNum: number, pageSize: number) => post<RecordBean[]>({
  url: `wechat/coupons/group/order/list?groupId=${groupId}&pageNum=${pageNum}&pageSize=${pageSize}`
});

export const preOrder = (data: any) => post<GoodsBean>({ url: 'wechat/coupons/group/pre_v2', data });

export const progress = (data: any) => post<any>({ url: 'wechat/coupons/group/pay/progress', data });
export const pay = (data: any) => post<any>({ url: 'wechat/coupons/group/pay', data });

