house.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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="tabtopa">
  20. <view class="tabtop flexc">
  21. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  22. <view class="tabbtn">未通过审核</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 列表 -->
  27. <view class="carlists">
  28. <car-list :datainfo="list" :wtdt="wtdt" :tabval="tabval" type='comehouse' @getDetail="getDetail" @getPut="getPut" @getJuzhu="getJuzhu" @getDelFn="getDelFn" @getCar="getCar" @getShFn="getShFn"></car-list>
  29. </view>
  30. <view class="cdbtns">
  31. <!-- <view class="btna" @click="getAddFn">单个添加</view>
  32. <view class="btnb" @click="getReplyFn">一键导入</view> -->
  33. <view class="btnb" @click="getAddFn">添加房屋</view>
  34. <!-- <view class="btnb" @click="getReplyFn">一键导入</view> -->
  35. </view>
  36. <loading></loading>
  37. </view>
  38. </template>
  39. <script>
  40. import config from '@/config'
  41. const baseUrl = config.baseUrl
  42. import carList from "@/work/components/car/list.vue"
  43. import {houseInfoList,examineResident,deleteResident} from "@/api/work/work.js"
  44. import {residentInfoList} from "@/api/work/people.js"
  45. import {getDictionaryFn} from "@/api/system/user.js"
  46. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  47. export default{
  48. components:{carList},
  49. data(){
  50. return{
  51. reset:require('@/car/static/car/reset.png'),
  52. search:require('@/car/static/car/search.png'),
  53. up:require('@/car/static/car/up.png'),
  54. cxrq:"",
  55. text:'',
  56. list:[],
  57. pageSize: 10,
  58. pageNum: 1,
  59. reachflag: true,
  60. wtdt:'',
  61. tabval:'-1',
  62. tablist:[{tit:"待审核",val:'-1'}],
  63. fwztList:[],
  64. }
  65. },
  66. onUnload() {
  67. uni.$off('refHouseList')
  68. },
  69. onLoad: function(e) {
  70. uni.$on('refHouseList',(res)=>{
  71. this.getrefreshData()
  72. })
  73. this.init()
  74. this.getDataFn();
  75. },
  76. // 上拉触底加载更多触发事件
  77. onReachBottom() {
  78. if (this.reachflag) {
  79. this.pageNum++
  80. this.getDataFn()
  81. }
  82. },
  83. methods:{
  84. checkPermi, checkRole,
  85. getDelFn(data){
  86. var that=this;
  87. var info=JSON.parse(JSON.stringify(data))
  88. var params={
  89. residentId:info.residentId,
  90. userId:info.userId,
  91. tenantId:info.tenantId,
  92. houseId:info.houseId,
  93. }
  94. deleteResident(params).then(res=>{
  95. if(res.code==200){
  96. this.$toast("删除成功");
  97. setTimeout(function(){
  98. that.getrefreshData()
  99. },1500)
  100. }
  101. })
  102. },
  103. init(){
  104. // 房屋状态
  105. getDictionaryFn('house_status').then(res=>{
  106. if(res.code==200){
  107. this.fwztList = res.data.map(v => {
  108. var obj={
  109. tit: v.dictLabel,
  110. val: v.dictValue
  111. }
  112. this.tablist.push(obj)
  113. return {
  114. dictLabel: v.dictLabel,
  115. dictValue: v.dictValue
  116. }
  117. })
  118. }
  119. })
  120. },
  121. getAddFn(){
  122. this.$tab.navigateTo("/work/pages/manage/houseadd")
  123. },
  124. getDetail(data){
  125. var info=JSON.parse(JSON.stringify(data))
  126. var tabval=this.tabval;
  127. if(tabval=='-1'){
  128. var id=info.residentId
  129. this.$tab.navigateTo(`/work/pages/manage/housedetail?id=${id}`)
  130. }else{
  131. var id=info.houseId
  132. this.$tab.navigateTo(`/work/pages/manage/addhouse?id=${id}`)
  133. }
  134. },
  135. getPut(e){
  136. this.$tab.navigateTo("/work/pages/manage/addhouse?id="+e)
  137. },
  138. getCar(e){
  139. this.$tab.navigateTo("/work/pages/manage/car?id="+e)
  140. },
  141. getShFn(data){
  142. var that=this;
  143. var info=JSON.parse(JSON.stringify(data))
  144. var params=JSON.parse(JSON.stringify(info.ite))
  145. params.examine=info.sh;
  146. examineResident(params).then(res=>{
  147. if(res.code==200){
  148. this.$toast('审核成功')
  149. setTimeout(function() {
  150. that.getrefreshData()
  151. }, 1500);
  152. }
  153. })
  154. },
  155. getJuzhu(e){
  156. var data={
  157. id:e,
  158. type:"house"
  159. }
  160. this.$tab.navigateTo("/people/pages/people/fwindex?data="+encodeURIComponent(JSON.stringify(data)))
  161. },
  162. getTabFn(val){
  163. this.tabval=val;
  164. this.getrefreshData()
  165. },
  166. getConfirm(){
  167. this.getrefreshData()
  168. },
  169. getReset(){
  170. this.cxrq='';
  171. this.text='';
  172. this.getrefreshData()
  173. },
  174. getrefreshData(){
  175. this.pageNum=1;
  176. this.list=[];
  177. this.reachflag=true;
  178. this.getDataFn()
  179. },
  180. bindDateChangea(e){
  181. var val=e.detail.value;
  182. this.cxrq=val;
  183. },
  184. getDataFn(){
  185. var params={
  186. pageSize:this.pageSize,
  187. pageNum: this.pageNum,
  188. }
  189. if(this.tabval!=-1){
  190. params.houseStatus=this.tabval
  191. }
  192. if(this.text){
  193. params.detailedAddress=this.text
  194. }
  195. if(this.tabval==-1){
  196. params.examine=1
  197. residentInfoList(params).then(res=>{
  198. if(res.code==200){
  199. if (res.rows.length < this.pageSize) {
  200. this.reachflag = false
  201. this.wtdt = '到底了~';
  202. } else {
  203. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  204. if (num < res.total) {
  205. this.reachflag = true
  206. this.wtdt = ''
  207. } else {
  208. this.reachflag = false
  209. this.wtdt = '到底了~';
  210. }
  211. }
  212. if (this.pageNum == 1) {
  213. this.list = res.rows;
  214. } else {
  215. this.list = this.list.concat(res.rows)
  216. }
  217. }else{
  218. this.$toast(res.msg)
  219. }
  220. })
  221. }else{
  222. houseInfoList(params).then(res=>{
  223. if(res.code==200){
  224. if (res.rows.length < this.pageSize) {
  225. this.reachflag = false
  226. this.wtdt = '到底了~';
  227. } else {
  228. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  229. if (num < res.total) {
  230. this.reachflag = true
  231. this.wtdt = ''
  232. } else {
  233. this.reachflag = false
  234. this.wtdt = '到底了~';
  235. }
  236. }
  237. if (this.pageNum == 1) {
  238. this.list = res.rows;
  239. } else {
  240. this.list = this.list.concat(res.rows)
  241. }
  242. }else{
  243. this.$toast(res.msg)
  244. }
  245. })
  246. }
  247. },
  248. }
  249. }
  250. </script>
  251. <style>
  252. page{background: #F3F3F0;}
  253. </style>
  254. <style lang="scss" scoped>
  255. .car{padding: 224rpx 0 110rpx;}
  256. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  257. .topa{padding: 20rpx ;
  258. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  259. .chekt{min-width: 180rpx;
  260. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  261. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  262. }
  263. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  264. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  265. input{flex: 1;font-size: 26rpx;color: #272727;}
  266. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  267. font-size: 26rpx;
  268. color: #FFFFFF;}
  269. }
  270. }
  271. .tabtopa{padding-right: 180rpx;position: relative;
  272. .tabtop{padding-bottom: 40rpx;overflow: auto;
  273. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;margin-right: 6rpx;flex: 0 0 auto;
  274. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  275. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  276. }
  277. }
  278. }
  279. .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;}
  280. }
  281. }
  282. .cdbtns{position: fixed;left: 0;right: 0;height: 98rpx;z-index: 2;display: flex;align-items: center;bottom: 0;
  283. view{flex: 1;display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 26rpx;height: 98rpx;
  284. &.btna{background: #FFFFFF;color: #0156FE;}
  285. &.btnb{background: #0156FE;color: #FFFFFF;}
  286. }
  287. }
  288. .carlists{padding: 0 18rpx;}
  289. </style>