//加载 $(function () { //缓交金额 $("#DelayAmount").blur(function () { //可缓交金额 var canDelayAmount = $("#CanDelayAmount").val(); //缓交金额 var delayAmount = $("#DelayAmount").val(); if (delayAmount != null && delayAmount != "") { //正浮点数(/^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/) var reg = /^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/; if (!reg.test(delayAmount)) { $("#DelayAmount").val(""); $("#DelayPercent").val(""); $.messager.alert("系统提示", "请输入金额。"); return; } $("#DelayPercent").attr("disabled", true); if (parseFloat(delayAmount) <= parseFloat(canDelayAmount)) { var delayPercent = Math.round((delayAmount / canDelayAmount).toFixed(2) * 100) > 0 ? Math.round((delayAmount / canDelayAmount).toFixed(2) * 100) : 1; //缓交百分比 $("#DelayPercent").val(delayPercent); } else { $("#DelayAmount").val(""); $("#DelayPercent").attr("disabled", false); $("#DelayPercent").val(""); $.messager.alert("系统提示", "缓交金额不能大于可缓交金额。"); } } else { $("#DelayPercent").attr("disabled", false); $("#DelayPercent").val(""); } }); //缓交百分比 $("#DelayPercent").blur(function () { //可缓交金额 var canDelayAmount = $("#CanDelayAmount").val(); //缓交百分比 var delayPercent = $("#DelayPercent").val(); if (delayPercent != null && delayPercent != "") { //正整数(/^[0-9]*[1-9][0-9]*$/) var reg = /^[0-9]*[1-9][0-9]*$/; if (!reg.test(delayPercent)) { $("#DelayPercent").val(""); $("#DelayAmount").val(""); $.messager.alert("系统提示", "请输入数字。"); return; } $("#DelayAmount").attr("disabled", true); if (parseInt(delayPercent) > 100 || parseInt(delayPercent) <= 0) { $("#DelayPercent").val(""); $("#DelayAmount").attr("disabled", false); $("#DelayAmount").val(""); $.messager.alert("系统提示", "缓缴百分比必须在1-100之间"); } else { var delayAmount = ((canDelayAmount * (delayPercent / 100).toFixed(2))).toFixed(1); //缓交金额 $("#DelayAmount").val(delayAmount); } } else { $("#DelayAmount").attr("disabled", false); $("#DelayAmount").val(""); } }); }) //确定(申请) function StudentChargeDelay_Save() { //缓交金额 var delayAmount = $("#DelayAmount").val(); //缓交百分比 var delayPercent = $("#DelayPercent").val(); if ((delayAmount == null || delayAmount == "") && (delayPercent == null || delayPercent == "")) { $.messager.alert("系统提示", "请输入缓交金额或缓交百分比。"); return; } if (delayPercent != null && delayPercent != "") { if (parseInt(delayPercent) > 100 || parseInt(delayPercent) <= 0) { $.messager.alert("系统提示", "缓缴百分比必须在1-100之间"); return; } } //可缓交金额 var canDelayAmount = $("#CanDelayAmount").val(); //缓交金额在可缓交金额范围内 if (parseFloat(delayAmount) > parseFloat(canDelayAmount)) { $.messager.alert("系统提示", "缓交金额不能大于可缓交金额。"); $("#DelayAmount").val(""); $("#DelayPercent").val(""); return; } $("#DelayAmount").attr("disabled", false); $("#DelayPercent").attr("disabled", false); //可缓交金额 $("#CanDelayAmount").attr("disabled", false); $(document.forms[0]).submit(); } //获取收费标准应收金额 function queryStudentChargeDelayStandard(data) { var userID = $("#UserID").val(); if (userID == "" || userID == "-1" || userID == null) { $("#Amount").val(""); $("#ChargeTag").combobox("setValue", "-1"); $("#ChargeAmount").val(""); $("#ActualAmount").val(""); $("#PaidAmount").val(""); $("#PassDelayAmount").val(""); $("#CanDelayAmount").val(""); $("#ApplyDelayAmount").val(""); return; } var chargeYearID = $("#ChargeYear").combogrid("getValue"); if (chargeYearID == "" || chargeYearID == "-1" || chargeYearID == null) { $("#Amount").val(""); $("#ChargeTag").combobox("setValue", "-1"); $("#ChargeAmount").val(""); $("#ActualAmount").val(""); $("#PaidAmount").val(""); $("#PassDelayAmount").val(""); $("#CanDelayAmount").val(""); $("#ApplyDelayAmount").val(""); return; } var chargeProjectID = $("#ChargeProjectID").combogridX("getValue"); if (chargeProjectID == "" || chargeProjectID == "-1" || chargeProjectID == null) { $("#Amount").val(""); $("#ChargeTag").combobox("setValue", "-1"); $("#ChargeAmount").val(""); $("#ActualAmount").val(""); $("#PaidAmount").val(""); $("#PassDelayAmount").val(""); $("#CanDelayAmount").val(""); $("#ApplyDelayAmount").val(""); return; } $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ChargeDelay/ChargeDelayStandard', { userID: userID, chargeYearID: chargeYearID, chargeProjectID: chargeProjectID }, function (data) { if (data.IsSuccess == true) { if (data.Data != null) { $("#Amount").val(data.Data.Amount); $("#ChargeTag").combobox("setValue", data.Data.ChargeTag); $("#ChargeAmount").val(data.Data.ChargeAmount); $("#ActualAmount").val(data.Data.ActualAmount); $("#PaidAmount").val(data.Data.PaidAmount); $("#PassDelayAmount").val(data.Data.PassDelayAmount); $("#CanDelayAmount").val(data.Data.CanDelayAmount); $("#ApplyDelayAmount").val(data.Data.ApplyDelayAmount); } else { $("#Amount").val(""); $("#ChargeTag").combobox("setValue", "-1"); $("#ChargeAmount").val(""); $("#ActualAmount").val(""); $("#PaidAmount").val(""); $("#PassDelayAmount").val(""); $("#CanDelayAmount").val(""); $("#ApplyDelayAmount").val(""); $.messager.alert("系统提示", "对应的应收名单不存在,请核查。"); } } else { $("#Amount").val(""); $("#ChargeTag").combobox("setValue", "-1"); $("#ChargeAmount").val(""); $("#ActualAmount").val(""); $("#PaidAmount").val(""); $("#PassDelayAmount").val(""); $("#CanDelayAmount").val(""); $("#ApplyDelayAmount").val(""); $.messager.alert("系统提示", data.Message); } }); }