You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
3.8 KiB

3 years ago
  1. <template>
  2. <view class="mix-rating-item b-b">
  3. <view class="wrap">
  4. <view class="avatar-wrap">
  5. <image v-if="!item.user.anonymous && item.user.lv > 0" class="crown" src="/static/icon/crown.png"></image>
  6. <image class="avatar" :src="item.user.anonymous ? '/static/icon/default-avatar.png' : item.user.avatar || '/static/icon/default-avatar.png'" mode="aspectFill"></image>
  7. <text v-if="!item.user.anonymous" class="mix-icon" :class="item.user.gender===2?'icon-xingbie-nv':'icon-xingbie'"></text>
  8. </view>
  9. <view class="right fill column">
  10. <view class="row">
  11. <text class="name"> {{
  12. (
  13. item.user.anonymous ? '匿名' :
  14. (item.user.nickname || item.user.username)
  15. ) | username
  16. }} </text>
  17. <text
  18. class="mix-icon icon-shoucang_xuanzhongzhuangtai"
  19. :class="{active: sIndex < item.rating}"
  20. v-for="(sItem, sIndex) in 5"
  21. :key="sIndex"
  22. ></text>
  23. </view>
  24. <text class="con">{{ item.content }}</text>
  25. <view class="pic-wrap" v-if="item.images && item.images.length > 0" >
  26. <image
  27. v-for="(picItem, picIndex) in item.images"
  28. :key="picIndex"
  29. class="pic"
  30. :class="{'no-mr': picIndex === 2}"
  31. :src="picItem"
  32. mode="aspectFill"
  33. @click="previewImage(picIndex, item.images)"
  34. ></image>
  35. </view>
  36. <view class="bot row">
  37. <text class="time">{{ item.add_time | date('Y-m-d H:i') }}</text>
  38. <text v-if="item.sku" class="attr clamp">购买类型{{ item.sku }}</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view v-if="item.reply" class="replay-wrap">
  43. <text>卖家回复{{ item.reply }}</text>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. /**
  49. * 商品评价
  50. */
  51. export default {
  52. name: 'MixRatingItem',
  53. data() {
  54. return {
  55. };
  56. },
  57. props: {
  58. item: {
  59. type: Object,
  60. default(){
  61. return {}
  62. }
  63. }
  64. },
  65. filters: {
  66. username(name){
  67. if(name.length === 11){
  68. return '****' + name.substr(7, 11)
  69. }else{
  70. return name;
  71. }
  72. }
  73. },
  74. methods: {
  75. previewImage(current, urls){
  76. uni.previewImage({
  77. current,
  78. urls
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. .mix-rating-item{
  86. padding: 30rpx 0 30rpx;
  87. &:last-child:after{
  88. border: 0;
  89. }
  90. }
  91. .wrap{
  92. display: flex;
  93. }
  94. .avatar-wrap{
  95. width: 80rpx;
  96. height: 80rpx;
  97. position: relative;
  98. .avatar{
  99. flex-shrink: 0;
  100. width: 100%;
  101. height: 100%;
  102. border-radius: 100px;
  103. }
  104. .crown{
  105. position: absolute;
  106. width: 40rpx;
  107. height: 40rpx;
  108. z-index: 1;
  109. left: -16rpx;
  110. top: -14rpx;
  111. transform: rotate(0deg);
  112. }
  113. .mix-icon{
  114. position: absolute;
  115. right: 0;
  116. bottom: 0;
  117. font-size: 28rpx;
  118. color: $base-color;
  119. border-radius: 100rpx;
  120. border: 2rpx solid #fff;
  121. background-color: #fff;
  122. }
  123. }
  124. .right{
  125. padding-left: 26rpx;
  126. .name{
  127. margin-right: 40rpx;
  128. font-size: 28rpx;
  129. color: #666;
  130. }
  131. .icon-shoucang_xuanzhongzhuangtai{
  132. margin-right: 6rpx;
  133. font-size: 28rpx;
  134. color: #ddd;
  135. &.active{
  136. color: #ffd600;
  137. }
  138. }
  139. .con{
  140. font-size: 28rpx;
  141. color: #333;
  142. padding: 20rpx 0;
  143. line-height: 1.4;
  144. }
  145. .bot{
  146. justify-content: space-between;
  147. font-size: 24rpx;
  148. color:#999;
  149. }
  150. .attr{
  151. width: 350rpx;
  152. text-align: right;
  153. }
  154. }
  155. .pic-wrap{
  156. display: flex;
  157. flex-wrap: wrap;
  158. padding-bottom: 8rpx;
  159. .pic{
  160. width: 184rpx;
  161. height: 180rpx;
  162. margin: 0 12rpx 12rpx 0;
  163. border-radius: 8rpx;
  164. &.no-mr{
  165. margin-right: 0;
  166. }
  167. }
  168. }
  169. .replay-wrap{
  170. display: flex;
  171. margin: 24rpx 0 0 100rpx;
  172. padding: 12rpx 20rpx;
  173. background-color: #f7f7f7;
  174. border-radius: 8rpx;
  175. text{
  176. font-size: 24rpx;
  177. color: #888;
  178. line-height: 1.6;
  179. }
  180. }
  181. </style>