messageList.vue 4.0 KB

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