messageList.vue 4.4 KB

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