123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- ;
- var settlement = new Vue({
- el:'#settlement',
- mixins: [cmSysVitaMixins],
- data:{
- params:{
- shopId:'',
- pageNum: 1,
- pageSize: 10,
- shopOrderNo:'',
- name: '',
- payStatus:'',
- },
- list:[],
- pageInput: '1',
- listRecord: 0,
- noMore:false,
- },
- 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];
- }
- },
- filters: {
- NumFormat: function (text) {//处理金额
- return Number(text).toFixed(2);
- },
- payStatusType:function(value) {
- if (value === 1) {
- return '待结算';
- } else if (value === 2) {
- return '部分结算';
- } else {
- return '已结算';
- }
- }
- },
- 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 (response) {
- if(response.code==0){
- var data = response.data;
- if( data.list && data.list.length>0 ){
- _this.list = data.list;
- _this.listRecord = data.total;
- }else {
- _this.list = data.list;
- _this.listRecord = data.total;
- }
- _this.requestFlag = true;
- }else{
- CAIMEI.Alert(response.msg, '确定', false);
- }
- })
- },
- 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();
- if(!isPC){
- //移动端上垃加载更多
- $(window).on('scroll', function(){
- var scrollTop = $(this).scrollTop();
- var scrollHeight = $(document).height();
- var windowHeight = window.innerHeight;
- if (scrollTop + windowHeight >= scrollHeight) {
- //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
- var totalPage = Math.ceil(_self.listRecord / _self.params.pageSize)?Math.ceil(_self.listRecord / _self.params.pageSize):1;
- var next = _self.params.pageNum+1;
- if(next <= totalPage){
- if (_self.requestFlag){
- _self.params.pageNum = next;
- if (_self.isRequset) {
- // 获取列表数据
- _self.settlementList();
- }
- }
- _self.requestFlag = false;
- }else{
- //到底了
- _self.noMore = true;
- $('footer').removeClass("noneImportant");
- }
- }
- });
- }
- $('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on");
- $('.navLayout').find('.navList').eq(0).addClass("on").find('.con').show().find('a').eq(1).addClass("on");
- }
- })
|