var basUrl = '../'

// 返回状态码
//status: 2000->用户名不存在 2001->token为空/错误

var _vp = {
    // 注册
    register: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontCommon/registPhone',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    // 登录
    login: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontCommon/login',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    // 首页列表
    indexList: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontCommon/HomeData',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    // 获取商品详情
    productDetail: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/findProductDetailsById',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    // 用户收货地址-增删查改
    AddressOper: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/AddressOper',
            header: {
                contentType : "application/x-www-form-urlencoded; charset=utf-8", 
            },
            type : 'POST',
            data: data,   
            success: resolve,
            error: reject,
        });
    },
    //首页顶部三个按钮对应的数据
    homeAllRecord: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontCommon/winningAllRecord',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //夺宝记录操作
    RecordOperation: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/findWinningRecordOperation',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //参与详情
    participationDetails: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/participationDetails',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //我的中奖纪录
    myWinningRecord: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/myWinningRecord',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //所有参与记录(我的页面)
    ParticipationRecord: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/myParticipationRecord_Lite',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //参与夺宝
    participateInTheTreasure: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/participateInTheTreasure',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //待审核(我的页面)
    pendingReview: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/pendingReview',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //更改用户信息
    UserInformation: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/changeUserInformation',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //获取用户信息
    getUserData: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/getUserData',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //获取首页轮播图
    carouselMap: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontCommon/carouselMap',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //余额充值
    Balance: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/Balance_recharge',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //充值记录
    RechargeRecord: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/Recharge_Record',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //忘记密码
    ForgetPassword: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontCommon/forgetPassword',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
    //获取中奖详情
    OrderDetails: function (data, resolve, reject) {
        $.ajax({
            url: basUrl + 'FrontUser/orderDetails',
            type: 'POST',
            data: data,
            success: resolve,
            error: reject,
        });
    },
}

