| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import { get, post, postL } from './http';
- const apis = {
- PRE_ONE_KEY: '/api/substituteOrder/preOneKeySubmit',
- COUPON: '/api/coupon/pageMyValidCoupon',
- BILL: '/api/wallet/bill',
-
- WITHDRAW_PRE: '/api/wallet/withdrawPre',
- WITHDRAW: '/api/wallet/withdraw',
- WITHDRAW_INFO: '/api/user/withdraw/info', // Bank info
- WITHDRAW_SAVE: '/api/user/withdraw/save',
- RECHARGE_SUBMIT: '/api/wallet/recharge/submit',
- RECHARGE_GENERATE_LINK: '/api/user/recharge/generatePaymentLink',
- RECHARGE_CHECK_PAYMENT_STATUS: '/api/user/recharge/checkPaymentStatus',
-
- INFO: '/api/wallet/getByType',
-
- NEW_USER_PROMOTION: '/api/activity/newUserPromotion',
- };
- export const preOneKeySubmit = async () => {
- const res = await post(apis.PRE_ONE_KEY);
- return res;
- };
- export const info = async (type: string, loading = false) => {
- // loading handled manually if needed, or pass header
- const res = await get(apis.INFO, { type }, { loading });
- return res.data;
- };
- export const bill = async (current: number, size: number, walletType: string, type: string) => {
- const res = await post(apis.BILL, { current, size, walletType, type });
- return res.data;
- };
- export const withdrawPre = async (type: string, walletType: string) => {
- const res = await get(apis.WITHDRAW_PRE, { type, walletType });
- return res.data;
- };
- export const getWithdraw = async () => {
- const res = await get(apis.WITHDRAW_INFO);
- return res.data;
- };
- export const saveWithdraw = async (data: any) => {
- const res = await post(apis.WITHDRAW_SAVE, data);
- return res.success;
- };
- export const withdraw = async (data: any) => {
- const res = await postL(apis.WITHDRAW, data);
- return res.success;
- };
- export const generatePaymentLink = async (amount: number, payType: string, walletType: string) => {
- const res = await postL(apis.RECHARGE_GENERATE_LINK, { amount, payType, walletType });
- return res;
- };
- export const rechargeSubmit = async (amount: number, paymentType: string, walletType: string) => {
- const res = await postL(apis.RECHARGE_SUBMIT, { amount, paymentType, walletType });
- return res;
- };
- export const checkPaymentStatus = async (data: { tradeNo: string }) => {
- const res = await post(apis.RECHARGE_CHECK_PAYMENT_STATUS, data);
- return res;
- };
- export const getNewUserPromotion = async () => {
- const res = await get(apis.NEW_USER_PROMOTION);
- return res.data;
- };
- export default {
- preOneKeySubmit,
- info,
- bill,
- withdrawPre,
- getWithdraw,
- saveWithdraw,
- withdraw,
- generatePaymentLink,
- rechargeSubmit,
- checkPaymentStatus,
- getNewUserPromotion,
- coupons: async (size = 30) => {
- const res = await post(apis.COUPON, { size }, { loading: true });
- return res.data;
- },
- };
|