messageList.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view>
  3. <u-navbar :title="title" title-color="#101010" ></u-navbar>
  4. <view class="main">
  5. <view class="item" v-for="(item,i) in list"
  6. @click="gotoUrl('/pages/deductionRecord/billPush?site=1&id='+item.id)"
  7. :key="i">
  8. <view class="item-message">
  9. {{item.name}}
  10. </view>
  11. <view class="item-time">
  12. {{item.createTime}} <!-- {{item.tenantName}} -->
  13. </view>
  14. </view>
  15. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容"
  16. border-color="#CFD2D5">已经到底了</u-divider>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import * as API from '@/apis/pagejs/message.js'
  22. export default {
  23. data() {
  24. return {
  25. type:0,
  26. formData:{
  27. pageIndex:1,
  28. pageSize:20,
  29. },
  30. list:[],
  31. recordsTotal:0
  32. }
  33. },
  34. computed:{
  35. title(){
  36. if(this.type==1){
  37. return '账单提醒'
  38. }else if(this.type==2){
  39. return '停电通知'
  40. }else if(this.type==3){
  41. return '故障警报'
  42. }else if(this.type==4){
  43. return '断电通知'
  44. }else if(this.type==5){
  45. return '账单提醒'
  46. }else{
  47. return '消息提醒'
  48. }
  49. }
  50. },
  51. onLoad(op) {
  52. if(op.type){
  53. this.type=op.type;
  54. }
  55. if(op.type==1){
  56. this.getBillList()
  57. }
  58. },
  59. onReachBottom() {
  60. if (this.list.length < this.recordsTotal) {
  61. this.myLoadmore();
  62. }
  63. },
  64. methods: {
  65. myLoadmore() {
  66. this.formData.pageIndex += 1;
  67. this.getBillList();
  68. },
  69. getBillList(){
  70. uni.showLoading({
  71. mask:true,title:'加载中...'
  72. })
  73. API.billList(this.formData).then((res) => {
  74. uni.hideLoading();
  75. if(this.formData.pageIndex==1){
  76. this.list = [
  77. ...res.data.data
  78. ];
  79. }else{
  80. this.list = [
  81. ...this.list,
  82. ...res.data.data
  83. ];
  84. }
  85. this.recordsTotal = res.data.recordsTotal;
  86. //this.list=response.data.data;
  87. }).catch(error => {
  88. uni.hideLoading();
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .main{
  96. background-color: #fff;
  97. margin-top: 24rpx;
  98. .item{
  99. padding: 32rpx;
  100. border-bottom: 1px solid rgba(244,244,244,1);
  101. .item-message{
  102. line-height: 44rpx;
  103. color: rgba(51,51,51,1);
  104. }
  105. .item-time{
  106. color: rgb(153,153,153);
  107. font-size: 24rpx;
  108. margin-top: 16rpx;
  109. }
  110. }
  111. }
  112. </style>