messageList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="container">
  3. <scroll-view class="message-list-box" scroll-y="true" @scrolltolower="handleLoadMore()">
  4. <view class="message-row" v-for="(item, index1) in messageList" :key="index1">
  5. <cover-image class="message-head" :src="item.headImg"></cover-image>
  6. <view class="message-info-box">
  7. <view class="message-name">{{item.userName}}</view>
  8. <view class="message-date">{{item.leaMsgTime}}</view>
  9. <view class="message-text">{{item.leaMsgContent}}</view>
  10. <view class="message-img-box" v-for="(site, index2) in item.orderLeaImgResVOs" :key="index2">
  11. <cover-image class="message-img" :src="site.imgUrl"></cover-image>
  12. </view>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. <view class="message-handle">
  17. <u-button type="success" shape="circle" :ripple="true" @click="addMessage" class="handle-custom">发布留言</u-button>
  18. </view>
  19. <u-top-tips ref="uTips"></u-top-tips>
  20. </view>
  21. </template>
  22. <script>
  23. const NET = require('@/utils/request')
  24. const API = require('@/config/api')
  25. export default {
  26. data() {
  27. return {
  28. orderId: '',
  29. tenantCode: '',
  30. pageIndex: 1,
  31. isOver: false,
  32. messageList: [],
  33. }
  34. },
  35. onLoad(options) {
  36. this.orderId = options.orderId
  37. this.tenantCode = options.tenantCode
  38. },
  39. onShow() {
  40. this.pageIndex = 1
  41. this.messageList = []
  42. this.getMessageList()
  43. },
  44. methods: {
  45. // 懒加载
  46. handleLoadMore() {
  47. if (!this.isOver) {
  48. this.pageIndex++
  49. this.getMessageList()
  50. }
  51. },
  52. // 获取全部留言
  53. getMessageList() {
  54. NET.request(API.getMessageList + this.pageIndex + '/10', {
  55. flag: 1,
  56. orderId: this.orderId
  57. }, 'GET').then(res => {
  58. this.isOver = res.data.list.length != 10
  59. this.messageList = this.messageList.concat(res.data.list)
  60. }).catch(error => {
  61. this.$refs.uTips.show({
  62. title: error.data.msg,
  63. type: 'warning',
  64. })
  65. })
  66. },
  67. // 新增留言
  68. addMessage() {
  69. uni.navigateTo({
  70. url: '/pagesMain/messageForm?orderId=' + this.orderId + '&tenantCode=' + this.tenantCode
  71. });
  72. },
  73. }
  74. }
  75. </script>
  76. <style lang="less" scoped>
  77. page {
  78. width: 100%;
  79. height: 100%;
  80. }
  81. .container {
  82. width: 100%;
  83. height: 100%;
  84. float: left;
  85. position: relative;
  86. .message-list-box {
  87. width: 100%;
  88. height: calc(100% - 70px);
  89. float: left;
  90. .message-row {
  91. width: calc(100% - 30px);
  92. float: left;
  93. padding-bottom: 15px;
  94. border-bottom: 1px solid #F6F6F6;
  95. margin: 0 15px 15px 15px;
  96. .message-head {
  97. width: 50px;
  98. height: 50px;
  99. object-fit: cover;
  100. float: left;
  101. border-radius: 50%;
  102. overflow: hidden;
  103. }
  104. .message-info-box {
  105. width: calc(100% - 75px);
  106. float: right;
  107. .message-name {
  108. width: 50%;
  109. height: 30px;
  110. float: left;
  111. font-size: 15px;
  112. font-family: PingFang SC;
  113. color: #333333;
  114. line-height: 30px;
  115. overflow: hidden;
  116. text-overflow: ellipsis;
  117. white-space: nowrap;
  118. }
  119. .message-date {
  120. width: 50%;
  121. height: 30px;
  122. float: left;
  123. font-size: 12px;
  124. font-family: PingFang SC;
  125. color: #666666;
  126. text-align: right;
  127. line-height: 30px;
  128. overflow: hidden;
  129. text-overflow: ellipsis;
  130. white-space: nowrap;
  131. }
  132. .message-text {
  133. width: 100%;
  134. height: 20px;
  135. float: left;
  136. font-size: 12px;
  137. font-family: PingFang SC;
  138. color: #666666;
  139. line-height: 20px;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. }
  144. .message-img-box {
  145. width: 100%;
  146. float: left;
  147. .message-img {
  148. width: 76px;
  149. height: 76px;
  150. object-fit: cover;
  151. float: left;
  152. margin: 0 10px 10px 0;
  153. }
  154. }
  155. }
  156. }
  157. }
  158. .message-handle {
  159. width: calc(100% - 30px);
  160. height: 40px;
  161. position: fixed;
  162. bottom: 20px;
  163. left: 15px;
  164. .handle-custom {
  165. background-color: #51A539;
  166. }
  167. }
  168. }
  169. </style>