chargeStatistics.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <div class="main">
  3. <div class="search">
  4. <el-input
  5. class="search-input"
  6. v-model="mixins_query.likeValue"
  7. placeholder="输入业主/房间号"
  8. clearable
  9. ></el-input>
  10. <el-select
  11. v-model="mixins_query.communityId"
  12. placeholder="选择社区"
  13. @change="communityChange"
  14. >
  15. <el-option
  16. v-for="(item, index) in communityArr"
  17. :key="index"
  18. :label="item.communityName"
  19. :value="item.id"
  20. ></el-option>
  21. </el-select>
  22. <el-date-picker
  23. v-model="times"
  24. value-format="yyyy-MM"
  25. type="monthrange"
  26. range-separator="至"
  27. start-placeholder="选择开始日期"
  28. end-placeholder="选择结束日期"
  29. @change="effectiveDateToggle"
  30. :clearable="false"
  31. ></el-date-picker>
  32. <el-button
  33. type="primary"
  34. class="search-btn"
  35. @click="initSearchAll"
  36. icon="el-icon-search"
  37. >查询 </el-button>
  38. <div class="search-icon">
  39. <el-tooltip
  40. class="item"
  41. effect="light"
  42. placement="bottom"
  43. content="导出"
  44. >
  45. <i
  46. class="zoniot_font zoniot-icon-daochu2"
  47. @click="exportExcel"
  48. ></i>
  49. </el-tooltip>
  50. </div>
  51. </div>
  52. <div class="table-top">
  53. <div class="table-top_block title">
  54. <div>{{ thisObjCommunit['communityName'] || '' }}收费统计</div>
  55. <div>{{ timeFiterType() }}</div>
  56. </div>
  57. <div
  58. class="table-top_block blockColor"
  59. v-for="item in blockArr"
  60. :key="item"
  61. >
  62. <div class="number">{{ item.val }}</div>
  63. <div>{{ item.label }}</div>
  64. </div>
  65. </div>
  66. <zz-table
  67. :cols="cols"
  68. :settings="{ showIndex: true, stripe: true }"
  69. :loading="mixins_onQuery"
  70. :data="mixins_list"
  71. :updateFlag="true"
  72. :pageset="mixins_pageset"
  73. @page-change="pageChange"
  74. >
  75. <template
  76. slot-scope="scope"
  77. :slot="item.md5Key"
  78. v-for="(item, index) in tableInsert"
  79. >
  80. <div :key="index">
  81. {{ activeName(item, scope.row['details']) }}
  82. </div>
  83. </template>
  84. </zz-table>
  85. </div>
  86. </template>
  87. <script>
  88. import list from '@utils/list.js';
  89. export default {
  90. mixins: [list],
  91. data () {
  92. let _this = this;
  93. return {
  94. cols: [
  95. {
  96. label: '社区名称',
  97. prop: 'communityName'
  98. },
  99. {
  100. label: '房间',
  101. prop: 'houseDetail'
  102. },
  103. {
  104. label: '业主',
  105. prop: 'residentName'
  106. },
  107. {
  108. label: '物业费标准(元/月)',
  109. prop: 'chargingStandard'
  110. },
  111. {
  112. label: '月数',
  113. prop: 'months'
  114. },
  115. {
  116. label: '合计',
  117. prop: 'totalAmount'
  118. }
  119. ],
  120. mixins_post: 'post',
  121. times: [],
  122. communityArr: [],
  123. blockArr: [],
  124. tableInsert: [],
  125. thisObjCommunit: {}
  126. };
  127. },
  128. created () {
  129. let thisDay = this.$moment(new Date()).format('YYYY-MM');
  130. this.times = [thisDay, thisDay];
  131. new Promise((resolve) => {
  132. this.getorgTree(resolve);
  133. }).then(() => {
  134. this.initSearchData(thisDay);
  135. this.mixins_dataUrl = '/czc-charge/charge/report/page';
  136. this.initSearchAll();
  137. });
  138. },
  139. mounted () { },
  140. methods: {
  141. initSearchData (time) {
  142. this.mixins_query = {
  143. communityId: this.thisObjCommunit.id,
  144. startTime: time,
  145. endTime: time
  146. };
  147. },
  148. initSearchAll () {
  149. new Promise((resolve) => {
  150. this.getTopTable(resolve);
  151. }).then(() => {
  152. this.mixins_search();
  153. });
  154. },
  155. typeName (item) {
  156. let name = '';
  157. switch (item.chargeType) {
  158. case 1:
  159. name = '物业费';
  160. break;
  161. case 2:
  162. name = '水费';
  163. break;
  164. case 3:
  165. name = '电费';
  166. break;
  167. case 4:
  168. name = '车位费';
  169. break;
  170. case 6:
  171. name = '卫生费';
  172. break;
  173. case 7:
  174. name = item.chargeName;
  175. break;
  176. }
  177. return name;
  178. },
  179. activeName (item, arr) {
  180. let amount = '--';
  181. arr.map((its) => {
  182. if (its.md5Key == item.md5Key) {
  183. amount = its.amount;
  184. }
  185. });
  186. return amount;
  187. },
  188. exportExcel () {
  189. this.__exportExcel('/czc-charge/charge/report/export/excel', this.mixins_query);
  190. },
  191. effectiveDateToggle (va) {
  192. let arr = va;
  193. if (!arr) {
  194. arr = ['', ''];
  195. }
  196. this.mixins_query.startTime = arr[0];
  197. this.mixins_query.endTime = arr[1];
  198. this.initSearchAll();
  199. },
  200. getorgTree (resolve) {
  201. this.$http
  202. .get('/czc-community/assets/community/list')
  203. .then((data) => {
  204. this.communityArr = data.data;
  205. this.thisObjCommunit = this.communityArr[0];
  206. this.$store.commit('setAreaSelect', data.data);
  207. resolve && resolve();
  208. })
  209. .catch(function () { });
  210. },
  211. getTopTable (resolve) {
  212. this.cols = [
  213. {
  214. label: '社区名称',
  215. prop: 'communityName'
  216. },
  217. {
  218. label: '房间',
  219. prop: 'houseDetail'
  220. },
  221. {
  222. label: '业主',
  223. prop: 'residentName'
  224. },
  225. {
  226. label: '物业费标准(元/月)',
  227. prop: 'chargingStandard'
  228. },
  229. {
  230. label: '月数',
  231. prop: 'months'
  232. },
  233. {
  234. label: '合计',
  235. prop: 'totalAmount'
  236. }
  237. ];
  238. let tableInsert = [];
  239. this.$http.post('/czc-charge/charge/report/total', this.mixins_query).then(({ data, status, msg }) => {
  240. if (status == 0) {
  241. if (!!data && data.details.length) {
  242. let arr = [{ label: '总收费', val: data.totalAmount }];
  243. data.details.map((item, index) => {
  244. arr.push({ label: this.typeName(item), val: item.amount });
  245. tableInsert.push({
  246. md5Key: item.md5Key
  247. });
  248. this.cols.splice(5 + index, 0, {
  249. label: this.typeName(item),
  250. slot: item.md5Key
  251. });
  252. });
  253. this.tableInsert = tableInsert;
  254. this.blockArr = arr;
  255. } else {
  256. this.tableInsert = [];
  257. this.blockArr = [];
  258. }
  259. }
  260. resolve && resolve();
  261. });
  262. },
  263. communityChange (e) {
  264. this.communityArr.find((item) => {
  265. if (item.id == e) {
  266. this.thisObjCommunit = item;
  267. this.initSearchAll();
  268. }
  269. });
  270. },
  271. timeFiterType () {
  272. let arr = this.times;
  273. let text = '';
  274. if (!arr) {
  275. arr = ['', ''];
  276. }
  277. let f = new Date(arr[0]).getMonth(),
  278. l = new Date(arr[1]).getMonth();
  279. if (f == l) {
  280. text = `${this.$moment(new Date(arr[0])).format('YYYY年M月')}`;
  281. } else {
  282. text = `${this.$moment(new Date(arr[0])).format('YYYY年M月')}-${this.$moment(new Date(arr[1])).format('YYYY年M月')}`;
  283. }
  284. return text;
  285. }
  286. }
  287. };
  288. </script>
  289. <style scoped lang='scss'>
  290. @import '@assets/css/public-style.scss';
  291. .table-top {
  292. display: flex;
  293. // margin-bottom: 20px;
  294. background: white;
  295. padding: 10px 0;
  296. .table-top_block {
  297. height: 60px;
  298. line-height: 20px;
  299. text-align: center;
  300. margin-left: 20px;
  301. &.title {
  302. font-size: 16px;
  303. font-weight: 600;
  304. color: #0eaeff;
  305. line-height: 27px;
  306. border-right: 1px solid #eee;
  307. padding-right: 60px;
  308. }
  309. &.blockColor {
  310. min-width: 150px;
  311. text-align: left;
  312. border-right: 1px solid #eee;
  313. &:last-child {
  314. border: none;
  315. }
  316. .number {
  317. font-size: 24px;
  318. font-weight: 600;
  319. line-height: 33px;
  320. }
  321. }
  322. }
  323. }
  324. </style>