<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>配件名称：<b>*</b></label>
				<input type="text" id="name" class="dfinput fl" name="name" />
			</li>
			<li>
				<label>配件颜色：<b>*</b></label>
				<input type="text" id="partscolor" class="dfinput fl" name="partscolor" />
			</li>
			<li>
				<label>总入库量：<b>*</b></label>
				<input type="number" id="sellwaitnum" value="" class="dfinput fl" name="sellwaitnum" />
			</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="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: ['确定','关闭'] //按钮
	}, function(){
		if($("#sellwaitnum").val()=='' || $("#sellwaitnum").val()<=0){
			parent.layer.msg("入库数量不能少于0",{icon:1});
			return;
		}
		var url="[[${sysUrl}]]/sys/fx/saveDeviceParts";
		 var params ={
		            'name':$("#name").val(),
		            'partsColor' : $("#partscolor").val(),
		            'sellWaitNum' : $("#sellwaitnum").val(),
		            'merchantId':$("#poscode").find("option:selected").data("id"),
		            'posCode':$("#poscode").val(),
		            'orgCode':$("#poscode").find("option:selected").data("orgcode"),
		            'remarks':$("#remarks").val(),
		        	'emsNumber':$("#emsnumber").val(),
					'emsAddress':$("#emsaddress").val(),
					'emsUsername':$("#emsusername").val(),
					'emsTelephone':$("#emstelephone").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>