zhangjiaqing
8 天以前 1cef3adee31c6934c0da4b4f0b8a6f5ac03b364f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            reportCollectFeesInfo: {
                fees: [],
                total: 0,
                records: 1,
                moreCondition: false,
                title: '',
                roomUnits: [],
                primeRates: [],
                feeConfigDtos: [],
                states: [],
                feeTypeCds: [],
                prepaymentStates: [],
                totalReceivableAmount: 0.0,
                totalReceivedAmount: 0.0,
                totalOweAmount: 0.0,
                totalPayableAmount: 0.0,
                allReceivableAmount: 0.0,
                allReceivedAmount: 0.0,
                allPayableAmount: 0.0,
                totalPreferentialAmount: 0.0,
                totalDeductionAmount: 0.0,
                totalLateFee: 0.0,
                totalVacantHousingDiscount: 0.0,
                totalVacantHousingReduction: 0.0,
                allPreferentialAmount: 0.0,
                allDeductionAmount: 0.0,
                allOweAmount: 0.0,
                allLateFee: 0.0,
                allVacantHousingDiscount: 0.0,
                allVacantHousingReduction: 0.0,
                allGiftAmount: 0.0,
                totalGiftAmount: 0.0,
                conditions: {
                    floorId: '',
                    floorName: '',
                    roomNum: '',
                    roomName: '', // 1-1-101
                    unitId: '',
                    configId: '',
                    primeRate: '',
                    state: '',
                    prepaymentState: '',
                    feeTypeCd: '888800010001',
                    startTime: '',
                    endTime: '',
                    startBeginTime: '',
                    startFinishTime: '',
                    endBeginTime: '',
                    endFinishTime: '',
                    communityId: vc.getCurrentCommunity().communityId
                }
            }
        },
        _initMethod: function () {
            vc.component._initDate();
            vc.component._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            vc.component._selectConfig();
            //与字典表支付方式关联
            vc.getDict('pay_fee_detail', "prime_rate", function (_data) {
                vc.component.reportCollectFeesInfo.primeRates = _data;
            });
            //与字典表费用状态关联
            vc.getDict('report_fee_month_statistics_bill', "prepayment_state", function (_data) {
                vc.component.reportCollectFeesInfo.prepaymentStates = _data;
            });
            //与字典表费用类型关联
            vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
                vc.component.reportCollectFeesInfo.feeTypeCds = _data;
            });
            $(".popover-show").mouseover(() => {
                $('.popover-show').popover('show');
            })
            $(".popover-show").mouseleave(() => {
                $('.popover-show').popover('hide');
            })
        },
        _initEvent: function () {
            vc.on('reportCollectFees', 'chooseFloor', function (_param) {
                vc.component.reportCollectFeesInfo.conditions.floorId = _param.floorId;
                vc.component.reportCollectFeesInfo.conditions.floorName = _param.floorName;
                vc.component.loadUnits(_param.floorId);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                vc.component._listFees(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _initDate: function () {
                $(".startTime").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $(".endTime").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $('.startTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".startTime").val();
                        vc.component.reportCollectFeesInfo.conditions.startTime = value;
                    });
                $('.endTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".endTime").val();
                        vc.component.reportCollectFeesInfo.conditions.endTime = value;
                        let start = Date.parse(new Date($that.reportCollectFeesInfo.conditions.startTime))
                        let end = Date.parse(new Date($that.reportCollectFeesInfo.conditions.endTime))
                        if (start - end >= 0) {
                            vc.toast("结束时间必须大于开始时间")
                            $that.reportCollectFeesInfo.conditions.endTime = '';
                        }
                    });
                $(".startBeginTime").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $(".startFinishTime").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $('.startBeginTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".startBeginTime").val();
                        vc.component.reportCollectFeesInfo.conditions.startBeginTime = value;
                    });
                $('.startFinishTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".startFinishTime").val();
                        vc.component.reportCollectFeesInfo.conditions.startFinishTime = value;
                        let start = Date.parse(new Date($that.reportCollectFeesInfo.conditions.startBeginTime))
                        let end = Date.parse(new Date($that.reportCollectFeesInfo.conditions.startFinishTime))
                        if (start - end >= 0) {
                            vc.toast("费用开始的结束时间必须大于费用开始的开始时间")
                            $that.reportCollectFeesInfo.conditions.startFinishTime = '';
                        }
                    });
                $(".endBeginTime").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $(".endFinishTime").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true,
                    clearBtn: true
                });
                $('.endBeginTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".endBeginTime").val();
                        vc.component.reportCollectFeesInfo.conditions.endBeginTime = value;
                    });
                $('.endFinishTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".endFinishTime").val();
                        vc.component.reportCollectFeesInfo.conditions.endFinishTime = value;
                        let start = Date.parse(new Date($that.reportCollectFeesInfo.conditions.endBeginTime))
                        let end = Date.parse(new Date($that.reportCollectFeesInfo.conditions.endFinishTime))
                        if (start - end >= 0) {
                            vc.toast("费用开始的结束时间必须大于费用开始的开始时间")
                            $that.reportCollectFeesInfo.conditions.endFinishTime = '';
                        }
                    });
                //防止多次点击时间插件失去焦点
                document.getElementsByName('startTime')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByName("endTime")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByClassName(' form-control startBeginTime')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByClassName(" form-control startFinishTime")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByClassName(' form-control endBeginTime')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByClassName(" form-control endFinishTime")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
            },
            //查询
            _queryMethod: function () {
                vc.component._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //查询方法
            _listFees: function (_page, _rows) {
                vc.component.reportCollectFeesInfo.conditions.page = _page;
                vc.component.reportCollectFeesInfo.conditions.row = _rows;
                vc.component.reportCollectFeesInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                var param = {
                    params: vc.component.reportCollectFeesInfo.conditions
                };
                //发送get请求
                vc.http.apiGet('/reportFeeMonthStatisticsPrepayment/queryReportCollectFees',
                    param,
                    function (json, res) {
                        var _reportCollectFeesInfo = JSON.parse(json);
                        vc.component.reportCollectFeesInfo.total = _reportCollectFeesInfo.total;
                        vc.component.reportCollectFeesInfo.records = _reportCollectFeesInfo.records;
                        vc.component.reportCollectFeesInfo.fees = _reportCollectFeesInfo.data;
                        vc.component.reportCollectFeesInfo.fees.forEach(item => {
                            item.lateFee = (item.lateFee * -1).toFixed(2);
                        })
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalReceivableAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalReceivableAmount = _reportCollectFeesInfo.sumTotal.totalReceivableAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalReceivableAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalReceivedAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalReceivedAmount = _reportCollectFeesInfo.sumTotal.totalReceivedAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalReceivedAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalOweAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalOweAmount = _reportCollectFeesInfo.sumTotal.totalOweAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalOweAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalPayableAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalPayableAmount = _reportCollectFeesInfo.sumTotal.totalPayableAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalPayableAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allReceivableAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allReceivableAmount = _reportCollectFeesInfo.sumTotal.allReceivableAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.allReceivableAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allReceivedAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allReceivedAmount = _reportCollectFeesInfo.sumTotal.allReceivedAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.allReceivedAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allOweAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allOweAmount = _reportCollectFeesInfo.sumTotal.allOweAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.allOweAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allPayableAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allPayableAmount = _reportCollectFeesInfo.sumTotal.allPayableAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.allPayableAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalPreferentialAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalPreferentialAmount = _reportCollectFeesInfo.sumTotal.totalPreferentialAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalPreferentialAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalDeductionAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalDeductionAmount = _reportCollectFeesInfo.sumTotal.totalDeductionAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalDeductionAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalLateFee) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalLateFee = (_reportCollectFeesInfo.sumTotal.totalLateFee) * (-1);
                        } else {
                            vc.component.reportCollectFeesInfo.totalLateFee = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalVacantHousingDiscount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalVacantHousingDiscount = _reportCollectFeesInfo.sumTotal.totalVacantHousingDiscount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalVacantHousingDiscount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalVacantHousingReduction) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalVacantHousingReduction = _reportCollectFeesInfo.sumTotal.totalVacantHousingReduction;
                        } else {
                            vc.component.reportCollectFeesInfo.totalVacantHousingReduction = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allPreferentialAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allPreferentialAmount = _reportCollectFeesInfo.sumTotal.allPreferentialAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.allPreferentialAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allDeductionAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allDeductionAmount = _reportCollectFeesInfo.sumTotal.allDeductionAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.allDeductionAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allLateFee) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allLateFee = (_reportCollectFeesInfo.sumTotal.allLateFee) * (-1);
                        } else {
                            vc.component.reportCollectFeesInfo.allLateFee = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allVacantHousingDiscount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allVacantHousingDiscount = _reportCollectFeesInfo.sumTotal.allVacantHousingDiscount;
                        } else {
                            vc.component.reportCollectFeesInfo.allVacantHousingDiscount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allVacantHousingReduction) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allVacantHousingReduction = _reportCollectFeesInfo.sumTotal.allVacantHousingReduction;
                        } else {
                            vc.component.reportCollectFeesInfo.allVacantHousingReduction = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.allGiftAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.allGiftAmount = _reportCollectFeesInfo.sumTotal.allGiftAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.allGiftAmount = 0.0.toFixed(2);
                        }
                        if (typeof (_reportCollectFeesInfo.sumTotal.totalGiftAmount) != 'undefined') {
                            vc.component.reportCollectFeesInfo.totalGiftAmount = _reportCollectFeesInfo.sumTotal.totalGiftAmount;
                        } else {
                            vc.component.reportCollectFeesInfo.totalGiftAmount = 0.0.toFixed(2);
                        }
                        vc.emit('pagination', 'init', {
                            total: vc.component.reportCollectFeesInfo.records,
                            dataCount: vc.component.reportCollectFeesInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //重置
            _resetMethod: function (_page, _rows) {
                vc.component._resetListFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _resetListFees: function (_page, _rows) {
                vc.component.reportCollectFeesInfo.conditions.floorId = "";
                vc.component.reportCollectFeesInfo.conditions.floorName = "";
                vc.component.reportCollectFeesInfo.conditions.unitId = "";
                vc.component.reportCollectFeesInfo.conditions.roomNum = "";
                vc.component.reportCollectFeesInfo.conditions.roomName = "";
                vc.component.reportCollectFeesInfo.conditions.primeRate = "";
                vc.component.reportCollectFeesInfo.conditions.startTime = "";
                vc.component.reportCollectFeesInfo.conditions.endTime = "";
                vc.component.reportCollectFeesInfo.conditions.startBeginTime = "";
                vc.component.reportCollectFeesInfo.conditions.startFinishTime = "";
                vc.component.reportCollectFeesInfo.conditions.endBeginTime = "";
                vc.component.reportCollectFeesInfo.conditions.endFinishTime = "";
                vc.component.reportCollectFeesInfo.conditions.configId = "";
                vc.component.reportCollectFeesInfo.conditions.state = "";
                vc.component.reportCollectFeesInfo.conditions.prepaymentState = "";
                vc.component.reportCollectFeesInfo.conditions.feeTypeCd = "";
                // 清除下拉框选项
                vc.component.reportCollectFeesInfo.roomUnits = [];
                vc.component.reportCollectFeesInfo.feeConfigDtos = [];
                vc.component._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            loadUnits: function (_floorId) {
                var param = {
                    params: {
                        floorId: _floorId,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                }
                vc.http.apiGet(
                    '/unit.queryUnits',
                    param,
                    function (json, res) {
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        if (res.status == 200) {
                            let tmpUnits = JSON.parse(json);
                            vc.component.reportCollectFeesInfo.roomUnits = tmpUnits;
                            return;
                        }
                        vc.toast(json);
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        vc.toast(errInfo);
                    });
            },
            _openChooseFloorMethod: function () {
                vc.emit('searchFloor', 'openSearchFloorModel', {});
            },
            //根据费用类型查询费用项
            _selectConfig: function () {
                var param = {
                    params: {
                        page: 1,
                        row: 50,
                        communityId: vc.getCurrentCommunity().communityId,
                        feeTypeCd: vc.component.reportCollectFeesInfo.conditions.feeTypeCd,
                        isFlag: "0"
                    }
                };
                //发送get请求
                vc.http.apiGet('/feeConfig.listFeeConfigs', param,
                    function (json, res) {
                        var _feeConfigManageInfo = JSON.parse(json);
                        vc.component.reportCollectFeesInfo.feeConfigDtos = _feeConfigManageInfo.feeConfigs;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    });
            },
            _moreCondition: function () {
                if (vc.component.reportCollectFeesInfo.moreCondition) {
                    vc.component.reportCollectFeesInfo.moreCondition = false;
                } else {
                    vc.component.reportCollectFeesInfo.moreCondition = true;
                }
            },
            _exportFee: function () {
                // vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportCollectFees&' + vc.objToGetParam($that.reportCollectFeesInfo.conditions));
                vc.component.reportCollectFeesInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                vc.component.reportCollectFeesInfo.conditions.pagePath = 'reportCollectFees';
                let param = {
                    params: vc.component.reportCollectFeesInfo.conditions
                };
                //发送get请求
                vc.http.apiGet('/export.exportData', param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        vc.toast(_json.msg);
                        if (_json.code == 0) {
                            vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心')
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    });
            },
        }
    });
})(window.vc);