evaluateList.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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" @tap="_previewImage(site.imgUrl,i)"></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. preview: false
  43. }
  44. },
  45. onLoad(options) {
  46. this.goodId = options.goodId
  47. },
  48. onShow() {
  49. if (!this.preview) {
  50. this.pageIndex = 1
  51. this.assessList = []
  52. this.getMessageList('refresh')
  53. }
  54. },
  55. onPullDownRefresh() {
  56. this.pageIndex = 1
  57. this.assessList = []
  58. this.getMessageList('refresh')
  59. },
  60. methods: {
  61. // 懒加载
  62. handleLoadMore() {
  63. if (!this.isOver) {
  64. this.pageIndex++
  65. this.getMessageList()
  66. }
  67. },
  68. // 获取全部留言
  69. getMessageList(type) {
  70. NET.request(API.getAssessList + this.goodId + '/' + this.pageIndex + '/10', {}, 'GET').then(res => {
  71. if (type == 'refresh') {
  72. uni.stopPullDownRefresh();
  73. }
  74. this.isOver = res.data.list.length != 10
  75. this.assessList = this.assessList.concat(res.data.list)
  76. }).catch(error => {
  77. this.$refs.uTips.show({
  78. title: error.data.msg,
  79. type: 'warning',
  80. })
  81. })
  82. },
  83. // 图片预览
  84. _previewImage(image,index) {
  85. this.preview = true
  86. var imgArr = [];
  87. imgArr.push(image);
  88. //预览图片
  89. uni.previewImage({
  90. urls: imgArr,
  91. current: imgArr[index]
  92. });
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="less" scoped>
  98. page {
  99. width: 100%;
  100. height: 100%;
  101. }
  102. .container {
  103. width: 100%;
  104. height: 100%;
  105. float: left;
  106. position: relative;
  107. .message-list-box {
  108. width: 100%;
  109. height: 100%;
  110. float: left;
  111. .assess-row {
  112. width: calc(100% - 30px);
  113. margin: 0 15px;
  114. float: left;
  115. border-top: 1px solid #F6F6F6;
  116. padding: 12px 0;
  117. .assess-head {
  118. width: 50px;
  119. height: 50px;
  120. float: left;
  121. object-fit: cover;
  122. border-radius: 50%;
  123. }
  124. .assess-info {
  125. width: calc(100% - 62px);
  126. margin-left: 12px;
  127. float: left;
  128. .assess-name {
  129. height: 18px;
  130. float: left;
  131. line-height: 18px;
  132. font-size: 15px;
  133. font-family: PingFang SC;
  134. font-weight: bold;
  135. color: #343434;
  136. }
  137. .assess-date {
  138. height: 18px;
  139. float: right;
  140. line-height: 18px;
  141. font-size: 12px;
  142. font-family: PingFang SC;
  143. font-weight: bold;
  144. color: #666666;
  145. }
  146. .assess-sore-box {
  147. width: 100%;
  148. height: 16px;
  149. float: left;
  150. margin: 6px 0;
  151. }
  152. .assess-text {
  153. width: 100%;
  154. float: left;
  155. font-size: 12px;
  156. font-family: PingFang SC;
  157. font-weight: bold;
  158. color: #666666;
  159. line-height: 16px;
  160. margin: 8px 0 10px 0;
  161. overflow: hidden;
  162. text-overflow: ellipsis;
  163. display: -webkit-box;
  164. -webkit-line-clamp: 2;
  165. -webkit-box-orient: vertical;
  166. word-wrap: break-word;
  167. }
  168. .assess-img-box {
  169. width: 100%;
  170. float: left;
  171. display: flex;
  172. .img-col {
  173. height: 60px;
  174. width: 60px;
  175. object-fit: cover;
  176. margin: 0 10px 10px 0;
  177. }
  178. }
  179. }
  180. .shop-reply-box {
  181. width: 100%;
  182. float: left;
  183. background: #F5F5F5;
  184. border-radius: 5px;
  185. margin-top: 10px;
  186. .shop-head {
  187. width: 100%;
  188. height: 36px;
  189. float: left;
  190. box-sizing: border-box;
  191. padding: 10px 12px;
  192. .icondianpu {
  193. width: 16px;
  194. height: 16px;
  195. float: left;
  196. color: #52A63A;
  197. font-size: 20px;
  198. margin-right: 8px;
  199. }
  200. .shop-name {
  201. height: 16px;
  202. float: left;
  203. font-size: 15px;
  204. font-family: PingFang SC;
  205. color: #52A63A;
  206. line-height: 16px;
  207. }
  208. }
  209. .shop-reply {
  210. width: 100%;
  211. float: left;
  212. box-sizing: border-box;
  213. padding: 0 12px 12px 12px;
  214. font-size: 12px;
  215. font-family: PingFang SC;
  216. color: #666666;
  217. line-height: 16px;
  218. }
  219. }
  220. }
  221. .assess-row:first-child {
  222. border-top: none;
  223. }
  224. }
  225. }
  226. </style>