evaluateList.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="container">
  3. <scroll-view class="message-list-box" scroll-y="true" @scrolltolower="handleLoadMore()">
  4. <view class="assess-row" v-for="(item, index1) in assessList" :key="index1">
  5. <image class="assess-head" :src="item.headimg"></image>
  6. <view class="assess-info">
  7. <view class="assess-name">{{item.nickname}}</view>
  8. <view class="assess-date">{{item.evaluateTime}}</view>
  9. <view class="assess-sore-box">
  10. <u-rate v-model="item.score" active-color="#FFAE21" disabled></u-rate>
  11. </view>
  12. <view class="assess-text">{{item.evaluateContent}}</view>
  13. <view class="assess-img-box">
  14. <image class="img-col" v-for="(site, index2) in item.evaluateImgs" :key="index2" :src="site.imgUrl"></image>
  15. </view>
  16. </view>
  17. <view class="shop-reply-box" v-if="item.replyContent">
  18. <view class="shop-head">
  19. <view class="iconfont icondianpu"></view>
  20. <view class="shop-name">店家回复</view>
  21. </view>
  22. <view class="shop-reply">{{item.replyContent}}</view>
  23. </view>
  24. </view>
  25. </scroll-view>
  26. <u-top-tips ref="uTips"></u-top-tips>
  27. </view>
  28. </template>
  29. <script>
  30. const NET = require('@/utils/request')
  31. const API = require('@/config/api')
  32. export default {
  33. data() {
  34. return {
  35. goodId: '',
  36. pageIndex: 1,
  37. isOver: false,
  38. assessList: [],
  39. }
  40. },
  41. onLoad(options) {
  42. this.goodId = options.goodId
  43. },
  44. onShow() {
  45. this.getMessageList('refresh')
  46. },
  47. onPullDownRefresh() {
  48. this.pageIndex = 1
  49. this.assessList = []
  50. this.getMessageList()
  51. },
  52. methods: {
  53. // 懒加载
  54. handleLoadMore() {
  55. if (!this.isOver) {
  56. this.pageIndex++
  57. this.getMessageList()
  58. }
  59. },
  60. // 获取全部留言
  61. getMessageList(type) {
  62. NET.request(API.getAssessList + this.goodId + '/' + this.pageIndex + '/10', {}, 'GET').then(res => {
  63. if (type == 'refresh') {
  64. uni.stopPullDownRefresh();
  65. }
  66. this.isOver = res.data.list.length != 10
  67. this.assessList = this.assessList.concat(res.data.list)
  68. }).catch(error => {
  69. this.$refs.uTips.show({
  70. title: error.data.msg,
  71. type: 'warning',
  72. })
  73. })
  74. },
  75. }
  76. }
  77. </script>
  78. <style lang="less" scoped>
  79. page {
  80. width: 100%;
  81. height: 100%;
  82. }
  83. .container {
  84. width: 100%;
  85. height: 100%;
  86. float: left;
  87. position: relative;
  88. .message-list-box {
  89. width: 100%;
  90. height: 100%;
  91. float: left;
  92. .assess-row {
  93. width: calc(100% - 30px);
  94. margin: 0 15px;
  95. float: left;
  96. border-top: 1px solid #F6F6F6;
  97. padding: 12px 0;
  98. .assess-head {
  99. width: 50px;
  100. height: 50px;
  101. float: left;
  102. object-fit: cover;
  103. border-radius: 50%;
  104. }
  105. .assess-info {
  106. width: calc(100% - 62px);
  107. margin-left: 12px;
  108. float: left;
  109. .assess-name {
  110. height: 18px;
  111. float: left;
  112. line-height: 18px;
  113. font-size: 15px;
  114. font-family: PingFang SC;
  115. font-weight: bold;
  116. color: #343434;
  117. }
  118. .assess-date {
  119. height: 18px;
  120. float: right;
  121. line-height: 18px;
  122. font-size: 12px;
  123. font-family: PingFang SC;
  124. font-weight: bold;
  125. color: #666666;
  126. }
  127. .assess-sore-box {
  128. width: 100%;
  129. height: 16px;
  130. float: left;
  131. margin: 6px 0;
  132. }
  133. .assess-text {
  134. width: 100%;
  135. float: left;
  136. font-size: 12px;
  137. font-family: PingFang SC;
  138. font-weight: bold;
  139. color: #666666;
  140. line-height: 16px;
  141. margin: 8px 0 10px 0;
  142. overflow: hidden;
  143. text-overflow: ellipsis;
  144. display: -webkit-box;
  145. -webkit-line-clamp: 2;
  146. -webkit-box-orient: vertical;
  147. word-wrap: break-word;
  148. }
  149. .assess-img-box {
  150. width: 100%;
  151. float: left;
  152. display: flex;
  153. .img-col {
  154. height: 60px;
  155. width: 60px;
  156. object-fit: cover;
  157. margin: 0 10px 10px 0;
  158. }
  159. }
  160. }
  161. .shop-reply-box {
  162. width: 100%;
  163. float: left;
  164. background: #F5F5F5;
  165. border-radius: 5px;
  166. margin-top: 10px;
  167. .shop-head {
  168. width: 100%;
  169. height: 36px;
  170. float: left;
  171. box-sizing: border-box;
  172. padding: 10px 12px;
  173. .icondianpu {
  174. width: 16px;
  175. height: 16px;
  176. float: left;
  177. color: #52A63A;
  178. font-size: 20px;
  179. margin-right: 8px;
  180. }
  181. .shop-name {
  182. height: 16px;
  183. float: left;
  184. font-size: 15px;
  185. font-family: PingFang SC;
  186. color: #52A63A;
  187. line-height: 16px;
  188. }
  189. }
  190. .shop-reply {
  191. width: 100%;
  192. float: left;
  193. box-sizing: border-box;
  194. padding: 0 12px 12px 12px;
  195. font-size: 12px;
  196. font-family: PingFang SC;
  197. color: #666666;
  198. line-height: 16px;
  199. }
  200. }
  201. }
  202. .assess-row:first-child {
  203. border-top: none;
  204. }
  205. }
  206. }
  207. </style>