messageList.vue 2.5 KB

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