import axios from '@/utils/http';
const base = process.env.VUE_APP_SERVER + '/order';
const order = {
    get(id: number = 0) {
        return axios.get(`${base}/get?id=${id}`, {
        });
    },
    list(page: number = 1, params: any) {
        return axios.post(`${base}/list`, {
            page,
            page_size: 20,
            ...params,
        });
    },
    add(planId: number, method: number, params: any) {
        return axios.post(`${base}/add`, {
            plan_id: planId,
            promo_code: '',
        });
    },
    pay(id: string, method: string, params: any) {
        const { protocol, host } = location;
        return axios({
            url: `${base}/pay`,
            method: 'post',
            headers: {
            },
            data: {
                id,
                method,
                device: 1,
                return_url: `${protocol}//${host}/#/rechargeSuccess`,
                ...params,
            },
        });
    },
};
export default order;
