import Utils from '@/extend/Utils';
import HttpRequest from '@/extend/HttpRequest';
import {host, http} from '@/config';
import router from '@/router';
import Login from '@/views/login/login';

export default class Http {
    public static PHONE = 18518267398;

    public static getInstance(...args: any[]): any {
        let Class: any = this;
        if (!Class._instance) {
            let argsLen: number = args.length;
            if (argsLen === 0) {
                Class._instance = new Class();
            } else {
                Class._instance = new Class(...args);
            }
        }
        return Class._instance;
    }

    public httpClient: HttpRequest = HttpRequest.getInstance();

    async login(params: any) {
        return this.httpClient.request({
            url: http.login,
            method: 'POST',
            data: params,
        });
    }

    async sns(params: any) {
        return this.httpClient.request({
            url: http.sns,
            data: params,
        });
    }

    async userinfo(params: any = null) {
        return this.httpClient.request({
            url: http.userinfo,
            method: 'POST',
            data: params,
        });
    }

    async setFirstLogin(params: any = null) {
        return this.httpClient.request({
            url: http.setfirstLogin,
            method: 'POST',
            data: params,
        });
    }
    async saveBase(params: any = null) {
        return this.httpClient.request({
            url: http.baseinfo,
            method: 'POST',
            data: params,
        });
    }

    async socialLimit(params: any = null) {
        return this.httpClient.request({
            url: http.sociallimit,
            data: params,
        });
    }

    async calcBill(params: any = null) {
        return this.httpClient.request({
            url: http.calcbill,
            data: params,
        });
    }

    async calcBilll(params: any = null) {
        return this.httpClient.request({
            url: http.calcbilll,
            data: params,
        });
    }
    async saveOrder(params: any = null) {
        return this.httpClient.request({
            url: http.createorder,
            method: 'POST',
            data: params,
        });
    }

    async savelistOrder(params: any = null) {
        return this.httpClient.request({
            url: http.savelistorder,
            method: 'POST',
            data: params,
        });
    }

    async ctOrder(params: any = null) {
        return this.httpClient.request({
            url: http.ctorder,
            method: 'POST',
            data: params,
        });
    }
    async cancelOrder(params: any = null) {
        return this.httpClient.request({
            url: http.cancelorder,
            method: 'POST',
            data: params,
        });
    }
    async payOrder(params: any = null) {
        return this.httpClient.request({
            url: http.payorder,
            method: 'POST',
            data: params,
        });
    }

    async getConfig(params: any = null) {
        return this.httpClient.request({
            url: http.getconfig,
            method: 'GET',
            data: params,
        });
    }

    async getPayInfo(params: any = null) {
        return this.httpClient.request({
            url: http.getpayinfo,
            method: 'GET',
            data: params,
        });
    }

    async getOrderList(params: any = null) {
        return this.httpClient.request({
            url: http.getorderlist,
            method: 'GET',
            data: params,
        });
    }

    async getOrderDetail(params: any = null) {
        return this.httpClient.request({
            url: http.getorderdetail,
            method: 'GET',
            data: params,
        });
    }

    async getInvitationList(params: any = null) {
        return this.httpClient.request({
            url: http.getinvitationlist,
            method: 'GET',
            data: params,
        });
    }

    async getInvitationChild(params: any = null) {
        return this.httpClient.request({
            url: http.getInvitationchild,
            method: 'GET',
            data: params,
        });
    }

    async getInvitationawardList(params: any = null) {
        return this.httpClient.request({
            url: http.getInvitationawardlist,
            method: 'GET',
            data: params,
        });
    }

    async getSocialConfig(params: any = null) {
        return this.httpClient.request({
            url: http.getsocialconfig,
            method: 'GET',
            data: params,
        });
    }

    async getDisCounts(params: any = null) {
        return this.httpClient.request({
            url: http.getDiscounts,
            method: 'GET',
            data: params,
        });
    }

    async getVerifyCode(params: any = null) {
        return this.httpClient.request({
            url: http.getverifycode,
            method: 'GET',
            data: params,
        });
    }

    async getDiscountListt(params: any = null) {
        return this.httpClient.request({
            url: http.getyouhui,
            method: 'GET',
            data: params,
        });
    }

    async getWeixin(params: any = null) {
        return this.httpClient.request({
            url: http.getweixin,
            method: 'GET',
            data: params,
        });
    }

    async getAlipay(params: any = null) {
        return this.httpClient.request({
            url: http.getalipay,
            method: 'GET',
            data: params,
        });
    }

    async getSharePic(params: any = null) {
        return this.httpClient.request({
            url: http.getsharepic,
            method: 'GET',
            data: params,
        });
    }
    async getWeixinpay(params: any = null) {
        return this.httpClient.request({
            url: http.getweixinpay,
            method: 'GET',
            data: params,
        });
    }

   async getProvinceList(params: any = null) {
       return this.httpClient.request({
           url: http.getProvinceList,
           method: 'GET',
           data: params,
       });
   }

   async getCityList(params: any = null) {
       return this.httpClient.request({
           url: http.getCityList,
           method: 'GET',
           data: params,
       });
   }

    async getIsrepairQual(params: any = null) {
        return this.httpClient.request({
            url: http.getIsrepairQual,
            method: 'GET',
            data: params,
        });
    }

    async getIsOrder(params: any = null) {
        return this.httpClient.request({
            url: http.getIsOrder,
            method: 'GET',
            data: params,
        });
    }

   async getmoth(params: any = null) {
       return this.httpClient.request({
           url: http.getmoth,
           method: 'GET',
           data: params,
       });
   }

    async setUserOpenid(params: any = null) {
        return this.httpClient.request({
            url: http.setUserOpenid,
            method: 'GET',
            data: params,
        });
    }
    async getRepairMonth(params: any = null) {
        return this.httpClient.request({
            url: http.getRepairMonth,
            method: 'GET',
            data: params,
        });
    }

    async createRepairOrder(params: any = null) {
        return this.httpClient.request({
            url: http.createRepairOrder,
            method: 'GET',
            data: params,
        });
    }

    async repairDetail(params: any = null) {
        return this.httpClient.request({
            url: http.repairDetail,
            method: 'GET',
            data: params,
        });
    }

    async withdrawal(params: any = null) {
        return this.httpClient.request({
            url: http.withdrawal,
            method: 'GET',
            data: params,
        });
    }

    async userWithdrawal(params: any = null) {
        return this.httpClient.request({
            url: http.userWithdrawal,
            method: 'GET',
            data: params,
        });
    }

    async getSociallist(params: any = null) {
        return this.httpClient.request({
            url: http.getSociallist,
            method: 'GET',
            data: params,
        });
    }

    async getBannerList(params: any = null) {
        return this.httpClient.request({
            url: http.getBannerList,
            method: 'GET',
            data: params,
        });
    }

    // 获取买房政策
    async getPolicy(params: any = null) {
        return this.httpClient.request({
            url: http.getPolicy,
            method: 'GET',
            data: params,
        });
    }

    // 获取充值面额
    async getDenomination() {
        return this.httpClient.request({
            url: http.getDenomination,
            method: 'GET'
        });
    }

    // 获取充值订单
    async getRechargeLists(params: any = null) {
        return this.httpClient.request({
            url: http.getRechargeLists,
            method: 'GET',
            data: params,
        });
    }

    // 油卡 手机充值
    async RechargeOrder(params: any = null) {
        return this.httpClient.request({
            url: http.RechargeOrder,
            method: 'GET',
            data: params,
        });
    }

    // 订单支付 
    async RechargeOrderPay(params: any = null) {
        return this.httpClient.request({
            url: http.RechargeOrderPay,
            method: 'GET',
            data: params,
        });
    }
    // 充值订单详情
    async RechargeOrderDetail(params: any = null) {
        return this.httpClient.request({
            url: http.RechargeOrderDetail,
            method: 'GET',
            data: params,
        });
    }

    // 取消充值订单
    async RechargecancelOrder(params: any = null) {
        return this.httpClient.request({
            url: http.RechargecancelOrder,
            method: 'GET',
            data: params,
        });
    }
}
