<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>私塾家</title>
<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
<script th:include="sys/common/metaJS" th:remove="tag"></script> 
<script src="sys/js/jquery.validate.min.js" th:src="@{/static/sys/js/jquery.validate.min.js}"></script>
<script src="sys/js/jquery-validation/messages_zh.js" th:src="@{/static/sys/js/jquery-validation/messages_zh.js}"></script>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
 <style>
    	.clearfix:after {
			visibility: hidden;
			display: block;
			font-size: 0;
			content: " ";
			clear: both;
			height: 0;
		}
		.clearfix { display: inline-table; }
		* html .clearfix { height: 1%; }
		.clearfix { display: block; }
		.fl{display:inline;float:left}
		clearfix >control-label-error{display:inline;float:left;marign-left:10px}
		 label.control-label-error {
  				color: Red;
             }
          .lispan {line-height: 34px;}   
          
          .select1{
   		    width:100%;
		    height: 32px;
		    line-height: 32px;
		    border-top: solid 1px #a7b5bc;
		    border-left: solid 1px #a7b5bc;
		    border-right: solid 1px #ced9df;
		    border-bottom: solid 1px #ced9df;
		    opacity:1;
	        margin-bottom: 10px;
    	}
    </style>
</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    	<li><a href="#">图书馆</a></li>
    	<li><a href="#">卡信息管理</a></li>
    </ul>
</div>
<div class="formbody">
	<div class="formtitle"><span>卡信息管理</span></div>
	<form id="submitFrom"   method="post" class="form-horizontal form-validate">
		     <input type="hidden" name="id" th:if="${ws.id}" th:value="${ws.id}"/>
		     <input type="hidden" name="userId" id="userId" th:value="${ws.userId}"/>
		     <input type="hidden" name="libId" id="libId" th:value="${ws.libId}"/>
		     <input type="hidden" id="state" name="state" th:value="${ws.state } ">
		<ul class="forminfo">
			<li class="clearfix">
				<label>持卡人姓名:<b>*</b></label>
				<input  id="cardName" class="dfinput fl" name="cardName"  th:value="${ws.cardName}"  />
			</li>
			<li class="clearfix" >
				<label>持卡人微信昵称:<b>*</b></label> 
				 <div   onclick="window.open('../userCard/userList.html', 'newwindow', 'height=530, width=1100, top=200, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');" style="margin-right: 5px; width: 346px">
				    <input type="text" id="wxName" name="wxName" style="width: 220px; " th:value="${wxName}" disabled="disabled" class="dfinput fl" >
				   </div>
			</li>
			<li class="clearfix">
				<label>所在馆:</label> 
				 <div   onclick="window.open('../userCard/libJoinList.html', 'newwindow', 'height=530, width=1100, top=200, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');" style="margin-right: 5px; width: 346px">
				    <input type="text" id="libName" name="libName" style="width: 220px; " th:value="${libName}" disabled="disabled" class="dfinput" >
				   </div>
			</li>
			<li class="clearfix">
				<label>卡号:<b>*</b></label>
				<input type="text" id="cardNum" class="dfinput fl" name="cardNum"  th:value="${ws.cardNum}"/>
			</li>
			<li class="clearfix">
				<label>开户行:<b>*</b></label>
				<input type="text" id="cardBank" class="dfinput fl" name="cardBank"  th:value="${ws.cardBank}"/>
			</li>
			<li class="clearfix">
				<label>预留手机号:</label>
				<input type="text" id="bankPhone" class="dfinput fl" name="bankPhone"  th:value="${ws.bankPhone}"/>
			</li>
			<li class="clearfix">
				<label>开户所在支行:</label>
				<input id="subbranch"  name="subbranch"  class="dfinput fl" type="text" th:value="${ws.subbranch}"/>
			</li>
			<li>
				<label>&nbsp;</label>
				
				<button type="button" class="btn" onclick="roleFrom()" >保存</button>
				<button type="button" class="btn" onClick="javascript :history.back(-1);" >返回</button>
			</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">
function roleFrom(){
	var cardName = $("#cardName").val();
	if(cardName == ""){
		layer.msg("持卡人姓名不能为空",{icon:11});
		return ;
	}
	var userId = $("#userId").val();
	if(userId == ""){
		layer.msg("持卡人微信昵称不能为空",{icon:11});
		return ;
	}
	var cardNum = $("#cardNum").val();
	if(cardNum == ""){
		layer.msg("卡号不能为空",{icon:11});
		return ;
	}
	var cardBank = $("#cardBank").val();
	if(cardBank == ""){
		layer.msg("开户行不能为空",{icon:11});
		return ;
	}
	var url="[[${sysUrl}]]/sys/userCard/cardSave";
	var params = $("#submitFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
				if(data.meta.success){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/userCard/cardInfoList.html';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}
</script>
</html>