index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="warpbox">
  3. <view class="tablist_new">
  4. <view class="tabtn" @click="changeTab(1)" :class="{'tabtn_active':active == 1}">{{i18n['未评价']}}</view>
  5. <view class="tabtn" @click="changeTab(0)" :class="{'tabtn_active':active == 0}">{{i18n['已评价']}}</view>
  6. </view>
  7. <scroll-view scroll-y class="scrollbox" @scrolltolower="loadMore">
  8. <view class="listwarp">
  9. <progressItem :list="list" :type="type"></progressItem>
  10. </view>
  11. </scroll-view>
  12. </view>
  13. </template>
  14. <script>
  15. import progressItem from './item.vue'
  16. import { netServiceList } from '@/api/api.js'
  17. export default{
  18. components:{
  19. progressItem
  20. },
  21. data() {
  22. return{
  23. page:1,
  24. totalPage:1,
  25. list:[],
  26. type:2, //已评价 2未评价
  27. active:1,
  28. }
  29. },
  30. computed:{
  31. i18n() {
  32. return this.$t("evaluate")
  33. }
  34. },
  35. onShow() {
  36. uni.setNavigationBarTitle({
  37. title: this.i18n['评价']
  38. })
  39. },
  40. onLoad() {
  41. this.init()
  42. },
  43. methods:{
  44. changeTab(e) {
  45. this.active = e
  46. if(this.active == 0) {
  47. this.type = 1
  48. }else{
  49. this.type = 2
  50. }
  51. this.init()
  52. },
  53. init() {
  54. this.page = 1
  55. this.list = []
  56. this.getList()
  57. },
  58. loadMore() {
  59. if(this.page >= this.totalPage) {
  60. return
  61. }
  62. this.page ++
  63. this.getList()
  64. },
  65. getList() {
  66. let params = {
  67. page:this.page,
  68. type:this.type
  69. }
  70. netServiceList(params).then(res=>{
  71. this.list = this.list.concat(res.data.data)
  72. this.totalPage = res.data.last_page
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .scrollbox{
  80. width:750rpx;
  81. height:calc(100vh - 100rpx);
  82. .listwarp{
  83. padding:24rpx;
  84. }
  85. }
  86. </style>