浏览代码

超计判断调整

MaiXinRong 4 年之前
父节点
当前提交
4a84979ab7
共有 2 个文件被更改,包括 17 次插入21 次删除
  1. 13 19
      app/extend/helper.js
  2. 4 2
      app/public/js/global.js

+ 13 - 19
app/extend/helper.js

@@ -1216,36 +1216,30 @@ module.exports = {
         //         }
         //     }
         // }
-        if (!bills) return false;
-        if (isTz) {
+        if (isTz && posRange.length > 0) {
             if (posRange.length > 0) {
                 for (const p of posRange) {
-                    if (checkUtils.posOver(p)) return true;
+                    const end_contract_qty = this.add(p.pre_contract_qty, p.contract_qty);
+                    if (!p.quantity) return !!end_contract_qty;
+                    return p.quantity > 0
+                        ? end_contract_qty > p.quantity
+                        : end_contract_qty < p.quantity || end_contract_qty > 0;
                 }
                 return false;
             }
-            if (bills.is_tp) {
-                if (!bills.total_price) return !!bills.end_contract_tp;
-                return bills.total_price >= 0
-                    ? bills.end_contract_tp > bills.total_price
-                    : bills.end_contract_tp < bills.total_price || bills.end_contract_tp > 0;
-            } else {
-                if (!bills.quantity) return !!bills.end_contract_qty;
-                return bills.quantity >= 0
-                    ? bills.end_contract_qty > bills.quantity
-                    : bills.end_contract_qty < bills.quantity || bills.end_contract_qty > 0;
-            }
         } else {
+            const end_contract_qty = this.add(bills.contract_qty, bills.pre_contract_qty);
+            const end_contract_tp = this.add(bills.contract_tp, bills.pre_contract_tp);
             if (bills.is_tp) {
-                if (!bills.deal_tp) return !!bills.end_contract_tp;
+                if (!bills.deal_tp) return !!end_contract_tp;
                 return bills.deal_tp >= 0
-                    ? bills.end_contract_tp > bills.deal_tp
-                    : bills.end_contract_tp < bills.deal_tp || bills.end_contract_tp > 0;
+                    ? end_contract_tp > bills.deal_tp
+                    : end_contract_tp < bills.deal_tp || end_contract_tp > 0;
             } else {
                 if (!bills.deal_qty) return !!bills.end_contract_qty;
                 return bills.deal_qty >= 0
-                    ? bills.end_contract_qty > bills.deal_qty
-                    : bills.end_contract_qty < bills.deal_qty || bills.end_contract_qty > 0;
+                    ? end_contract_qty > bills.deal_qty
+                    : end_contract_qty < bills.deal_qty || end_contract_qty > 0;
             }
         }
 

+ 4 - 2
app/public/js/global.js

@@ -864,7 +864,9 @@ const checkUtils = {
     posOver(data) {
         if (!data) return false;
         if (!data.quantity) return !!data.end_contract_qty;
-        return data.quantity > 0 ? data.end_contract_qty > data.quantity : data.end_contract_qty < data.quantity;
+        return data.quantity > 0
+            ? data.end_contract_qty > data.quantity
+            : data.end_contract_qty < data.quantity || data.end_contract_qty > 0;
     },
     billsOver(data, isTz, relaPos) {
         if (!data) return false;
@@ -897,7 +899,7 @@ const checkUtils = {
                 if (!data.deal_qty) return !!data.end_contract_qty;
                 return data.deal_qty > 0
                     ? data.end_contract_qty > data.deal_qty
-                    : data.end_contract_qty < data.deal_qty || data.end_contract_tp > 0;
+                    : data.end_contract_qty < data.deal_qty || data.end_contract_qty > 0;
             }
         }
     }