messageList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view>
  3. <u-navbar :title="title" title-color="#101010" ></u-navbar>
  4. <view class="main" v-if="type=='AA'">
  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" style="display: flex;justify-content: space-between;">
  13. <!-- {{item.tenantName}} -->
  14. <view>{{item.createTime}}</view>
  15. <view >{{item.payTime?'已支付':''}}</view>
  16. </view>
  17. </view>
  18. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容"
  19. border-color="#CFD2D5">已经到底了</u-divider>
  20. </view>
  21. <view class="main" v-else >
  22. <view class="item" v-for="(item,i) in list" :key="i">
  23. <view class="item-message">
  24. <view v-html="item.content"></view>
  25. <view class="billAmount"></view>
  26. </view>
  27. <view class="item-time">
  28. {{item.createTime}} <!-- {{item.tenantName}} -->
  29. </view>
  30. </view>
  31. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容"
  32. border-color="#CFD2D5">已经到底了</u-divider>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import * as API from '@/apis/pagejs/message.js'
  38. export default {
  39. data() {
  40. return {
  41. type:0,
  42. formData:{
  43. pageIndex:1,
  44. pageSize:20,
  45. },
  46. typeName:"",
  47. list:[],
  48. recordsTotal:0
  49. }
  50. },
  51. computed:{
  52. title(){
  53. if(this.type=='AA'){
  54. return '账单提醒'
  55. }else if(this.typeName){
  56. return this.typeName
  57. }else{
  58. return '消息提醒'
  59. }
  60. }
  61. },
  62. onLoad(op) {
  63. if(op.type){
  64. this.type=op.type;
  65. this.formData.type=op.type;
  66. }
  67. if(op.typeName){
  68. this.typeName=op.typeName;
  69. }
  70. this.getList()
  71. },
  72. onReachBottom() {
  73. if (this.list.length < this.recordsTotal) {
  74. this.myLoadmore();
  75. }
  76. },
  77. methods: {
  78. getList(){
  79. if(this.type=='AA'){
  80. this.getBillList()
  81. }else{
  82. this.getMessageList()
  83. }
  84. },
  85. myLoadmore() {
  86. this.formData.pageIndex += 1;
  87. this.getList()
  88. },
  89. getMessageList(){
  90. uni.showLoading({
  91. mask:true,title:'加载中...'
  92. })
  93. API.messageList(this.formData).then((res) => {
  94. uni.hideLoading();
  95. if(this.formData.pageIndex==1){
  96. this.list = [
  97. ...res.data.data
  98. ];
  99. }else{
  100. this.list = [
  101. ...this.list,
  102. ...res.data.data
  103. ];
  104. }
  105. this.recordsTotal = res.data.recordsTotal;
  106. //this.list=response.data.data;
  107. }).catch(error => {
  108. uni.hideLoading();
  109. uni.showToast({
  110. icon: "none",
  111. title: error
  112. })
  113. })
  114. },
  115. getBillList(){
  116. uni.showLoading({
  117. mask:true,title:'加载中...'
  118. })
  119. API.billList(this.formData).then((res) => {
  120. uni.hideLoading();
  121. if(this.formData.pageIndex==1){
  122. this.list = [
  123. ...res.data.data
  124. ];
  125. }else{
  126. this.list = [
  127. ...this.list,
  128. ...res.data.data
  129. ];
  130. }
  131. this.recordsTotal = res.data.recordsTotal;
  132. //this.list=response.data.data;
  133. }).catch(error => {
  134. uni.hideLoading();
  135. uni.showToast({
  136. icon: "none",
  137. title: error
  138. })
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .main{
  146. background-color: #fff;
  147. margin-top: 24rpx;
  148. .item{
  149. padding: 32rpx;
  150. border-bottom: 1px solid rgba(244,244,244,1);
  151. .item-message{
  152. line-height: 44rpx;
  153. display: flex;
  154. justify-content: space-between;
  155. color: rgba(51,51,51,1);
  156. .billAmount{
  157. color: #F44336;
  158. }
  159. }
  160. .item-time{
  161. color: rgb(153,153,153);
  162. font-size: 24rpx;
  163. margin-top: 16rpx;
  164. }
  165. }
  166. }
  167. </style>