MicroCommunityWeb/public/pages/property/payFeeOrder/payFeeOrder.js
sangzhigang a2ad31d6fa 费用管理房屋收费修改如下:
1.业主名称、业主身份证号、房屋编号选框去空处理
  2.新增重置按钮
  3.列表手机号隐藏中间四位数字,身份证号隐藏后四位
  4.列表页面居中处理
  5.在表头加上单位,修改房屋显示格式
  6.解决房屋收费批量创建页面时间插件多次点击失去焦点问题
  7.查看费用中水电抄表和创建费用时间插件防止失去焦点处理
  8.缴费历史时间查询修改;加了重置按钮;列表居中处理;并在表    头加上单位;开始时间和结束时间选框日期插件只能选择年月日,  且终止时间不能大于起始时间
  9.费用变更修改成功后加了操作成功提示
2020-12-03 16:29:37 +08:00

249 lines
11 KiB
JavaScript

(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
payFeeOrderInfo: {
feeId: '',
feeName: '',
feeTypeCdName: '',
endTime: '',
feeFlag: '',
feePrice: 0.00,
tempCycles: '',
cycles: '',
paymentCycles: [],
totalFeePrice: 0.00,
receivedAmount: '',
communityId: vc.getCurrentCommunity().communityId,
payerObjName: '',
squarePrice: '',
remark: '',
builtUpArea: 0.0,
squarePrice: 0.0,
additionalAmount: 0.0,
receiptId: '',
showEndTime: '',
selectDiscount: [],
totalDiscountMoney: 0.0
}
},
_initMethod: function () {
if (vc.notNull(vc.getParam("feeId"))) {
vc.component.payFeeOrderInfo.feeId = vc.getParam('feeId');
vc.component.payFeeOrderInfo.feeName = vc.getParam('feeName');
vc.component.payFeeOrderInfo.feeTypeCdName = vc.getParam('feeTypeCdName');
vc.component.payFeeOrderInfo.endTime = vc.getParam('endTime').replace(/%3A/g, ':');
vc.component.payFeeOrderInfo.feePrice = vc.getParam('feePrice');
$that.payFeeOrderInfo.feeFlag = vc.getParam('feeFlag');
$that.payFeeOrderInfo.payerObjName = vc.getParam('payerObjName');
$that.payFeeOrderInfo.squarePrice = vc.getParam('squarePrice');
$that.payFeeOrderInfo.additionalAmount = vc.getParam('additionalAmount');
//$that.payFeeOrderInfo.builtUpArea = vc.getParam('builtUpArea');
$that.payFeeOrderInfo.squarePrice = vc.getParam('squarePrice');
$that.payFeeOrderInfo.additionalAmount = vc.getParam('additionalAmount');
$that.payFeeOrderInfo.paymentCycles = [];
for (let _index = 1; _index < 7; _index++) {
$that.payFeeOrderInfo.paymentCycles.push(_index * vc.getParam('paymentCycle'))
}
$that.listPayFeeOrderRoom();
}
vc.component.payFeeOrderInfo.totalFeePrice = $that._mathCeil(vc.component.payFeeOrderInfo.feePrice);
vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice;
},
_initEvent: function () {
vc.on('payFeeOrder', 'changeDiscountPrice', function (_param) {
let _totalFeePrice = $that.payFeeOrderInfo.totalFeePrice;
if (_totalFeePrice < 0) {
return;
}
let _totalDiscountMoney = _param.totalDiscountMoney;
//如果应收小区 优惠金额 则不优惠
if (_totalFeePrice < _totalDiscountMoney) {
return;
}
$that.payFeeOrderInfo.selectDiscount = _param.selectDiscount;
$that.payFeeOrderInfo.totalDiscountMoney = _totalDiscountMoney;
$that.payFeeOrderInfo.receivedAmount = _totalFeePrice - _totalDiscountMoney;
});
vc.on('payFeeOrder', 'initData', function (_param) {
$that.payFeeOrderInfo.paymentCycles = [];
for (let _index = 1; _index < 7; _index++) {
$that.payFeeOrderInfo.paymentCycles.push(_index * _param.paymentCycle);
}
$that.payFeeOrderInfo.totalFeePrice = $that._mathCeil(vc.component.payFeeOrderInfo.feePrice);
$that.payFeeOrderInfo.receivedAmount = $that.payFeeOrderInfo.totalFeePrice;
})
},
methods: {
payFeeValidate: function () {
return vc.validate.validate({
payFeeOrderInfo: vc.component.payFeeOrderInfo
}, {
'payFeeOrderInfo.feeId': [
{
limit: "required",
param: "",
errInfo: "费用ID不能为空"
}
],
'payFeeOrderInfo.cycles': [
{
limit: "required",
param: "",
errInfo: "缴费周期不能为空"
}
],
'payFeeOrderInfo.receivedAmount': [
{
limit: "required",
param: "",
errInfo: "实收金额不能为空"
},
{
limit: "money",
param: "",
errInfo: "实收金额不是有效的金额"
}
]
});
},
_openPayFee: function () {
if ($that.payFeeOrderInfo.tempCycles != "" && $that.payFeeOrderInfo.tempCycles != '-102') {
$that.payFeeOrderInfo.cycles = $that.payFeeOrderInfo.tempCycles;
}
if ($that.payFeeOrderInfo.feeFlag == '2006012') {
$that.payFeeOrderInfo.cycles = '1';
}
if ($that.payFeeOrderInfo.cycles == "") {
$that.payFeeOrderInfo.cycles = '-101';
}
if (!vc.component.payFeeValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
if (!(/(^[1-9]\d*$)/.test($that.payFeeOrderInfo.cycles))) {
$that.payFeeOrderInfo.showEndTime = '';
} else {
console.log('cycle', $that.payFeeOrderInfo.cycles)
$that.payFeeOrderInfo.showEndTime = vc.addMonth(new Date($that.payFeeOrderInfo.endTime), parseInt($that.payFeeOrderInfo.cycles));
}
//关闭model
$("#doPayFeeModal").modal('show');
},
_closeDoPayFeeModal: function () {
//关闭model
$("#doPayFeeModal").modal('hide')
$that.payFeeOrderInfo.showEndTime = '';
},
_payFee: function (_page, _row) {
$that._closeDoPayFeeModal();
let _printFees = [];
_printFees.push({
feeId: $that.payFeeOrderInfo.feeId,
squarePrice: $that.payFeeOrderInfo.squarePrice,
additionalAmount: $that.payFeeOrderInfo.additionalAmount,
feeName: $that.payFeeOrderInfo.feeName,
amount: $that.payFeeOrderInfo.receivedAmount
});
vc.http.post(
'propertyPay',
'payFee',
JSON.stringify(vc.component.payFeeOrderInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
let _feeInfo = {
totalAmount: $that.payFeeOrderInfo.receivedAmount,
fees: _printFees
}
let _data = JSON.parse(json).data;
$that.payFeeOrderInfo.receiptId = _data.receiptId;
//vc.saveData('_feeInfo', _feeInfo);
//关闭model
$("#payFeeResult").modal({
backdrop: "static",//点击空白处不关闭对话框
show: true
});
return;
}
vc.toast(json);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_changeMonth: function (_cycles) {
if ('-102' == _cycles) {
vc.component.payFeeOrderInfo.totalFeePrice = 0.00;
vc.component.payFeeOrderInfo.receivedAmount = '';
return;
}
let _newCycles = _cycles;
if (_cycles == '') {
_newCycles = $that.payFeeOrderInfo.paymentCycles[0];
}
vc.component.payFeeOrderInfo.totalFeePrice = $that._mathCeil(Math.floor(parseFloat(_newCycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100);
vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice;
vc.emit('payFeeDiscount', 'computeFeeDiscount', {
feeId: $that.payFeeOrderInfo.feeId,
cycles: _cycles
});
},
changeCycle: function (_cycles) {
if (_cycles == '') {
return;
}
vc.component.payFeeOrderInfo.totalFeePrice = $that._mathCeil(Math.floor(parseFloat(_cycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100);
vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice;
vc.emit('payFeeDiscount', 'computeFeeDiscount', {
feeId: $that.payFeeOrderInfo.feeId,
cycles: _cycles
});
},
_back: function () {
$('#payFeeResult').modal("hide");
vc.getBack();
},
_goBack: function () {
vc.goBack();
},
_printAndBack: function () {
//$('#payFeeResult').modal("hide");
window.open("/print.html#/pages/property/printPayFee?receiptId=" + $that.payFeeOrderInfo.receiptId)
},
_mathCeil: function (_price) {
return Math.ceil(_price);
},
listPayFeeOrderRoom: function () {
if (!vc.notNull($that.payFeeOrderInfo.feeId)) {
return;
}
let param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
feeId: $that.payFeeOrderInfo.feeId,
page: 1,
row: 1
}
};
//发送get请求
vc.http.apiGet('/feeApi/listFeeObj',
param,
function (json, res) {
let listRoomData = JSON.parse(json);
vc.copyObject(listRoomData.data, $that.payFeeOrderInfo);
vc.emit('payFeeOrder', 'initData', listRoomData.data);
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
}
});
})(window.vc);