Files
PropertyDeployment/resources/Web/MicroCommunityWeb/html/pages/property/propertyFee/propertyFee.js
2025-12-09 20:22:03 +08:00

148 lines
5.9 KiB
JavaScript

/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROW = 10;
vc.extends({
data: {
feeDetailInfo: {
feeDetails: [],
total: 0,
records: 1,
feeId: '',
startTime: '',
endTime: ''
}
},
_initMethod: function () {
$that.initDate();
},
_initEvent: function () {
vc.on('propertyFee', 'listFeeDetail', function (_param) {
$that.feeDetailInfo.feeId = _param.feeId;
$that.listFeeDetail(DEFAULT_PAGE, DEFAULT_ROW);
});
vc.on('propertyFee', 'listParkingSpaceData', function (_param) {
$that.feeDetailInfo.feeId = _param.feeId;
$that.listFeeDetail(DEFAULT_PAGE, DEFAULT_ROW);
});
vc.on('pagination', 'page_event', function (_currentPage) {
$that.listFeeDetail(_currentPage, DEFAULT_ROW);
});
},
methods: {
initDate: function () {
$(".start_time").datetimepicker({
format: 'yyyy-mm-dd',
fontAwesome: 'fa',
language: 'zh-CN',
initTime: true,
initialDate: new Date(),
startView: 'year',
maxView: 'decade',
minView: 'month',
autoClose: 1,
todayBtn: true
});
$('.start_time').datetimepicker()
.on('changeDate', function (ev) {
var value = $(".start_time").val();
var start = Date.parse(new Date(value));
var end = Date.parse(new Date($that.feeDetailInfo.endTime));
if (start - end >= 0) {
vc.toast("开始时间必须小于结束时间");
$(".start_time").val('');
$that.feeDetailInfo.startTime = "";
} else {
$that.feeDetailInfo.startTime = value;
}
});
$(".end_time").datetimepicker({
format: 'yyyy-mm-dd',
fontAwesome: 'fa',
language: 'zh-CN',
initTime: true,
initialDate: new Date(),
startView: 'year',
maxView: 'decade',
minView: 'month',
autoClose: 1,
todayBtn: true
});
$('.end_time').datetimepicker()
.on('changeDate', function (ev) {
var value = $(".end_time").val();
var start = Date.parse(new Date($that.feeDetailInfo.startTime));
var end = Date.parse(new Date(value));
if (start - end >= 0) {
vc.toast("结束时间必须大于开始时间");
$(".end_time").val('');
$that.feeDetailInfo.endTime = "";
} else {
$that.feeDetailInfo.endTime = value;
}
});
//防止多次点击时间插件失去焦点
document.getElementsByClassName("form-control form-control-sm start_time")[0].addEventListener('click', myfunc)
function myfunc(e) {
e.currentTarget.blur();
}
document.getElementsByClassName("form-control form-control-sm end_time")[0].addEventListener('click', myfunc)
function myfunc(e) {
e.currentTarget.blur();
}
},
listFeeDetail: function (_page, _row) {
let param = {
params: {
page: _page,
row: _row,
communityId: vc.getCurrentCommunity().communityId,
feeId: $that.feeDetailInfo.feeId,
startTime: $that.feeDetailInfo.startTime,
endTime: $that.feeDetailInfo.endTime
}
}
//发送get请求
vc.http.apiGet('/fee.queryFeeDetail',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.feeDetailInfo.total = _json.total;
$that.feeDetailInfo.records = _json.records;
$that.feeDetailInfo.feeDetails = _json.feeDetails;
vc.emit('pagination', 'init', {
total: $that.feeDetailInfo.records,
dataCount: $that.feeDetailInfo.total,
currentPage: _page
});
},
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
//查询
queryFeeDetailMethod: function () {
$that.listFeeDetail(DEFAULT_PAGE, DEFAULT_ROW);
},
//重置
resetFeeDetailMethod: function () {
$that.feeDetailInfo.startTime = "";
$that.feeDetailInfo.endTime = "";
$that.listFeeDetail(DEFAULT_PAGE, DEFAULT_ROW);
},
_openRefundModel: function (_feeDetail) {
_feeDetail.mainFeeInfo = $that.mainFeeInfo;
vc.emit('returnPayFee', 'openReturnPayFeeModel', _feeDetail);
},
_openFeeDetailDiscountModal: function (_detail) {
vc.emit('viewFeeDetailDiscount', 'openModel', _detail);
}
}
});
})(window.vc);