<template> <view class="car"> <view class="cartop"> <view class="topa flexc"> <!-- <image :src="reset" class="resetimg" @click="getReset"></image> <picker mode="date" @change='bindDateChangea'> <view class="chekt flexc"> <view>{{cxrq|| "选择日期"}}</view> <image :src="up"></image> </view> </picker> --> <view class="search flexc"> <image :src="search"></image> <!-- confirm-type="search" @confirm="getConfirm" --> <input placeholder="请输入户号进行搜索" v-model="text"/> <view class="btn" @click="getConfirm">搜索</view> </view> </view> <view class="tabtopa"> <view class="tabtop flexc"> <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view> <view class="tabbtn" :class="tabval=='wtg'?'act':''" @click="getTabFn('wtg')">未通过审核</view> </view> </view> </view> <!-- 列表 --> <view class="carlists"> <car-list :datainfo="list" :wtdt="wtdt" :tabval="tabval" :rylxList="rylxList" type='comehouse' @getDetail="getDetail" @getPut="getPut" @getJuzhu="getJuzhu" @getDelFn="getDelFn" @getCar="getCar" @getShFn="getShFn"></car-list> </view> <view class="cdbtns"> <!-- <view class="btna" @click="getAddFn">单个添加</view> <view class="btnb" @click="getReplyFn">一键导入</view> --> <view class="btnb" @click="getAddFn">添加房屋</view> <!-- <view class="btnb" @click="getReplyFn">一键导入</view> --> </view> <loading></loading> </view> </template> <script> import config from '@/config' const baseUrl = config.baseUrl import carList from "@/work/components/car/list.vue" import {houseInfoList,examineResident,deleteResident,houseInfowyList} from "@/api/work/work.js" import {residentInfoList} from "@/api/work/people.js" import {getDictionaryFn} from "@/api/system/user.js" import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数 export default{ components:{carList}, data(){ return{ reset:require('@/car/static/car/reset.png'), search:require('@/car/static/car/search.png'), up:require('@/car/static/car/up.png'), cxrq:"", text:'', list:[], pageSize: 10, pageNum: 1, reachflag: true, wtdt:'', tabval:'-1', tablist:[{tit:"待审核",val:'-1'},{tit:"全部",val:'-2'}], fwztList:[], rylxList:[], } }, onUnload() { uni.$off('refHouseList') }, onLoad: function(e) { uni.$on('refHouseList',(res)=>{ this.getrefreshData() }) this.init() this.getDataFn(); }, // 上拉触底加载更多触发事件 onReachBottom() { if (this.reachflag) { this.pageNum++ this.getDataFn() } }, methods:{ checkPermi, checkRole, getDelFn(data){ var that=this; var info=JSON.parse(JSON.stringify(data)) var params={ residentId:info.residentId, userId:info.userId, tenantId:info.tenantId, houseId:info.houseId, examine:info.examine, } deleteResident(params).then(res=>{ if(res.code==200){ this.$toast("删除成功"); setTimeout(function(){ that.getrefreshData() },1500) } }) }, init(){ // 房屋状态 getDictionaryFn('house_status').then(res=>{ if(res.code==200){ this.fwztList = res.data.map(v => { var obj={ tit: v.dictLabel, val: v.dictValue } this.tablist.push(obj) return { dictLabel: v.dictLabel, dictValue: v.dictValue } }) } }) //人员类型 getDictionaryFn('resident_Type').then(res=>{ if(res.code==200){ this.rylxList = res.data.map(v => { return { dictLabel: v.dictLabel, dictValue: v.dictValue } }) } }) }, getAddFn(){ this.$tab.navigateTo("/work/pages/manage/houseadd") }, getDetail(data){ var info=JSON.parse(JSON.stringify(data)) var tabval=this.tabval; if(tabval=='-1'||tabval=='wtg'){ var id=info.residentId this.$tab.navigateTo(`/work/pages/manage/housedetail?id=${id}`) }else{ var id=info.houseId this.$tab.navigateTo(`/work/pages/manage/addhouse?id=${id}`) } }, getPut(e){ this.$tab.navigateTo("/work/pages/manage/addhouse?id="+e) }, getCar(e){ this.$tab.navigateTo("/work/pages/manage/car?id="+e) }, getShFn(data){ var that=this; var info=JSON.parse(JSON.stringify(data)) var params=JSON.parse(JSON.stringify(info.ite)) params.examine=info.sh; examineResident(params).then(res=>{ if(res.code==200){ this.$toast('审核成功') setTimeout(function() { that.getrefreshData() }, 1500); } }) }, getJuzhu(e){ var data={ id:e, type:"house" } this.$tab.navigateTo("/people/pages/people/fwindex?data="+encodeURIComponent(JSON.stringify(data))) }, getTabFn(val){ this.tabval=val; this.getrefreshData() }, getConfirm(){ this.getrefreshData() }, getReset(){ this.cxrq=''; this.text=''; this.getrefreshData() }, getrefreshData(){ this.pageNum=1; this.list=[]; this.reachflag=true; this.getDataFn() }, bindDateChangea(e){ var val=e.detail.value; this.cxrq=val; }, getDataFn(){ var params={ pageSize:this.pageSize, pageNum: this.pageNum, } if(this.tabval!=-1&&this.tabval!='wtg'&&this.tabval!=-2){ params.houseStatus=this.tabval } if(this.text){ params.detailedAddress=this.text } if(this.tabval==-1||this.tabval=='wtg'){ if(this.tabval=='wtg'){ params.examine=3 }else{ params.examine=1 } residentInfoList(params).then(res=>{ if(res.code==200){ if (res.rows.length < this.pageSize) { this.reachflag = false this.wtdt = '到底了~'; } else { var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1) if (num < res.total) { this.reachflag = true this.wtdt = '' } else { this.reachflag = false this.wtdt = '到底了~'; } } if (this.pageNum == 1) { this.list = res.rows; } else { this.list = this.list.concat(res.rows) } }else{ this.$toast(res.msg) } }) }else{ houseInfowyList(params).then(res=>{ if(res.code==200){ if (res.rows.length < this.pageSize) { this.reachflag = false this.wtdt = '到底了~'; } else { var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1) if (num < res.total) { this.reachflag = true this.wtdt = '' } else { this.reachflag = false this.wtdt = '到底了~'; } } if (this.pageNum == 1) { this.list = res.rows; } else { this.list = this.list.concat(res.rows) } }else{ this.$toast(res.msg) } }) } }, } } </script> <style> page{background: #F3F3F0;} </style> <style lang="scss" scoped> .car{padding: 224rpx 0 110rpx;} .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2; .topa{padding: 20rpx ; .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;} .chekt{min-width: 180rpx; view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;} image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;} } .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box; image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;} input{flex: 1;font-size: 26rpx;color: #272727;} .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx; font-size: 26rpx; color: #FFFFFF;} } } .tabtopa{padding-right: 180rpx;position: relative; .tabtop{padding-bottom: 40rpx;overflow: auto; .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;margin-right: 6rpx;flex: 0 0 auto; &.act{font-weight: bold;font-size: 32rpx;color: #272727; &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;} } } } .tabbtn{border-radius: 58rpx 0 0 58rpx;background: #E6E6E6;padding: 0 18rpx 0 26rpx;font-weight: 500;font-size: 26rpx;color: #3565ED;line-height: 58rpx;position: absolute;right: 0;top: 0; &.act{ &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;} } } } } .cdbtns{position: fixed;left: 0;right: 0;height: 98rpx;z-index: 2;display: flex;align-items: center;bottom: 0; view{flex: 1;display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 26rpx;height: 98rpx; &.btna{background: #FFFFFF;color: #0156FE;} &.btnb{background: #0156FE;color: #FFFFFF;} } } .carlists{padding: 0 18rpx;} </style>