index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="comment">
  3. <view class="comment_tabs">
  4. <view class="box" v-for="(item,index) in list" :key="index" @click="change(index)" :class="{btna:count == index}">{{item}}</view>
  5. </view>
  6. <view class="tab_box" :class="{dis:btnnum == 0}">
  7. <view class="content">
  8. <view class="content_box" v-for="(item,index) in head" :key="item.id">
  9. <view class="comment_head">
  10. <view class="head_left">
  11. <view class="img">
  12. <image :src="item.avatar?item.avatar:'../../../static/logo.png'"></image>
  13. </view>
  14. <view class="comment_name">{{item.nickName?item.nickName:'匿名'}}</view>
  15. </view>
  16. <view class="head_right" v-if="item.satisfactionFlag=='0'">
  17. <view class="image">
  18. <image src="../static/zan.png"></image>
  19. </view>
  20. <view class="comment_tit">满意</view>
  21. </view>
  22. </view>
  23. <view class="comment_title">{{item.evaluateMessage}}</view>
  24. </view>
  25. </view>
  26. <empty v-if="head.length == 0" ></empty>
  27. </view>
  28. <view class="tab_box" :class="{dis:btnnum == 1}">
  29. <view class="content">
  30. <view class="content_box" v-for="(item,index) in head" :key="item.id">
  31. <view class="comment_head">
  32. <view class="head_left">
  33. <view class="img">
  34. <image :src="item.avatar?item.avatar:'../../../static/logo.png'"></image>
  35. </view>
  36. <view class="comment_name">{{item.nickName?item.nickName:'匿名'}}</view>
  37. </view>
  38. <view class="head_right" v-if="item.satisfactionFlag=='1'">
  39. <view class="image">
  40. <image src="../static/zz.png"></image>
  41. </view>
  42. <view class="comment_tit comment_tit1">不满意</view>
  43. </view>
  44. </view>
  45. <view class="comment_title">{{item.evaluateMessage}}</view>
  46. </view>
  47. </view>
  48. <empty v-if="head.length == 0" ></empty>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import empty from '@/components/empty'
  54. export default {
  55. components: {
  56. empty
  57. },
  58. data() {
  59. return {
  60. list: ["满意", "不满意"],
  61. btnnum: 0,
  62. count: "",
  63. head: [],
  64. page:1,
  65. limit:10,
  66. totalCount:0,
  67. satisfactionFlag:0
  68. }
  69. },
  70. mounted() {
  71. this.bindorder()
  72. },
  73. methods: {
  74. change(e) {
  75. // console.log(e)
  76. this.head = []
  77. this.page = 1
  78. this.count = e
  79. this.btnnum = e
  80. this.satisfactionFlag = e
  81. this.bindorder()
  82. },
  83. // 获取数据
  84. bindorder() {
  85. this.$Request.getT('/app/userinfo/findEvaluate',
  86. {
  87. page:this.page,
  88. limit:this.limit,
  89. satisfactionFlag:this.satisfactionFlag
  90. }).then(res => {
  91. if(res.code==0){
  92. // this.head = res.data
  93. if (this.page == 1) {
  94. this.head = res.data.list
  95. } else {
  96. this.head = this.head.concat(res.data.list)
  97. }
  98. this.totalCount = res.data.totalCount
  99. }else{
  100. console.log('失败:',res.data)
  101. }
  102. uni.stopPullDownRefresh();
  103. });
  104. },
  105. },
  106. // 上拉加载
  107. onReachBottom: function() {
  108. if(this.page<this.totalCount){
  109. this.page = this.page + 1;
  110. this.bindorder();
  111. }else{
  112. uni.showToast({
  113. title:'已经最后一页啦',
  114. icon:'none'
  115. })
  116. }
  117. },
  118. // 下拉刷新
  119. onPullDownRefresh: function() {
  120. this.page = 1;
  121. this.bindorder();
  122. },
  123. }
  124. </script>
  125. <style>
  126. body {
  127. background: #F5F5F5;
  128. }
  129. .comment {
  130. width: 100%;
  131. }
  132. .comment_tabs {
  133. width: 100%;
  134. display: flex;
  135. background: #FFFFFF;
  136. height: 90rpx;
  137. }
  138. .box {
  139. flex: 1;
  140. display: flex;
  141. justify-content: center;
  142. align-items: center;
  143. }
  144. .btna {
  145. background-color: #E6E6E6;
  146. }
  147. .tab_box {
  148. display: none;
  149. }
  150. .dis {
  151. display: block;
  152. }
  153. /* 满意 */
  154. .content {
  155. width: 90%;
  156. margin: 0 auto;
  157. background: #ffffff;
  158. border-radius: 16rpx;
  159. margin-top: 30rpx;
  160. }
  161. .content_box {
  162. height: 145rpx;
  163. }
  164. .img image {
  165. width: 50rpx;
  166. height: 50rpx;
  167. border-radius: 50%;
  168. }
  169. .comment_head {
  170. width: 90%;
  171. margin: 0 auto;
  172. display: flex;
  173. }
  174. .comment_name {
  175. color: #333333;
  176. font-size: 22rpx;
  177. margin-left: 10rpx;
  178. }
  179. .head_left {
  180. flex: 1;
  181. display: flex;
  182. justify-content: left;
  183. align-items: center;
  184. height: 65rpx;
  185. margin-top: 20rpx;
  186. }
  187. .head_right {
  188. flex: 1;
  189. display: flex;
  190. justify-content: flex-end;
  191. align-items: center;
  192. color: #3390FF;
  193. font-size: 20rpx;
  194. }
  195. .image {
  196. margin-right: 11rpx;
  197. margin-top: 8rpx;
  198. }
  199. .image image {
  200. width: 22rpx;
  201. height: 22rpx;
  202. }
  203. .comment_title {
  204. width: 90%;
  205. margin: 0 auto;
  206. color: #333333;
  207. font-size: 25rpx;
  208. }
  209. /* 不满意 */
  210. .comment_tit1 {
  211. color: #cccccc;
  212. }
  213. </style>