rentBill.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <van-nav-bar
  3. title="租户账单"
  4. left-arrow
  5. @click-left="onClickLeft"
  6. safe-area-inset-top
  7. />
  8. <div class="page_check">
  9. <div class="search_pannel">
  10. <div class="pannel_left">
  11. <van-image
  12. :src="require('@/assets/position.svg')"
  13. width="16"
  14. height="16"
  15. fit="contain"
  16. />
  17. <span>{{ name }}</span>
  18. <van-image
  19. :src="require('@/assets/arrow-right.svg')"
  20. width="24"
  21. height="24"
  22. fit="contain"
  23. />
  24. </div>
  25. <div class="pannel_right" @click="toPath">
  26. <van-image
  27. :src="require('@/assets/search.svg')"
  28. width="16"
  29. height="16"
  30. fit="contain"
  31. />
  32. </div>
  33. </div>
  34. <div class="drop_down">
  35. <van-dropdown-menu active-color="#1989fa">
  36. <van-dropdown-item
  37. v-model="rentStatus"
  38. @change="handelChange('rentStatus', rentStatus)"
  39. :title="rentStatusTitle"
  40. :options="rentStatusList"
  41. />
  42. </van-dropdown-menu>
  43. </div>
  44. <div class="list_total">
  45. <span>共有</span>
  46. <v-count-up
  47. :end-val="total"
  48. class="count_up"
  49. options="{ separator: ',' }"
  50. />
  51. <span>条记录</span>
  52. </div>
  53. <div class="check_info">
  54. <div class="info_list">
  55. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  56. <van-list
  57. v-model:loading="loading"
  58. :finished="finished"
  59. :error="error"
  60. error-text="请求失败,点击重新加载"
  61. finished-text="没有更多了"
  62. @load="onLoad"
  63. >
  64. <div v-for="item in list" :key="item.id" class="list_item">
  65. <div
  66. class="reduce_type"
  67. :style="{
  68. 'background-color': `${
  69. rentStatus_filter(item.rentStatus)['color']
  70. }`,
  71. }"
  72. >
  73. <span>{{
  74. `${rentStatus_filter(item.rentStatus)["label"]}`
  75. }}</span>
  76. </div>
  77. <span class="header">{{ item.name }}</span>
  78. <span style="color: #fa5555"
  79. >本期金额:¥{{ item.rentMoney }}</span
  80. >
  81. <span
  82. >欠费天数:<span style="color: #0c1935; font-weight: 600">{{
  83. item.rentDays
  84. }}</span>
  85. </span>
  86. <span
  87. >账户余额:<span style="color: #0c1935; font-weight: 600"
  88. >¥{{ item.accountMoney }}
  89. </span></span
  90. >
  91. <span>联系电话:{{ item.tel }}</span>
  92. <div class="list_btn" v-if="item.status == 2">
  93. <van-button plain type="primary" size="small">催费</van-button>
  94. </div>
  95. </div>
  96. </van-list>
  97. </van-pull-refresh>
  98. </div>
  99. </div>
  100. </div>
  101. </template>
  102. <script>
  103. import { isEmpty } from "@/utils/index.js";
  104. import VCountUp from "./CountUp";
  105. export default {
  106. components: {
  107. "v-count-up": VCountUp,
  108. },
  109. data() {
  110. return {
  111. loading: false,
  112. name: "电商园四期-B座",
  113. rentStatus: "",
  114. rentStatusTitle: "是否结清",
  115. rentStatusList: [
  116. { text: "已结清", value: 1 },
  117. { text: "未结清", value: 2 },
  118. ],
  119. total: 3,
  120. list: [
  121. {
  122. name: "合肥市传秀科技有限公司",
  123. rentStatus: 1,
  124. rentMoney: 3454,
  125. rentDays: 0,
  126. accountMoney: 100,
  127. tel: 13212341111,
  128. },
  129. ],
  130. loading: false,
  131. refreshing: false,
  132. finished: false,
  133. };
  134. },
  135. methods: {
  136. rentStatus_filter(val) {
  137. if (isEmpty(val)) {
  138. return {};
  139. }
  140. if (val == 1) {
  141. return { label: "已结清", color: "#09C700" };
  142. }
  143. if (val == 2) {
  144. return { label: "未结清", color: "#FA5555" };
  145. }
  146. },
  147. onLoad() {
  148. setTimeout(() => {
  149. if (this.refreshing) {
  150. this.list = [];
  151. this.refreshing = false;
  152. }
  153. for (let i = 0; i < 10; i++) {
  154. this.list.push(this.list.length + 1);
  155. }
  156. this.loading = false;
  157. if (this.list.length >= 40) {
  158. this.finished = true;
  159. }
  160. }, 1000);
  161. },
  162. onRefresh() {
  163. // 清空列表数据
  164. this.finished = false;
  165. // 重新加载数据
  166. // 将 loading 设置为 true,表示处于加载状态
  167. this.loading = true;
  168. this.onLoad();
  169. },
  170. // change事件可以拿到的是value
  171. handelChange(type, val) {
  172. console.log(type, val);
  173. if (type == "checkType") {
  174. // 这里打印出来的值就是我们想要的text
  175. this.checkTypeTitle = this.checkTypeList.filter(
  176. (item) => item.value === val
  177. )[0].text;
  178. }
  179. if (type == "checkPerson") {
  180. // 这里打印出来的值就是我们想要的text
  181. this.checkPersonTitle = this.checkPersonList.filter(
  182. (item) => item.value === val
  183. )[0].text;
  184. }
  185. },
  186. onClickLeft() {},
  187. },
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. .page_check {
  192. height: 100%;
  193. .search_pannel {
  194. padding: 10px 16px;
  195. background: #5c8fff;
  196. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.04);
  197. display: flex;
  198. align-items: center;
  199. .pannel_left {
  200. display: flex;
  201. align-items: center;
  202. span {
  203. height: 24px;
  204. font-size: 16px;
  205. font-weight: 400;
  206. color: #ffffff;
  207. line-height: 24px;
  208. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04);
  209. text-indent: 4px;
  210. }
  211. }
  212. .pannel_left,
  213. .pannel_right {
  214. flex: 1;
  215. }
  216. .pannel_right {
  217. text-align: right;
  218. }
  219. }
  220. .drop_down {
  221. /deep/ {
  222. --van-gray-4: #999999;
  223. --van-dropdown-menu-title-text-color: #0c1935;
  224. }
  225. }
  226. .list_total {
  227. padding: 0 16px;
  228. margin: 8px 0;
  229. display: flex;
  230. text-align: left;
  231. span {
  232. height: 16px;
  233. font-size: 12px;
  234. font-weight: 400;
  235. color: #999999;
  236. line-height: 16px;
  237. }
  238. .count_up {
  239. font-size: 16px;
  240. font-weight: 500;
  241. color: #fa5555;
  242. margin: 0 2px;
  243. }
  244. }
  245. .check_info {
  246. padding: 0 16px;
  247. height: calc(
  248. 100% - var(--van-nav-bar-height) - var(--van-dropdown-menu-height) - 76px
  249. );
  250. .info_list {
  251. height: 100%;
  252. overflow-y: auto;
  253. .list_item {
  254. background: #ffffff;
  255. box-shadow: 0px 0px 10px 0px rgba(153, 153, 153, 0.15);
  256. border-radius: 4px;
  257. margin-bottom: 12px;
  258. padding: 12px 16px;
  259. display: flex;
  260. flex-direction: column;
  261. align-items: flex-start;
  262. position: relative;
  263. &:nth-last-child(1) {
  264. margin-bottom: 0;
  265. }
  266. .header {
  267. height: 22px;
  268. font-size: 16px;
  269. font-weight: 600;
  270. color: #313836;
  271. line-height: 22px;
  272. margin-bottom: 8px;
  273. }
  274. span {
  275. height: 18px;
  276. font-size: 14px;
  277. font-weight: 400;
  278. color: #999999;
  279. line-height: 18px;
  280. margin-bottom: 4px;
  281. &:nth-last-child(1) {
  282. margin-bottom: 0;
  283. }
  284. }
  285. .reduce_type {
  286. position: absolute;
  287. top: 0;
  288. right: 0;
  289. height: 24px;
  290. padding: 0 12px;
  291. border-radius: 0px 4px 0px 10px;
  292. span {
  293. height: 16px;
  294. font-size: 12px;
  295. font-weight: 400;
  296. color: #ffffff;
  297. line-height: 16px;
  298. }
  299. }
  300. .list_btn {
  301. position: absolute;
  302. bottom: 15px;
  303. right: 12px;
  304. .van-button {
  305. &:nth-child(2) {
  306. margin: 0 12px;
  307. }
  308. }
  309. }
  310. }
  311. }
  312. }
  313. }
  314. </style>