ProductReview.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!-- Evaluation.vue -->
  2. <template>
  3. <view class="scroll-view-wrapper div ui-evaluation" style="height:100%">
  4. <view class="scroll-view div" style="position:relative">
  5. <scroll-view
  6. style="position: absolute;top:0;right:0;left:0;bottom:0"
  7. class="div ui-evaluation-body"
  8. @scrolltolower="loadMore"
  9. scroll-y="true"
  10. >
  11. <view
  12. class="div list"
  13. v-for="(item, index) in reviewList"
  14. v-if="reviewList.length > 0"
  15. :key="index"
  16. >
  17. <view class="div">
  18. <view class="span">
  19. <image mode="aspectFit" class="img avatar" :src="item.member_avatar">
  20. <text>{{ item.point_buyername }}</text>
  21. </view>
  22. <text class="span">{{ getTime(item.point_addtime) }}</text>
  23. </view>
  24. </view>
  25. <view class="div list-empty" v-if="reviewList.length <= 0">
  26. <view class="p">本商品暂无兑换记录</view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { getPointsorderList } from '../../../../api/homePointsgoods'
  34. export default {
  35. data () {
  36. return {
  37. id: this.$store.state.pointsgoods.currentProductId
  38. ? this.$store.state.pointsgoods.currentProductId
  39. : '',
  40. reviewList: [],
  41. page: 0,
  42. loading: false,
  43. total: 1
  44. }
  45. },
  46. created () {
  47. this.loadMore()
  48. },
  49. methods: {
  50. loadMore () {
  51. this.loading = true
  52. this.page = ++this.page
  53. if (this.page <= this.total) {
  54. this.loading = false
  55. this.getReviewList(true)
  56. }
  57. },
  58. getReviewList (ispush) {
  59. getPointsorderList({ page: this.page, per_page: 10 }, this.id).then(res => {
  60. if (res) {
  61. if (ispush) {
  62. this.reviewList = this.reviewList.concat(res.result.order_list)
  63. } else {
  64. this.reviewList = res.result.order_list
  65. }
  66. if (res.hasmore) {
  67. this.loading = false
  68. } else {
  69. this.loading = true
  70. }
  71. this.total = res.page_total
  72. }
  73. })
  74. },
  75. getTime (timestamps) {
  76. let date = new Date(timestamps * 1000)
  77. let year = date.getFullYear()
  78. let month = date.getMonth() + 1
  79. let day = date.getDate()
  80. return year + '-' + month + '-' + day
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .scroll-view-wrapper{display: flex;flex-direction: column;}
  87. .scroll-view{flex:1}
  88. .ui-evaluation {
  89. .ui-evaluation-header {
  90. background: #ffffff;
  91. .flex-header {
  92. width: auto;
  93. display: flex;
  94. display: -webkit-flex;
  95. display: -moz-flex;
  96. flex-basis: 100%;
  97. justify-content: space-around;
  98. align-content: center;
  99. align-items: center;
  100. height: 2.2rem;
  101. .div {
  102. color: #5c5958;
  103. font-size:$subFontSize;
  104. height: 1.2rem;
  105. border: 0.5px solid #333;
  106. padding: 0 0.45rem;
  107. line-height: 1.2rem;
  108. text-align: center;
  109. &.active {
  110. color: #ffffff;
  111. background: $primaryColor;
  112. border: 0.5px solid transparent;
  113. }
  114. }
  115. }
  116. }
  117. .ui-evaluation-body {
  118. padding: 0 $pageSpace;
  119. background: rgba(255, 255, 255, 1);
  120. box-sizing: border-box;
  121. .list {
  122. padding: 0.4rem 0;
  123. border-bottom: 0.5px solid rgba(232, 234, 237, 1);
  124. color: #333;
  125. font-size:$subFontSize;
  126. height:3rem;
  127. .div {
  128. overflow: hidden;
  129. display: flex;
  130. justify-content: space-between;
  131. align-content: center;
  132. align-items: center;
  133. .avatar{height:3rem;width:3rem;border-radius:50%;margin-right: .5rem;}
  134. .span {
  135. &:first-child {
  136. display: flex;
  137. justify-content: space-around;
  138. align-content: center;
  139. align-items: center;
  140. .span {
  141. margin-left: 0.75rem;
  142. color: #ffffff;
  143. font-size:$fontSize;
  144. }
  145. }
  146. &:last-child {
  147. color: #999999;
  148. font-size:$fontSize;
  149. }
  150. &.good-review {
  151. background: #fc2e39;
  152. width: 1.8rem;
  153. height: 0.8rem;
  154. text-align: center;
  155. background-size: cover;
  156. line-height: 0.8rem;
  157. border-radius: 0.4rem;
  158. }
  159. &.medium-review {
  160. background: $primaryColor;
  161. width: 1.8rem;
  162. height: 0.8rem;
  163. text-align: center;
  164. background-size: cover;
  165. line-height: 0.8rem;
  166. border-radius: 0.4rem;
  167. }
  168. &.bad-review {
  169. background: #c3c3c3;
  170. width: 1.8rem;
  171. height: 0.8rem;
  172. text-align: center;
  173. background-size: cover;
  174. line-height: 0.8rem;
  175. border-radius: 0.4rem;
  176. }
  177. }
  178. }
  179. .p {
  180. padding: 0;
  181. margin: 0;
  182. flex-basis: 100%;
  183. display: -webkit-box;
  184. -webkit-box-orient: vertical;
  185. -webkit-line-clamp: 2;
  186. overflow: hidden;
  187. }
  188. }
  189. .list-empty {
  190. position: absolute;
  191. top: 50%;
  192. left: 50%;
  193. transform: translate(-50%, -50%);
  194. text-align: center;
  195. .img {
  196. width: 2.75rem;
  197. }
  198. .p {
  199. color: #7c7f88;
  200. font-size:$subFontSize;
  201. padding: 0;
  202. margin: 0;
  203. font-weight: normal;
  204. }
  205. }
  206. }
  207. }
  208. </style>