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



<script type="text/javascript"> 

function SaveSub()
{ GetOptionText();
		if(jQuery("#SubClassId").val()<1){Alert("请选择分类");return false;}		
		if(jQuery("#ProductBrief").val().length>100){Alert("商品简介限字数100字以内，请删减。");return false;}		
		var pass=checkform();//jQuery.formValidator.pageIsValid('4');		
		if(pass){
			var queryString = jQuery('#form_add').serialize();
			$.post("Update.aspx?IsAdd=2", queryString,function(msg){
				if(msg=='1'){ //先保留msg这个值以备以后使用 //18:36 2011-06-09 改为1
					Alert('<%=(DataInfo.ID>0)?"修改":"添加" %>商品信息成功!',1,function(){Common.Refresh();});
					//Common.Refresh();
				}else{
					msg = "<%=(DataInfo.ID>0)?"修改":"添加" %>商品信息失败,请检查各项输入是否正确或网络连接状态.代码("+ msg +")";
					AlertErr(msg,2);
				}
			});
	}		
	return false;		
}

$(document).ready(function(){

	//上传图片控件
	$("#ChoosePic").click(function(){
		OpenDlg('PhotoPath');
	});

});

function GetOptionText(){
	//$('#BrandName').val($('#BrandId').text())
	var o = $('#BrandId')[0];
	if(o!=null)
	{
		var i = o.selectedIndex;
		$('#BrandName').val(o.options[i].text);
	}
}

function ContentDivTab(tab)
{
	if(tab==0){jQuery("#Div_Show_0").show();jQuery("#Div_Show_1").hide();
		jQuery("#span_Tab_0").removeClass("Span_NoSelect").addClass("Span_Select");
		jQuery("#span_Tab_1").removeClass("Span_Select").addClass("Span_NoSelect");
	}
	else {jQuery("#Div_Show_1").show();jQuery("#Div_Show_0").hide();
		jQuery("#span_Tab_1").removeClass("Span_NoSelect").addClass("Span_Select");
		jQuery("#span_Tab_0").removeClass("Span_Select").addClass("Span_NoSelect");
	}	
}







function funSucc(id,msg){}
function funFail(id,msg){Common.ShowTipFaceSmile(false,msg,3);}
function checkform(){
    var ok = jQuery.checkForm2({
        ctrls: [   
		{id: "ProductName",type:"mustRegular", par:/[\w\u4e00-\u9fa5]{2,20}$/,funSuccess: function(ctr){ funSucc(ctr.id,"");},funFailed:function(ctr){funFail(ctr.id,"商品名称字数:2~20字以内，允许中文。");}}
            ]
        //,success: function(){ },failed: function(msg){}
        });
	return ok;	
}

</script> 

<div class="W700">

	<form id="form_add">

<div style="width:98.5%">
<div class="TableUpdateDiv" style="width:100%;">
<div style="background-color:#fafafa;width:98%;line-height:25px">
		<table   class="TableUpdate" style="text-align:left;">
		<tr>
		<td style="padding:5px 0px 5px 0px;text-align:left;">&nbsp;
		<span id="span_Tab_0" class="Span_Select" onclick="ContentDivTab(0)"> 基本信息
		</span>
		<span id="span_Tab_1" class="Span_NoSelect"  onclick="ContentDivTab(1)"> 详细信息
		</span>
		</td>
		</tr>
		</table>
		</div>
		</div>	

		<div class="Clear"> </div>

<div class="TableUpdateDiv" style="width:100%;" id="Div_Show_0" >
<div style="width:98%;">
	<table class="TableUpdate" style="text-align:left;">

	<tr>
	<td >
		商品名称:
		
		<input id="id" name="id" type="hidden" class="input"  value="<%=DataInfo.ID%>" />
		<input id="ProductName" name="ProductName" type="text" class="input" style="width:220px;"  value="<%=DataInfo.ProductName%>" />
&nbsp;&nbsp;
		品牌/大分类:
	
		<input id="BrandName" name="BrandName" type="hidden" style="text-align:left" class="input" style="width:60px;"  value="<%=DataInfo.BrandName%>"  />
		<select id="BrandId" name="BrandId" style="width:160px;" onclick="GetOptionText()" >
		<%=GetBrandListOption() %>
		</select>		
		<input id="PhotoPath" name="PhotoPath" type="hidden" class="input" style="width:220px;" value="<%=DataInfo.PhotoPath%>" />
	</td>
	</tr>
	

	
	
	<tr>
	<td >
	<b>分类与状态:</b>
		分类:
	
		<input id="BigClassId" name="BigClassId" type="hidden" class="input" style="width:220px;" value="<%=DataInfo.BigClassId%>" />
		<input id="SubClassId" name="SubClassId" type="hidden" class="input" style="width:220px;" value="<%=DataInfo.SubClassId%>" />
		
		<select id="BigClassId_1" name="BigClassId_1" style="width:100px;" >

		</select>		
		
		<select id="SubClassId_1" name="SubClassId_1" style="width:120px;" >

		</select>
		
			&nbsp;&nbsp;
				状态:
		<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>	
	</td>
	</tr>
	
	<tr>
	<td >
	
	<b>费用:(人民币)</b>
		市价:
		<input id="MarketValue" name="MarketValue" type="text" class="input" style="width:80px;"  value="<%=DataInfo.MarketValue/100f%>" />元

		&nbsp;&nbsp;保价/折扣价:
		<input id="SafetyValue" name="SafetyValue" type="text" class="input" style="width:80px;"  value="<%=DataInfo.SafetyValue/100f%>" />元
		&nbsp;&nbsp;运费:
		<input id="Carriage" name="Carriage" type="text" class="input" style="width:50px;"  value="<%=DataInfo.Carriage/100f%>" />元
		&nbsp;&nbsp;是否保价/折扣:
		<SELECT id="IsSafetyValue" name="IsSafetyValue" >
		<option value="0" <%=(DataInfo.IsSafetyValue==0?"selected":"")%>>禁止</option>
		<option value="1" <%=(DataInfo.IsSafetyValue==1?"selected":"")%>>允许</option>
		</select>
	
	</td>
	</tr>		
	
	<tr>
	<td >
		<b>积分商城:</b>
		兑换该商品所需积分:
		<input id="UserPoints" name="UserPoints" type="text" class="input" style="width:80px;"  value="<%=DataInfo.UserPoints%>" />分

		&nbsp;&nbsp;是否允许用积分兑换该商品:
		<select id="IsUserPoints" name="IsUserPoints" style="width:60px;" >
		<option value="0" style="color:red" <%=((DataInfo.IsUserPoints==0)?"selected":"")%> >禁止</option>
		<option value="1" <%=((DataInfo.IsUserPoints==1)?"selected":"")%> >允许</option>
		</select>
	
	</td>
	</tr>	
	
	<tr>
	<td >	
	积分有效时间:起<input id="CreditsTimeA" name="CreditsTimeA" type="input" value="<%=DataInfo.CreditsTimeA.ToString("yyyy-MM-dd HH:mm:ss")%>" /> ~ 
	止<input id="CreditsTimeB" name="CreditsTimeB" type="input" value="<%=DataInfo.CreditsTimeB.ToString("yyyy-MM-dd HH:mm:ss")%>" />
	</td>
	</tr>	
		
		
	<tr>
	<td >	
	用户喜好投票:
	喜欢:<input id="PollA" name="PollA" type="input" value="<%=DataInfo.PollA%>" />
	不喜欢:<input id="PollB" name="PollB" type="input" value="<%=DataInfo.PollB%>" />

	</td>
	</tr>			
	
	<tr>
	<td >
		产品简介:(100字以内)<br />
		<textarea id="ProductBrief" name="ProductBrief" class="input" maxlength="100" style="width:460px;height:60px" ><%=DataInfo.ProductBrief%></textarea>
	</td>
	</tr>
	

	</table>
	
</div>
</div>

<div class="TableUpdateDiv" style="width:100%;text-align:left;display:none" id="Div_Show_1" >
<div style="background-color:#fafafa;width:98%;">
		<table style="margin:5px">
		<tr>
		<td style="line-height:25px;">
		详细描述:<br />
		<textarea id="Details" name="Details" class="input" style="width:460px;height:100px"><%=DataInfo.Details%></textarea>
		</td>
		</tr>
		</table>
</div>
</div>

</form>
	
	</div>
</div>


<script>
var PaiPaiCS = new PaiPaiSystemClass(<%=ClassType%>);

jQuery(function(){
	PaiPaiCS.Fill("BigClassId_1",<%=DataInfo.BigClassId%>);
	PaiPaiCS.Fill_Sub("SubClassId_1",<%=DataInfo.BigClassId%>,<%=DataInfo.SubClassId%>);
	jQuery("#BigClassId_1").click(function(){
		var bid= jQuery(this).val();
		jQuery("#BigClassId").val(bid);
		PaiPaiCS.Fill_Sub("SubClassId_1",bid,<%=DataInfo.SubClassId%>);
	});
	jQuery("#BigClassId_1").keyup(function(){
		jQuery(this).click();
	});
	
	
	jQuery("#SubClassId_1").click(function(){
		var bid= jQuery(this).val();
		jQuery("#SubClassId").val(bid);
	
	});
	jQuery("#SubClassId_1").keyup(function(){
		jQuery(this).click();
	});
	
});



</script>