evaluateList.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. }
  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. _previewImage(image,index) {
  80. var imgArr = [];
  81. imgArr.push(image);
  82. //预览图片
  83. uni.previewImage({
  84. urls: imgArr,
  85. current: imgArr[index]
  86. });
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="less" scoped>
  92. page {
  93. width: 100%;
  94. height: 100%;
  95. }
  96. .container {
  97. width: 100%;
  98. height: 100%;
  99. float: left;
  100. position: relative;
  101. .message-list-box {
  102. width: 100%;
  103. height: 100%;
  104. float: left;
  105. .assess-row {
  106. width: calc(100% - 30px);
  107. margin: 0 15px;
  108. float: left;
  109. border-top: 1px solid #F6F6F6;
  110. padding: 12px 0;
  111. .assess-head {
  112. width: 50px;
  113. height: 50px;
  114. float: left;
  115. object-fit: cover;
  116. border-radius: 50%;
  117. }
  118. .assess-info {
  119. width: calc(100% - 62px);
  120. margin-left: 12px;
  121. float: left;
  122. .assess-name {
  123. height: 18px;
  124. float: left;
  125. line-height: 18px;
  126. font-size: 15px;
  127. font-family: PingFang SC;
  128. font-weight: bold;
  129. color: #343434;
  130. }
  131. .assess-date {
  132. height: 18px;
  133. float: right;
  134. line-height: 18px;
  135. font-size: 12px;
  136. font-family: PingFang SC;
  137. font-weight: bold;
  138. color: #666666;
  139. }
  140. .assess-sore-box {
  141. width: 100%;
  142. height: 16px;
  143. float: left;
  144. margin: 6px 0;
  145. }
  146. .assess-text {
  147. width: 100%;
  148. float: left;
  149. font-size: 12px;
  150. font-family: PingFang SC;
  151. font-weight: bold;
  152. color: #666666;
  153. line-height: 16px;
  154. margin: 8px 0 10px 0;
  155. overflow: hidden;
  156. text-overflow: ellipsis;
  157. display: -webkit-box;
  158. -webkit-line-clamp: 2;
  159. -webkit-box-orient: vertical;
  160. word-wrap: break-word;
  161. }
  162. .assess-img-box {
  163. width: 100%;
  164. float: left;
  165. display: flex;
  166. .img-col {
  167. height: 60px;
  168. width: 60px;
  169. object-fit: cover;
  170. margin: 0 10px 10px 0;
  171. }
  172. }
  173. }
  174. .shop-reply-box {
  175. width: 100%;
  176. float: left;
  177. background: #F5F5F5;
  178. border-radius: 5px;
  179. margin-top: 10px;
  180. .shop-head {
  181. width: 100%;
  182. height: 36px;
  183. float: left;
  184. box-sizing: border-box;
  185. padding: 10px 12px;
  186. .icondianpu {
  187. width: 16px;
  188. height: 16px;
  189. float: left;
  190. color: #52A63A;
  191. font-size: 20px;
  192. margin-right: 8px;
  193. }
  194. .shop-name {
  195. height: 16px;
  196. float: left;
  197. font-size: 15px;
  198. font-family: PingFang SC;
  199. color: #52A63A;
  200. line-height: 16px;
  201. }
  202. }
  203. .shop-reply {
  204. width: 100%;
  205. float: left;
  206. box-sizing: border-box;
  207. padding: 0 12px 12px 12px;
  208. font-size: 12px;
  209. font-family: PingFang SC;
  210. color: #666666;
  211. line-height: 16px;
  212. }
  213. }
  214. }
  215. .assess-row:first-child {
  216. border-top: none;
  217. }
  218. }
  219. }
  220. </style>