mui.init({
    pullRefresh: {
        container: '#pullrefresh',
        down: {},
        up: {contentrefresh: '正在加载...', callback: pullupRefresh}
    }
});
var endNO = 0, pageSize = 10;
function pullupRefresh() {
    var btnArray = ['否', '是'];
    $.ajax(base_path + '/member/porxyCheckUser', {
        data: {"endNO": endNO, "pageSize": pageSize},
        dataType: 'json',
        type: 'post',
        timeout: 15000,
        success: function (dt) {
            if (dt.status) {
                var xiaxian_list = [];
                endNO = dt.data.endNO;
                xiaxian_list = dt.data.list;
                document.querySelector('.buyedNum').innerHTML = dt.data.buyedNum;
                document.querySelector('.downNum').innerHTML = dt.data.downNum;
                mui('#pullrefresh').pullRefresh().endPullupToRefresh(xiaxian_list.length < pageSize);
                var table = document.body.querySelector('.my-tab-view-pull');
                var cells = document.body.querySelectorAll('.my-tab-view-pull .mui-table-view-cell');
                mui(xiaxian_list).each(function (index) {
                    var li = document.createElement('li');
                    li.className = 'mui-table-view-cell';
                    var userHead = '/iamberry/common/shop/images/logo_head.png';
                    if (this.userHead != null && typeof(this.userHead) != "undefined" && this.userHead != '') {
                        userHead = this.userHead
                    }
                    var userNickname = '爱贝源';
                    if (this.userNickname != null && typeof(this.userNickname) != "undefined" && this.userNickname != '') {
                        userNickname = decodeURI(this.userNickname)
                    }
                    var userAddr = '';
                    if (this.userAddr != null && typeof(this.userAddr) != "undefined" && this.userAddr != '') {
                        userAddr = this.userAddr
                    }
                    li.innerHTML = '<a><img class="mui-media-object mui-pull-left" src="' + userHead + '"><div class="mui-media-body">' + userNickname + '<p class="mui-ellipsis">' + userAddr + '</p></div></a>';
                    table.appendChild(li)
                })
            } else {
                mui.confirm(dt.message + '是否刷新页面？', '爱贝源-提示', btnArray, function (e) {
                    if (e.index == 1) {
                    }
                })
            }
        },
        error: function (xhr, type, errorThrown) {
            errorfn(xhr)
        }
    })
};mui.ready(function () {
    mui('#pullrefresh').pullRefresh().pullupLoading();
    getCartNum();
    document.querySelector('.loading-bg').style.display = 'none'
});