优化修改时的bug

This commit is contained in:
wuxw 2024-01-12 10:51:10 +08:00
parent f90e39dcd9
commit 911f580c88

View File

@ -30,32 +30,32 @@
}
},
_initMethod: function () {
vc.component._initEditFeeConfigDateInfo();
$that._initEditFeeConfigDateInfo();
vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
vc.component.editFeeConfigInfo.feeTypeCds = _data;
$that.editFeeConfigInfo.feeTypeCds = _data;
});
vc.getDict('pay_fee_config', "computing_formula", function (_data) {
vc.component.editFeeConfigInfo.computingFormulas = _data;
$that.editFeeConfigInfo.computingFormulas = _data;
});
vc.getDict('pay_fee_config', 'fee_flag', function (_data) {
vc.component.editFeeConfigInfo.feeFlags = _data;
$that.editFeeConfigInfo.feeFlags = _data;
});
vc.getDict('pay_fee_config', 'bill_type', function (_data) {
vc.component.editFeeConfigInfo.billTypes = _data;
$that.editFeeConfigInfo.billTypes = _data;
});
vc.getDict('pay_fee_config', 'payment_cd', function (_data) {
vc.component.editFeeConfigInfo.paymentCds = _data;
$that.editFeeConfigInfo.paymentCds = _data;
});
},
_initEvent: function () {
vc.on('editFeeConfig', 'openEditFeeConfigModal',
function (_params) {
vc.component.refreshEditFeeConfigInfo();
$that.refreshEditFeeConfigInfo();
$('#editFeeConfigModel').modal('show');
vc.copyObject(_params, vc.component.editFeeConfigInfo);
vc.component.editFeeConfigInfo.startTime = vc.dateFormat(_params.startTime);
vc.component.editFeeConfigInfo.endTime = vc.dateFormat(_params.endTime);
vc.component.editFeeConfigInfo.communityId = vc.getCurrentCommunity().communityId;
vc.copyObject(_params, $that.editFeeConfigInfo);
$that.editFeeConfigInfo.startTime = vc.dateFormat(_params.startTime);
$that.editFeeConfigInfo.endTime = vc.dateFormat(_params.endTime);
$that.editFeeConfigInfo.communityId = vc.getCurrentCommunity().communityId;
});
},
methods: {
@ -74,13 +74,13 @@
.on('changeDate', function (ev) {
var value = $(".editFeeConfigStartTime").val();
var start = Date.parse(new Date(value));
var end = Date.parse(new Date(vc.component.editFeeConfigInfo.endTime));
var end = Date.parse(new Date($that.editFeeConfigInfo.endTime));
if (start - end >= 0) {
vc.toast("计费起始时间必须小于计费终止时间");
$(".editFeeConfigStartTime").val('');
vc.component.editFeeConfigInfo.startTime = "";
$that.editFeeConfigInfo.startTime = "";
} else {
vc.component.editFeeConfigInfo.startTime = value;
$that.editFeeConfigInfo.startTime = value;
}
});
$('.editFeeConfigEndTime').datetimepicker({
@ -96,14 +96,14 @@
$('.editFeeConfigEndTime').datetimepicker()
.on('changeDate', function (ev) {
var value = $(".editFeeConfigEndTime").val();
var start = Date.parse(new Date(vc.component.editFeeConfigInfo.startTime));
var start = Date.parse(new Date($that.editFeeConfigInfo.startTime));
var end = Date.parse(new Date(value));
if (start - end >= 0) {
vc.toast("计费终止时间必须大于计费起始时间");
$(".editFeeConfigEndTime").val('');
vc.component.editFeeConfigInfo.endTime = "";
$that.editFeeConfigInfo.endTime = "";
} else {
vc.component.editFeeConfigInfo.endTime = value;
$that.editFeeConfigInfo.endTime = value;
}
});
//防止多次点击时间插件失去焦点
@ -121,7 +121,7 @@
},
editFeeConfigValidate: function () {
return vc.validate.validate({
editFeeConfigInfo: vc.component.editFeeConfigInfo
editFeeConfigInfo: $that.editFeeConfigInfo
}, {
'editFeeConfigInfo.feeTypeCd': [
{
@ -268,44 +268,43 @@
},
editFeeConfig: function () {
//固定费用
if (vc.component.editFeeConfigInfo.computingFormula == '2002') {
vc.component.editFeeConfigInfo.squarePrice = "0.00";
if ($that.editFeeConfigInfo.computingFormula == '2002') {
$that.editFeeConfigInfo.squarePrice = "0.00";
}
//自定义费用
if (vc.component.editFeeConfigInfo.computingFormula == '7007' ||
vc.component.editFeeConfigInfo.computingFormula == '4004' ||
vc.component.editFeeConfigInfo.computingFormula == '1101' ||
vc.component.editFeeConfigInfo.computingFormula == '1102' ||
vc.component.editFeeConfigInfo.computingFormula == '9009') {
vc.component.editFeeConfigInfo.squarePrice = "0.00";
vc.component.editFeeConfigInfo.additionalAmount = "0.00";
if ($that.editFeeConfigInfo.computingFormula == '7007' ||
$that.editFeeConfigInfo.computingFormula == '4004' ||
$that.editFeeConfigInfo.computingFormula == '1101' ||
$that.editFeeConfigInfo.computingFormula == '1102' ||
$that.editFeeConfigInfo.computingFormula == '9009') {
$that.editFeeConfigInfo.squarePrice = "0.00";
$that.editFeeConfigInfo.additionalAmount = "0.00";
}
if (vc.component.editFeeConfigInfo.feeFlag == '2006012') {
vc.component.editFeeConfigInfo.paymentCycle = '1';
if ($that.editFeeConfigInfo.feeFlag == '2006012') {
$that.editFeeConfigInfo.paymentCycle = '1';
}
if (vc.component.editFeeConfigInfo.paymentCd == '1200') { //如果是预付费
if (vc.component.editFeeConfigInfo.prepaymentPeriod == null || vc.component.editFeeConfigInfo.prepaymentPeriod == undefined ||
vc.component.editFeeConfigInfo.prepaymentPeriod == "") {
if ($that.editFeeConfigInfo.paymentCd == '1200') { //如果是预付费
if (!$that.editFeeConfigInfo.prepaymentPeriod) {
vc.toast("预付期不能为空!");
return;
}
}
if (!vc.component.editFeeConfigValidate()) {
if ($that.editFeeConfigInfo.paymentCd != '1200') { //如果不是预付费
$that.editFeeConfigInfo.prepaymentPeriod = '0';
}
if (!$that.editFeeConfigValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
if (vc.component.editFeeConfigInfo.paymentCd != '1200') { //如果不是预付费
vc.component.editFeeConfigInfo.prepaymentPeriod = '';
}
//收费项目去空
vc.component.editFeeConfigInfo.feeName = vc.component.editFeeConfigInfo.feeName.trim();
$that.editFeeConfigInfo.feeName = $that.editFeeConfigInfo.feeName.trim();
//计费单价去空
//vc.component.editFeeConfigInfo.squarePrice = vc.component.editFeeConfigInfo.squarePrice.trim();
//$that.editFeeConfigInfo.squarePrice = $that.editFeeConfigInfo.squarePrice.trim();
//附加费用去空
//vc.component.editFeeConfigInfo.additionalAmount = vc.component.editFeeConfigInfo.additionalAmount.trim();
//$that.editFeeConfigInfo.additionalAmount = $that.editFeeConfigInfo.additionalAmount.trim();
//缴费周期去空
vc.component.editFeeConfigInfo.paymentCycle = vc.component.editFeeConfigInfo.paymentCycle.trim();
vc.http.apiPost('/feeConfig.updateFeeConfig', JSON.stringify(vc.component.editFeeConfigInfo), {
$that.editFeeConfigInfo.paymentCycle = $that.editFeeConfigInfo.paymentCycle.trim();
vc.http.apiPost('/feeConfig.updateFeeConfig', JSON.stringify($that.editFeeConfigInfo), {
emulateJSON: true
},
function (json, res) {
@ -327,12 +326,12 @@
});
},
refreshEditFeeConfigInfo: function () {
var _feeTypeCds = vc.component.editFeeConfigInfo.feeTypeCds;
var _computingFormulas = vc.component.editFeeConfigInfo.computingFormulas;
var _feeFlags = vc.component.editFeeConfigInfo.feeFlags;
var _billTypes = vc.component.editFeeConfigInfo.billTypes;
var _paymentCds = vc.component.editFeeConfigInfo.paymentCds;
vc.component.editFeeConfigInfo = {
var _feeTypeCds = $that.editFeeConfigInfo.feeTypeCds;
var _computingFormulas = $that.editFeeConfigInfo.computingFormulas;
var _feeFlags = $that.editFeeConfigInfo.feeFlags;
var _billTypes = $that.editFeeConfigInfo.billTypes;
var _paymentCds = $that.editFeeConfigInfo.paymentCds;
$that.editFeeConfigInfo = {
configId: '',
feeTypeCd: '',
feeName: '',
@ -354,12 +353,12 @@
units: '元',
prepaymentPeriod: '1'
};
vc.component.editFeeConfigInfo.feeTypeCds = _feeTypeCds;
vc.component.editFeeConfigInfo.computingFormulas = _computingFormulas;
vc.component.editFeeConfigInfo.feeFlags = _feeFlags;
vc.component.editFeeConfigInfo.billTypes = _billTypes;
vc.component.editFeeConfigInfo.paymentCds = _paymentCds;
$that.editFeeConfigInfo.feeTypeCds = _feeTypeCds;
$that.editFeeConfigInfo.computingFormulas = _computingFormulas;
$that.editFeeConfigInfo.feeFlags = _feeFlags;
$that.editFeeConfigInfo.billTypes = _billTypes;
$that.editFeeConfigInfo.paymentCds = _paymentCds;
}
}
});
})(window.vc, window.vc.component);
})(window.vc, window.$that);