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
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            listContractFeeInfo: {
                fees: [],
                contractName: '',
                contractId: '',
                total: 0,
                records: 1,
                builtUpArea: 0.00,
                contractCode: '',
                ownerName: '',
                contractType: '',
                hireOwnerFee: '0',
                urlOwnerId: ''
            }
        },
        _initMethod: function () {
            if (vc.notNull(vc.getParam("contractId"))) {
                $that.listContractFeeInfo.contractName = vc.getParam('contractCode')
                $that.listContractFeeInfo.contractId = vc.getParam('contractId');
                $that._listContract($that.listContractFeeInfo.contractId);
            }
            if (vc.notNull(vc.getParam('ownerId'))) {
                $that.listContractFeeInfo.urlOwnerId = vc.getParam("ownerId");
            }
            vc.component._loadListContractFeeInfo(DEFAULT_PAGE, DEFAULT_ROWS);
        },
        _initEvent: function () {
            vc.on('listContractFee', 'notify', function (_param) {
                vc.component._loadListContractFeeInfo(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event',
                function (_currentPage) {
                    vc.component._loadListContractFeeInfo(_currentPage, DEFAULT_ROWS);
                });
        },
        methods: {
            _loadListContractFeeInfo: function (_page, _row) {
                var param = {
                    params: {
                        page: _page,
                        row: _row,
                        communityId: vc.getCurrentCommunity().communityId,
                        payerObjId: vc.component.listContractFeeInfo.contractId,
                        ownerId: $that.listContractFeeInfo.urlOwnerId,
                        isContractFee:'O'
                    }
                };
                //发送get请求
                vc.http.apiGet('/fee.listFee',
                    param,
                    function (json) {
                        var _feeConfigInfo = JSON.parse(json);
                        vc.component.listContractFeeInfo.total = _feeConfigInfo.total;
                        vc.component.listContractFeeInfo.records = _feeConfigInfo.records;
                        vc.component.listContractFeeInfo.fees = _feeConfigInfo.fees;
                        vc.emit('pagination', 'init', {
                            total: _feeConfigInfo.records,
                            dataCount: _feeConfigInfo.total,
                            currentPage: _page
                        });
                    },
                    function () {
                        console.log('请求失败处理');
                    }
                );
            },
            _openTempImportContractFeeModal: function () {
                vc.emit('tempImportRoomFee', 'openImportRoomFeeModal', {
                    roomId: $that.listContractFeeInfo.contractId,
                    objType: '7777',
                    roomName: $that.listContractFeeInfo.contractName,
                    ownerName: $that.listContractFeeInfo.ownerName
                })
            },
            _payFee: function (_fee) {
                vc.jumpToPage('/#/pages/property/payFeeOrder?feeId=' + _fee.feeId + '&isContractFee=' + _fee.isContractFee);
 
            },
            _editFee: function (_fee) {
                vc.emit('editFee', 'openEditFeeModal', _fee);
            },
            _payFeeHis: function (_fee) {
                _fee.builtUpArea = $that.listContractFeeInfo.builtUpArea;
                vc.jumpToPage('/#/pages/property/propertyFee?' + vc.objToGetParam(_fee));
            },
            _deleteFee: function (_fee) {
                // var dateA = new Date(_fee.startTime);
                // var dateB = new Date();
                // if(dateA.setHours(0, 0, 0, 0) != dateB.setHours(0, 0, 0, 0)){
                //     vc.toast("只能取消当天添加的费用");
                //     return;
                // }
                vc.emit('deleteFee', 'openDeleteFeeModal', {
                    communityId: vc.getCurrentCommunity().communityId,
                    feeId: _fee.feeId
                });
            },
            _finishFee: function (_fee) {
                vc.emit('finishFee', 'openFinishFeeModal', {
                    communityId: vc.getCurrentCommunity().communityId,
                    feeId: _fee.feeId
                });
            },
            _refreshListContractFeeInfo: function () {
                vc.component.listContractFeeInfo._currentFeeConfigName = "";
            },
            _goBack: function () {
                vc.goBack();
            },
            _toOwnerPayFee: function () {
                vc.jumpToPage('/#/pages/property/owePayFeeOrder?payObjId=' + $that.listContractFeeInfo.contractId +
                    "&payObjType=7777&contractName=" + $that.listContractFeeInfo.contractName);
            },
            _openRoomCreateFeeAddModal: function () {
                vc.emit('contractCreateFeeAdd', 'openContractCreateFeeAddModal', {
                    isMore: false,
                    contract: $that.listContractFeeInfo
                });
            },
            _getAttrValue: function (_attrs, _specCd) {
                let _value = "";
                _attrs.forEach(item => {
                    if (item.specCd == _specCd) {
                        _value = item.value;
                        return;
                    }
                });
                return _value;
            },
            _getDeadlineTime: function (_fee) {
                if (_fee.amountOwed == 0 && _fee.endTime == _fee.deadlineTime) {
                    return "-";
                }
                if (_fee.state == '2009001') {
                    return "-";
                }
                return vc.dateFormat( _fee.deadlineTime);
            },
            _getEndTime: function (_fee) {
                if (_fee.state == '2009001') {
                    return "-";
                }
                return vc.dateFormat(_fee.endTime);
            },
            _listContract: function (contractId) {
                let param = {
                    params: {
                        page: 1,
                        row: 1,
                        contractId: contractId,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
                //发送get请求
                vc.http.apiGet('/contract/queryContract',
                    param,
                    function (json, res) {
                        let listRoomData = JSON.parse(json);
                        if (listRoomData.total < 1) {
                            return;
                        }
                        vc.copyObject(listRoomData.data[0], $that.listContractFeeInfo);
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
        }
    });
})(window.vc);