contractList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <template>
  2. <view>
  3. <u-navbar title="租户管理预警" title-color="#101010">
  4. <view class="slot" style="color: #909399" slot="right"
  5. @click="tenantshowAll">
  6. {{allShow?'全部收起':'全部展开'}}
  7. </view>
  8. </u-navbar>
  9. <u-select ref="refselect" title="" v-model="tabsFrom.show1" :defaultValue="current2"
  10. :list="companyList" value-name="id" label-name="name"
  11. child-name="childList"
  12. mode="mutil-column-auto"
  13. @confirm="selector1confirm" >
  14. </u-select>
  15. <view class="head-head" style="background: #fff;">
  16. <view style="
  17. text-align: center;
  18. display: flex;
  19. align-items: center;
  20. " >
  21. <view style="width: 40%;" @click="tabsFrom.show1=true">
  22. {{device}} <u-icon name="arrow-down" color="#999999"></u-icon>
  23. </view>
  24. <view style="width: 60%;">
  25. <u-search placeholder="请输入关键字" :show-action="false" v-model="keyword"></u-search>
  26. </view>
  27. </view>
  28. <u-tabs :list="listType" v-if="tenantList.length" style="margin-top: 12rpx;" :is-scroll="false" :current="selectType" @change="change" ></u-tabs>
  29. </view>
  30. <view class="head-head-placeholder ">
  31. </view>
  32. <view class="main">
  33. <view class="tenant" v-for="(tenant,i) in tenantList"
  34. @click="tenantshow(tenant)"
  35. v-show="(keyword==''||(tenant.name&&tenant.name.indexOf(keyword)!=-1))&&selectTypeMethod(tenant,selectType)"
  36. :key="i" >
  37. <view class="tenant-name" >
  38. <view class="tenant-name1">
  39. {{tenant.name}}
  40. </view>
  41. <view class="tenant-name2" v-if="tenant.show" >
  42. <u-icon name="arrow-up" color="#909399" ></u-icon>
  43. </view>
  44. <view class="tenant-name2" v-else >
  45. <u-icon name="arrow-down" color="#909399" ></u-icon>
  46. </view>
  47. </view>
  48. <view class="balance">
  49. <view class="title">
  50. <view class="icon">
  51. <image class="img" src="@/assets/img/wallet@3x.png" mode=""></image>
  52. </view>
  53. <view class="text">
  54. 账户余额
  55. <span class="state" v-if="tenant.balance<0">已欠费</span>
  56. </view>
  57. </view>
  58. <view class="balance-number">
  59. <view class="number" :class="{
  60. number2:tenant.balance<0
  61. }" >
  62. {{tenant.balance}}元
  63. </view>
  64. </view>
  65. </view>
  66. <view v-show="tenant.show">
  67. <view class="deadline" v-for="(obj,i) in tenant.tenantContractList" :key="i">
  68. <view class="deadline-item" v-for="(item,i) in obj.contractItemList" :key="i" v-if="item.paymentMethod==1&&item.name!='电费'" >
  69. <view class="item-icon">
  70. <image class="img" v-if="item.name.indexOf('水')>-1" src="@/assets/img/deadline2.png" mode=""></image>
  71. <image class="img" v-else-if="item.name.indexOf('房')>-1||item.name.indexOf('租')>-1" src="@/assets/img/deadline1.png" mode=""></image>
  72. <image class="img" v-else-if="item.name.indexOf('保洁')>-1" src="@/assets/img/deadline4.png" mode=""></image>
  73. <image class="img" v-else-if="item.name.indexOf('物业')>-1" src="@/assets/img/deadline3.png" mode=""></image>
  74. <image class="img" v-else src="@/assets/img/deadline3.png" mode=""></image>
  75. </view>
  76. <view class="date-box" :class="{
  77. stateBl:stateBl(item.prepaidEndTime)
  78. }">
  79. <view class="classify">
  80. {{item.name}}
  81. </view>
  82. <view class="classify">
  83. <span class="state" v-if="item.prepaidEndTime&&stateBl(item.prepaidEndTime)">已到期</span>
  84. <span class="state" v-if="!item.prepaidEndTime">未交费</span>
  85. </view>
  86. <view class="date" v-if="item.prepaidEndTime">
  87. 已缴费至 <text class="state">{{item.prepaidEndTime}}</text>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="remark" >
  92. <view class="item" style=" display: flex; justify-content: space-between;">
  93. <view>
  94. 自动扣费:<span style="color:#5aa867 ;" v-if="obj.autoDeductFee">是</span>
  95. <span style="color:#ee3138 ;" v-else>否</span>
  96. </view>
  97. <view v-if="tenant.minBalance">
  98. 余额提醒:<span :style="tenant.minBalance<tenant.balance?'color:#5aa867 ;':'color:#ee3138 ;'" >{{tenant.minBalance}}元</span>
  99. </view>
  100. </view>
  101. <view class="item" v-if="obj.address">
  102. 租住地址:{{obj.address}}
  103. </view>
  104. <view class="item">
  105. 租赁期:{{thisparseUnixTime(obj.contractStartTime)}} 至 {{thisparseUnixTime(obj.contractEndTime)}}
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <u-divider :isnone="listType[selectType].count==0" nonetext="无记录"
  113. border-color="#CFD2D5">已经到底了</u-divider>
  114. </view>
  115. </template>
  116. <script>
  117. import * as API_index from '@/apis/pagejs/index.js'
  118. import * as API from '@/apis/pagejs/tenantList.js'
  119. import {
  120. newDate,parseUnixTime
  121. } from '@/apis/utils'
  122. export default {
  123. data() {
  124. return {
  125. device: '全部设备',
  126. allShow:false,
  127. tenantList:[],
  128. getTenantListReady:false,
  129. keyword:"",
  130. selectType:0,
  131. num1:0,
  132. num2:0,
  133. num3:0,
  134. num4:0,
  135. current2:[0,0],
  136. tabsFrom: {
  137. show1: false,
  138. show1Index: 0,
  139. show2Index: '',
  140. show2: false,
  141. show1Text: "全部类型",
  142. show2Text: "全部时间",
  143. },
  144. companyList:[],
  145. companyId:"",
  146. sp:0,
  147. listType: [{
  148. name: '全部'
  149. }, {
  150. name: '余额不足'
  151. }, {
  152. name: '即将到期',
  153. count: 0
  154. }, {
  155. name: '已过期',
  156. count: 0
  157. }],
  158. }
  159. },
  160. onLoad(op){
  161. if(op.query){
  162. this.selectType=op.query;
  163. }
  164. if(op.companyId){
  165. this.companyId=op.companyId
  166. }
  167. this.getCompanyInfoList()
  168. },
  169. onReady() {
  170. // this.current=1
  171. },
  172. methods: {
  173. selector1confirm(e){
  174. var index = [e[0].i,e[1].i]
  175. console.log(e)
  176. this.companyId=e[1].value
  177. this.device=e[1].label
  178. this.sp=e[1].i==0?1:0
  179. this.current2=index
  180. this.getTenantList()
  181. },
  182. getCompanyInfoList() {
  183. this.companyKwhList = [];
  184. API_index.deviceCompanyList().then((response) => {
  185. var list1 = response.data.companyInfoList;
  186. var list=[]
  187. for(var i in list1){
  188. var obj=list1[i]
  189. if(obj.type==5){
  190. list.push(obj)
  191. }
  192. }
  193. // if(list.length==1&&list[0].childList&&list[0].childList.length){
  194. // list=list[0].childList
  195. // }
  196. for(var i in list){
  197. var obj=list[i]
  198. // if(!list.childList){
  199. // list.childList=[]
  200. // }
  201. list[i].childList.unshift({
  202. id:obj.id,
  203. name:list.length>1?obj.name:'全部设备',
  204. sp:1
  205. })
  206. }
  207. if(list.length>1){
  208. list.unshift({
  209. id:'',
  210. name:"全部",
  211. childList:[
  212. {
  213. id:'',
  214. name:"全部设备"
  215. }
  216. ]
  217. })
  218. }
  219. if(list.length==1){
  220. this.companyId=list[0].id
  221. }
  222. for(var i in list){
  223. var obj=list[i]
  224. if(this.companyId){
  225. for(var j in list[i].childList){
  226. var item=list[i].childList[j]
  227. if(item.id==this.companyId){
  228. //this.current2=[i,j]
  229. this.sp=j==0?1:0
  230. this.device=item.name
  231. }
  232. }
  233. }
  234. }
  235. this.companyList = list;
  236. //this.$refs.refselect.setSelectValue()
  237. this.getTenantList()
  238. }).catch(error => {
  239. uni.showToast({
  240. title: error,
  241. icon: "none"
  242. })
  243. })
  244. },
  245. tenantshowAll(item){
  246. this.allShow=!this.allShow
  247. for(var i in this.tenantList){
  248. var obj=this.tenantList[i]
  249. obj.show=this.allShow
  250. }
  251. this.$forceUpdate()
  252. },
  253. tenantshow(item){
  254. item.show=!item.show
  255. this.$forceUpdate()
  256. },
  257. change(index) {
  258. uni.pageScrollTo({
  259. scrollTop: 0, // 设置一个足够大的值,确保滚动到最底部
  260. duration: 300 // 滚动动画时长,单位ms
  261. });
  262. this.selectType = index;
  263. },
  264. selectTypeMethod(tenant,selectType){
  265. var selectType1=selectType;
  266. // if(selectType){
  267. // selectType1=selectType;
  268. // }
  269. // if(selectType1==1){
  270. // return tenant.balance<100
  271. // }
  272. if(true){
  273. var bl=false;
  274. for(var j in tenant.tenantContractList){
  275. var tenant1=tenant.tenantContractList[j]
  276. for(var k in tenant1.contractItemList){
  277. var item=tenant1.contractItemList[k]
  278. //console.log(item.prepaidEndTime)
  279. // if(tenant1.autoDeductFee!=true){
  280. // console.log(tenant.name)
  281. // continue;
  282. // }
  283. if(selectType1==0){
  284. bl=true
  285. }
  286. if(selectType1==1){
  287. if(tenant1.autoDeductFee!=true){
  288. continue;
  289. }
  290. return tenant.balance<tenant.minBalance
  291. }
  292. if(item.paymentMethod==1&&item.name!='电费'){
  293. if(selectType1==2){
  294. if(item.prepaidEndTime&&this.stateBl(item.prepaidEndTime,30)){
  295. bl=true;
  296. }
  297. }
  298. if(selectType1==3){
  299. if(item.prepaidEndTime&&this.stateBl(item.prepaidEndTime)){
  300. bl=true;
  301. }
  302. if(item.prepaidEndTime==null){
  303. bl=true;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. return bl
  310. }
  311. },
  312. thisparseUnixTime(time){
  313. return parseUnixTime(newDate(time),'{y}年{m}月{d}日')
  314. },
  315. stateBl(timekey,day){
  316. var get=newDate(timekey)
  317. var time=new Date()
  318. if(!day){
  319. return time>get;
  320. }else{
  321. var get2=newDate(timekey)
  322. get2.setDate(get2.getDate() - day)
  323. return get2<time&&get>time;
  324. }
  325. },
  326. getTenantList(){
  327. uni.showLoading({
  328. title: "加载中",
  329. mask: true,
  330. })
  331. this.num1=0
  332. this.num2=0
  333. this.num3=0
  334. this.num4=0
  335. API.tenantContractList({
  336. companyId:this.companyId,
  337. queryParent:this.sp?1:0,
  338. }).then((response) => {
  339. uni.hideLoading();
  340. this.getTenantListReady=true
  341. this.tenantList=response.data.tenantInfoList;
  342. //this.num1=this.tenantList.length
  343. for(var i in this.tenantList){
  344. var obj=this.tenantList[i]
  345. obj.show=false
  346. if(this.selectTypeMethod(obj,0)){
  347. this.num1++;
  348. }
  349. if(this.selectTypeMethod(obj,1)){
  350. this.num2++;
  351. }
  352. if(this.selectTypeMethod(obj,2)){
  353. this.num3++;
  354. }
  355. if(this.selectTypeMethod(obj,3)){
  356. this.num4++;
  357. }
  358. }
  359. this.listType[0].count=this.num1
  360. this.listType[1].count=this.num2
  361. this.listType[2].count=this.num3
  362. this.listType[3].count=this.num4
  363. }).catch(error => {
  364. uni.showToast({
  365. title: error,
  366. icon: "none"
  367. })
  368. })
  369. }
  370. }
  371. }
  372. </script>
  373. <style lang="scss" scoped>
  374. .main{
  375. margin-top: 24rpx;
  376. .tenant{
  377. background-color: #fff;
  378. color: rgba(51,51,51,1);
  379. font-size: 32rpx;
  380. margin: 24rpx;
  381. border-radius: 8px;
  382. .tenant-name{
  383. font-size: 40rpx;
  384. font-weight: bold;
  385. padding:24rpx 24rpx 12rpx 24rpx;
  386. display: flex;
  387. justify-content: space-between;
  388. .tenant-name2{
  389. width: 50rpx;
  390. }
  391. }
  392. }
  393. }
  394. .balance{
  395. padding: 12rpx 24rpx;
  396. border-bottom: 1px solid #F4F4F4;
  397. display: flex;
  398. justify-content: space-between;
  399. }
  400. .title {
  401. display: flex;
  402. .icon {
  403. width: 40rpx;
  404. height: 40rpx;
  405. .img {
  406. width: 100%;
  407. height: 100%;
  408. }
  409. }
  410. .text {
  411. margin-left: 16rpx;
  412. color: rgba(51, 51, 51, 1);
  413. font-size: 32rpx;
  414. font-weight: bold;
  415. .state {
  416. white-space: pre;
  417. margin-left: 16rpx;
  418. color: rgba(238, 49, 56, 1);
  419. }
  420. }
  421. }
  422. .balance-number {
  423. // display: flex;
  424. // align-items: center;
  425. // justify-content: space-between;
  426. // margin-top: 16rpx;
  427. // margin-left: 56rpx;
  428. .number2 {
  429. color: rgba(238, 49, 56, 1);
  430. }
  431. .number {
  432. //font-size: 56rpx;
  433. font-weight: bold;
  434. }
  435. .recharge {
  436. width: 144rpx;
  437. height: 56rpx;
  438. line-height: 56rpx;
  439. border-radius: 50px;
  440. background: linear-gradient(85.19deg, rgba(255, 61, 0, 1) 4.89%, rgba(255, 123, 0, 1) 95.37%);
  441. color: rgba(255, 255, 255, 1);
  442. text-align: center;
  443. }
  444. }
  445. // 期限
  446. .deadline {
  447. display: flex;
  448. flex-wrap: wrap;
  449. .remark{
  450. font-size: 24rpx;
  451. padding: 24rpx ;
  452. }
  453. .deadline-item:first-of-type{
  454. //border-top: 1px solid #F4F4F4;
  455. }
  456. .deadline-item:last-of-type{
  457. // border-left: 1px solid #F4F4F4;
  458. }
  459. .deadline-item {
  460. border-bottom: 1px solid #F4F4F4;
  461. border-right: 1px solid #F4F4F4;
  462. width: 50%;
  463. display: flex;
  464. padding: 24rpx ;
  465. .item-icon {
  466. width: 40rpx;
  467. height: 40rpx;
  468. margin-right: 12rpx;
  469. .img {
  470. width: 100%;
  471. height: 100%;
  472. vertical-align: middle;
  473. }
  474. }
  475. .stateBl{
  476. .state {
  477. // white-space: pre;
  478. color: rgba(238, 49, 56, 1);
  479. }
  480. }
  481. .date-box {
  482. .state {
  483. white-space: pre;
  484. //color: rgba(238, 49, 56, 1);
  485. }
  486. text{
  487. margin-left: 8rpx;
  488. }
  489. .classify {
  490. color: rgba(51, 51, 51, 1);
  491. font-size: 32rpx;
  492. font-weight: bold;
  493. }
  494. .date{
  495. color: rgba(51,51,51,1);
  496. font-size: 24rpx;
  497. margin-top: 4rpx;
  498. }
  499. }
  500. }
  501. }
  502. .head-head{
  503. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.15);
  504. padding:24rpx;
  505. position: fixed;
  506. left: 0;
  507. right: 0;
  508. top: 80rpx;
  509. z-index: 991;
  510. .head-body{
  511. margin-top: 32rpx;
  512. display: flex;
  513. justify-content: space-around;
  514. .head-btn{
  515. text-align: center;
  516. width: 31%;
  517. padding: 12rpx;
  518. border: 1px solid #f2f2f2;
  519. background-color:#f2f2f2 ;
  520. border-radius: 6px;
  521. span{
  522. margin-left: 4rpx;
  523. }
  524. }
  525. .head-select{
  526. border: 1px solid #1677FF;
  527. background-color:#1677FF ;
  528. color: #fff;
  529. }
  530. }
  531. }
  532. .head-head-placeholder{
  533. height: 200rpx;
  534. }
  535. .slot{
  536. display: flex;
  537. align-items: center;
  538. .img{
  539. width: 48rpx;
  540. height: 48rpx;
  541. margin-right: 4rpx;
  542. }
  543. }
  544. </style>