jqMultipleShow("click", ".navList", ".tab", ".con");
var settlement = new Vue({
    el:'#settlement',
    data:{
        params:{
            shopID:'',
            pageNum: 1,
            pageSize: 10,
            shopOrderNo:'',
            userName: '',
            payStatus:'',
        },
        list:[],
        pageInput: '1',
        listRecord: 0,
        },
     computed: {
        pageTotal: function () {
            var total = Math.ceil(this.listRecord / this.params.pageSize);
            return total > 0 ? total : 1;
        },
        showPageBtn: function () {
            var total = Math.ceil(this.listRecord / this.params.pageSize);
            total = total > 0 ? total : 1;
            var index = this.params.pageNum, arr = [];
            if (total <= 6) {
                for (var i = 1; i <= total; i++) {
                    arr.push(i);
                }
                return arr;
            }
            if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
            if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
            return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
        }
    },
    methods:{
         toPagination: function (pageNum) {
            if (pageNum <= this.pageTotal) {
                this.params.pageNum = pageNum;
                this.settlementList(this.params);
            }
        },
        checkNum: function () {
            if (this.pageInput > this.pageTotal) {
                this.pageInput = this.pageTotal;
            } else if (this.pageInput < 1) {
                this.pageInput = 1;
            }
        },
        settlementList:function () {
            var _this = this;
            SupplierApi.settlementList(_this.params,function (res) {
                if(res.code==0){
                    if(res.data.results.length>0){
                        _this.list = res.data.results;
                        _this.listRecord = res.data.totalRecord;
                    }else {
                        _this.results = res.data.results;
                        _this.listRecord = res.data.totalRecord;
                    }
                }
            })
        },
        getstatus:function () { //状态
            var _this = this;
             _this.params.payStatus=event.target.value;
        },
        serchBtn:function () {
        console.log(this.params)
           this.settlementList()
        }
    },
    mounted:function () {
        var _self= this;
        if(globalUserData){
              _self.params.shopID = globalUserData.shopId;
            }
        _self.settlementList()
    }
})
