优化代码

This commit is contained in:
java110 2021-06-15 12:46:37 +08:00
parent 359581cc1b
commit f1db3059b3
7 changed files with 101 additions and 76 deletions

View File

@ -86,14 +86,17 @@
<select class="custom-select" v-model="addFeeConfigInfo.computingFormula">
<option selected disabled value="">必填,请选择计算公式</option>
<option v-for="(item,index) in addFeeConfigInfo.computingFormulas" :key="index"
v-if="item.statusCd != '4004'" v-bind:value="item.statusCd">
v-bind:value="item.statusCd">
{{item.name}}
</option>
</select>
</div>
</div>
<div class="form-group row"
v-show="addFeeConfigInfo.computingFormula != '2002' && addFeeConfigInfo.computingFormula != '7007' && addFeeConfigInfo.computingFormula != '8008'">
v-show="addFeeConfigInfo.computingFormula != '2002'
&& addFeeConfigInfo.computingFormula != '7007'
&& addFeeConfigInfo.computingFormula != '8008'
&& addFeeConfigInfo.computingFormula != '4004'">
<label class="col-sm-2 col-form-label">计费单价</label>
<div class="col-sm-10">
<input v-model="addFeeConfigInfo.squarePrice" type="text" placeholder="必填,请填写计费单价"
@ -101,7 +104,9 @@
</div>
</div>
<div class="form-group row"
v-show="addFeeConfigInfo.computingFormula != '7007' && addFeeConfigInfo.computingFormula != '8008'">
v-show="addFeeConfigInfo.computingFormula != '7007'
&& addFeeConfigInfo.computingFormula != '8008'
&& addFeeConfigInfo.computingFormula != '4004'">
<label class="col-sm-2 col-form-label">
{{addFeeConfigInfo.computingFormula == '1001' ?'附加费用':'固定费用'}}
</label>

View File

@ -24,7 +24,7 @@
billType: '',
paymentCycle: '',
paymentCd: '',
computingFormulaText:''
computingFormulaText: ''
}
},
_initMethod: function () {
@ -109,96 +109,96 @@
},
addFeeConfigValidate() {
return vc.validate.validate({
addFeeConfigInfo: vc.component.addFeeConfigInfo
},
addFeeConfigInfo: vc.component.addFeeConfigInfo
},
{
'addFeeConfigInfo.feeTypeCd': [{
limit: "required",
param: "",
errInfo: "费用类型不能为空"
},
{
limit: "num",
param: "",
errInfo: "费用类型格式错误"
},
{
limit: "num",
param: "",
errInfo: "费用类型格式错误"
},
],
'addFeeConfigInfo.feeName': [{
limit: "required",
param: "",
errInfo: "收费项目不能为空"
},
{
limit: "maxin",
param: "1,100",
errInfo: "收费项目不能超过100位"
},
{
limit: "maxin",
param: "1,100",
errInfo: "收费项目不能超过100位"
},
],
'addFeeConfigInfo.feeFlag': [{
limit: "required",
param: "",
errInfo: "费用标识不能为空"
},
{
limit: "num",
param: "",
errInfo: "费用类型格式错误"
},
{
limit: "num",
param: "",
errInfo: "费用类型格式错误"
},
],
'addFeeConfigInfo.startTime': [{
limit: "required",
param: "",
errInfo: "计费起始时间不能为空"
},
{
limit: "dateTime",
param: "",
errInfo: "计费起始时间不是有效的时间格式"
},
{
limit: "dateTime",
param: "",
errInfo: "计费起始时间不是有效的时间格式"
},
],
'addFeeConfigInfo.endTime': [{
limit: "required",
param: "",
errInfo: "计费终止时间不能为空"
},
{
limit: "dateTime",
param: "",
errInfo: "计费终止时间不是有效的时间格式"
},
{
limit: "dateTime",
param: "",
errInfo: "计费终止时间不是有效的时间格式"
},
],
'addFeeConfigInfo.computingFormula': [{
limit: "required",
param: "",
errInfo: "计算公式不能为空"
},
{
limit: "num",
param: "",
errInfo: "计算公式格式错误"
},
{
limit: "num",
param: "",
errInfo: "计算公式格式错误"
},
],
'addFeeConfigInfo.squarePrice': [{
limit: "required",
param: "",
errInfo: "计费单价不能为空"
},
{
limit: "moneyModulus",
param: "",
errInfo: "计费单价格式错误如1.5000"
},
{
limit: "moneyModulus",
param: "",
errInfo: "计费单价格式错误如1.5000"
},
],
'addFeeConfigInfo.additionalAmount': [{
limit: "required",
param: "",
errInfo: "附加费用不能为空"
},
{
limit: "money",
param: "",
errInfo: "附加费用格式错误"
},
{
limit: "money",
param: "",
errInfo: "附加费用格式错误"
},
],
'addFeeConfigInfo.billType': [{
limit: "required",
@ -211,47 +211,48 @@
param: "",
errInfo: "缴费周期不能为空"
},
{
limit: "num",
param: "",
errInfo: "缴费周期必须为数字 单位月"
},
{
limit: "num",
param: "",
errInfo: "缴费周期必须为数字 单位月"
},
],
'addFeeConfigInfo.paymentCd': [{
limit: "required",
param: "",
errInfo: "付费类型不能为空"
},
{
limit: "num",
param: "",
errInfo: "付费类型格式错误"
},
{
limit: "num",
param: "",
errInfo: "付费类型格式错误"
},
]
});
},
saveFeeConfigInfo: function () {
//固定费用
if (vc.component.addFeeConfigInfo.computingFormula == '2002') {
vc.component.addFeeConfigInfo.squarePrice = "0.00";
}
//自定义费用
if (vc.component.addFeeConfigInfo.computingFormula == '7007') {
if (vc.component.addFeeConfigInfo.computingFormula == '7007' ||
vc.component.addFeeConfigInfo.computingFormula == '4004') {
vc.component.addFeeConfigInfo.squarePrice = "0.00";
vc.component.addFeeConfigInfo.additionalAmount = "0.00";
}
if (vc.component.addFeeConfigInfo.feeFlag == '2006012') {
vc.component.addFeeConfigInfo.paymentCycle = '1';
}
//收费项目去空
vc.component.addFeeConfigInfo.feeName = vc.component.addFeeConfigInfo.feeName.trim();
//缴费周期去空
vc.component.addFeeConfigInfo.paymentCycle = vc.component.addFeeConfigInfo.paymentCycle.trim();
//计费单价去空
vc.component.addFeeConfigInfo.squarePrice = vc.component.addFeeConfigInfo.squarePrice.trim();
//附加费用去空
vc.component.addFeeConfigInfo.additionalAmount = vc.component.addFeeConfigInfo.additionalAmount.trim();
//收费项目去空
vc.component.addFeeConfigInfo.feeName = vc.component.addFeeConfigInfo.feeName.trim();
//缴费周期去空
vc.component.addFeeConfigInfo.paymentCycle = vc.component.addFeeConfigInfo.paymentCycle.trim();
//计费单价去空
vc.component.addFeeConfigInfo.squarePrice = vc.component.addFeeConfigInfo.squarePrice.trim();
//附加费用去空
vc.component.addFeeConfigInfo.additionalAmount = vc.component.addFeeConfigInfo.additionalAmount.trim();
if (!vc.component.addFeeConfigValidate()) {
vc.toast(vc.validate.errInfo);
return;
@ -264,8 +265,8 @@
return;
}
vc.http.post('addFeeConfig', 'save', JSON.stringify(vc.component.addFeeConfigInfo), {
emulateJSON: true
},
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
@ -305,7 +306,7 @@
billType: '',
paymentCycle: '',
paymentCd: '',
computingFormulaText:''
computingFormulaText: ''
};
}
}

View File

@ -89,14 +89,17 @@
v-model="editFeeConfigInfo.computingFormula">
<option selected disabled value="">必填,请选择计算公式</option>
<option v-for="(item,index) in editFeeConfigInfo.computingFormulas" :key="index"
v-if="item.statusCd != '4004'" v-bind:value="item.statusCd">
v-bind:value="item.statusCd">
{{item.name}}
</option>
</select>
</div>
</div>
<div class="form-group row"
v-show="editFeeConfigInfo.computingFormula != '2002' && editFeeConfigInfo.computingFormula != '7007' && editFeeConfigInfo.computingFormula != '8008'">
v-show="editFeeConfigInfo.computingFormula != '2002'
&& editFeeConfigInfo.computingFormula != '7007'
&& editFeeConfigInfo.computingFormula != '8008'
&& editFeeConfigInfo.computingFormula != '4004'">
<label class="col-sm-2 col-form-label">计费单价</label>
<div class="col-sm-10">
<input v-model="editFeeConfigInfo.squarePrice" type="text" placeholder="必填,请填写计费单价"
@ -104,7 +107,9 @@
</div>
</div>
<div class="form-group row"
v-show="editFeeConfigInfo.computingFormula != '7007' && editFeeConfigInfo.computingFormula != '8008'">
v-show="editFeeConfigInfo.computingFormula != '7007'
&& editFeeConfigInfo.computingFormula != '8008'
&& editFeeConfigInfo.computingFormula != '4004'">
<label class="col-sm-2 col-form-label">{{editFeeConfigInfo.computingFormula
== '1001'
?'附加费用':'固定费用'}}</label>

View File

@ -235,7 +235,8 @@
vc.component.editFeeConfigInfo.squarePrice = "0.00";
}
//自定义费用
if (vc.component.editFeeConfigInfo.computingFormula == '7007') {
if (vc.component.editFeeConfigInfo.computingFormula == '7007'
||vc.component.editFeeConfigInfo.computingFormula != '4004') {
vc.component.editFeeConfigInfo.squarePrice = "0.00";
vc.component.editFeeConfigInfo.additionalAmount = "0.00";
}

View File

@ -87,6 +87,13 @@
</select>
</div>
</div>
<div class="form-group row" v-if="roomCreateFeeAddInfo.computingFormula == '4004'">
<label class="col-sm-2 col-form-label">收费金额</label>
<div class="col-sm-10">
<input v-model="roomCreateFeeAddInfo.amount" type="text"
placeholder="必填,请填写收费金额" class="form-control">
</div>
</div>
<div class="form-group row" v-if="roomCreateFeeAddInfo.isMore == true">
<label class="col-sm-2 col-form-label">楼层</label>
<div class="col-sm-8" v-if="roomCreateFeeAddInfo.feeLayer != '全部'">

View File

@ -21,7 +21,9 @@
roomType: '1010301',
feeLayer: '全部',
feeFlag: '',
endTime: ''
endTime: '',
computingFormula:'',
amount:''
}
},
_initMethod: function () {
@ -210,6 +212,8 @@
feeLayer: '全部',
feeFlag: '',
endTime: '',
computingFormula:'',
amount:''
};
$that.roomCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
},
@ -255,6 +259,7 @@
$that.roomCreateFeeAddInfo.feeConfigs.forEach(item => {
if (_configId == item.configId) {
$that.roomCreateFeeAddInfo.feeFlag = item.feeFlag;
$that.roomCreateFeeAddInfo.computingFormula = item.computingFormula;
return;
}
});

View File

@ -228,7 +228,8 @@
if (_cycles == '') {
_newCycles = $that.payFeeOrderInfo.paymentCycles[0];
}
var price = parseFloat(_newCycles) * ((vc.component.payFeeOrderInfo.builtUpArea) * (vc.component.payFeeOrderInfo.squarePrice) + parseFloat(vc.component.payFeeOrderInfo.additionalAmount));
//var price = parseFloat(_newCycles) * ((vc.component.payFeeOrderInfo.builtUpArea) * (vc.component.payFeeOrderInfo.squarePrice) + parseFloat(vc.component.payFeeOrderInfo.additionalAmount));
var price = parseFloat(_newCycles) * parseFloat($that.payFeeOrderInfo.feePrice);
// 调整为根据映射 取整
// let unFixedNum = Math.floor(parseFloat(_newCycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100;
vc.component.payFeeOrderInfo.totalFeePrice = $that._getFixedNum(price);
@ -250,7 +251,7 @@
if (_cycles == '') {
return;
}
var price = parseFloat(_cycles) * ((vc.component.payFeeOrderInfo.builtUpArea) * (vc.component.payFeeOrderInfo.squarePrice) + parseFloat(vc.component.payFeeOrderInfo.additionalAmount));
var price = parseFloat(_cycles) * parseFloat($that.payFeeOrderInfo.feePrice);
// let unFixedNum = Math.floor(parseFloat(_cycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100;
vc.component.payFeeOrderInfo.totalFeePrice = $that._getFixedNum(price);
vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice;