evaluate.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view>
  3. <!-- <view class="top-fixed">
  4. <u-tabs
  5. :scrollable="false"
  6. :list="tabs"
  7. :current="current"
  8. lineColor="#2583EB"
  9. @change="tabChange">
  10. </u-tabs>
  11. </view> -->
  12. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  13. <view class="evaluate">
  14. <evaluateItem :showLine="0" v-for="(item,index) in dataList" :key="index" :item="item"></evaluateItem>
  15. </view>
  16. </mescroll-body>
  17. </view>
  18. </template>
  19. <script>
  20. import evaluateItem from "@/components/evaluateItem";
  21. import {selectCommentByUser} from '@/api/myStoreOrder.js'
  22. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  23. export default {
  24. mixins: [MescrollMixin],
  25. components: {
  26. evaluateItem
  27. },
  28. data() {
  29. return {
  30. tabs:[
  31. {
  32. id:0,
  33. name:'待评价'
  34. },
  35. {
  36. id:1,
  37. name:'已评价'
  38. }
  39. ],
  40. current: 0,
  41. mescroll: null,
  42. downOption: { //下拉刷新
  43. use:true,
  44. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  45. },
  46. upOption: {
  47. onScroll:true,
  48. use: true, // 是否启用上拉加载; 默认true
  49. page: {
  50. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  51. size: 10 // 每页数据的数量,默认10
  52. },
  53. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  54. empty: {
  55. icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
  56. tip: '暂无数据',
  57. },
  58. textNoMore:"已经到底了",
  59. },
  60. // 列表数据
  61. dataList: [],
  62. orderId: '',
  63. productIds: '',
  64. storeId: '',
  65. }
  66. },
  67. onLoad(option) {
  68. this.orderId = option.orderId || ''
  69. this.productIds = option.productIds || ''
  70. this.storeId = option.storeId || ''
  71. },
  72. methods: {
  73. tabChange(item){
  74. this.current=item.index
  75. this.mescroll.resetUpScroll()
  76. },
  77. preview(img, current) {
  78. const urls = img.split(',')
  79. uni.previewImage({
  80. urls,
  81. current
  82. });
  83. },
  84. mescrollInit(mescroll) {
  85. this.mescroll = mescroll;
  86. },
  87. upCallback(page) {
  88. //联网加载数据
  89. var that = this;
  90. var data = {
  91. page: page.num,
  92. pageSize: page.size,
  93. storeId:this.storeId,
  94. orderId:this.orderId,
  95. productIds:this.productIds,
  96. userId: uni.getStorageSync('userId'),
  97. showSelf: this.orderId ? 1 : 0
  98. };
  99. selectCommentByUser(data).then(res => {
  100. if(res.code==200){
  101. //设置列表数据
  102. if (page.num == 1) {
  103. that.dataList = res.data.list;
  104. } else {
  105. that.dataList = that.dataList.concat(res.data.list);
  106. }
  107. that.mescroll.endBySize(res.data.list.length, res.data.total);
  108. }else{
  109. uni.showToast({
  110. icon:'none',
  111. title: "请求失败",
  112. });
  113. that.dataList = null;
  114. that.mescroll.endErr();
  115. }
  116. });
  117. },
  118. }
  119. }
  120. </script>
  121. <style scoped lang="scss">
  122. .top-fixed{
  123. width: 100%;
  124. position: fixed;
  125. top: 0;
  126. left: 0;
  127. z-index: 10;
  128. height: 88upx;
  129. background-color: #fff;
  130. }
  131. .evaluate {
  132. padding: 24rpx;
  133. ::v-deep {
  134. .comment-item {
  135. padding: 24rpx;
  136. border-radius: 16rpx;
  137. }
  138. }
  139. }
  140. </style>