Bläddra i källkod

实付金额提示词修正

ellisran 10 månader sedan
förälder
incheckning
63c09532c8
1 ändrade filer med 16 tillägg och 6 borttagningar
  1. 16 6
      app/public/js/contract_detail.js

+ 16 - 6
app/public/js/contract_detail.js

@@ -1164,6 +1164,11 @@ $(document).ready(function() {
                 toastr.warning('合同金额只能输入数字');
                 return;
             }
+            if (parseFloat(data.total_price) < node.yf_price) {
+                const name = contract_type === contractConst.type.expenses ? '付' : '回';
+                toastr.warning('合同金额不能小于累计应' + name);
+                return;
+            }
             if (data.party_b === '') {
                 toastr.warning('签订单位(乙方)不能为空');
                 return;
@@ -1705,28 +1710,33 @@ $(document).ready(function() {
         const debit_price = $('#cons-addpay input[name="debit_price"]').val() || 0;
         const yf_price = ZhCalc.sub(pay_price, debit_price);
         $('#cons-addpay .yf-tips').text('');
-        if (parseFloat(yf_price) > ZhCalc.sub(node.total_price, node.yf_price)) {
-            $('#cons-addpay .yf-tips').text(' ≤ ' + ZhCalc.sub(node.total_price, node.yf_price));
-        } else {
-            $('#cons-addpay .yf-tips').text('');
-        }
         const cpid = $('#cons-addpay input[name="cpid"]').val();
         if (cpid) {
             const cpInfo = _.find(contractPays, { id: parseInt(cpid) });
             const newNodePayPrice = ZhCalc.add(ZhCalc.sub(node.pay_price, cpInfo.pay_price), parseFloat(pay_price));
             const newNodeDebitPrice = ZhCalc.add(ZhCalc.sub(node.debit_price, cpInfo.debit_price), parseFloat(debit_price));
             const newNodeYfPrice = ZhCalc.sub(newNodePayPrice, newNodeDebitPrice);
-            if (parseFloat(sf_price) > ZhCalc.sub(newNodeYfPrice, node.sf_price)) {
+            if (parseFloat(sf_price) > ZhCalc.add(cpInfo.sf_price, ZhCalc.sub(newNodeYfPrice, node.sf_price))) {
                 $('#cons-addpay .sf-tips').text(' ≤ ' + ZhCalc.add(cpInfo.sf_price, ZhCalc.sub(newNodeYfPrice, node.sf_price)));
             } else {
                 $('#cons-addpay .sf-tips').text('');
             }
+            if (parseFloat(yf_price) > ZhCalc.add(cpInfo.yf_price, ZhCalc.sub(node.total_price, node.yf_price))) {
+                $('#cons-addpay .yf-tips').text(' ≤ ' + ZhCalc.add(cpInfo.yf_price, ZhCalc.sub(node.total_price, node.yf_price)));
+            } else {
+                $('#cons-addpay .yf-tips').text('');
+            }
         } else {
             if (parseFloat(sf_price) > ZhCalc.sub(ZhCalc.add(node.yf_price, yf_price), node.sf_price)) {
                 $('#cons-addpay .sf-tips').text(' ≤ ' + ZhCalc.sub(ZhCalc.add(node.yf_price, yf_price), node.sf_price));
             } else {
                 $('#cons-addpay .sf-tips').text('');
             }
+            if (parseFloat(yf_price) > ZhCalc.sub(node.total_price, node.yf_price)) {
+                $('#cons-addpay .yf-tips').text(' ≤ ' + ZhCalc.sub(node.total_price, node.yf_price));
+            } else {
+                $('#cons-addpay .yf-tips').text('');
+            }
         }
         if (name === 'pay_price' || name === 'debit_price') {
             $('#cons-addpay input[name="yf_price"]').val(yf_price);