mui.init({
    pullRefresh: {
        container: '#pullrefresh',
        down: {},
        up: {contentrefresh: '正在加载...', callback: pullupRefresh}
    }
});
var pageNumber = 0, pagesize = 10;
function pullupRefresh() {
    pageNumber += 1;
    var btnArray = ['否', '是'];
    mui.ajax(base_path + '/withdraw/selectUserLogs?dates=' + new Date().getTime(), {
        data: {
            "pageSize": pagesize,
            "pageNo": pageNumber
        }, dataType: 'json', type: 'post', timeout: 15000, success: function (dt) {
            if (dt.status) {
                var log_list = [];
                log_list = dt.data;
                mui('#pullrefresh').pullRefresh().endPullupToRefresh((log_list.lenght < pagesize));
                var table = document.body.querySelector('.my-tab-view-pull');
                mui(log_list).each(function (index) {
                    var li = document.createElement('li');
                    li.className = 'mui-table-view-cell';
                    this.name == null ? this.name = "神仙哥哥" : this.name;
                    var status = this.withdrawalsStatus;
                    switch (status) {
                        case 1:
                            status = "提现成功";
                            break;
                        case 2:
                            status = "提现申请中";
                            break;
                        default:
                            status = "提现失败"
                    }
                    ;
                    li.innerHTML = '<span>兑换：<span class="cl-red">¥' + accDiv(this.withdrawalsLogsAmount, 100) + '</span></span><span>-' + this.withdrawalsLogsAmount + '0积分</span><span class="mui-btn-link">' + status + '</span><font class="mui-badge mui-badge-inverted">' + this.withdrawalsLogsDate + '</font>';
                    table.appendChild(li)
                })
            } else {
                mui.confirm(dt.message + '是否刷新页面？', '爱贝源-提示', btnArray, function (e) {
                    if (e.index == 1) {
                        location.reload(true)
                    }
                })
            }
        }, error: function (xhr, type, errorThrown) {
            console.log(xhr)
        }
    })
};mui.ready(function () {
    mui('#pullrefresh').pullRefresh().pullupLoading();
    getCartNum();
    document.querySelector('.loading-bg').style.display = 'none'
});