comegl.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="topa flexc">
  5. <image :src="reset" class="resetimg" @click="getReset"></image>
  6. <picker mode="date" @change='bindDateChangea'>
  7. <view class="chekt flexc">
  8. <view>{{cxrq|| "选择日期"}}</view>
  9. <image :src="up"></image>
  10. </view>
  11. </picker>
  12. <view class="search flexc">
  13. <image :src="search"></image>
  14. <!-- confirm-type="search" @confirm="getConfirm" -->
  15. <input placeholder="请输入房号进行搜索" v-model="text"/>
  16. <view class="btn" @click="getConfirm">搜索</view>
  17. </view>
  18. </view>
  19. <view class="tabtop flexc">
  20. <view class="tabt" :class="ttopval==ite.val?'act':''" v-for="(ite,idx) in ttoplist" :key="idx" @click="getTabtop(ite.val)">{{ite.tit}}</view>
  21. </view>
  22. </view>
  23. <!-- 列表 -->
  24. <view class="carlists">
  25. <car-list :datainfo="list" :topval="ttopval" :wtdt="wtdt" type='comepeo'></car-list>
  26. </view>
  27. <view class="rfbtn" @click="getAddFn">添加访客</view>
  28. <loading></loading>
  29. </view>
  30. </template>
  31. <script>
  32. import config from '@/config'
  33. const baseUrl = config.baseUrl
  34. import carList from "@/work/components/car/list.vue"
  35. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  36. export default{
  37. components:{carList},
  38. data(){
  39. return{
  40. reset:require('@/work/static/car/reset.png'),
  41. search:require('@/work/static/car/search.png'),
  42. up:require('@/work/static/car/up.png'),
  43. cxrq:"",
  44. text:'',
  45. list:[{tit:'皖A IC520',type:1},{tit:'晋E KD783',type:2},],
  46. pageSize: 10,
  47. pageNum: 1,
  48. reachflag: true,
  49. wtdt:'',
  50. ttopval:'0',
  51. ttoplist:[{tit:'全部',val:0},{tit:'预约来访',val:1},{tit:'已来访',val:2}]
  52. }
  53. },
  54. onLoad: function() {
  55. },
  56. // 上拉触底加载更多触发事件
  57. onReachBottom() {
  58. if (this.reachflag) {
  59. this.pageNum++
  60. this.getDataFn()
  61. }
  62. },
  63. methods:{
  64. checkPermi, checkRole,
  65. getAddFn(){
  66. this.$tab.navigateTo("/work/pages/people/comeadd")
  67. },
  68. getTabtop(val){
  69. this.ttopval=val
  70. },
  71. getConfirm(){
  72. this.getrefreshData()
  73. },
  74. getReset(){
  75. this.cxrq='';
  76. this.text='';
  77. this.getrefreshData()
  78. },
  79. getrefreshData(){
  80. this.pageNum=1;
  81. this.list=[];
  82. this.reachflag=true;
  83. this.getDataFn()
  84. },
  85. getTabFn(val){
  86. this.tabval=val
  87. },
  88. bindDateChangea(e){
  89. var val=e.detail.value;
  90. this.cxrq=val;
  91. },
  92. getDataFn(){
  93. var params={
  94. pageSize:this.pageSize,
  95. pageNum: this.pageNum,
  96. }
  97. params.noticeType=this.tabidx
  98. getNoticeList(params).then(res=>{
  99. if(res.code==200){
  100. if (res.rows.length < this.pageSize) {
  101. this.reachflag = false
  102. this.wtdt = '到底了~';
  103. } else {
  104. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  105. if (num < res.total) {
  106. this.reachflag = true
  107. this.wtdt = ''
  108. } else {
  109. this.reachflag = false
  110. this.wtdt = '到底了~';
  111. }
  112. }
  113. if (this.pageNum == 1) {
  114. this.list = res.rows;
  115. } else {
  116. this.list = this.list.concat(res.rows)
  117. }
  118. }else{
  119. this.$toast(res.msg)
  120. }
  121. })
  122. },
  123. }
  124. }
  125. </script>
  126. <style>
  127. page{background: #F3F3F0;}
  128. </style>
  129. <style lang="scss" scoped>
  130. .car{padding: 230rpx 0 110rpx;}
  131. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  132. .topa{padding: 20rpx ;
  133. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  134. .chekt{min-width: 180rpx;
  135. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  136. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  137. }
  138. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  139. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  140. input{flex: 1;font-size: 26rpx;color: #272727;}
  141. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  142. font-size: 26rpx;
  143. color: #FFFFFF;}
  144. }
  145. }
  146. .tabtop{padding-bottom: 46rpx;
  147. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;margin-right: 6rpx;
  148. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  149. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  150. }
  151. }
  152. }
  153. }
  154. .carlists{padding: 0 18rpx;}
  155. </style>