<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> 
</head>
 <style type="text/css">
   body{min-width:180px;}
       .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;
    	}
    	.btn{
    	  width: 100px;
    	}
     label.control-label-error {color: Red;}	
    </style>
<body>
<div class="formbody">
		<ul class="forminfo">
			<li>
				<label>设备IMEI号：<b>*</b></label>
				<input type="text" id="imei" class="dfinput fl" name="imei" />
			</li>
			<li>
				<label>设备名称：<b>*</b></label>
				<input type="text" id="devicename" class="dfinput fl" name="devicename" />
			</li>
			<li>
				<label>小塾号：<b></b></label>
				<input type="text" id="devicenumber" class="dfinput fl" name="devicenumber" />
			</li>
			<li>
				<label>设备型号：<b></b></label>
				<input type="text" id="devicemodel" class="dfinput fl" name="devicemodel" />
			</li>
			<li>
				<label>设备颜色：<b></b></label>
				<input type="text" id="devicecolor" class="dfinput fl" name="devicecolor" />
			</li>
			<li>
				<label>设备代码：<b></b></label>
				<input type="text" id="devicecode" class="dfinput fl" name="devicecode"  />
			</li>
			
			<li>
				<label>simcard：<b></b></label>
				<input type="text" id="devicesn" class="dfinput fl" name="devicsn"  />
			</li>
			<li>
				<label>进货单价：<b></b></label>
				<input type="text" id="price" class="dfinput fl" name="price"  />
			</li>
			<li>
				<label>批次编号：<b></b></label>
				<input type="text" id="batchcode" class="dfinput fl" name="batchcode"  />
			</li>
			<li>
				<label>快递单号：<b></b></label>
				<input type="text" id="emsnumber" class="dfinput fl" name="emsnumber"  />
			</li>
			<li>
				<label>快递地址：<b></b></label>
				<input type="text" id="emsaddress" class="dfinput fl" name="emsaddress"  />
			</li>
			<li>
				<label>快递联系人：<b></b></label>
				<input type="text" id="emsusername" class="dfinput fl" name="emsusername"  />
			</li>
			<li>
				<label>联系人电话：<b></b></label>
				<input type="text" id="emstelephone" class="dfinput fl" name="emstelephone" />
			</li>
			<li>
				<label>交付状态<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 345px">
					<select name="status" id="status" class="select1"> 
						<option value="1" selected="selected">待收货</option>
						<option value="2" >已收货</option>
						<option value="5" >无效</option>
					</select>
				</div>
			</li>
			
			 <li>
				<label>流通类型<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 345px">
					<select name="type" id="type" class="select1"> 
						<option value="1" selected="selected">出售</option>
						<option value="2" >租赁</option>
						<option value="3" >损坏</option>
						<option value="4" >内部使用</option>
					</select>
				</div>
			</li>
			<li>
 				<label>交付商户<b>*</b></label>
 				<div class="vocation" style="margin-right: 5px; width: 345px">
					<select name="poscode" id="poscode" class="select1" > 
						<option th:each="item:${poslist}" value="1" th:data-orgcode="${item.orgCode}" th:data-id="${item.id}" th:value="${item.posCode}" th:text="${item.posCode}+':'+${item.unitName}"></option>
 					</select>
 				</div>
 			</li>
			
			
			<li>
				<label>备注：<b></b></label>
				<input type="text" id="remarks" class="dfinput fl" name="remarks"  />
			</li>
			<li>
				<label>&nbsp;</label>
				<button type="submit" onclick="push_user();" class="btn">提交</button>
				<button type="button" class="btn" onclick="closeWin();">取消</button>
			</li>
		</ul>
		<br/><br/><br/>
</div>
</body>
<script type="text/javascript">
function push_user(){
	var content ="您确定要保存记录吗?";
	parent.layer.confirm(content, {
		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
	}, function(){
		var url="[[${sysUrl}]]/sys/fx/saveDevice";
		 var params ={
		            'imei' : $("#imei").val(),
		            'batchCode' : $("#batchcode").val(),
		            'deviceColor' : $("#devicecolor").val(),
		            'deviceName' : $("#devicename").val(),
		            'deviceNumber' : $("#devicenumber").val(),
		            'deviceModel' : $("#devicemodel").val(),
		            'deviceCode' : $("#devicecode").val(),
		            'deviceSn' : $("#devicesn").val(),
		            'status':$("#status").val(),
		            'posCode':$("#poscode").val(),
		            'price':$("#price").val(),
		            'emsNumber':$("#emsnumber").val(),
		            'emsAddress':$("#emsaddress").val(),
		            'emsUsername':$("#emsusername").val(),
		            'emsTelephone':$("#emstelephone").val(),
		            'type':$("#type").find("option:selected").val(),
		            'merchantId':$("#poscode").find("option:selected").data("id"),
		            'orgCode':$("#poscode").find("option:selected").data("orgcode"),
		            'remarks':$("#remarks").val()
		        };
		$.post(url,params,function(data){
			if(data.meta.success){
				parent.layer.msg("保存成功",{icon:1});
				parent.location.reload();
				parent.layer.close(parent.layer.getFrameIndex(window.name));
			}else{
				parent.layer.msg(data.meta.message,{icon:11});
			}
		});
	});
}


</script>
</html>