vlist.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view class="car">
  3. <!-- 列表 -->
  4. <view class="carlists">
  5. <box-list :datainfo="list" :fkztList="fkztList" :wtdt="wtdt" type='visitor' @getDetail="getDetail" @getDelFn="getDelFn"></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 "@/work/components/box/list.vue"
  14. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  15. import {reservList,reservDel} from "@/api/work/people.js"
  16. import {getDictionaryFn} from "@/api/system/user.js"
  17. export default{
  18. components:{boxList},
  19. data(){
  20. return{
  21. // reset:require('@/work/static/car/reset.png'),
  22. // search:require('@/work/static/car/search.png'),
  23. // up:require('@/work/static/car/up.png'),
  24. cxrq:"",
  25. text:'',
  26. list:[],
  27. pageSize: 10,
  28. pageNum: 1,
  29. reachflag: true,
  30. wtdt:'',
  31. fkztList:[],
  32. portalId:'5'
  33. }
  34. },
  35. onLoad: function(e) {
  36. // this.portalId=e.houseId
  37. this.init()
  38. this.getDataFn()
  39. },
  40. // 上拉触底加载更多触发事件
  41. onReachBottom() {
  42. if (this.reachflag) {
  43. this.pageNum++
  44. this.getDataFn()
  45. }
  46. },
  47. methods:{
  48. checkPermi, checkRole,
  49. getDetail(id){
  50. this.$tab.navigateTo("/work/pages/visitor/vdetail?id="+id)
  51. },
  52. init(){
  53. // 访客状态
  54. getDictionaryFn('yuyetype').then(res=>{
  55. if(res.code==200){
  56. this.fkztList = res.data.map(v => {
  57. return {
  58. dictLabel: v.dictLabel,
  59. dictValue: v.dictValue
  60. }
  61. })
  62. }
  63. })
  64. },
  65. getConfirm(){
  66. this.getrefreshData()
  67. },
  68. getReset(){
  69. this.cxrq='';
  70. this.text='';
  71. this.getrefreshData()
  72. },
  73. getrefreshData(){
  74. this.pageNum=1;
  75. this.list=[];
  76. this.reachflag=true;
  77. this.getDataFn()
  78. },
  79. getTabFn(val){
  80. this.tabval=val
  81. },
  82. bindDateChangea(e){
  83. var val=e.detail.value;
  84. this.cxrq=val;
  85. },
  86. getDelFn(data){
  87. var that=this;
  88. reservDel(data).then(res=>{
  89. if(res.code==200){
  90. this.$toast("删除成功");
  91. setTimeout(function(){
  92. that.getrefreshData()
  93. },1500)
  94. }
  95. })
  96. },
  97. getDataFn(){
  98. var params={
  99. pageSize:this.pageSize,
  100. pageNum: this.pageNum,
  101. portalId:this.portalId
  102. }
  103. reservList(params).then(res=>{
  104. if(res.code==200){
  105. if (res.rows.length < this.pageSize) {
  106. this.reachflag = false
  107. this.wtdt = '到底了~';
  108. } else {
  109. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  110. if (num < res.total) {
  111. this.reachflag = true
  112. this.wtdt = ''
  113. } else {
  114. this.reachflag = false
  115. this.wtdt = '到底了~';
  116. }
  117. }
  118. var newArr=JSON.parse(JSON.stringify(res.rows))
  119. newArr.forEach(ite=>{
  120. ite.right=0;
  121. })
  122. if (this.pageNum == 1) {
  123. this.list = newArr;
  124. } else {
  125. this.list = this.list.concat(newArr)
  126. }
  127. }else{
  128. this.$toast(res.msg)
  129. }
  130. })
  131. },
  132. }
  133. }
  134. </script>
  135. <style>
  136. page{background: #F3F3F0;}
  137. </style>
  138. <style lang="scss" scoped>
  139. .car{padding: 24rpx 0 10rpx;}
  140. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  141. .topa{padding: 20rpx ;
  142. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  143. .chekt{min-width: 180rpx;
  144. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  145. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  146. }
  147. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  148. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  149. input{flex: 1;font-size: 26rpx;color: #272727;}
  150. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  151. font-size: 26rpx;
  152. color: #FFFFFF;}
  153. }
  154. }
  155. .tabtop{padding-bottom: 40rpx;padding-top: 26rpx;
  156. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;
  157. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  158. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  159. }
  160. }
  161. }
  162. }
  163. .carlists{padding: 0 18rpx;}
  164. </style>