home.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <div class="page_home">
  3. <div class="home_bg">
  4. <div class="bg_title">
  5. <div class="title_info">
  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. </div>
  20. <div class="user_info" @click="toPath">
  21. <van-image
  22. :src="require('@/assets/user.svg')"
  23. width="16"
  24. height="16"
  25. fit="contain"
  26. />
  27. </div>
  28. </div>
  29. </div>
  30. <div class="home_info">
  31. <div class="info_content">
  32. <div
  33. class="content_item"
  34. v-for="(item, index) in functionList"
  35. :key="index"
  36. >
  37. <van-image :src="item.src" width="36" height="36" fit="contain" />
  38. <span>{{ item.label }}</span>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="card_list">
  43. <div class="sub_title">
  44. <span>工单待办</span>
  45. <div class="function_btn">
  46. <span>立即处理</span>
  47. <van-image
  48. :src="require('@/assets/btn-arrow-right.svg')"
  49. width="24"
  50. height="24"
  51. fit="contain"
  52. />
  53. </div>
  54. </div>
  55. <div class="list_item">
  56. <div
  57. class="item_info"
  58. v-for="(item, index) in workList"
  59. :key="item + '_' + index"
  60. >
  61. <span class="label">{{ item.label }}</span>
  62. <v-count-up
  63. :end-val="Number(item['count'])"
  64. class="count_up"
  65. :options="item['options']"
  66. />
  67. </div>
  68. </div>
  69. <div class="sub_title">
  70. <span>设备异常</span>
  71. <div class="function_btn">
  72. <span>立即处理</span>
  73. <van-image
  74. :src="require('@/assets/btn-arrow-right.svg')"
  75. width="24"
  76. height="24"
  77. fit="contain"
  78. />
  79. </div>
  80. </div>
  81. <div class="list_item">
  82. <div
  83. class="item_info"
  84. v-for="(item, index) in deviceErrorList"
  85. :key="item + '-' + index"
  86. >
  87. <span class="label">{{ item.label }}</span>
  88. <v-count-up
  89. :end-val="Number(item['count'])"
  90. class="count_up"
  91. :options="item['options']"
  92. style="color: #fa5555"
  93. />
  94. </div>
  95. </div>
  96. <div class="sub_title">
  97. <span>欠费待收</span>
  98. <div class="function_btn">
  99. <span>立即处理</span>
  100. <van-image
  101. :src="require('@/assets/btn-arrow-right.svg')"
  102. width="24"
  103. height="24"
  104. fit="contain"
  105. />
  106. </div>
  107. </div>
  108. <div class="list_item list_table">
  109. <div class="table_info">
  110. <div class="table_header">
  111. <span>欠费类型</span>
  112. <span>欠费租户数</span>
  113. <span>累计欠费</span>
  114. </div>
  115. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  116. <van-list
  117. v-model:loading="loading"
  118. :finished="finished"
  119. :error="error"
  120. error-text="请求失败,点击重新加载"
  121. finished-text="没有更多了"
  122. @load="onLoad"
  123. >
  124. <van-row v-for="item in list" :key="item.id">
  125. <van-cell :value="item.type" />
  126. <van-cell :value="item.fee" />
  127. <van-cell :value="item.totalFee" />
  128. </van-row>
  129. </van-list>
  130. </van-pull-refresh>
  131. </div>
  132. </div>
  133. </div>
  134. <van-tabbar
  135. v-model="activeTab"
  136. active-color="#5776E6"
  137. inactive-color="#333333"
  138. >
  139. <van-tabbar-item name="home" :icon="require('@/assets/home.svg')" to=""
  140. >首页</van-tabbar-item
  141. >
  142. <van-tabbar-item
  143. name="rentBill"
  144. :icon="require('@/assets/rent-bill.svg')"
  145. to=""
  146. >租户账单</van-tabbar-item
  147. >
  148. <van-tabbar-item
  149. name="remoteControl"
  150. :icon="require('@/assets/remote-control.svg')"
  151. to=""
  152. >远程管控</van-tabbar-item
  153. >
  154. </van-tabbar>
  155. </div>
  156. </template>
  157. <script>
  158. import VCountUp from "./CountUp";
  159. export default {
  160. components: {
  161. "v-count-up": VCountUp,
  162. },
  163. data() {
  164. return {
  165. name: "电商园四期-B座",
  166. activeTab: "rentBill",
  167. functionList: [
  168. { src: require("@/assets/repair-online.svg"), label: "线上报修" },
  169. { src: require("@/assets/check-review.svg"), label: "巡检记录" },
  170. { src: require("@/assets/reduce-record.svg"), label: "扣缴记录" },
  171. ],
  172. workList: [
  173. {
  174. label: "待指派",
  175. count: 3,
  176. options: {
  177. separator: ",",
  178. },
  179. },
  180. {
  181. label: "待维修",
  182. count: 2,
  183. options: {
  184. separator: ",",
  185. },
  186. },
  187. {
  188. label: "已维修",
  189. count: 1,
  190. options: {
  191. separator: ",",
  192. },
  193. },
  194. ],
  195. deviceErrorList: [
  196. {
  197. label: "异常总数",
  198. count: 7,
  199. options: {
  200. separator: ",",
  201. },
  202. },
  203. {
  204. label: "电表异常",
  205. count: 5,
  206. options: {
  207. separator: ",",
  208. },
  209. },
  210. {
  211. label: "水表异常",
  212. count: 2,
  213. options: {
  214. separator: ",",
  215. },
  216. },
  217. ],
  218. list: [],
  219. loading: false,
  220. refreshing: false,
  221. finished: false,
  222. };
  223. },
  224. methods: {
  225. onLoad() {
  226. setTimeout(() => {
  227. if (this.refreshing.value) {
  228. this.list.value = [];
  229. this.refreshing.value = false;
  230. }
  231. for (let i = 0; i < 10; i++) {
  232. this.list.value.push(this.list.value.length + 1);
  233. }
  234. this.loading.value = false;
  235. if (this.list.value.length >= 40) {
  236. this.finished.value = true;
  237. }
  238. }, 1000);
  239. },
  240. onRefresh() {
  241. // 清空列表数据
  242. this.finished.value = false;
  243. // 重新加载数据
  244. // 将 loading 设置为 true,表示处于加载状态
  245. this.loading.value = true;
  246. this.onLoad();
  247. },
  248. toPath() {
  249. this.$router.push("/userInfo");
  250. },
  251. },
  252. };
  253. </script>
  254. <style lang="scss" scoped>
  255. .page_home {
  256. position: relative;
  257. .home_bg {
  258. width: 100%;
  259. height: 102px;
  260. background: #5c8fff;
  261. border-radius: 0px 0px 16px 16px;
  262. padding-top: 12px;
  263. margin-bottom: 42px;
  264. .bg_title {
  265. display: flex;
  266. align-items: center;
  267. justify-content: space-between;
  268. padding: 0 16px;
  269. .title_info {
  270. display: flex;
  271. align-items: center;
  272. span {
  273. height: 24px;
  274. font-size: 16px;
  275. font-weight: 600;
  276. color: #ffffff;
  277. line-height: 24px;
  278. text-align: center;
  279. text-indent: 4px;
  280. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04);
  281. }
  282. }
  283. .user-info {
  284. }
  285. }
  286. }
  287. .home_info {
  288. position: absolute;
  289. top: 52px;
  290. width: calc(100% - 32px);
  291. padding: 0 16px;
  292. .info_content {
  293. background: #ffffff;
  294. box-shadow: 0px 0px 8px 0px rgba(51, 51, 51, 0.08);
  295. border-radius: 4px;
  296. display: flex;
  297. align-items: center;
  298. justify-content: space-between;
  299. padding: 16px 30px;
  300. .content_item {
  301. display: flex;
  302. flex-direction: column;
  303. align-items: center;
  304. justify-content: center;
  305. span {
  306. height: 20px;
  307. font-size: 14px;
  308. font-weight: 400;
  309. color: #697081;
  310. line-height: 20px;
  311. margin-top: 4px;
  312. }
  313. }
  314. }
  315. }
  316. .card_list {
  317. padding: 0 16px;
  318. .sub_title {
  319. display: flex;
  320. align-items: center;
  321. justify-content: space-between;
  322. margin: 12px 0 6px 0;
  323. span {
  324. height: 20px;
  325. font-size: 14px;
  326. font-weight: 600;
  327. color: #0c1935;
  328. line-height: 20px;
  329. }
  330. .function_btn {
  331. display: flex;
  332. align-items: center;
  333. span {
  334. height: 16px;
  335. font-size: 12px;
  336. font-weight: 400;
  337. color: #2e69eb;
  338. line-height: 16px;
  339. }
  340. }
  341. }
  342. .list_item {
  343. background: #ffffff;
  344. box-shadow: 0px 0px 4px 0px rgba(51, 51, 51, 0.08);
  345. border-radius: 4px;
  346. padding: 16px 30px;
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-between;
  350. .item_info {
  351. display: flex;
  352. flex-direction: column;
  353. align-items: center;
  354. justify-content: center;
  355. .label {
  356. height: 16px;
  357. font-size: 12px;
  358. font-weight: 400;
  359. color: #697081;
  360. line-height: 16px;
  361. }
  362. .count_up {
  363. margin-top: 4px;
  364. height: 22px;
  365. font-size: 20px;
  366. font-weight: 500;
  367. color: #0c1935;
  368. line-height: 22px;
  369. }
  370. }
  371. }
  372. .list_table {
  373. padding: 16px 20px;
  374. .table_info {
  375. .table_header {
  376. display: flex;
  377. justify-content: space-between;
  378. padding-bottom: 8px;
  379. border-bottom: 1px solid #eeeeee;
  380. span {
  381. height: 16px;
  382. font-size: 12px;
  383. font-weight: 600;
  384. color: #9da0ac;
  385. line-height: 16px;
  386. }
  387. }
  388. }
  389. }
  390. }
  391. }
  392. </style>