evaluateList.vue 4.8 KB

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