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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            reportOweFeeDetailInfo: {
                fees: [],
                floors: [],
                total: 0,
                records: 1,
                moreCondition: false,
                title: '',
                feeTypeCds: [],
                communitys: [],
                totalPreferentialAmount: 0.0,
                allOweAmount: 0.0,
                conditions: {
                    floorId: '',
                    floorName: '',
                    roomNum: '',
                    objNameLike: '',
                    feeTypeCd: '',
                    startTime: '',
                    endTime: '',
                    communityId: '',
                    ownerNameLike: '',
                }
            }
        },
        _initMethod: function () {
            vc.initDate('startTime', function (_value) {
                $that.reportOweFeeDetailInfo.conditions.startTime = _value;
            });
            vc.initDate('endTime', function (_value) {
                $that.reportOweFeeDetailInfo.conditions.endTime = _value;
            });
            vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
                $that.reportOweFeeDetailInfo.feeTypeCds = _data
            });
            $that.reportOweFeeDetailInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
            $that._listFloors();
            $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            $that._loadStaffCommunitys();
 
            $(".popover-show").mouseover(() => { $('.popover-show').popover('show'); })
            $(".popover-show").mouseleave(() => { $('.popover-show').popover('hide'); })
        },
        _initEvent: function () {
            vc.on('reportOweFeeDetail', 'chooseFloor', function (_param) {
                $that.reportOweFeeDetailInfo.conditions.floorId = _param.floorId;
                $that.reportOweFeeDetailInfo.conditions.floorName = _param.floorName;
                $that.loadUnits(_param.floorId);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listFees(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            //查询
            _queryMethod: function () {
                $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetMethod: function () {
                $that._resetFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //查询方法
            _listFees: function (_page, _rows) {
                $that.reportOweFeeDetailInfo.conditions.page = _page;
                $that.reportOweFeeDetailInfo.conditions.row = _rows;
                //$that.reportOweFeeDetailInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                let param = {
                    params: $that.reportOweFeeDetailInfo.conditions
                };
                //发送get请求
                vc.http.apiGet('/reportFeeMonthStatistics/queryOweFeeDetail',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.reportOweFeeDetailInfo.total = _json.total;
                        $that.reportOweFeeDetailInfo.records = _json.records;
                        $that.reportOweFeeDetailInfo.fees = _json.data;
                        //计算小计
                        let _totalPreferentialAmount = 0.0;
                        _json.data.forEach(item => {
                            _totalPreferentialAmount += parseFloat(item.oweAmount);
                        });
                        $that.reportOweFeeDetailInfo.totalPreferentialAmount = _totalPreferentialAmount.toFixed(2);
                        if (_json.data.length > 0) {
                            $that.reportOweFeeDetailInfo.allOweAmount = _json.data[0].allOweAmount;
                        } else {
                            $that.reportOweFeeDetailInfo.allOweAmount = 0.0.toFixed(2);
                        }
                        vc.emit('pagination', 'init', {
                            total: $that.reportOweFeeDetailInfo.records,
                            dataCount: $that.reportOweFeeDetailInfo.total,
                            currentPage: _page
                        });
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //重置方法
            _resetFees: function (_page, _rows) {
                $that.reportOweFeeDetailInfo.conditions.floorName = "";
                $that.reportOweFeeDetailInfo.conditions.floorId = "";
                $that.reportOweFeeDetailInfo.conditions.objName = "";
                $that.reportOweFeeDetailInfo.conditions.startTime = "";
                $that.reportOweFeeDetailInfo.conditions.endTime = "";
                $that.reportOweFeeDetailInfo.roomUnits = [];
                $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            swatchFloor: function (_floorId) {
                $that.reportOweFeeDetailInfo.conditions.floorId = _floorId;
                $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _listFloors: function () {
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                        communityId: $that.reportOweFeeDetailInfo.conditions.communityId
                    }
                };
                //发送get请求
                vc.http.apiGet('/floor.queryFloors', param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.reportOweFeeDetailInfo.floors = _json.apiFloorDataVoList;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    });
            },
            _openChooseFloorMethod: function () {
                vc.emit('searchFloor', 'openSearchFloorModel', {});
            },
            _moreCondition: function () {
                if ($that.reportOweFeeDetailInfo.moreCondition) {
                    $that.reportOweFeeDetailInfo.moreCondition = false;
                } else {
                    $that.reportOweFeeDetailInfo.moreCondition = true;
                }
            },
            _exportExcel: function () {
                $that.reportOweFeeDetailInfo.conditions.pagePath = 'reportOweFeeDetail';
                let _param = {
                    params: $that.reportOweFeeDetailInfo.conditions
                }
                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('请求失败处理');
                    });
            },
            _loadStaffCommunitys: function () {
                let param = {
                    params: {
                        _uid: '123mlkdinkldldijdhuudjdjkkd',
                        page: 1,
                        row: 100,
                    }
                };
                vc.http.apiGet('/community.listMyEnteredCommunitys',
                    param,
                    function (json, res) {
                        if (res.status == 200) {
                            let _data = JSON.parse(json);
                            $that.reportOweFeeDetailInfo.communitys = _data.communitys;
                        }
                    }, function () {
                        console.log('请求失败处理');
                    }
                );
            },
            _changCommunity: function () {
                $that.reportOweFeeDetailInfo.conditions.floorId = "";
                $that._listFloors();
                $that._listFees(DEFAULT_PAGE, DEFAULT_ROWS);
            }
        }
    });
})(window.vc);