| | |
| | | } |
| | | }, |
| | | _initMethod: function () { |
| | | $that.feeDetailInfo.roomNum = vc.getParam('roomNum'); |
| | | $that.feeDetailInfo.needBack = vc.getParam('needBack'); |
| | | console.log('=======================',$that.feeDetailInfo.roomNum); |
| | | |
| | | // 初始化时设置参数 |
| | | this.feeDetailInfo.roomNum = vc.getParam('roomNum'); |
| | | this.feeDetailInfo.needBack = vc.getParam('needBack'); |
| | | |
| | | let _currentTab = vc.getParam('currentTab'); |
| | | if (_currentTab) { |
| | | $that.feeDetailInfo._currentTab = _currentTab; |
| | | this.feeDetailInfo._currentTab = _currentTab; |
| | | } |
| | | $that._loadOwnerInfo(); |
| | | |
| | | console.log('费用明细组件初始化完成'); |
| | | }, |
| | | // 组件挂载完成后立即加载数据 |
| | | mounted: function() { |
| | | console.log('费用明细组件已挂载,立即加载数据'); |
| | | |
| | | // 立即加载数据 |
| | | this._loadOwnerInfo(); |
| | | |
| | | // 添加全局刷新事件监听 |
| | | vc.on('globalRefresh', 'refreshData', function () { |
| | | if (vc.component) { |
| | | console.log('收到全局刷新事件,重新加载费用明细数据'); |
| | | vc.component._loadOwnerInfo(); |
| | | } |
| | | }); |
| | | |
| | | // 添加页面可见性变化监听 |
| | | document.addEventListener('visibilitychange', () => { |
| | | if (document.visibilityState === 'visible' && vc.component) { |
| | | console.log('页面变为可见,重新加载费用明细数据'); |
| | | vc.component._loadOwnerInfo(); |
| | | } |
| | | }); |
| | | |
| | | // 添加组件激活监听 |
| | | window.addEventListener('hashchange', () => { |
| | | if (window.location.hash.includes('managementFeesDetail') && vc.component) { |
| | | console.log('组件激活,重新加载费用明细数据'); |
| | | vc.component._loadOwnerInfo(); |
| | | } |
| | | }); |
| | | }, |
| | | _initEvent: function () { |
| | | vc.on('ownerDetail', 'listOwnerData', function (_info) { |
| | | $that._loadOwnerInfo(); |
| | | if (vc.component) { |
| | | vc.component._loadOwnerInfo(); |
| | | } |
| | | }); |
| | | }, |
| | | methods: { |
| | |
| | | return mainWidth + 'px'; |
| | | }, |
| | | _loadOwnerInfo: function () { |
| | | // 在方法内部使用this,确保组件上下文正确 |
| | | const _this = this; |
| | | |
| | | let param = { |
| | | params: { |
| | | roomNum: $that.feeDetailInfo.roomNum, |
| | | roomNum: _this.feeDetailInfo.roomNum, |
| | | communityId: vc.getCurrentCommunity().communityId, |
| | | } |
| | | } |
| | |
| | | vc.http.apiGet('/fee.reportPropertyFeeCmd', |
| | | param, |
| | | function (json, res) { |
| | | // 在回调中使用vc.component确保组件存在 |
| | | if (!vc.component) { |
| | | console.error('组件已销毁,无法更新费用明细数据'); |
| | | return; |
| | | } |
| | | |
| | | let _json = JSON.parse(json); |
| | | console.log('===========json=========',_json.data); |
| | | |
| | | |
| | | vc.copyObject(_json.data[0], $that.feeDetailInfo); |
| | | $that.feeDetailInfo.owner = _json.data.owner; |
| | | $that.feeDetailInfo.roomDto = _json.data.roomDto; |
| | | $that.feeDetailInfo.carFeeList = _json.data.carFeeList; |
| | | $that.feeDetailInfo.otherFeeList = _json.data.otherFeeList; |
| | | $that.feeDetailInfo.propertyFeeList = _json.data.propertyFeeList; |
| | | |
| | | vc.copyObject(_json.data[0], vc.component.feeDetailInfo); |
| | | vc.component.feeDetailInfo.owner = _json.data.owner; |
| | | vc.component.feeDetailInfo.roomDto = _json.data.roomDto; |
| | | vc.component.feeDetailInfo.carFeeList = _json.data.carFeeList; |
| | | vc.component.feeDetailInfo.otherFeeList = _json.data.otherFeeList; |
| | | vc.component.feeDetailInfo.propertyFeeList = _json.data.propertyFeeList; |
| | | |
| | | }, |
| | | function (errInfo, error) { |
| | | console.log('请求失败处理'); |
| | | console.log('请求失败处理:', errInfo, error); |
| | | } |
| | | ); |
| | | }, |