diff --git a/Application/Admin/View/Statement/createCpStatement.html b/Application/Admin/View/Statement/createCpStatement.html index 6dbc23016..5d6634367 100644 --- a/Application/Admin/View/Statement/createCpStatement.html +++ b/Application/Admin/View/Statement/createCpStatement.html @@ -447,6 +447,12 @@ callback(data) } }) + }, + floatAdd(a,b){ + return Math.round(a*100+b*100)/100; + }, + floatCut(a,b){ + return Math.round(a*100-b*100)/100; } } //数据类 @@ -627,28 +633,31 @@ }else{ var ratio = td['second_ratio']/100; } - DATAOBJ.statement_count['sum_money'] -= td['sum_money']; + DATAOBJ.statement_count['sum_money'] = PUBLIC.floatCut(DATAOBJ.statement_count['sum_money'],td['sum_money']); - td['sum_money'] = Math.floor((td['pay_amount']*(100-td['promote_ratio'])/100*ratio*(100-td['fax_ratio'])/100)* 100) / 100 ; - DATAOBJ.statement_count['sum_money']+=(td['sum_money']-0); + td['sum_money'] = Math.round((td['pay_amount']*(100-td['promote_ratio'])/100*ratio*(100-td['fax_ratio'])/100)* 100) / 100 ; + + DATAOBJ.statement_count['sum_money']=PUBLIC.floatAdd(DATAOBJ.statement_count['sum_money'],td['sum_money']); + }else{ - DATAOBJ.fine = Math.floor(DATAOBJ.fine * 100) / 100 ; + DATAOBJ.fine = Math.round(DATAOBJ.fine * 100) / 100 ; + if(!CHECK.money.test(val)){ + layer.msg('罚款金额格式错误'); + $(this).val(DATAOBJ.fine); + return false; + } if(val > DATAOBJ.statement_count['sum_money']){ layer.msg('罚款金额过大,总计不允许为负数'); $(this).val(DATAOBJ.fine); return false; } - DATAOBJ.statement_count['sum_money'] = (DATAOBJ.statement_count['sum_money'] -0+DATAOBJ.fine); - DATAOBJ.statement_count['pay_amount'] = (DATAOBJ.statement_count['pay_amount'] -0+DATAOBJ.fine); + DATAOBJ.statement_count['sum_money'] =PUBLIC.floatAdd(DATAOBJ.statement_count['sum_money'],DATAOBJ.fine); + DATAOBJ.statement_count['pay_amount'] = PUBLIC.floatAdd(DATAOBJ.statement_count['pay_amount'],DATAOBJ.fine); eval(str); - DATAOBJ.statement_count['sum_money'] = DATAOBJ.statement_count['sum_money']-DATAOBJ.fine; - DATAOBJ.statement_count['pay_amount'] = DATAOBJ.statement_count['pay_amount']-DATAOBJ.fine; - + DATAOBJ.statement_count['sum_money'] =PUBLIC.floatCut(DATAOBJ.statement_count['sum_money'],DATAOBJ.fine); + DATAOBJ.statement_count['pay_amount'] = PUBLIC.floatCut(DATAOBJ.statement_count['pay_amount'],DATAOBJ.fine); } - DATAOBJ.statement_count['pay_amount'] = Math.floor(DATAOBJ.statement_count['pay_amount'] * 100) / 100 ; - DATAOBJ.statement_count['sum_money'] = Math.floor(DATAOBJ.statement_count['sum_money'] * 100) / 100; - TPLSHOW.showStatementList(true); }) }, diff --git a/Application/Admin/View/StatementMangement/createDownstreamOrder.html b/Application/Admin/View/StatementMangement/createDownstreamOrder.html index a47d9ca0b..2c3a66a2f 100644 --- a/Application/Admin/View/StatementMangement/createDownstreamOrder.html +++ b/Application/Admin/View/StatementMangement/createDownstreamOrder.html @@ -285,9 +285,9 @@ function eventnew(){ $(".tax").off("blur"); $(".tax").on("blur", function() { - var lastNum = $(this).parent().next().text(); + var lastNum = (parseFloat($(this).parent().next().text())).toFixed(2); $(this).parent().next().text(($(this).parent().next().attr('data-value')*(1-$(this).val()/100)).toFixed(2)); - var nowNum = $(this).parent().next().text(); + var nowNum = (parseFloat($(this).parent().next().text())).toFixed(2); console.log((nowNum-lastNum)) $(".sumAll").text((parseFloat($(".sumAll").text())+(nowNum-lastNum)).toFixed(2)); }); @@ -296,7 +296,7 @@ $(".forfeit").on("blur", function() { var lastNumber = $(this).parent().next().next().next().text(); - $(this).parent().next().next().next().text($(this).val()); + $(this).parent().next().next().next().text(parseFloat($(this).val()).toFixed(2)); $(".sumAmount").text($(".sumAmount").attr("data-value")-$(this).val()); $(".sumAll").text((parseFloat($(".sumAll").text())+parseFloat(lastNumber)-parseFloat($(this).val())).toFixed(2)); diff --git a/Application/Admin/View/StatementMangement/edit.html b/Application/Admin/View/StatementMangement/edit.html index 8c0dd5723..02ceb35c8 100644 --- a/Application/Admin/View/StatementMangement/edit.html +++ b/Application/Admin/View/StatementMangement/edit.html @@ -286,9 +286,9 @@ function eventnew(){ $(".tax").off("blur"); $(".tax").on("blur", function() { - var lastNum = $(this).parent().next().text(); + var lastNum = (parseFloat($(this).parent().next().text())).toFixed(2); $(this).parent().next().text(($(this).parent().next().attr('data-value')*(1-$(this).val()/100)).toFixed(2)); - var nowNum = $(this).parent().next().text(); + var nowNum = (parseFloat($(this).parent().next().text())).toFixed(2); console.log((nowNum-lastNum)) $(".sumAll").text((parseFloat($(".sumAll").text())+(nowNum-lastNum)).toFixed(2)); }); @@ -297,8 +297,8 @@ $(".forfeit").on("blur", function() { var lastNumber = $(this).parent().next().next().next().text(); - $(this).parent().next().next().next().text($(this).val()); - $(".sumAmount").text($(".sumAmount").attr("data-value")-$(this).val()); + $(this).parent().next().next().next().text(parseFloat($(this).val()).toFixed(2)); + $(".sumAmount").text(($(".sumAmount").attr("data-value")-$(this).val()).toFixed(2)); $(".sumAll").text((parseFloat($(".sumAll").text())+parseFloat(lastNumber)-parseFloat($(this).val())).toFixed(2));