chargeStatistics.vue 9.4 KB

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