<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" disabled="disabled" class="dfinput fl" name="imei" th:value="${device.imei}"/>
			</li>
			<li>
				<label>设备名称：<b>*</b></label>
				<input type="text" id="devicename" class="dfinput fl" name="devicename"  th:value="${device.deviceName}"/>
			</li>
			<li>
				<label>真实小塾号：<b></b></label>
				<input type="text" id="deviceRealNumber" class="dfinput fl" name="deviceRealNumber" th:value="${device.deviceRealNumber}"/>
			</li>
			<li>
				<label>小塾号：<b></b></label>
				<input type="text" id="devicenumber" class="dfinput fl" name="devicenumber" th:value="${device.deviceNumber}"/>
			</li>
			<li>
				<label>设备型号：<b></b></label>
				<input type="text" id="devicemodel" class="dfinput fl" name="devicemodel" th:value="${device.deviceModel}"/>
			</li>
			<li>
				<label>设备颜色：<b></b></label>
				<input type="text" id="devicecolor" class="dfinput fl" name="devicecolor" th:value="${device.deviceColor}"/>
			</li>
			<li>
				<label>设备代码：<b></b></label>
				<input type="text" id="devicecode" class="dfinput fl" name="devicecode"  th:value="${device.deviceCode}"/>
			</li>
		
			<li>
				<label>simcard：<b></b></label>
				<input type="text" id="devicesn" class="dfinput fl" name="devicsn"  th:value="${device.deviceSn}"/>
			</li>
			<li>
				<label>进货单价：<b></b></label>
				<input type="text" id="price" class="dfinput fl" name="price"  th:value="${device.price}"/>
			</li>
			<li>
				<label>批次编号：<b></b></label>
				<input type="text" id="batchcode" class="dfinput fl" name="batchcode"  th:value="${device.batchCode}"/>
			</li>
			<li>
				<label>快递单号：<b></b></label>
				<input type="text" id="emsnumber" class="dfinput fl" name="emsnumber"  th:value="${device.emsNumber}"/>
			</li>
			<li>
				<label>快递地址：<b></b></label>
				<input type="text" id="emsaddress" class="dfinput fl" name="emsaddress"  th:value="${device.emsAddress}"/>
			</li>
			<li>
				<label>快递联系人：<b></b></label>
				<input type="text" id="emsusername" class="dfinput fl" name="emsusername"  th:value="${device.emsUsername}"/>
			</li>
			<li>
				<label>联系人电话：<b></b></label>
				<input type="text" id="emstelephone" class="dfinput fl" name="emstelephone"  th:value="${device.emsTelephone}"/>
			</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" th:selected="${device.type==1 ? true : false}">出售</option>
						<option value="2" th:selected="${device.type==2 ? true : false}">租赁</option>
						<option value="3" th:selected="${device.type==3 ? true : false}">损坏</option>
						<option value="4" th:selected="${device.type==4 ? true : false}">内部使用</option>
					</select>
				</div>
			</li>
			<li>
				<label>备注：<b></b></label>
				<input type="text" id="remarks" class="dfinput fl" name="remarks"  th:value="${device.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">
var id='[[${param.id}]]';
function push_user(){
	var content ="您确定要保存记录吗?";
	parent.layer.confirm(content, {
		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
	}, function(){
		var url="[[${sysUrl}]]/sys/fx/saveDevice";
		 var params ={
				 	'id' : id,
		            'imei' : $("#imei").val(),
		            'batchCode' : $("#batchcode").val(),
		            'deviceColor' : $("#devicecolor").val(),
		            'deviceName' : $("#devicename").val(),
		            'deviceNumber' : $("#devicenumber").val(),
		            'deviceRealNumber' : $("#deviceRealNumber").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>