mui.init({
    pullRefresh: {
        container: '#pullrefresh',
        down: {},
        up: {contentrefresh: '正在加载...', callback: pullupRefresh}
    }
});
var pageNumber = 0, pagesize = 10;
function pullupRefresh() {
    pageNumber += 1;
    var btnArray = ['否', '是'];
    $.ajax(base_path + '/placeLogs/unIncomeOrderCastNext?dates=' + new Date().getTime(), {
        data: {
            "openid": "",
            "pageSize": pagesize,
            "pageNumber": pageNumber
        }, 
        dataType: 'json', 
        type: 'post', 
        timeout: 15000, 
        xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
        success: function (dt) {
        	if (dt.isRedirect) {
					location.href = dt.redirectURL;
				} else {
            if (dt.status) {
                var fenxiao_list = [];
                if (fenxiao_list != null) {
                    fenxiao_list = dt.data.list
                }
                $(".price_to").html(accDiv(dt.data.amount, 100));
                mui('#pullrefresh').pullRefresh().endPullupToRefresh(fenxiao_list.lenght < pagesize);
                var table = document.body.querySelector('.my-tab-view-pull');
                mui(fenxiao_list).each(function (index) {
                    var li = document.createElement('li');
                    li.className = 'mui-table-view-cell';
                    this.name == null ? this.name = "我的好友" : this.name = decodeURI(this.name);
                    li.innerHTML = '<table class="my-dl-tb-order"><tr><td rowspan="2"><img class="wh-80" src="' + this.img + '"></td><td>订单:' + this.orderNo + '</td><td><span class="cl-red">+¥' + accDiv(this.amount, 100) + '</span></td></tr><tr><td>' + this.name + '</td><td>' + this.strDate + '</td></tr></table>';
                    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'
});