Преглед на файлове

修改费用因子总费用正则浮点数与结算结果

785834757 преди 2 години
родител
ревизия
04ad2655cf
променени са 1 файла, в които са добавени 10 реда и са изтрити 8 реда
  1. 10 8
      src/views/AgreementManage/CarInsurance/AgreementEntry.vue

+ 10 - 8
src/views/AgreementManage/CarInsurance/AgreementEntry.vue

@@ -1320,8 +1320,8 @@ export default {
         jqCostsProportion: [
           { required: true, message: "请输入总费用比例", trigger: "blur" },
           {
-            pattern: /^([0-9]{1,2}|100)$/,
-            message: "请输入0-100的整数",
+            pattern: /^100$|^[1-9]?\d(\.\d+)?$|^0(\.\d+)?$/,
+            message: "请输入0-100数",
             trigger: "blur",
           },
         ],
@@ -1345,8 +1345,8 @@ export default {
         syCostsProportion: [
           { required: true, message: "请输入总费用比例", trigger: "blur" },
           {
-            pattern: /^([0-9]{1,2}|100)$/,
-            message: "请输入0-100的数",
+            pattern: /^100$|^[1-9]?\d(\.\d+)?$|^0(\.\d+)?$/,
+            message: "请输入0-100的数",
             trigger: "blur",
           },
         ],
@@ -1361,8 +1361,8 @@ export default {
         costsProportion: [
           { required: true, message: "请输入总共费用比例", trigger: "blur" },
           {
-            pattern: /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/,
-            message: "只能是正数",
+            pattern: /^100$|^[1-9]?\d(\.\d+)?$|^0(\.\d+)?$/,
+            message: "请输入0-100的数",
             trigger: "blur",
           },
         ],
@@ -2104,7 +2104,8 @@ export default {
       let pay2 = this.productCostForm[partial]; //费用
       if (pay1) {
         if (Number(pay1) >= Number(pay2)) {
-          this.productCostForm[other] = pay1 - pay2;
+          var otherPay = pay1 - pay2;
+          this.productCostForm[other] = Math.round(otherPay * 100) / 100;
         } else {
           //如果总比例不够扣减,则置空重新填
           this.productCostForm[total] = null;
@@ -2122,7 +2123,8 @@ export default {
       let pay2 = this.productCostForm[partial]; //费用
       if (pay1) {
         if (Number(pay2) <= Number(pay1)) {
-          this.productCostForm[other] = pay1 - pay2;
+          var otherPay = pay1 - pay2;
+          this.productCostForm[other] = Math.round(otherPay * 100) / 100;
         } else {
           //如果总比例不够扣减,则置空重新填
           this.productCostForm[total] = null;