house.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="car">
  3. <!-- 列表 -->
  4. <view class="carlists">
  5. <box-list :datainfo="list" :wtdt="wtdt" type='comehouse' @getDetail="getDetail" ></box-list>
  6. </view>
  7. <loading></loading>
  8. </view>
  9. </template>
  10. <script>
  11. import config from '@/config'
  12. const baseUrl = config.baseUrl
  13. import boxList from "@/mine/components/box/list.vue"
  14. import {houseInfoList} from "@/api/work/work.js"
  15. import {getDictionaryFn} from "@/api/system/user.js"
  16. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  17. export default{
  18. components:{boxList},
  19. data(){
  20. return{
  21. text:'',
  22. list:[],
  23. pageSize: 10,
  24. pageNum: 1,
  25. reachflag: true,
  26. wtdt:'',
  27. fwztList:[],
  28. userId:this.$store.state.user.userId,
  29. }
  30. },
  31. onUnload() {
  32. uni.$off('refHouseList')
  33. },
  34. onLoad: function(e) {
  35. uni.$on('refHouseList',(res)=>{
  36. this.getrefreshData()
  37. })
  38. this.init()
  39. this.getDataFn();
  40. },
  41. // 上拉触底加载更多触发事件
  42. onReachBottom() {
  43. if (this.reachflag) {
  44. this.pageNum++
  45. this.getDataFn()
  46. }
  47. },
  48. methods:{
  49. checkPermi, checkRole,
  50. init(){
  51. // 房屋状态
  52. // getDictionaryFn('house_status').then(res=>{
  53. // if(res.code==200){
  54. // this.fwztList = res.data.map(v => {
  55. // var obj={
  56. // tit: v.dictLabel,
  57. // val: v.dictValue
  58. // }
  59. // this.tablist.push(obj)
  60. // return {
  61. // dictLabel: v.dictLabel,
  62. // dictValue: v.dictValue
  63. // }
  64. // })
  65. // }
  66. // })
  67. },
  68. getAddFn(){
  69. this.$tab.navigateTo("/mine/pages/house/addhouse")
  70. },
  71. getDetail(e){
  72. this.$tab.navigateTo(`/mine/pages/house/housedetail?id=${e}`)
  73. },
  74. getrefreshData(){
  75. this.pageNum=1;
  76. this.list=[];
  77. this.reachflag=true;
  78. this.getDataFn()
  79. },
  80. getDataFn(){
  81. var params={
  82. pageSize:this.pageSize,
  83. pageNum: this.pageNum,
  84. userId:this.userId
  85. }
  86. houseInfoList(params).then(res=>{
  87. if(res.code==200){
  88. if (res.rows.length < this.pageSize) {
  89. this.reachflag = false
  90. this.wtdt = '到底了~';
  91. } else {
  92. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  93. if (num < res.total) {
  94. this.reachflag = true
  95. this.wtdt = ''
  96. } else {
  97. this.reachflag = false
  98. this.wtdt = '到底了~';
  99. }
  100. }
  101. if (this.pageNum == 1) {
  102. this.list = res.rows;
  103. } else {
  104. this.list = this.list.concat(res.rows)
  105. }
  106. }else{
  107. this.$toast(res.msg)
  108. }
  109. })
  110. },
  111. }
  112. }
  113. </script>
  114. <style>
  115. page{background: #F3F3F0;}
  116. </style>
  117. <style lang="scss" scoped>
  118. .car{padding: 24rpx 0 10rpx;}
  119. .carlists{padding: 0 18rpx;}
  120. </style>