home.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <div class="page_info">
  3. <div class="info_bg">
  4. <van-row align="center" class="bg_title">
  5. <van-col>
  6. <van-image
  7. :src="require('@/assets/position.svg')"
  8. width="16"
  9. height="16"
  10. fit="contain"
  11. />
  12. <span>{{ name }}</span>
  13. <van-image
  14. :src="require('@/assets/arrow-right.svg')"
  15. width="24"
  16. height="24"
  17. fit="contain"
  18. />
  19. </van-col>
  20. <van-col @click="toPath">
  21. <van-image
  22. :src="require('@/assets/user.svg')"
  23. width="16"
  24. height="16"
  25. fit="contain"
  26. />
  27. </van-col>
  28. </van-row>
  29. </div>
  30. <!-- 维修工没有此块功能 -->
  31. <template v-if="role != 3">
  32. <div class="info_function">
  33. <div
  34. class="function_item"
  35. v-for="(item, index) in functionList"
  36. :key="index"
  37. :style="{ display: !item.role.includes(role) ? 'none' : '' }"
  38. >
  39. <template v-if="item.role.includes(role)">
  40. <van-image :src="item.src" width="36" height="36" fit="contain" />
  41. <span>{{ item.label }}</span>
  42. </template>
  43. </div>
  44. </div>
  45. </template>
  46. <div class="info_list">
  47. <!-- 实时巡检begin -->
  48. <van-row align="center" justify="space-between" class="sub_title">
  49. <van-col class="title">实时巡检</van-col>
  50. <van-col class="function_btn">
  51. <van-col>立即巡检</van-col>
  52. <van-image
  53. :src="require('@/assets/btn-arrow-right.svg')"
  54. width="24"
  55. height="24"
  56. fit="contain"
  57. />
  58. </van-col>
  59. </van-row>
  60. <van-row align="center" justify="space-between" class="list_item">
  61. <van-row
  62. align="center"
  63. justify="space-between"
  64. style="flex-direction: column"
  65. v-for="(item, index) in checkList"
  66. :key="item + '_' + index"
  67. >
  68. <van-col>{{ item.label }}</van-col>
  69. <v-count-up
  70. :end-val="Number(item['count'])"
  71. class="count_up"
  72. :options="item['options']"
  73. />
  74. </van-row>
  75. </van-row>
  76. <!-- 实时巡检end -->
  77. <!-- 工单待办begin -->
  78. <van-row align="center" justify="space-between" class="sub_title">
  79. <van-col class="title">工单待办</van-col>
  80. <van-col class="function_btn">
  81. <van-col>立即处理</van-col>
  82. <van-image
  83. :src="require('@/assets/btn-arrow-right.svg')"
  84. width="24"
  85. height="24"
  86. fit="contain"
  87. />
  88. </van-col>
  89. </van-row>
  90. <van-row align="center" justify="space-between" class="list_item">
  91. <van-row
  92. align="center"
  93. justify="space-between"
  94. style="flex-direction: column"
  95. v-for="(item, index) in workList"
  96. :key="item + '_' + index"
  97. >
  98. <van-col>{{ item.label }}</van-col>
  99. <v-count-up
  100. :end-val="Number(item['count'])"
  101. class="count_up"
  102. :options="item['options']"
  103. />
  104. </van-row>
  105. </van-row>
  106. <!-- 工单待办end -->
  107. <!-- 设备异常begin -->
  108. <van-row align="center" justify="space-between" class="sub_title">
  109. <van-col class="title">工单待办</van-col>
  110. <van-col class="function_btn">
  111. <van-col>立即处理</van-col>
  112. <van-image
  113. :src="require('@/assets/btn-arrow-right.svg')"
  114. width="24"
  115. height="24"
  116. fit="contain"
  117. />
  118. </van-col>
  119. </van-row>
  120. <van-row align="center" justify="space-between" class="list_item">
  121. <van-row
  122. align="center"
  123. justify="space-between"
  124. style="flex-direction: column"
  125. >
  126. <van-col>{{ abnormalNum.label }}</van-col>
  127. <v-count-up
  128. :end-val="Number(abnormalNum['count'])"
  129. class="count_up"
  130. />
  131. </van-row>
  132. <van-row
  133. align="center"
  134. justify="space-between"
  135. style="flex-direction: column"
  136. v-for="(item, index) in deviceErrorList"
  137. :key="item + '_' + index"
  138. >
  139. <van-col>{{ item.label }}</van-col>
  140. <v-count-up
  141. :end-val="Number(item['count'])"
  142. class="count_up"
  143. />
  144. </van-row>
  145. </van-row>
  146. <van-row align="center" justify="space-between" class="sub_title">
  147. <van-col class="title">欠费待收</van-col>
  148. <van-col class="function_btn">
  149. <van-col>立即处理</van-col>
  150. <van-image
  151. :src="require('@/assets/btn-arrow-right.svg')"
  152. width="24"
  153. height="24"
  154. fit="contain"
  155. />
  156. </van-col>
  157. </van-row>
  158. <div class="list_table">
  159. <van-row class="billTit" style="padding-bottom:10px">
  160. <van-col span="8">欠费类型</van-col>
  161. <van-col span="8">欠费租户数</van-col>
  162. <van-col span="8">累计欠费</van-col>
  163. </van-row>
  164. <van-row v-for="(item,index) in billPaymentList" :key="index" class="billList">
  165. <van-col span="8" class="billTit">{{item.payType}}</van-col>
  166. <van-col span="8" class="billAmount">{{item.arrearageNum}}</van-col>
  167. <van-col span="8" class="billAmount">{{item.arrearageAmount}}</van-col>
  168. </van-row>
  169. </div>
  170. <!-- 欠费待收end -->
  171. </div>
  172. </div>
  173. <!-- 底部tabbar -->
  174. <van-tabbar
  175. v-model="activeTabBar"
  176. active-color="#2E69EB"
  177. inactive-color="#333333"
  178. safe-area-inset-bottom
  179. >
  180. <van-tabbar-item
  181. name="home"
  182. :icon="
  183. activeTabBar == 'home'
  184. ? require('@/assets/home-active.svg')
  185. : require('@/assets/home.svg')
  186. "
  187. to="/home"
  188. >首页</van-tabbar-item
  189. >
  190. <van-tabbar-item
  191. name="rentBill"
  192. :icon="
  193. activeTabBar == 'rentBill'
  194. ? require('@/assets/rent-bill-active.svg')
  195. : require('@/assets/rent-bill.svg')
  196. "
  197. to="/rentBill"
  198. >租户账单</van-tabbar-item
  199. >
  200. <van-tabbar-item
  201. name="remoteControl"
  202. :icon="
  203. activeTabBar == 'remoteControl'
  204. ? require('@/assets/remote-control-active.svg')
  205. : require('@/assets/remote-control.svg')
  206. "
  207. to="/remoteControl"
  208. >远程管控</van-tabbar-item
  209. >
  210. </van-tabbar>
  211. </template>
  212. <script>
  213. import { isEmpty } from "@/utils/index.js";
  214. import api from "../utils/api";
  215. import VCountUp from "./CountUp";
  216. export default {
  217. components: {
  218. "v-count-up": VCountUp,
  219. },
  220. data() {
  221. return {
  222. role: 1, //1:admin、2:巡检人员、3:维修工、4:租户
  223. name: "电商园四期-B座",
  224. activeTabBar: "home",
  225. functionList: [
  226. {
  227. src: require("@/assets/repair-online.svg"),
  228. label: "线上报修",
  229. role: [1, 2, 4],
  230. },
  231. {
  232. src: require("@/assets/check-review.svg"),
  233. label: "巡检记录",
  234. role: [1, 2],
  235. },
  236. {
  237. src: require("@/assets/reduce-record.svg"),
  238. label: "扣缴记录",
  239. role: [1, 4],
  240. },
  241. ],
  242. checkList: [
  243. {
  244. label: "今日待巡检",
  245. count: 88,
  246. options: {
  247. separator: ",",
  248. },
  249. },
  250. {
  251. label: "今日已巡检",
  252. count: 2,
  253. options: {
  254. separator: ",",
  255. },
  256. },
  257. ],
  258. billPaymentList: [],
  259. abnormalNum: { label: "异常总数", count: "" },
  260. workList: [
  261. {
  262. label: "待指派",
  263. count: 3,
  264. },
  265. {
  266. label: "待维修",
  267. count: 2,
  268. },
  269. {
  270. label: "已维修",
  271. count: 0,
  272. },
  273. ],
  274. deviceErrorList: [],
  275. loading: false,
  276. };
  277. },
  278. created() {
  279. this.getHomeData();
  280. },
  281. methods: {
  282. getHomeData() {
  283. api.homedata().then((res) => {
  284. console.log(res);
  285. if (res.code == 0) {
  286. //工单代办数据
  287. for (let k in res.data.workOrder) {
  288. this.workList[k - 1].count = res.data.workOrder[k];
  289. }
  290. //设备异常数据
  291. let mapsArr = [];
  292. for (let k in res.data.equip.maps) {
  293. let json = {};
  294. json.label = k;
  295. json.count = res.data.equip.maps[k];
  296. mapsArr.push(json);
  297. }
  298. this.deviceErrorList = mapsArr;
  299. //赋值异常总数
  300. this.abnormalNum.count = res.data.equip.abnormalNum;
  301. //欠费待收数据
  302. this.billPaymentList = res.data.billPaymentList;
  303. }
  304. });
  305. },
  306. onLoad() {
  307. setTimeout(() => {
  308. if (this.refreshing.value) {
  309. this.list.value = [];
  310. this.refreshing.value = false;
  311. }
  312. for (let i = 0; i < 10; i++) {
  313. this.list.value.push(this.list.value.length + 1);
  314. }
  315. this.loading.value = false;
  316. if (this.list.value.length >= 40) {
  317. this.finished.value = true;
  318. }
  319. }, 1000);
  320. },
  321. onRefresh() {
  322. // 清空列表数据
  323. this.finished.value = false;
  324. // 重新加载数据
  325. // 将 loading 设置为 true,表示处于加载状态
  326. this.loading.value = true;
  327. this.onLoad();
  328. },
  329. toPath() {
  330. this.$router.push({
  331. path: "/userInfo",
  332. query: {
  333. title: "账号中心",
  334. source: "account",
  335. },
  336. });
  337. },
  338. },
  339. };
  340. </script>
  341. <style lang="scss" scoped>
  342. .page_info {
  343. position: relative;
  344. height: calc(
  345. 100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 60px
  346. );
  347. .info_bg {
  348. width: 100%;
  349. height: 102px;
  350. background: #5c8fff;
  351. border-radius: 0px 0px 16px 16px;
  352. padding-top: 12px;
  353. margin-bottom: 42px;
  354. .bg_title {
  355. display: flex;
  356. align-items: center;
  357. justify-content: space-between;
  358. padding: 0 16px;
  359. .van-col {
  360. height: 24px;
  361. font-size: 16px;
  362. font-weight: 600;
  363. color: #ffffff;
  364. line-height: 24px;
  365. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04);
  366. display: flex;
  367. align-items: center;
  368. }
  369. }
  370. }
  371. .info_function {
  372. position: absolute;
  373. top: 52px;
  374. width: calc(100% - 32px);
  375. margin: 0 16px;
  376. background: #ffffff;
  377. box-shadow: 0px 0px 8px 0px rgba(51, 51, 51, 0.08);
  378. border-radius: 4px;
  379. display: flex;
  380. align-items: center;
  381. justify-content: space-around;
  382. padding: 16px 0;
  383. .function_item {
  384. display: flex;
  385. flex-direction: column;
  386. align-items: center;
  387. justify-content: center;
  388. span {
  389. height: 20px;
  390. font-size: 14px;
  391. font-weight: 400;
  392. color: #697081;
  393. line-height: 20px;
  394. margin-top: 4px;
  395. }
  396. }
  397. }
  398. .info_list {
  399. max-height: calc(100% - 114px - 42px - 20px);
  400. padding: 0 16px;
  401. overflow-y: auto;
  402. .sub_title {
  403. margin: 12px 0 6px 0;
  404. .title {
  405. height: 20px;
  406. font-size: 14px;
  407. font-weight: 500;
  408. color: #0c1935;
  409. line-height: 20px;
  410. }
  411. .function_btn {
  412. display: flex;
  413. align-items: center;
  414. .van-col {
  415. height: 16px;
  416. font-size: 12px;
  417. font-weight: 400;
  418. color: #2e69eb;
  419. line-height: 16px;
  420. }
  421. }
  422. }
  423. .list_item {
  424. background: #ffffff;
  425. box-shadow: 0px 0px 4px 0px rgba(51, 51, 51, 0.08);
  426. border-radius: 4px;
  427. padding: 16px 30px;
  428. .van-col {
  429. height: 16px;
  430. font-size: 12px;
  431. font-weight: 400;
  432. color: #666666;
  433. line-height: 16px;
  434. }
  435. .count_up {
  436. margin-top: 4px;
  437. height: 22px;
  438. font-size: 20px;
  439. font-weight: 500;
  440. color: #0c1935;
  441. line-height: 22px;
  442. }
  443. }
  444. .list_table {
  445. padding: 8px 16px;
  446. .table_header {
  447. padding: 8px 0;
  448. border-bottom: 1px solid #eeeeee;
  449. .van-col {
  450. height: 16px;
  451. font-size: 12px;
  452. font-weight: 600;
  453. color: #999999;
  454. line-height: 16px;
  455. }
  456. }
  457. }
  458. .list_table {
  459. background: #fff;
  460. padding: 16px 20px;
  461. .table_info {
  462. .table_header {
  463. display: flex;
  464. justify-content: space-between;
  465. padding-bottom: 8px;
  466. border-bottom: 1px solid #eeeeee;
  467. span {
  468. height: 16px;
  469. font-size: 12px;
  470. font-weight: 600;
  471. color: #9da0ac;
  472. line-height: 16px;
  473. }
  474. }
  475. }
  476. }
  477. .billList {
  478. padding: 15px 0;
  479. border-top: 1px solid #eee;
  480. }
  481. .billTit {
  482. height: 16px;
  483. font-size: 12px;
  484. font-weight: 400;
  485. color: #697081;
  486. line-height: 16px;
  487. }
  488. .billAmount {
  489. font-size: 16px;
  490. }
  491. }
  492. }
  493. </style>