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
(function (vc) {
    var DEFAULT_PAGE = vc.paginationConfig ? vc.paginationConfig.defaultPage : 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            listCarFeeInfo: {
                fees: [],
                carNum: '',
                carId: '',
                total: 0,
                records: 1,
                areaNum: '',
                num: '',
                parkingName: ''
            }
        },
        _initMethod: function () {
            if (vc.notNull(vc.getParam("carNum"))) {
                vc.component.listCarFeeInfo.carNum = vc.getParam('carNum');
                vc.component.listCarFeeInfo.carId = vc.getParam('carId');
                vc.component.listCarFeeInfo.areaNum = vc.getParam('areaNum');
                vc.component.listCarFeeInfo.num = vc.getParam('num');
            }
            let _parkingName = "无车位";
            if (vc.component.listCarFeeInfo.areaNum != 'undefined') {
                _parkingName = vc.component.listCarFeeInfo.areaNum + "停车场" + vc.component.listCarFeeInfo.num + "车位";
            }
            vc.component.listCarFeeInfo.parkingName = _parkingName;
            vc.component._loadlistCarFeeInfo(1, 10);
        },
        _initEvent: function () {
            vc.on('listParkingSpaceFee', 'notify', function (_param) {
                vc.component._loadlistCarFeeInfo(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event',
                function (_currentPage) {
                    vc.component._loadlistCarFeeInfo(_currentPage, DEFAULT_ROWS);
                });
        },
        methods: {
            _loadlistCarFeeInfo: function (_page, _row) {
                var param = {
                    params: {
                        page: _page,
                        row: _row,
                        communityId: vc.getCurrentCommunity().communityId,
                        payerObjId: vc.component.listCarFeeInfo.carId
                    }
                };
                //发送get请求
                vc.http.apiGet('/fee.listFee',
                    param,
                    function (json) {
                        console.log('API返回的数据:', json);
                        let _feeConfigInfo = JSON.parse(json);
                        console.log('解析后的数据:', _feeConfigInfo);
                        vc.component.listCarFeeInfo.total = _feeConfigInfo.total;
                        vc.component.listCarFeeInfo.records = _feeConfigInfo.records;
                        vc.component.listCarFeeInfo.fees = _feeConfigInfo.fees;
                        console.log('赋值后的fees:', vc.component.listCarFeeInfo.fees);
                        // 计算总页数
                        var totalPages = Math.ceil(_feeConfigInfo.total / _rows) || 1;
                        vc.emit('pagination', 'init', {
                            total: totalPages,
                            dataCount: _feeConfigInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo) {
                        console.log('请求失败处理:', errInfo);
                    }
                );
            },
            _payFee: function (_fee) {
                _fee.roomName = vc.component.listCarFeeInfo.carNum;
                vc.jumpToPage('/#/pages/property/payFeeOrder?feeId=' + _fee.feeId);
            },
            _payFeeHis: function (_fee) {
                vc.jumpToPage('/#/pages/property/propertyFee?' + vc.objToGetParam(_fee));
            },
            _editFee: function (_fee) {
                vc.emit('editFee', 'openEditFeeModal', _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
                });
            },
            _refreshlistCarFeeInfo: function () {
                vc.component.listCarFeeInfo._currentFeeConfigName = "";
            },
            _openCarCreateFeeAddModal: function () {
                vc.emit('carCreateFeeAdd', 'openCarCreateFeeAddModal', {
                    isMore: false,
                    car: vc.component.listCarFeeInfo
                });
            },
            _openAddMeterWaterModal: function () {
                vc.emit('addMeterWater', 'openAddMeterWaterModal', {
                    roomId: vc.component.listCarFeeInfo.carId,
                    roomName: vc.component.listCarFeeInfo.carNum,
                    ownerName: vc.component.listCarFeeInfo.parkingName,
                    objType: '6666'
                });
            },
            _goBack: function () {
                vc.goBack();
            },
            _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);
            },
            _viewCarFeeConfig: function (_fee) {
                let param = {
                    params: {
                        page: 1,
                        row: 1,
                        communityId: vc.getCurrentCommunity().communityId,
                        configId: _fee.configId
                    }
                };
                //发送get请求
                vc.http.apiGet('/feeConfig.listFeeConfigs', param,
                    function (json, res) {
                        let _feeConfigManageInfo = JSON.parse(json);
                        let _feeConfig = _feeConfigManageInfo.feeConfigs[0];
                        vc.emit('viewData', 'openViewDataModal', {
                            title: _fee.feeName,
                            data: {
                                "费用项ID": _feeConfig.configId,
                                "费用类型": _feeConfig.feeTypeCdName,
                                "收费项目": _feeConfig.feeName,
                                "费用标识": _feeConfig.feeFlagName,
                                "催缴类型": _feeConfig.billTypeName,
                                "付费类型": _feeConfig.paymentCd == '1200' ? '预付费' : '后付费',
                                "缴费周期": _feeConfig.paymentCycle,
                                "计费起始时间": _feeConfig.startTime,
                                "计费终止时间": _feeConfig.endTime,
                                "公式": _feeConfig.computingFormulaName,
                                "计费单价": _feeConfig.computingFormula == '2002' ? '-' : _feeConfig.squarePrice,
                                "附加/固定费用": _feeConfig.additionalAmount,
                            }
                        })
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _viewCarFee: function (_fee) {
                let _data = {
                    "费用ID": _fee.feeId,
                    "费用标识": _fee.feeFlagName,
                    "费用类型": _fee.feeTypeCdName,
                    "费用项": _fee.feeName,
                    "费用状态": _fee.stateName,
                    "建账时间": _fee.startTime,
                    "计费开始时间": $that._getEndTime(_fee),
                    "计费结束时间": $that._getDeadlineTime(_fee),
                    "批次": _fee.batchId,
                };
                _fee.feeAttrs.forEach(attr => {
                    _data[attr.specCdName] = attr.value;
                })
                vc.emit('viewData', 'openViewDataModal', {
                    title: _fee.feeName + " 详情",
                    data: _data
                });
            },
            _splitPayFee:function(_fee){
                vc.emit('splitFee', 'openSplitFeeModal',_fee);
            }
        }
    });
})(window.vc);