settlement.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ;
  2. var settlement = new Vue({
  3. el:'#settlement',
  4. mixins: [cmSysVitaMixins],
  5. data:{
  6. params:{
  7. shopId:'',
  8. pageNum: 1,
  9. pageSize: 10,
  10. shopOrderNo:'',
  11. name: '',
  12. payStatus:'',
  13. },
  14. list:[],
  15. pageInput: '1',
  16. listRecord: 0,
  17. noMore:false,
  18. },
  19. computed: {
  20. pageTotal: function () {
  21. var total = Math.ceil(this.listRecord / this.params.pageSize);
  22. return total > 0 ? total : 1;
  23. },
  24. showPageBtn: function () {
  25. var total = Math.ceil(this.listRecord / this.params.pageSize);
  26. total = total > 0 ? total : 1;
  27. var index = this.params.pageNum, arr = [];
  28. if (total <= 6) {
  29. for (var i = 1; i <= total; i++) {
  30. arr.push(i);
  31. }
  32. return arr;
  33. }
  34. if (index <= 3) return [1, 2, 3, 4, 5, 0, total];
  35. if (index >= total - 2) return [1, 0, total - 4, total - 3, total - 2, total - 1, total];
  36. return [1, 0, index - 2, index - 1, index, index + 1, index + 2, 0, total];
  37. }
  38. },
  39. filters: {
  40. NumFormat: function (text) {//处理金额
  41. return Number(text).toFixed(2);
  42. },
  43. payStatusType:function(value) {
  44. if (value === 1) {
  45. return '待结算';
  46. } else if (value === 2) {
  47. return '部分结算';
  48. } else {
  49. return '已结算';
  50. }
  51. }
  52. },
  53. methods:{
  54. toPagination: function (pageNum) {
  55. if (pageNum <= this.pageTotal) {
  56. this.params.pageNum = pageNum;
  57. this.settlementList(this.params);
  58. }
  59. },
  60. checkNum: function () {
  61. if (this.pageInput > this.pageTotal) {
  62. this.pageInput = this.pageTotal;
  63. } else if (this.pageInput < 1) {
  64. this.pageInput = 1;
  65. }
  66. },
  67. settlementList:function () {//获取结算列表数据
  68. var _this = this;
  69. SupplierApi.settlementList(_this.params,function (response) {
  70. if(response.code==0){
  71. var data = response.data;
  72. if( data.list && data.list.length>0 ){
  73. _this.list = data.list;
  74. _this.listRecord = data.total;
  75. }else {
  76. _this.list = data.list;
  77. _this.listRecord = data.total;
  78. }
  79. _this.requestFlag = true;
  80. }else{
  81. CAIMEI.Alert(response.msg, '确定', false);
  82. }
  83. })
  84. },
  85. getstatus:function () { //状态
  86. var _this = this;
  87. _this.params.payStatus=event.target.value;
  88. },
  89. serchBtn:function () {
  90. console.log(this.params)
  91. this.settlementList()
  92. }
  93. },
  94. mounted:function () {
  95. var _self= this;
  96. if(globalUserData){
  97. _self.params.shopId = globalUserData.shopId;
  98. }
  99. _self.settlementList();
  100. if(!isPC){
  101. //移动端上垃加载更多
  102. $(window).on('scroll', function(){
  103. var scrollTop = $(this).scrollTop();
  104. var scrollHeight = $(document).height();
  105. var windowHeight = window.innerHeight;
  106. if (scrollTop + windowHeight >= scrollHeight) {
  107. //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
  108. var totalPage = Math.ceil(_self.listRecord / _self.params.pageSize)?Math.ceil(_self.listRecord / _self.params.pageSize):1;
  109. var next = _self.params.pageNum+1;
  110. if(next <= totalPage){
  111. if (_self.requestFlag){
  112. _self.params.pageNum = next;
  113. if (_self.isRequset) {
  114. // 获取列表数据
  115. _self.settlementList();
  116. }
  117. }
  118. _self.requestFlag = false;
  119. }else{
  120. //到底了
  121. _self.noMore = true;
  122. $('footer').removeClass("noneImportant");
  123. }
  124. }
  125. });
  126. }
  127. $('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on");
  128. $('.navLayout').find('.navList').eq(0).addClass("on").find('.con').show().find('a').eq(1).addClass("on");
  129. }
  130. })