<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<div id="modal-dkjl" class="modal fade" tabindex="-1">
	<div class="modal-dialog" style="max-width: 600px;">
		<div class="modal-content">
			<div class="modal-header no-padding">
      			<div class="table-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						<span class="white">&times;</span>
					</button>
					打款记录
				</div>
	      	</div>
	      	<div class="modal-body">
	      		<form id="dkjlForm" class="form-horizontal">
      				<input type="hidden" name="orderId" id="mod-dkjl-orderId"/>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label">打款信息:</label>
			      		<div class="col-sm-10 text-left">
			      			<textarea rows="5" id="mod-dkjl-info" class="form-control"></textarea>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label">金额:</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-dkjl-remark" class="form-control" />
			      		</div>
			      	</div>
		      	</form>
	      	</div>
	      	<div class="modal-footer">
                <button class="btn " data-dismiss="modal"><i class="fa fa-share bigger-160"></i>取消</button>
	      		<button class="btn btn-primary" type="button" id="mod-dkjl-submit"><strong>确定</strong></button>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
	$(function(){
		$('#mod-dkjl-submit').click(function(event) {
			dkjlSubmit();
		});
	});
	
	function dkjlClear(){
		var ids = ['mod-dkjl-info','mod-dkjl-remark'];
		for(var i in ids){
			$('#' + ids[i]).val('');
		}
	}
	
	function dkjlShow(orderId){
		dkjlClear();
		$('#mod-dkjl-orderId').val(orderId);
		$('#modal-dkjl').modal('toggle');
	}
	
	function dkjlSubmit(){
		var info = $('#mod-dkjl-info').val();
		var remark = $('#mod-dkjl-remark').val();
		if(!isNotBlank(info)){
			showMsg('请输入打款信息');
			return;
		}
		if(isNotDouble(remark)){
			showMsg('金额只能为浮点数');
			return;
		}
		var url = contextPath + '/ssrz/ssrzOrder/saveDkjl';
		var parameters = {'orderId':$('#mod-dkjl-orderId').val(),'info':info,'remark':remark};
		postData(url, parameters, dkjlSubmitCallback, errorCallbackDefault);
	}
	
	function dkjlSubmitCallback(data){
		if(data.success){
			$('#modal-dkjl').modal('toggle');
			showMsg('保存成功');
		}else{
			showMsg(data.message);
		}
	}

</script>
