hx-comment.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="hx-comment">
  3. <view class="hx-comment_basic-info">
  4. <view class="hx-comment_basic-info_left">
  5. <view class="hx-comment_basic-info_left_top">
  6. <text>3.5</text>
  7. </view>
  8. <view class="hx-comment_basic-info_left_bottom">
  9. <text>商家评分</text>
  10. </view>
  11. </view>
  12. <view class="hx-comment_basic-info_center">
  13. <view class="hx-comment_basic-info_center_item" style="margin-bottom: 10px;">
  14. <view class="hx-comment_basic-info_center_item_left">
  15. <text>包装</text>
  16. </view>
  17. <view class="hx-comment_basic-info_center_item_center">
  18. <uni-rate size="14" value="3.6"></uni-rate>
  19. </view>
  20. <view class="hx-comment_basic-info_center_item_right">
  21. <text>3.6</text>
  22. </view>
  23. </view>
  24. <view class="hx-comment_basic-info_center_item">
  25. <view class="hx-comment_basic-info_center_item_left">
  26. <text>新鲜</text>
  27. </view>
  28. <view class="hx-comment_basic-info_center_item_center">
  29. <uni-rate size="14" value="4.5"></uni-rate>
  30. </view>
  31. <view class="hx-comment_basic-info_center_item_right">
  32. <text>4.5</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="hx-comment_basic-info_right">
  37. <view class="hx-comment_basic-info_right_top">
  38. <view class="hx-comment_basic-info_right_top">
  39. <text>95%</text>
  40. </view>
  41. <view class="hx-comment_basic-info_right_bottom">
  42. <text>配送满意度</text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="hx-comment_dividing-line15"></view>
  48. <view class="hx-comment_main-box">
  49. <view class="lists" v-if="listData.length > 0">
  50. <block v-for="(item, index_) in listData" :key="index_">
  51. <view class="item">
  52. <view class="icon"><image :src="item.header_img" mode="widthFix" style="width:100%" /></view>
  53. <view class="info">
  54. <view class="name-time">
  55. <text class="name">{{ item.user_name }}</text>
  56. <text class="time">{{ item.create_time }}</text>
  57. </view>
  58. <view class="stars">
  59. <text>评分</text> <uni-rate size="14" value="4.5"></uni-rate>
  60. </view>
  61. <view class="evaluate-content">
  62. <text>{{ item.content || '用户暂未评价' }}</text>
  63. <view class="imgs" v-if="item.imgs">
  64. <block v-for="(imgurl, index) in item.imgs" :key="index">
  65. <view class="imgs-box"><image :src="imgurl" mode="widthFix" style="width: 100%;" @click="previewImgs(imgurl,item.imgs)"></image></view>
  66. </block>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="hx-bb"></view>
  72. </block>
  73. </view>
  74. <view class="no-lists" v-else>暂无评论</view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import uniRate from '@/components/uni-rate/uni-rate.vue'
  80. export default {
  81. name: "hx-comment",
  82. components: {uniRate},
  83. props: {
  84. //评价列表数据
  85. listData: {
  86. type: Array,
  87. default: function(){
  88. return [];
  89. },
  90. },
  91. },
  92. data() {
  93. return {
  94. };
  95. },
  96. created() {
  97. },
  98. methods: {
  99. previewImgs(img,imgList){
  100. // 预览图片
  101. uni.previewImage({
  102. current: img,
  103. urls: imgList,
  104. indicator: "default",
  105. // longPressActions: {
  106. // itemList: ['发送给朋友', '保存图片', '收藏'],
  107. // success: function(data) {
  108. // //console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  109. // },
  110. // fail: function(err) {
  111. // //console.log(err.errMsg);
  112. // }
  113. // }
  114. });
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. $hx-color-main: #ff9800;
  121. $hx-color-gray: #999999;
  122. .hx-comment{
  123. position: relative;
  124. .hx-bb{
  125. margin-left: 11px;
  126. border-bottom: 1px solid #efefef;
  127. }
  128. &_dividing-line15{
  129. height: 15px;
  130. background: #efefef;
  131. width: 100%;
  132. }
  133. &_dividing-line{
  134. height: 2px;
  135. background: #efefef;
  136. width: 100%;
  137. }
  138. &_basic-info{
  139. height: 82px;
  140. display: flex;
  141. flex-direction: row;
  142. align-items: center;
  143. text-align: center;
  144. &_left{
  145. display: flex;
  146. flex-direction: column;
  147. width: 100px;
  148. &_top{
  149. font-size: 32px;
  150. margin-bottom: 2px;
  151. color: $hx-color-main;
  152. }
  153. &_bottom{
  154. font-size: 12px;
  155. color: #555555;
  156. }
  157. }
  158. &_center{
  159. flex: 1;
  160. display: flex;
  161. align-items: center;
  162. flex-direction: column;
  163. &_item{
  164. font-size: 12px;
  165. display: flex;
  166. flex-direction: row;
  167. align-items: center;
  168. justify-content : center;
  169. &_left{
  170. color: #555555;
  171. }
  172. &_center{
  173. margin: 0 6px 0 8px;
  174. height: 0;
  175. }
  176. &_right{
  177. color: #FF9800;
  178. }
  179. }
  180. }
  181. &_right{
  182. width: 100px;
  183. display: flex;
  184. flex-direction: column;
  185. border-left: 1px solid #efefef;
  186. &_top{
  187. font-size: 26px;
  188. margin-bottom: 2px;
  189. color: $hx-color-gray;
  190. }
  191. &_bottom{
  192. font-size: 12px;
  193. color: $hx-color-gray;
  194. }
  195. }
  196. }
  197. &_main-box{
  198. .lists .item {
  199. padding: 20upx;
  200. display: flex;
  201. font-size: 22upx;
  202. color: #999;
  203. .icon {
  204. width: 60upx;
  205. height: 60upx;
  206. border-radius: 50%;
  207. overflow: hidden;
  208. margin-right: 26upx;
  209. border: 1px solid #efefef;
  210. }
  211. }
  212. .lists .item .info {
  213. flex: 1;
  214. font-size: 16px;
  215. color: #000;
  216. .name-time {
  217. display: flex;
  218. align-items: center;
  219. justify-content: space-between;
  220. .name{
  221. font-size: 16px;
  222. color: #000;
  223. }
  224. .time{
  225. font-size: 12px;
  226. color: #999;
  227. }
  228. }
  229. .stars {
  230. padding: 6px 0 10px;
  231. display: flex;
  232. flex-direction: row;
  233. align-items: center;
  234. position: relative;
  235. text{
  236. font-size: 12px;
  237. color: #999;
  238. margin-right: 6px;
  239. }
  240. .uni-rate{
  241. height: 0;
  242. }
  243. }
  244. .evaluate-content {
  245. color: #555555;
  246. font-size: 14px;
  247. text-align: left;
  248. padding-top: 4px;
  249. .imgs {
  250. display: flex;
  251. flex-wrap: wrap;
  252. padding-top: 4px;
  253. .imgs-box {
  254. width: 25%;
  255. padding-right: 5px;
  256. box-sizing: border-box;
  257. image{
  258. border-radius: 4px;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. .no-lists {
  265. padding: 20upx 0;
  266. text-align: center;
  267. font-size: 24upx;
  268. color: #666;
  269. }
  270. }
  271. }
  272. </style>