<%@ page language="C#" autoeventwireup="true" inherits="wap_user_editInfo, kfenlei" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-control" content="no-cache" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title><%=sWebName %> - 修改信息</title>
<link href="/js/css/layui.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css.css" type="text/css" />
</head>
<body>
<form action="/inc/kfUpload.aspx" style="display:none;" id="upFileForm" name="upFileForm" method="post" enctype="multipart/form-data">
<input type="file" id="upFile" name="upFile" />
<input type="submit" value="上传">
</form>
<%=qTemplate.Ac("wapUserTop.html") %>
<script type="text/javascript" src="/js/m.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" language="javascript" src="/js/layui.js"></script>
<script type="text/javascript">
layui.use(['form','laydate'], function(){
var form = layui.form();
    form.render();
	form.on('select(address)', function(data){
acLoadAddress($("#address").val(),"");
valiPost('exAddress');
});
});
</script>
<div align="left">
<div class="wapPageTitle"><a href="javascript:history.go(-1);" class="infoback">返回</a>修改信息</div>
<div class="in" align="left">
<div class="userRightContent">
<form action="/wap/user/action.aspx?s=editInfo" method="post"  class="layui-form" onSubmit="return valiPost('all')" name="postmess"><input type="hidden" value="<%=adminpassword %>" name="adminpassword" /><input type="hidden" value="<%=sId%>" name="id" />
<input type="hidden" name="sort" value="<%=sSort %>" />
<div class="postForm">
<div class="pfInput">
<div class="label"><strong>*</strong>标题：</div>
<div class="inputDiv"><input type="text" name="title" id="title" onBlur="valiPost('exTitle')" class="textInput" value="<%=title %>" /></div>
<div class="exDiv" id="exTitle"></div>
<div class="clear"></div>
</div>
<div class="pfInput"><div class="label"><strong>*</strong>内容：</div>
<div class="inputDiv"><textarea name="content" class="postTextarea" id="content" onBlur="valiPost('exContent')"><%=content %></textarea></div>
<div class="exDiv" id="exContent"></div>
<div class="clear"></div>
</div>
<%if(iPicCount>0){%>
<div class="pfInput">
<div class="label">图片：</div>
<div class="inputDiv2">
<div class="inputPs1">可上传<strong><%=sPicCount%></strong>张图片，图片请小于<%=sPicSize1%></div>
<div class="swfupload-control">
<ul id="preview" class="preview"><li id="wapUploadBtn" class="wapUploadBtn"><img src="/wap/images/wapUploadBtn.png" /></li></ul><div class="clear"></div></div>
</div>
<input type="hidden" name="pic" id="pic" value="<%=pic %>" />
<script language="javascript">
var iPicCount=<%=sPicCount%>;
setCookie("kPicCount",0);
var iPic=0;
function uPic()
{
	var sPic=$("#pic").val();
	if(sPic!="")
	{
		iPic=0;
		var saPic=sPic.split(',');
		var sPreview="";
		for(i=0;i<saPic.length-1;i++)
		{
			if(saPic[i]!="")
			{
				iPic++;
				sPreview+='<li><div><img src="/'+saPic[i]+'" height="100" width="100" /></div><div class="previewDel" onclick="delUp(\''+saPic[i]+'\')">&times;</div></li>';
			}
		}
		setCookie("kPicCount",iPic);
		$("#preview").html(sPreview+'<li id="wapUploadBtn" class="wapUploadBtn"><img src="/wap/images/wapUploadBtn.png" /></li>');
	}
	else
	{
		$("#preview").html('<li id="wapUploadBtn" class="wapUploadBtn"><img src="/wap/images/wapUploadBtn.png" /></li>');
		setCookie("kPicCount",0);
	}
}
uPic();
$("#wapUploadBtn").click(function(){
	if(getCookie("kPicCount")>=iPicCount)
	{
		alert("最多可上传<%=sPicCount%>张图片!");
	}
	else
	{
		$("#upFile").click();
	}
});
function delUp(picName)
{
	$("#pic").val($("#pic").val().replace(picName+",",""));
	$("#preview li").has("img[src='/"+picName+"']").remove();
	iPic--
	setCookie("kPicCount",iPic);
}
$('#upFile').change(function(){
if($('#upFile').val()!="")
{
$("#wapUploadBtn").before('<li><img src="/images/wait.gif" class="previewWait" /></li>');
}
$("#upFileForm").ajaxSubmit({url:"/inc/kfUpload.aspx",
type:"POST",
success:function(response){
var data=eval("("+response+")");
if(data.status=="1")
{
$("#wapUploadBtn").prev().html('<div><img src="/'+data.pic+'" height="100" width="100" /></div><div class="previewDel" onclick="delUp(\''+data.pic+'\')">&times;</div>');  
$("#pic").val($("#pic").val()+data.pic+",");
iPic++;
setCookie("kPicCount",iPic);
}
else
{
	$("#wapUploadBtn").prev().remove();
  	alert(data.ps);
}
  },
  error:function(msg){
  }
});
$('#upFile').val('');
});
</script>
</div>
<%}%>
<div class="pfInput2"><div class="label"><strong>*</strong>地区：</div>
<div class="inputDiv2"><div class="selectDivLine"><%=tools.showAddressSelect("address","address1") %></div></div>
<div class="exDiv" id="exAddress"></div>
<div class="clear"></div>
</div>
<div class="pfInput">
<div class="label">价格：</div>
<div class="inputDiv"><input type="text" name="price" id="price" onBlur="valiPost('exPrice')" class="textInput" value="<%=price %>" /><div class="inputPs">（元）</div></div>
<div class="exDiv" id="exPrice"></div>
<div class="clear"></div>
</div>
<div class="pfInput">
<div class="label"><strong>*</strong>电话：</div>
<div class="inputDiv"><input type="text" name="tel" id="tel" onBlur="valiPost('exTel')" class="textInput" value="<%=tel %>" /></div>
<div class="exDiv" id="exTel"></div>
<div class="clear"></div>
</div>
<div class="pfInput">
<div class="label">微信：</div>
<div class="inputDiv"><input type="text" name="weixin" onBlur="valiPost('exWeixin')" id="weixin" class="textInput" value="<%=weixin %>"/></div>
<div class="exDiv" id="exWeixin"></div>
<div class="clear"></div>
</div>
<div class="pfInput">
<div class="label">QQ：</div>
<div class="inputDiv"><input type="text" name="qq" onBlur="valiPost('exQq')" id="qq" class="textInput" value="<%=qq %>" /></div>
<div class="exDiv" id="exQq"></div>
<div class="clear"></div>
</div>
<div class="pfInput">
<div class="label">联系人：</div>
<div class="inputDiv">
<input type="text" name="name" id="name" onBlur="valiPost('exName')" class="textInput" value="<%=name %>" />
</div>
<div class="exDiv" id="exName"></div>
<div class="clear"></div>
</div>
<div class="pfInput">
<div class="label"><strong>*</strong>有效期：</div>
<div class="inputDiv"><input type="text" class="textInput" name="overdate" value="<%=overdate%>" onBlur="valiPost('exOverDate')" id="overdate" />
<div class="inputPs">（天）</div></div>
<div class="exDiv" id="exOverDate"></div>
<div class="clear"></div>
</div>
<div class="clear10"></div>
<div align="center"><input type="submit" class="postSubmit" value="确认修改信息" /></div>
</div>
</form>
</div>
</div>
<div class="clear10"></div>
</div>
<script type="text/javascript" src="<%=sPostPath%>vali.js"></script>
<script language="javascript" type="text/javascript">
if($("#valiPic")!=null)
{
	$("#valiPic").attr("src","/validate/?cache="+Math.random());
}
if(getCookie("kState") != null&&getCookie("kState")!="")
{
	var post_con=JSON.parse(getCookie("post_con"));
	$("#title").val(post_con.kTitle);
	$("#name").val(post_con.kName);
	$("#price").val(post_con.kPrice);
	$("#pic").val(post_con.kPic);
	$("#content").val(post_con.kContent);
	$("#tel").val(post_con.kTel);
	$("#weixin").val(post_con.kWeixin);
	$("#qq").val(post_con.kQq);
	$("#overdate").val(post_con.kOverDate);
	$("#address").val(post_con.kAddress);
	$("#adminpassword").val(post_con.kAdminPassWord);
	acLoadAddress(post_con.kAddress,post_con.kAddress1);
	setTimeout('updatePic()',500);
	alert(decodeURI(escape(getCookie("kState"))));
	preview();
	valiPost("all");
}
else
{
  $("#address").val('<%=address  %>');
    acLoadAddress('<%=address  %>','<%=address1  %>');
}
</script>
</body>
</html>
