/**
|
入驻小区
|
**/
|
(function(vc) {
|
var DEFAULT_PAGE = 1;
|
var DEFAULT_ROWS = 10;
|
vc.extends({
|
data: {
|
reportFeeSummaryInfo: {
|
fees: [],
|
feeConfigs: [],
|
feeConfigNames: [],
|
total: 0,
|
records: 1,
|
moreCondition: false,
|
title: '',
|
roomUnits: [],
|
totalReceivableAmount: 0.0,
|
allReceivableAmount: 0.0,
|
totalReceivedAmount: 0.0,
|
allReceivedAmount: 0.0,
|
totalPreferentialAmount: 0.0,
|
allHisOweReceivedAmount: 0.0,
|
allOweAmount: 0.0,
|
conditions: {
|
floorId: '',
|
floorName: '',
|
roomNum: '',
|
unitId: '',
|
startTime: '',
|
endTime: '',
|
communityId: vc.getCurrentCommunity().communityId
|
}
|
}
|
},
|
_initMethod: function() {
|
|
vc.component._listAllFees(DEFAULT_PAGE, DEFAULT_ROWS);
|
$(".popover-show").mouseover(() => {
|
$('.popover-show').popover('show');
|
})
|
$(".popover-show").mouseleave(() => {
|
$('.popover-show').popover('hide');
|
})
|
},
|
_initEvent: function() {
|
$('#configIds').on('changed.bs.select', function(e, clickedIndex, isSelected, previousValue) {
|
// do something...
|
if (isSelected) {
|
$that.reportFeeSummaryInfo.feeConfigNames.push({
|
configId: $that.reportFeeSummaryInfo.feeConfigs[clickedIndex].configId,
|
configName: $that.reportFeeSummaryInfo.feeConfigs[clickedIndex].feeName
|
})
|
} else {
|
let _feeConfigNames = [];
|
$that.reportFeeSummaryInfo.feeConfigNames.forEach(item => {
|
if (item.configId != $that.reportFeeSummaryInfo.feeConfigs[clickedIndex].configId) {
|
_feeConfigNames.push(item);
|
}
|
});
|
$that.reportFeeSummaryInfo.feeConfigNames = _feeConfigNames;
|
}
|
});
|
vc.on('reportFeeSummary', 'chooseFloor', function(_param) {
|
vc.component.reportFeeSummaryInfo.conditions.floorId = _param.floorId;
|
vc.component.reportFeeSummaryInfo.conditions.floorName = _param.floorName;
|
vc.component.loadUnits(_param.floorId);
|
});
|
vc.on('pagination', 'page_event', function(_currentPage) {
|
vc.component._listFees(_currentPage, DEFAULT_ROWS);
|
});
|
},
|
methods: {
|
//查询
|
_queryMethod: function() {
|
vc.component._listAllFees(DEFAULT_PAGE, DEFAULT_ROWS);
|
},
|
//查询方法
|
_listFees: function(_yearMonth) {
|
// 检查是否为本地开发环境
|
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
|
|
if (isLocalhost) {
|
// 本地开发环境,使用模拟数据
|
setTimeout(() => { // 模拟异步请求延迟
|
let _json = {
|
data: [
|
{
|
roomId: '1',
|
roomName: '1-1-101',
|
feeConfigDtos: [
|
{configId: '1', feeName: '物业费', amount: '100.00', receivedAmount: '100.00'},
|
{configId: '2', feeName: '水费', amount: '50.00', receivedAmount: '50.00'}
|
],
|
receivableAmount: '150.00',
|
receivedAmount: '150.00',
|
preferentialAmount: '0.00',
|
oweAmount: '0.00'
|
},
|
{
|
roomId: '2',
|
roomName: '1-1-102',
|
feeConfigDtos: [
|
{configId: '1', feeName: '物业费', amount: '100.00', receivedAmount: '80.00'},
|
{configId: '3', feeName: '电费', amount: '60.00', receivedAmount: '60.00'}
|
],
|
receivableAmount: '160.00',
|
receivedAmount: '140.00',
|
preferentialAmount: '20.00',
|
oweAmount: '0.00'
|
}
|
]
|
};
|
//vc.component.reportFeeSummaryInfo.fees = _json.data;
|
_json.data.forEach(item => {
|
item.yearMonth = _yearMonth;
|
vc.component.reportFeeSummaryInfo.fees.push(item);
|
});
|
}, 500);
|
} else {
|
// 生产环境,使用真实后端服务
|
vc.component.reportFeeSummaryInfo.conditions.page = 1;
|
vc.component.reportFeeSummaryInfo.conditions.row = 1;
|
vc.component.reportFeeSummaryInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
|
$that.reportFeeSummaryInfo.conditions.startDate = _yearMonth + "-01";
|
// 下个月
|
let _date = new Date(Date.parse($that.reportFeeSummaryInfo.conditions.startDate.replace(/-/g, "/")));
|
vc.component.reportFeeSummaryInfo.conditions.endDate = vc.addMonthDate(_date, 1);
|
|
let param = {
|
params: vc.component.reportFeeSummaryInfo.conditions
|
};
|
param.params.roomNum = param.params.roomNum.trim();
|
// let _configIds = "";
|
// $that.reportFeeSummaryInfo.feeConfigNames.forEach(item => {
|
// _configIds += (item.configId + ',')
|
// })
|
// if (_configIds.endsWith(',')) {
|
// _configIds = _configIds.substring(0, _configIds.length - 1);
|
// }
|
// param.params.configIds = _configIds;
|
//发送get请求
|
vc.http.apiGet('/reportFeeMonthStatistics.queryReportFeeSummary',
|
param,
|
function(json, res) {
|
let _json = JSON.parse(json);
|
//vc.component.reportFeeSummaryInfo.fees = _json.data;
|
_json.data.forEach(item => {
|
item.yearMonth = _yearMonth;
|
vc.component.reportFeeSummaryInfo.fees.push(item);
|
});
|
},
|
function(errInfo, error) {
|
console.log('请求失败处理');
|
}
|
);
|
}
|
},
|
//重置
|
_resetMethod: function(_page, _rows) {
|
vc.component.reportFeeSummaryInfo.conditions.floorName = "";
|
vc.component.reportFeeSummaryInfo.conditions.floorId = "";
|
vc.component.reportFeeSummaryInfo.conditions.unitId = "";
|
vc.component.reportFeeSummaryInfo.conditions.roomNum = "";
|
vc.component.reportFeeSummaryInfo.conditions.startTime = "";
|
vc.component.reportFeeSummaryInfo.conditions.endTime = "";
|
$that._listAllFees(DEFAULT_PAGE, DEFAULT_ROWS);
|
},
|
loadUnits: function(_floorId) {
|
var param = {
|
params: {
|
floorId: _floorId,
|
communityId: vc.getCurrentCommunity().communityId
|
}
|
}
|
vc.http.apiGet(
|
'/unit.queryUnits',
|
param,
|
function(json, res) {
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
if (res.status == 200) {
|
let tmpUnits = JSON.parse(json);
|
vc.component.reportFeeSummaryInfo.roomUnits = tmpUnits;
|
return;
|
}
|
vc.toast(json);
|
},
|
function(errInfo, error) {
|
console.log('请求失败处理');
|
vc.toast(errInfo);
|
});
|
},
|
_openChooseFloorMethod: function() {
|
vc.emit('searchFloor', 'openSearchFloorModel', {});
|
},
|
_moreCondition: function() {
|
if (vc.component.reportFeeSummaryInfo.moreCondition) {
|
vc.component.reportFeeSummaryInfo.moreCondition = false;
|
} else {
|
vc.component.reportFeeSummaryInfo.moreCondition = true;
|
}
|
},
|
|
_getFeeReceivedAmountAmount: function(item, fee) {
|
let _items = fee.feeConfigDtos;
|
if (!_items) {
|
return 0;
|
}
|
let _value = 0;
|
_items.forEach(tmp => {
|
if (tmp.configId == item.configId) {
|
_value = tmp.amount;
|
return;
|
}
|
})
|
return _value;
|
},
|
_exportExcel: function() {
|
// 检查是否为本地开发环境
|
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
|
|
if (isLocalhost) {
|
// 本地开发环境,模拟导出成功
|
setTimeout(() => { // 模拟异步请求延迟
|
vc.toast('导出任务已提交,稍后可在下载中心查看');
|
// 可以跳转到下载中心页面
|
// vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心')
|
}, 500);
|
} else {
|
// 生产环境,使用真实后端服务
|
vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportFeeSummary&' + vc.objToGetParam($that.reportFeeSummaryInfo.conditions));
|
}
|
},
|
_computeSum: function(a, b) {
|
return (parseFloat(a) + parseFloat(b)).toFixed(2)
|
},
|
|
_printFeeSummary: function() {
|
let _param = vc.objToGetParam($that.reportFeeSummaryInfo.conditions);
|
window.open('/print.html#/pages/property/reportFeeSummaryPrint?' + _param);
|
},
|
_listAllFees: function() {
|
vc.component.reportFeeSummaryInfo.fees = [];
|
let data = new Date();
|
//获取年
|
let year = data.getFullYear();
|
//获取月
|
let mon = data.getMonth() + 1;
|
let arry = new Array();
|
for (let i = 0; i < 12; i++) {
|
if (mon <= 0) {
|
year = year - 1;
|
mon = mon + 12;
|
}
|
if (mon < 10) {
|
mon = "0" + mon;
|
}
|
arry[i] = year + "-" + mon;
|
mon = mon - 1;
|
}
|
|
arry.forEach(item => {
|
$that._listFees(item);
|
})
|
|
}
|
}
|
});
|
})(window.vc);
|