<%@ Page Language="C#" AutoEventWireup="true" debug="true" Inherits="WinLibClass.Form.Admin.PointSetting.Update"  CodePage="65001" %>


<script type="text/javascript"> 


$(document).ready(function(){

});

function UpdateCheckInfo(o)
{
	if(o){
	if(o.checked){jQuery("#span_IsPoint2").css("color","#339966");jQuery("#span_IsCredits").css("color","#000000");jQuery("#tr_Credits").hide();jQuery("tr[id^='tr_Point']").show(); }
	else{jQuery("#span_IsPoint2").css("color","#000000");jQuery("#span_IsCredits").css("color","#339966");jQuery("tr[id^='tr_Point']").hide(); jQuery("#tr_Credits").show();}
	}
	//else(alert(o.checked));
}


function UpdateData()
{
		var pass= true;//checkform();// $.formValidator.pageIsValid('4');
		if(pass)
		{
		/*
			var o =jQuery("#chk_IsPoint2");
			if(o) o = o[0];
			if(o.checked){
				jQuery("input[id^='Credits']").val("0");
			}
			else{
				jQuery("input[id^='Point']").val("0");
			}
			*/
		
			var queryString = $('#form_add').serialize()
			$.ajax({
				async:false,
				type: "POST",
				url: "update.aspx?IsAdd=2&RuleType=<%=RuleType%>",
				data:queryString,
				cache: false,
				success: function(msg){
						if(msg==1){ 
							Alert('<%=(DataInfo.ID>0?"修改":"添加") %>成功!',1,function(){Common.Refresh();});
							//Common.Refresh();

						}else if(msg==-1){
							AlertErr("序号填写无效，可用有效值范围：<%= __Agent.Provider_PointSetting.IsReserveNumberA_Max+1 %> ~ <%=__Agent.Provider_PointSetting.IsReserveNumberB_Min-1 %> .");
						}else if(msg==-2){
							AlertErr("序号填写无效，可用有效值范围：大于<%= __Agent.Provider_PointSetting.IsReserveNumberB_Max %>.");
						}else{
							msg = "<%=(DataInfo.ID>0?"修改":"添加") %>失败,序号重复、序号无效或网络异常.代码("+ msg +")";
							AlertErr(msg);
						}
				},
				error:function(msg)
				{
					//ShowErrorMsg("出错啦:" + msg.responseText);
					AlertErr("写入数据库异常.");
				}
				
			});		
			
		}
		else
		{
			AlertErr("出错啦:连接异常,操作失败");
		}
		return false;

}


function checkSetUp()
{
	
}

</script> 


<div CLASS="W600">



	<form id="form_add">

<div class="TableUpdateDiv"  style="width:100%;">
<div style="width:98%;">
	<table class="TableUpdate" style="text-align:left;">
	<tr>
		<td>
		<input id="Id" name="Id" type="hidden" value="<%=DataInfo.ID%>" readonly />
		固定编号：
		<%=((DataInfo.IsReserve==1)?"<span style='width:100px;display:inline-block;'>"+ DataInfo.Pid  +"</span>":"")%>
		<input id="Pid" name="Pid" type="<%=((DataInfo.IsReserve==1)?"hidden":"text")%>" value="<%=DataInfo.Pid%>" />
		<input id="Pid_Old" name="Pid_Old" type="hidden" value="<%=DataInfo.Pid%>"  />
		固定名称:
		<%=((DataInfo.IsReserve==1)?"<span>"+ DataInfo.Name  +"</span>":"")%>
		<input id="name" name="name" type="<%=((DataInfo.IsReserve==1)?"hidden":"text")%>" class="input" style="width:220px;"  value="<%=DataInfo.Name %>" />	
		</td>
	</tr>
	
	
	<tr>
	<td>状态:
		<select id="IsChecked" name="IsChecked" style="width:60px;" >
		<option value="0" style="color:red" <%=((DataInfo.IsChecked==0)?"selected":"")%> >停用</option>
		<option value="1" <%=((DataInfo.IsChecked==1)?"selected":"")%> >启用</option>
		</select>
		<font class="Hide">
		<input type="checkbox" id="chk_IsPoint2" <%=DataInfo.Credits>0?"":"checked" %> >
		<span id="span_IsPoint2">送<%=WinLibClass.Config.Global.WebSiteConfig.PointName_2%>(Y)</span> / <span id="span_IsCredits">送积分(N)</span>
		</font>
		
		
	</td>
	</tr>	
	

	
	<tr id="tr_Point1" style="display:none1;">
	<td>
	<B style="display:inline-block;"><%=WinLibClass.Config.Global.WebSiteConfig.PointName_1%>  </b>：
	类型	<select id="PointType1" name="PointType1" style="width:100px;" >
		<%
		if(RuleType==0)
		{
		%>
		<option value="0" <%=((DataInfo.PointType1==0)?"selected":"")%> >购买-分值</option>
		<option value="1" <%=((DataInfo.PointType1==1)?"selected":"")%> >购买-百分比</option>
		<%
		}
		%>
		<option value="10" <%=((DataInfo.PointType1==10)?"selected":"")%> >赠送-分值</option>
		<option value="11" <%=((DataInfo.PointType1==11)?"selected":"")%> >赠送-百分比</option>
		<option value="20" <%=((DataInfo.PointType1==20)?"selected":"")%> >返还-分值</option>
		<option value="21" <%=((DataInfo.PointType1==21)?"selected":"")%> >返还-百分比</option>
		</select>	
	
	
	额度值	<input id="Point1" name="Point1" type="text" class="input" style="width:100px;"  value="<%=DataInfo.Point1 %>" />点	
	<%
	if(RuleType==0)
	{
	%>
	
	所需金额 	<input id="PointPrice" name="PointPrice" type="text" class="input" style="width:100px;"  value="<%=DataInfo.PointPrice/100f %>" />	
	<%
	}
	%>
	</td>
	</tr>
	
	
	<tr id="tr_Point2" style="display:none1;">
	<td>
	<B style="display:inline-block;"><%=WinLibClass.Config.Global.WebSiteConfig.PointName_2%>  </b>：
	类型	<select id="PointType2" name="PointType2" style="width:100px;" >
		<option value="10" <%=((DataInfo.PointType2==10)?"selected":"")%> >赠送-分值</option>
		<option value="11" <%=((DataInfo.PointType2==11)?"selected":"")%> >赠送-百分比</option>
		<option value="20" <%=((DataInfo.PointType2==20)?"selected":"")%> >返还-分值</option>
		<option value="21" <%=((DataInfo.PointType2==21)?"selected":"")%> >返还-百分比</option>
		</select>
	额度值	<input id="Point2" name="Point2" type="text" class="input" style="width:100px;"  value="<%=DataInfo.Point2 %>" />点
	
	</td>
	</tr>
	
	<tr id="tr_Point3" style="display:none1;">
	<td>
	<B style="display:inline-block;"><%=WinLibClass.Config.Global.WebSiteConfig.PointName_3%>  </b>：
	类型	<select id="PointType3" name="PointType3" style="width:100px;" >

		<option value="10" <%=((DataInfo.PointType3==10)?"selected":"")%> >赠送-分值</option>
		<option value="11" <%=((DataInfo.PointType3==11)?"selected":"")%> >赠送-百分比</option>
		<option value="20" <%=((DataInfo.PointType3==20)?"selected":"")%> >返还-分值</option>
		<option value="21" <%=((DataInfo.PointType3==21)?"selected":"")%> >返还-百分比</option>
		</select>
	额度值	<input id="Point3" name="Point3" type="text" class="input" style="width:100px;"  value="<%=DataInfo.Point3 %>" />点	
	
	</td>
	</tr>

	<tr id="tr_Credits" style="display:none1;">
	<td>
	<B style="display:inline-block;">积　分</b>：
	类型	<select id="CreditsType1" name="CreditsType1" style="width:100px;" >
		<%
		if(1==0)
		{
		%>
		<option value="0" <%=((DataInfo.CreditsType1==0)?"selected":"")%> >购买-分值</option>
		<option value="1" <%=((DataInfo.CreditsType1==1)?"selected":"")%> >购买-百分比</option>
		
		<option value="11" <%=((DataInfo.CreditsType1==11)?"selected":"")%> >赠送-百分比</option>
		<option value="20" <%=((DataInfo.CreditsType1==20)?"selected":"")%> >返还-分值</option>
		<option value="21" <%=((DataInfo.CreditsType1==21)?"selected":"")%> >返还-百分比</option>

		<%
		}
		%>
		
		
		<option value="10" <%=((DataInfo.CreditsType1==10)?"selected":"")%> >赠送-分值</option>
		</select>
	额度值	<input id="Credits" name="Credits" type="text" class="input" style="width:100px;"  value="<%=DataInfo.Credits %>" />点	
	<!--所需金额--> 	<input id="CreditsPrice" name="CreditsPrice" type="hidden" class="input" style="width:100px;"  value="<%=DataInfo.CreditsPrice /100f%>" />	
	</td>
	</tr>
	
	</table>

	</div>
</div>

<div class="TableUpdateDiv Hide" style="width:99%;">	
<div style="width:98%;">
		<table  class="TableUpdate" style="text-align:left;">
		<Tr>
		<Td style="border:0px;">	
	
		<button type="button" class="button" style="width:150px" id='BtnSubmit' >确认<%=(DataInfo.ID>0)?"修改":"添加" %>及发送</button>
		<span id="notetip"></span>
		<span id="tips"></span> 
	
	</td>
	</tr>
	</table>
	</div>
</div>	
</form>
	
</div>

<script>
function funSucc(id,msg){}
function funFail(id,msg){Common.ShowTipFaceSmile(false,msg,1);}
function checkform(){
    var ok = jQuery.checkForm2({
        ctrls: [   
        {id: "Id",type:"mustMoreThan", par:1,funSuccess: function(ctr){ funSucc(ctr.id,"");},funFailed:function(ctr){funFail(ctr.id,"请选择会员");}}                                
		,{id: "Point1",type:"mustMoreThan", par:1,funSuccess: function(ctr){ funSucc(ctr.id,"");},funFailed:function(ctr){funFail(ctr.id,"请填写额度值");}}
        ],success: function(){},failed: function(msg){}
        });
	return ok;	

}

</script>
