|
|
@@ -412,9 +412,10 @@ function f_importCancelMaterial(item, dialog) {
|
|
|
}
|
|
|
|
|
|
function addPayInfo() {
|
|
|
- // 检查是否有物料信息
|
|
|
- if ($(".startTr1:not(.hide)").length === 0) {
|
|
|
- $.ligerDialog.warn("请先添加物料信息再填写付款信息!");
|
|
|
+ // 检查是否有合同金额
|
|
|
+ var contractMoney = parseFloat($("#contract_money").val()) || parseFloat($("#totalPrice").val()) || 0;
|
|
|
+ if (contractMoney <= 0) {
|
|
|
+ $.ligerDialog.warn("请先输入合同金额再填写付款信息!");
|
|
|
return;
|
|
|
}
|
|
|
var cloneObj = $("#template_2").clone().removeClass("hide").removeAttr("id");
|
|
|
@@ -585,7 +586,7 @@ function calculateTotalPrice() {
|
|
|
// 保留用户手动输入的较大值
|
|
|
// 不更新合同金额
|
|
|
} else {
|
|
|
- // 自动更新为物料总额
|
|
|
+ // 自动更新为物料总额(包括非手动输入,或手动输入但物料总额更大的情况)
|
|
|
$("#contract_money").val(total.toFixed(2));
|
|
|
// 重置手动输入标记
|
|
|
$("#contract_money").removeData("manual-input");
|
|
|
@@ -594,6 +595,8 @@ function calculateTotalPrice() {
|
|
|
// 没有物料时,只有非手动输入才清空
|
|
|
if (!manualInput) {
|
|
|
$("#contract_money").val("");
|
|
|
+ // 合同金额被清空时,删除所有付款信息
|
|
|
+ clearAllPaymentInfo();
|
|
|
}
|
|
|
// 注意:如果是手动输入,即使没有物料也保留用户输入
|
|
|
}
|
|
|
@@ -610,17 +613,8 @@ function calculateTotalPrice() {
|
|
|
}
|
|
|
|
|
|
function checkMaterialFilled() {
|
|
|
- var hasMaterial = $(".startTr1:not(.hide)").length > 0;
|
|
|
- $("#addPayInfo").prop("disabled", !hasMaterial);
|
|
|
- $(".startTr2:not(.hide) input, .startTr2:not(.hide) select").prop("disabled", !hasMaterial);
|
|
|
-
|
|
|
- // 添加视觉提示
|
|
|
- if (!hasMaterial) {
|
|
|
- $("#secondDiv").addClass("disabled-section");
|
|
|
- $("#contract_money").val(""); // 清空合同金额
|
|
|
- } else {
|
|
|
- $("#secondDiv").removeClass("disabled-section");
|
|
|
- }
|
|
|
+ // 不再根据物料状态禁用付款信息
|
|
|
+ // 该函数保留用于其他可能的用途
|
|
|
}
|
|
|
|
|
|
//计算付款信息中的金额(根据比例自动计算)
|
|
|
@@ -662,15 +656,18 @@ function hideInlineError(element) {
|
|
|
element.next('.inline-error').remove();
|
|
|
}
|
|
|
|
|
|
-//检查是否需要删除合同付款信息
|
|
|
+//检查是否需要删除合同付款信息(已废弃,保留用于兼容)
|
|
|
function checkAndRemovePaymentInfo() {
|
|
|
- var hasMaterial = $(".startTr1:not(.hide)").length > 0;
|
|
|
- // 如果没有物料,则删除所有付款信息
|
|
|
- if (!hasMaterial ) {
|
|
|
- $(".startTr2:not(.hide)").each(function() {
|
|
|
- $(this).remove();
|
|
|
- });
|
|
|
- }
|
|
|
+ // 不再自动删除付款信息,允许在没有物料的情况下保留付款信息
|
|
|
+ // 该函数保留用于其他可能的用途
|
|
|
+}
|
|
|
+
|
|
|
+// 清空所有付款信息
|
|
|
+function clearAllPaymentInfo() {
|
|
|
+ $(".startTr2:not(.hide)").each(function() {
|
|
|
+ $(this).remove();
|
|
|
+ });
|
|
|
+ addPayIdAndName(); // 重新编号
|
|
|
}
|
|
|
|
|
|
function initPriceForProcess() {
|