$(function(){});function finDepositHandle(){var a=$("#rdrDataGridList").datagrid("getSelected");if(!a){return openMessageDlg("请先选择一条读者信息,才能进行押金处理")}searchDepositGridList(a,"deposit","fin_deposit_dlg")}function searchDepositGridList(c,a,b){if(!b){b="fin_debt_dlg"}$("#"+b).dialog({onLoad:function(){if(b){setValue("depositMoney","")}var d=base_path+"cir/fine/pageCurFine.do";if(a=="debt"){d=base_path+"cir/fine/pageCurFineUnion.do"}clearGridData(""+a+"DataGridList");$(".fin-"+a+"-tip").html("");$(".fin-total"+a+"-tip").html("");var e="读者证号:["+c.rdrno+"],姓名:["+c.name+"]";$(".fin-"+a+"-tip").html(e);setTimeout(function(){var f={};f.rows=10;f.page=1;f.rdrid=c.id;f.type=a;$("#"+a+"DataGridList").datagrid({url:d,queryParams:f,onLoadSuccess:function(k){if(k.total>0){var j=k.rows;var g=0;for(var h=0;h0){var b="";var c="您确定要为读者证号为["+d.rdrno+"]的读者,交["+getValue("depositMoney")+"]元押金吗?";b+="
"+c+"
";var a;if(VPAGEFIN=="reader"){a=rdrConfigParamjson.paybarcode}else{a=cirConfigParamjson.paybarcode}if(a&&a=="1"){b+="
提示:如果【现金支付】请选择确定按钮,如果【微信或者支付宝支付】直接扫描读者出示的二维码进行扫码支付
";b+='
'}openConfirmDlg(b,null,payDepositResult,null,"deposit")}else{openMessageDlg("要交的押金必须大于0")}}function payDepositResult(){var a=base_path+"cir/fine/pay.do";var c={};var b=$("#rdrDataGridList").datagrid("getSelected");c.type="0";c.rdrid=b.id;c.money=getValue("depositMoney");c.payway="0";if($("#olpaycode").length>0){c.olpaycode=$("#olpaycode").val()}$.post(a,c,function(e){if(e.status=="0"){searchDepositGridList(b,"deposit","fin_deposit_dlg");var d=$("#rdrDataGridList").datagrid("getRowIndex",b);$("#rdrDataGridList").datagrid("selectRow",d)}else{openMessageDlg(e.message)}},"json")}function refundDeposit(){var c=$("#depositDataGridList").datagrid("getRows");var a=0;for(var b=0;b0){var d=$("#rdrDataGridList").datagrid("getSelected");openConfirmDlg("您确定要为读者证号为["+d.rdrno+"]的读者,退["+a.toFixed(2)+"]元押金吗?",null,refundDepositResult,null)}else{openMessageDlg("要退的押金必须大于0")}}function refundDepositResult(){var d=$("#depositDataGridList").datagrid("getRows");var a=0;for(var c=0;c0){openConfirmDlg("您确定要为读者证号为["+a.rdrno+"]的读者,设置欠款["+getValue("debtMoney")+"]元欠款吗?",null,setFinDebtResult,null)}else{openMessageDlg("要设置的欠款必须大于0")}}function setFinDebtResult(){var a=base_path+"cir/fine/set.do";var c={};var b=getValue("rdrid");if(VPAGEFIN=="reader"){b=getValue("id")}c.type="4";c.rdrid=b;c.money=getValue("debtMoney");c.note=getValue("debtNote");c.payway="0";$.post(a,c,function(d){if(d.status=="0"){openMessageDlg(d.message);reLoadFinDebtResult()}else{openMessageDlg(d.message)}},"json")}function payFinDebt(){var c=$("#debtDataGridList").datagrid("getSelections");if(c.length==0){return openMessageDlg("请选中一条欠款信息,才能进行交罚款操作")}var b=0;for(var e=0;e["+b.toFixed(2)+"]元,确定要交付吗?";d+="
"+f+"
";var a;if(VPAGEFIN=="reader"){a=rdrConfigParamjson.paybarcode}else{a=cirConfigParamjson.paybarcode}if(a&&a=="1"){d+="
提示:如果【现金支付】请选择确定按钮,如果【微信或者支付宝支付】直接扫描读者出示的二维码进行扫码支付
";d+='
'}openConfirmDlg(d,null,payFinDebtResult,null,"debt")}function bindOpenConfirmEvent(a){if($("#olpaycode").length>0){$("#olpaycode").focus().select();$("#olpaycode").keydown(function(b){if(b.keyCode==13){closeConfirmDlg();if(a=="deposit"){payDepositResult()}if(a=="debt"){payFinDebtResult()}}})}}function payFinDebtResult(){var e=$("#debtDataGridList").datagrid("getSelections");var a=0;var d="";for(var c=0;c0){d+=","}}d+=e[c].fineid}var b=base_path+"cir/fine/pay.do";var f={};f.payway="0";f.parentids=d;if($("#olpaycode").length>0){f.olpaycode=$("#olpaycode").val()}$.post(b,f,function(g){if(g.status=="0"){var h;if(VPAGEFIN=="reader"){h=$("#rdrDataGridList").datagrid("getSelected")}else{h=getJsonData(null,"record")}reLoadFinDebtResult();printTicketHandler("debt",h,e);openMessageDlg(g.message)}else{openMessageDlg(g.message)}},"json")}function reLoadFinDebtResult(){var c={};if(VPAGEFIN=="reader"){c=$("#rdrDataGridList").datagrid("getSelected");var a=$("#rdrDataGridList").datagrid("getRowIndex",c);$("#rdrDataGridList").datagrid("selectRow",a)}else{var b=getValue("rdrid");c.id=getValue("rdrid");c.rdrno=getValue("rdrno");c.name=getValue("name")}searchDepositGridList(c,"debt")}function cancleDebt(){var b=$("#debtDataGridList").datagrid("getSelections");if(b.length==0){return openMessageDlg("请选中一条欠款信息,才能进行取消罚款操作")}var a=0;for(var c=0;c0){d+=","}}d+=e[c].fineid}var b=base_path+"cir/fine/cancel.do";var f={};f.payway="0";f.parentids=d;$.post(b,f,function(g){if(g.status=="0"){openMessageDlg(g.message);reLoadFinDebtResult()}else{openMessageDlg(g.message)}},"json")}function onOpenFinDebtDlg(){}function onCloseDebtDlg(){if(VPAGEFIN!="reader"){var a=$("#debtDataGridList").datagrid("getRows");if(a.length==0){getFocusBarCode()}}}function finSearchHandle(){var a=getValue("rdrid");if(VPAGEFIN=="reader"){a=getValue("id")}if(a>0){$("#fin_search_dlg").dialog({onLoad:function(){_myPage.prototype.onLoadData(_fmtGridDataRows,initJson);setValue("finsearchrdrno",getValue("rdrno"));bindHistoryFinDataGridList(a)}}).dialog("open")}else{openMessageDlg("请选中一条读者记录进行操作!")}}function onOpenFinSearchDlg(){$("#finsearchrdrno").textbox("textbox").focus()}function searchFinLog(){var a=getValue("rdrid");if(VPAGEFIN=="reader"){a=getValue("id")}bindHistoryFinDataGridList(a)}function onFineRefund(){var a=$("#finLogDataGridList").datagrid("getSelected");if(a){if("1"==a.rectype){openConfirmDlg("您确定要执行退款操作吗?",null,onFineRefundResult,null)}else{openMessageDlg("不是交款记录无法进行退款")}}}function onFineRefundResult(){var c=$("#finLogDataGridList").datagrid("getSelected");var a=base_path+"cir/fine/refund.do";var b={};b.parentids=c.id;$.post(a,b,function(d){if(d.status=="0"){searchFinLog()}else{openMessageDlg(d.message)}},"json")}function bindHistoryFinDataGridList(b){var a=base_path+"cir/fine/pageUnion.do";var c={};clearGridData("finLogDataGridList");c.rows=10;c.page=1;c.rdrid=b;if(getValue("finsearchpayway").length>0){c.payway=getValue("finsearchpayway")}if(getValue("finsearchfintype").length>0){c.type=getValue("finsearchfintype")}if(getValue("finsearchrectype").length>0){c.rectype=getValue("finsearchrectype")}if(getValue("finsearchbegdate").length>0&&getValue("finsearchenddate").length>0){c["limit[0].condition"]="findate";c["limit[0].typeHandler"]="2";c["limit[0].value"]=getValue("finsearchbegdate").replace(new RegExp("-","g"),"");c["limit[0].secondValue"]=getValue("finsearchenddate").replace(new RegExp("-","g"),"")}$("#finLogDataGridList").datagrid({url:a,queryParams:c,onLoadSuccess:function(d){},method:"post"})};