contractList.vue 11 KB

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