MicroCommunityWeb/public/components/report/dataReportEarnedDetailStatistics/dataReportEarnedDetailStatistics.js
2023-05-31 23:33:46 +08:00

87 lines
3.6 KiB
JavaScript

/**
入驻小区
**/
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
dataReportEarnedDetailStatisticsInfo: {
fees: [],
feeTypeCds: [],
ownerId: '',
roomNum: '',
startDate: '',
endDate: '',
objName: '',
ownerName: '',
link: '',
feeAmount: '0'
}
},
_initMethod: function() {
vc.getDict('pay_fee_config', "fee_type_cd_show", function(_data) {
$that.dataReportEarnedDetailStatisticsInfo.feeTypeCds = _data
});
},
_initEvent: function() {
vc.on('dataReportEarnedDetailStatistics', 'switch', function(_data) {
$that.dataReportEarnedDetailStatisticsInfo.startDate = _data.startDate;
$that.dataReportEarnedDetailStatisticsInfo.endDate = _data.endDate;
$that._loadDataReportEarnedDetailStatisticsData(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('dataReportEarnedDetailStatistics', 'paginationPlus', 'page_event',
function(_currentPage) {
$that._loadDataReportEarnedDetailStatisticsData(_currentPage, DEFAULT_ROWS);
});
vc.on('dataReportEarnedDetailStatistics', 'notify', function(_data) {
$that._loadDataReportEarnedDetailStatisticsData(DEFAULT_PAGE, DEFAULT_ROWS);
})
},
methods: {
_loadDataReportEarnedDetailStatisticsData: function(_page, _row) {
let param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
startDate: $that.dataReportEarnedDetailStatisticsInfo.startDate,
endDate: $that.dataReportEarnedDetailStatisticsInfo.endDate,
objName: $that.dataReportEarnedDetailStatisticsInfo.objName,
ownerName: $that.dataReportEarnedDetailStatisticsInfo.ownerName,
link: $that.dataReportEarnedDetailStatisticsInfo.link,
page: _page,
row: _row
}
};
//发送get请求
vc.http.apiGet('/dataReport.queryReceivedDetailStatistics',
param,
function(json) {
let _json = JSON.parse(json);
$that.dataReportEarnedDetailStatisticsInfo.fees = _json.data;
vc.emit('dataReportEarnedDetailStatistics', 'paginationPlus', 'init', {
total: _json.records,
dataCount: _json.total,
currentPage: _page
});
let _feeAmount = 0.0;
if (_json.data && _json.data.length > 0) {
_json.data.forEach(item => {
_feeAmount += parseFloat(item.receivedFee);
});
}
$that.dataReportEarnedDetailStatisticsInfo.feeAmount = _feeAmount.toFixed(2);
},
function() {
console.log('请求失败处理');
}
);
},
//查询
_qureyDataReportEarnedDetailStatistics: function() {
$that._loadDataReportEarnedDetailStatisticsData(DEFAULT_PAGE, DEFAULT_ROWS);
},
}
});
})(window.vc);