jialh
2025-07-25 4d04a2c2695cef163680ab4a5787ac75f0b79396
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
/**
 入驻小区
 **/
 (function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            simplifyRoomFeeInfo: {
                total: 0,
                records: 1,
                fees: [],
                monthFees: [],
                roomId: '',
                roomName: '',
                name: '',
                floorNum: '',
                unitNum: '',
                roomNum: '',
                configId: '',
                feeTypeCds: [],
                feeTypeCd: '',
                state: '2008001',
                totalAmount: 0.0,
                roomType: '',
                ownerFee: 'N',
                ownerId: '',
                showFlag: 'DEFAULT'
            }
        },
        _initMethod: function () {
            vc.popover('popover-show');
            vc.popover('popover-show-endTime');
            vc.popover('popover-show-deadlineTime');
 
            $that._changeSimplifyRoomFeeFeeTypeCd($that.simplifyRoomFeeInfo.feeTypeCd);
        },
        _initEvent: function () {
            //切换 至费用页面
            vc.on('simplifyRoomFee', 'switch', function (_param) {
                $that.clearSimplifyRoomFeeInfo();
                if (_param.roomId == '') {
                    return;
                }
                vc.copyObject(_param, $that.simplifyRoomFeeInfo)
                $that._listSimplifyRoomFee(DEFAULT_PAGE, DEFAULT_ROWS);
                vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
                    $that.simplifyRoomFeeInfo.feeTypeCds = _data;
                });
            });
            vc.on('simplifyRoomFee', 'notify', function () {
                $that._listSimplifyRoomFee(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('simplifyRoomFee', 'paginationPlus', 'page_event',
                function(_currentPage) {
                    $that._listSimplifyRoomFee(_currentPage, DEFAULT_ROWS);
                });
        },
        methods: {
            getOnePrice1: function (fee) {
                let _price = fee.mwPrice;
                if (!_price) {
                    return fee.squarePrice;
                }
                if (parseFloat(_price) > 0) {
                    return _price;
                }
                return fee.squarePrice;
            },
            _listSimplifyRoomFee: function (_page, _row) {
                let param = {
                    params: {
                        page: _page,
                        row: _row,
                        communityId: vc.getCurrentCommunity().communityId,
                        payerObjId: $that.simplifyRoomFeeInfo.roomId,
                        payerObjType: '3333',
                        configId: $that.simplifyRoomFeeInfo.configId,
                        state: $that.simplifyRoomFeeInfo.state,
                        feeTypeCd: $that.simplifyRoomFeeInfo.feeTypeCd,
                    }
                };
                //按业主查询
                if ($that.simplifyRoomFeeInfo.ownerFee == 'Y') {
                    param.params.payerObjId = '';
                    param.params.ownerId = $that.simplifyRoomFeeInfo.ownerId;
                }
                //发送get请求
                vc.http.apiGet('/fee.listFee',
                    param,
                    function (json) {
                        let _feeConfigInfo = JSON.parse(json);
                        $that.simplifyRoomFeeInfo.total = _feeConfigInfo.total;
                        $that.simplifyRoomFeeInfo.records = _feeConfigInfo.records;
                        let _totalAmount = 0.0;
                        _feeConfigInfo.fees.forEach(item => {
                            _totalAmount += parseFloat(item.amountOwed);
                        })
                        $that.simplifyRoomFeeInfo.totalAmount = _totalAmount.toFixed(2);
                        $that.simplifyRoomFeeInfo.fees = _feeConfigInfo.fees.sort($that._roomFeeCompare);
                        vc.emit('simplifyRoomFee', 'paginationPlus', 'init', {
                            total: $that.simplifyRoomFeeInfo.records,
                            dataCount: $that.simplifyRoomFeeInfo.total,
                            currentPage: _page
                        });
                    },
                    function () {
                        console.log('请求失败处理');
                    }
                );
            },
            _roomFeeCompare: function (a, b) {
                var val1 = a.payerObjName;
                var val2 = b.payerObjName;
                if (val1 < val2) {
                    return -1;
                } else if (val1 > val2) {
                    return 1;
                } else {
                    return 0;
                }
            },
            _toOwnerPayFee: function () {
                vc.jumpToPage('/#/pages/property/owePayFeeOrder?payObjId=' + $that.simplifyRoomFeeInfo.roomId + "&payObjType=3333&roomName=" + $that.simplifyRoomFeeInfo.roomName);
            },
           
            _openRoomCreateFeeAddModal: function () {
                $that.simplifyRoomFeeInfo.ownerName = $that.simplifyRoomFeeInfo.name;
                vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal', {
                    isMore: false,
                    room: $that.simplifyRoomFeeInfo,
                    ownerName: $that.simplifyRoomFeeInfo.name
                });
            },
            _openAddMeterWaterSimplifyModal: function () {
                vc.emit('addMeterWater', 'openAddMeterWaterModal', {
                    roomId: $that.simplifyRoomFeeInfo.roomId,
                    roomName: $that.simplifyRoomFeeInfo.roomName,
                    ownerName: $that.simplifyRoomFeeInfo.name
                });
            },
            _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.maxEndTime) {
                    return "-";
                }
                if (_fee.state == '2009001') {
                    return "-";
                }
                return vc.dateFormat(_fee.maxEndTime);
            },
            _getEndTime: function (_fee) {
                if (_fee.state == '2009001') {
                    return "-";
                }
                return vc.dateFormat(_fee.endTime);
            },
            _openProxyFeeModal: function () { //创建代收费用
                vc.emit('addProxyFee', 'openAddProxyFeeModal', {
                    roomId: $that.simplifyRoomFeeInfo.roomId,
                    roomName: $that.simplifyRoomFeeInfo.roomName,
                    ownerName: $that.simplifyRoomFeeInfo.name
                });
            },
            _payFee: function (_fee) {
                _fee.roomName = $that.simplifyRoomFeeInfo.roomName;
                _fee.builtUpArea = $that.simplifyRoomFeeInfo.builtUpArea;
                // vc.jumpToPage('/#/pages/property/payFeeOrder?' + vc.objToGetParam(_fee));
                vc.jumpToPage('/#/pages/property/payFeeOrder?feeId=' + _fee.feeId);
            },
            _editFee: function (_fee) {
                // 计费结束时间
                _fee.maxEndTime = $that._getAttrValue(_fee.feeAttrs, '390010');
                vc.emit('editFee', 'openEditFeeModal', _fee);
            },
            _payFeeHis: function (_fee) {
                _fee.builtUpArea = $that.simplifyRoomFeeInfo.builtUpArea;
                vc.jumpToPage('/#/pages/property/propertyFee?' + vc.objToGetParam(_fee));
            },
            _deleteFee: function (_fee) {
                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
                });
            },
            _openTempImportRoomFeeModal: function () {
                vc.emit('tempImportRoomFee', 'openImportRoomFeeModal', {
                    roomId: $that.simplifyRoomFeeInfo.roomId,
                    roomName: $that.simplifyRoomFeeInfo.roomName,
                    ownerName: $that.simplifyRoomFeeInfo.name
                })
            },
            clearSimplifyRoomFeeInfo: function () {
                let _feeConfigs = $that.roomCreateFeeAddInfo.feeTypeCds;
                $that.simplifyRoomFeeInfo = {
                    total: 0,
                    records: 1,
                    fees: [],
                    monthFees: [],
                    accounts: [],
                    roomId: '',
                    name: '',
                    roomName: '',
                    floorNum: '',
                    unitNum: '',
                    roomNum: '',
                    feeConfigs: _feeConfigs,
                    feeTypeCd: '',
                    configId: '',
                    state: '2008001',
                    totalAmount: 0.0,
                    roomType: '',
                    ownerFee: 'N',
                    ownerId: '',
                    showFlag: 'DEFAULT'
                }
            },
            _changeSimplifyRoomFeeFeeTypeCd: function (_feeTypeCd) {
                $that.simplifyRoomFeeInfo.configId = '';
                vc.emit('simplifyRoomFee', 'notify', {});
                var param = {
                    params: {
                        page: 1,
                        row: 50,
                        communityId: vc.getCurrentCommunity().communityId,
                        feeTypeCd: _feeTypeCd,
                        isDefault: '',
                        valid: '1'
                    }
                };
                //发送get请求
                vc.http.apiGet('/feeConfig.listFeeConfigs', param,
                    function (json, res) {
                        var _feeConfigManageInfo = JSON.parse(json);
                        $that.simplifyRoomFeeInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    });
            },
            _changeSimplifyRoomConfigId: function () {
                vc.emit('simplifyRoomFee', 'notify', {});
            },
            _simplifyRoomGetFeeOwnerInfo: function (attrs) {
                let ownerName = $that._getAttrValue(attrs, '390008');
                let ownerLink = $that._getAttrValue(attrs, '390009');
                return '业主:' + ownerName + ',电话:' + ownerLink;
            },
            _getSimplifyRoomFeeRoomName: function (fee) {
                if ($that.simplifyRoomFeeInfo.ownerFee != 'Y') {
                    return '';
                }
                let _feeName = ''
                fee.feeAttrs.forEach(item => {
                    if (item.specCd == '390012') {
                        _feeName = '(' + item.value + ')';
                    }
                })
                return _feeName;
            },
            _openBatchPayRoomFeeModal: function () {
                vc.jumpToPage('/#/pages/property/batchPayFeeOrder?ownerId=' + $that.simplifyRoomFeeInfo.ownerId + "&payerObjType=3333")
            },
            _openMonthPayRoomFeeModal: function() {
                vc.jumpToPage('/#/pages/property/payFeeMonthOrder?payerObjId=' +
                    $that.simplifyRoomFeeInfo.roomId +
                    "&payerObjType=3333");
            },
            _openRoomCreateFeeComboModal: function() {
                vc.jumpToPage('/#/pages/property/createFeeByCombo?payerObjId=' +
                    $that.simplifyRoomFeeInfo.roomId +
                    "&payerObjName=" + $that.simplifyRoomFeeInfo.roomName + "&payerObjType=3333")
            },
            _viewRoomFeeConfig: 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('请求失败处理');
                    }
                );
 
            },
            _viewRoomFee: function (_fee) {
                let _data = {
                    "费用ID": _fee.feeId,
                    "费用标识": _fee.feeFlagName,
                    "费用类型": _fee.feeTypeCdName,
                    "付费对象": _fee.payerObjName,
                    "费用项": _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
                });
            },
            _changeSimplifyRoomShowFlag: function() {
                if ($that.simplifyRoomFeeInfo.showFlag == 'MONTH') {
                    $that._listSimplifyRoomMonthFee(DEFAULT_PAGE, DEFAULT_ROWS)
                } else {
                    $that._listSimplifyRoomFee(DEFAULT_PAGE, DEFAULT_ROWS);
                }
            },
            _listSimplifyRoomMonthFee: function(_page, _row) {
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                        communityId: vc.getCurrentCommunity().communityId,
                        objId: $that.simplifyRoomFeeInfo.roomId,
                        payerObjType: '3333',
                        configId: $that.simplifyRoomFeeInfo.configId,
                        feeTypeCd: $that.simplifyRoomFeeInfo.feeTypeCd,
                        detailId: '-1',
                        feeState:'2008001'
                    }
                };
                //按业主查询
                if ($that.simplifyRoomFeeInfo.ownerFee == 'Y') {
                    param.params.payerObjId = '';
                    param.params.ownerId = $that.simplifyRoomFeeInfo.ownerId;
                }
                //发送get请求
                vc.http.apiGet('/fee.listMonthFee',
                    param,
                    function(json) {
                        let _feeConfigInfo = JSON.parse(json);
                        $that.simplifyRoomFeeInfo.total = _feeConfigInfo.total;
                        $that.simplifyRoomFeeInfo.records = _feeConfigInfo.records;
                        let _totalAmount = 0.0;
                        _feeConfigInfo.data.forEach(item => {
                            _totalAmount += parseFloat(item.receivableAmount);
                        })
                        $that.simplifyRoomFeeInfo.totalAmount = _totalAmount.toFixed(2);
                        $that.simplifyRoomFeeInfo.monthFees = _feeConfigInfo.data;
                    },
                    function() {
                        console.log('请求失败处理');
                    }
                );
            },
        }
    });
})(window.vc);