<%@ Register TagPrefix="ftb" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<%@ Page language="c#" Codebehind="ProductAdd.aspx.cs" AutoEventWireup="false" Inherits="wqeshop.Admin.ProductAdd" validateRequest="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>ProductAdd</title>
		<LINK href="inc/style.css" type="text/css" rel="stylesheet">
<style type="text/css">
body {margin:0px; height:768px}
</style>
			<script language="JavaScript">
    function addFileControl()
    {
    	var str = '<br><INPUT type="file" NAME="File">'
    	document.getElementById('FileCollection').insertAdjacentHTML("beforeEnd",str)
    }
			</script>
			
			<script language="javascript"> 
              //jb函数会根据不同的浏览器初始化个xmlhttp对象 
              function jb() 
              { 
                 var A=null; 
               try 
               { 
                   A=new ActiveXObject("Msxml2.XMLHTTP"); 
                } 
                 catch(e) 
                 { 
                  try 
                   { 
                      A=new ActiveXObject("Microsoft.XMLHTTP"); 
                   } 
                       catch(oc) 
                      { 
                     A=null 
                   } 
              } 
           if ( !A && typeof XMLHttpRequest != "undefined" ) 
            { 
               A=new XMLHttpRequest() 
             } 
           return A 
              } 
              
              //下面Go函数是父列表框改变的时候调用，参数是选择的条目 
              function Go(obj) 
              { 
                 //得到选择框的下拉列表的value 
                var svalue = obj.value; 
                 //定义要处理数据的页面 
                 var weburl = "productadd.aspx?product_category_id="+svalue; 
                 //初始化个xmlhttp对象 
                 var xmlhttp = jb(); 
                 //提交数据，第一个参数最好为get，第三个参数最好为true 
                 xmlhttp.open("get",weburl,true); 
                 //如果已经成功的返回了数据 
                 xmlhttp.onreadystatechange=function() 
                 { 
                   if(xmlhttp.readyState==4)//4代表成功返回数据 
                    { 
						var result = xmlhttp.responseText.split("<")[0].toString();//得到服务器返回的数据 
						
                    } 
                 } 
                 //发送数据，请注意顺序和参数，参数一定为null或者"" 
                 xmlhttp.send(null); 
              } 
		</script>
	</HEAD>
	<body onLoad="CheckAlert()">
		<form id="Form1" method="post" runat="server">
<table width="99%" height="550" style="border:1px #619ADF solid; border-left:0;margin-top:6px; margin-right:7px;background:#F2F7FD;" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top">
<div class="top">
<table width="100%" align="center" cellspacing="0" cellpadding="0">
	<tr>
		<td class="tl"></td>
		<td class="tm"><span class="tt">商品管理 &gt;&gt; &nbsp;&nbsp;
						<asp:label id="lblTitleInfo" Runat="server"><font size="2">商品添加</font></asp:label></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href="ProductAdd_excel.aspx" style="display:none"><span class="tt">批量添加<span class="tt"></A></td>
		<td class="tm2"><span class="tt"><a href="http://www.wangqi.com" target="_blank"><IMG alt="帮助" src="Images/admin_help.gif" border="0"></a></span></td>
		<td class="tr"></td>
	</tr>
</table>
</div>
<div class="mframe">
<table width="100%" align="center" cellspacing="0" cellpadding="0">
	<tr>
		<td class="tl"></td>
		<td class="tm"><div class="tt">&nbsp; 商品添加</div></td>
		<td class="tr"></td>
	</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
      <td class="ml"></td>
    <td  class="mm" align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#EBF3FE" valign="top" style=" border-right:1px #77ABE5 solid;">
<table width="90%"  cellspacing="0" cellpadding="0">
	<tr>
		<td class="ml1"></td>
		<td class="mm1">
<table class="tableBorder" cellSpacing="0" cellPadding="0" width="95%" align="center" border="0" style="line-height:30px">
							<tr>
								<td align="left" width="100">商品名称：								</td>
								<td width="240"><asp:textbox id="txtName" CssClass="input" runat="server"></asp:textbox><font color="red">*</font></td>
								<td vAlign="top" align="left" width="80" rowSpan="7">所属分类：<br>
									（按住Ctrl可多选）								</td>
								<td vAlign="top" width="200" rowSpan="7"><asp:listbox id="lbxCategories" runat="server" SelectionMode="Multiple" Rows="10" AutoPostBack="True"></asp:listbox><FONT face="宋体"><BR>
									</FONT>								</td>
							</tr>
							<tr>
								<td align="left" width="100" height="18">商品代码：								</td>
								<td height="18"><asp:textbox id="txtProductNo"  CssClass="input" runat="server"></asp:textbox></td>
							</tr>
							<tr>
								<td align="left" width="100">商品品牌：								</td>
								<td><asp:textbox id="txtBrand" CssClass="input" runat="server"></asp:textbox></td>
							</tr>
							<tr>
								<td align="left" width="100">简单描述：								</td>
								<td><asp:textbox id="txtShortDesc" CssClass="input" runat="server" Width="200px"></asp:textbox></td>
							</tr>
							<tr>
								<td align="left" width="100">计量单位：								</td>
								<td><asp:textbox id="txtUnit" CssClass="input" runat="server"></asp:textbox><FONT color="red">*</FONT></td>
							</tr>
							<tr>
								<td align="left" width="100" height="17">单位重量：								</td>
								<td height="17"><asp:textbox id="txtWeight" CssClass="input" runat="server">0</asp:textbox>克</td>
							</tr>
							<% if(config.MarkUnit == 1) {%>
							<tr>
								<td align="left" width="100" height="18">积分点数：								</td>
								<td height="18"><asp:textbox id="txtScore" CssClass="input" runat="server">0</asp:textbox><FONT color="red"></FONT></td>
							</tr>
							<% }%>
							<tr>
								<td align="left" width="100" height="19">市场价格：								</td>
								<td colSpan="3" height="19"><asp:textbox id="txtMarketPrice" CssClass="input" runat="server">0</asp:textbox><FONT color="red">*</FONT></td>
							</tr>
							<tr>
								<td align="left" width="100">会员价格：								</td>
								<td colSpan="3"><asp:textbox id="txtMemberPrice" runat="server">0</asp:textbox><FONT color="red">*</FONT></td>
							</tr>
							<tr>
								<td align="left" width="100">最低购买数量：								</td>
								<td colSpan="3"><asp:textbox id="txtMin" CssClass="input" runat="server">1</asp:textbox><FONT color="red">*</FONT></td>
							</tr>
							<script language="javascript">
								function SelectFieldValue(itemID)
								{									
									if(document.Form1.elements["dlProductFields__ctl" + itemID + "_ddlFieldValues"].value=="0")
									{
										eval("FieldValue" + itemID + ".style.display=\"\";");
									}
									else
									{
										eval("FieldValue" + itemID + ".style.display=\"none\";");
									}
								}	
							</script>
							<asp:datalist id="dlProductFields" Runat="server" DataKeyField="FieldID" ShowHeader="False" ShowFooter="False"
								RepeatLayout="Flow" GridLines="None">
								<ItemTemplate>
									<tr>
										<td align="left"><%# DataBinder.Eval(Container.DataItem, "FieldName") %>：										</td>
										<td colspan="3">
											<asp:DropDownList ID="ddlFieldValues" Runat="server"></asp:DropDownList>
											<span id='FieldValue<%# Container.ItemIndex %>' style="DISPLAY: none">
<asp:textbox id="txtFieldValue" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "FieldValues") %>'>												</asp:textbox>（<font color="red">请勿使用符号“|”</font>）</span><script language="javascript">SelectFieldValue(<%# Container.ItemIndex %>);</script></td>
									</tr>
								</ItemTemplate>
							</asp:datalist>
							<tr>
								<td align="left" width="100"><b>附件：</b></td>
								<td colSpan="3">更多属性可通过<b><asp:label id="lblCustomField" Runat="server"></asp:label></b>进行设置</td>
							</tr>
							<tr>
								<td align="left" width="100">添加水印：</td>
								<TD>
									<TABLE id="Table1" height="55" cellSpacing="1" cellPadding="1" width="250" border="0">
										
										<TR>
											<TD valign=bottom><asp:radiobutton id="rbNoWatermark" runat="server" GroupName="watermark" Text="不添加水印" Checked="True"></asp:radiobutton><asp:radiobutton id="rbPicWatermark" runat="server" Text="添加图片水印" GroupName="watermark"></asp:radiobutton>
											<br><asp:radiobutton id="rbFontWatermark" runat="server" Text="添加文字水印" GroupName="watermark"></asp:radiobutton>(文字水印只支持JPG格式图片)</TD>
											<TD valign=bottom></TD>
										</TR>
									</TABLE>
								</TD>
								
							</tr>
							<tr>
								<td align="left" width="100">商品大图：								</td>
								<td colSpan="3"><INPUT id="File2" type="file" class="input" name="file2" runat="server"></td>
							</tr>
							<script language="javascript">
								function SetThumbnail()
								{
									if(document.Form1.cbxFromBigPic.checked)
									{
										eval("ThumbnailPic" + ".style.display=\"none\";");
									}
									else
									{
										eval("ThumbnailPic" + ".style.display=\"\";");
									}
								}
							</script>
							<tr>
								<td align="left" width="100">商品缩略图：								</td>
								<td colSpan="3"><SPAN id="ThumbnailPic" style="DISPLAY: none"><INPUT id="File1" type="file" name="file2" runat="server"></SPAN><asp:checkbox id="cbxFromBigPic" runat="server" Checked="True"></asp:checkbox>自动生成宽度为<asp:textbox id="txtPicWidth" runat="server" Width="30px">140</asp:textbox>象素的缩略图
									<script language="javascript">SetThumbnail();</script>								</td>
							</tr>
							<tr>
								<td align="left" width="100">商品多图</td>
								<td width="400" colSpan="3">
									<P id="FileCollection"><INPUT type="file" class="input" name="File"></P>								</td>
							</tr>
							<tr>
								<td width="100"></td>
								<td colSpan="3"><input name="button" class="btn1" type="button" onClick="addFileControl()" value="增加(File)"></td>
							</tr>
							<tr>
								<td align="left" colSpan="4"><asp:datagrid id="dgRelatedImgs" runat="server" Width="50%" DataKeyField="img" AutoGenerateColumns="False"
										HeaderStyle-CssClass="summary-title">
										<Columns>
											<asp:TemplateColumn HeaderText="商品多图图片">
												<ItemTemplate>
													<a href='../upload/relatedImgs/<%# DataBinder.Eval(Container.DataItem, "img") %>' target=_blank>
														<%# DataBinder.Eval(Container.DataItem, "img") %>													</a>												</ItemTemplate>
											</asp:TemplateColumn>
											<asp:ButtonColumn ButtonType="LinkButton" HeaderText="删除" Text="删除" CommandName="Delete"></asp:ButtonColumn>
										</Columns>
									</asp:datagrid></td>
							</tr>
							<tr>
								<td align="left" width="100">是否库存警告：								</td>
								<td colSpan="3"><asp:checkbox id="cbxNeedAlert" runat="server"></asp:checkbox></td>
							</tr>
							<tr>
								<td align="left" width="100" height="21">库存数量：								</td>
								<td colSpan="3" height="21"><asp:textbox id="txtStorage" runat="server" Width="80px">0</asp:textbox><SPAN id="mininum" style="DISPLAY: none">警告数量： <asp:textbox id="txtMininum" runat="server" Width="80px">0</asp:textbox></SPAN></td>
							</tr>
							<tr>
								<td align="left" width="100">是否发布：								</td>
								<td colSpan="3"><asp:checkbox id="cbxForSale" runat="server" Checked="True"></asp:checkbox><asp:checkbox id="cbxIsCard" runat="server" Visible="False"></asp:checkbox><SPAN id="card" style="DISPLAY: none">虚拟卡管理</SPAN></td>
							</tr>
							<tr>
								<td align="left" width="100">是否推荐：								</td>
								<td colSpan="3"><asp:checkbox id="cbxCommend" runat="server" Checked="True"></asp:checkbox></td>
							</tr>
							<tr>
								<td align="left" width="100">是否特价：								</td>
								<td colSpan="3"><asp:checkbox id="cbxSpecialOffer" runat="server" Checked="True"></asp:checkbox></td>
							</tr>
							<tr>
								<td align="left" width="100">是否热卖：								</td>
								<td colSpan="3"><asp:checkbox id="cbxHot" runat="server" Checked="True"></asp:checkbox></td>
							</tr>
							<tr>
								<td align="left" width="100">是否允许评论：								</td>
								<td colSpan="3"><asp:checkbox id="cbxCanReview" runat="server" Checked="True"></asp:checkbox></td>
							</tr>
							<tr>
								<td align="left" width="100">是否参与打折：								</td>
								<td colSpan="3"><asp:checkbox id="cbxDiscount" runat="server" Checked="True"></asp:checkbox></td>
							</tr>
							<tr>
								<td align="left" width="100">详细描述：								</td>
								<td colSpan="3"><FTB:FREETEXTBOX id="ftbContent" runat="Server" Width="520" ButtonOverImage="True" ButtonDownImage="True"
										ButtonPath="images/ftb/officeXP/" ToolbarType="OfficeXP" ImageGalleryPath="Upload/"></FTB:FREETEXTBOX></td>
							</tr>
							<tr>
								<td align="left" width="100">相关商品：								</td>
								<td colSpan="3"><asp:datagrid id="dgAbout" runat="server" Width="40%" DataKeyField="ProductID" AutoGenerateColumns="False"
										HeaderStyle-CssClass="summary-title" PageSize="15" PagerStyle-Mode="NumericPages" HorizontalAlign="left">
										<HeaderStyle Font-Bold="True" CssClass="summary-title"></HeaderStyle>
										<Columns>
											<asp:TemplateColumn>
												<HeaderTemplate>
													<asp:CheckBox id="chkAll1" runat="server"></asp:CheckBox>
												</HeaderTemplate>
												<ItemTemplate>
													<asp:CheckBox id="chkItem1" runat="server"></asp:CheckBox>
												</ItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn HeaderText="商品名称">
												<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
												<ItemStyle HorizontalAlign="Left"></ItemStyle>
												<ItemTemplate>
													<%# DataBinder.Eval(Container.DataItem, "Name") %>												</ItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn HeaderText="商品代码">
												<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
												<ItemStyle HorizontalAlign="Left" Width="80px"></ItemStyle>
												<ItemTemplate>
													<%# DataBinder.Eval(Container.DataItem, "ProductNo") %>												</ItemTemplate>
											</asp:TemplateColumn>
										</Columns>
										<PagerStyle Mode="NumericPages"></PagerStyle>
									</asp:datagrid><asp:textbox id="txtAboutKey" CssClass="input" runat="server"></asp:textbox>&nbsp;&nbsp;<asp:button id="btnAbout" CssClass="btn1" runat="server" Text="搜索相关商品"></asp:button></td>
							</tr>
							<tr>
								<td align="left" colSpan="4"><asp:datagrid id="dgProductList" runat="server" Width="40%" DataKeyField="ProductID" AutoGenerateColumns="False"
										HeaderStyle-CssClass="summary-title" PageSize="15" PagerStyle-Mode="NumericPages" HorizontalAlign="left">
										<HeaderStyle Font-Bold="True" CssClass="summary-title"></HeaderStyle>
										<Columns>
											<asp:TemplateColumn>
												<HeaderTemplate>
													<asp:CheckBox id="chkAll" runat="server"></asp:CheckBox>
												</HeaderTemplate>
												<ItemTemplate>
													<asp:CheckBox id="chkItem" runat="server"></asp:CheckBox>
												</ItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn HeaderText="商品名称">
												<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
												<ItemStyle HorizontalAlign="Left"></ItemStyle>
												<ItemTemplate>
													<%# DataBinder.Eval(Container.DataItem, "Name") %>												</ItemTemplate>
											</asp:TemplateColumn>
											<asp:TemplateColumn HeaderText="商品代码">
												<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
												<ItemStyle HorizontalAlign="Left" Width="80px"></ItemStyle>
												<ItemTemplate>
													<%# DataBinder.Eval(Container.DataItem, "ProductNo") %>												</ItemTemplate>
											</asp:TemplateColumn>
										</Columns>
										<PagerStyle Mode="NumericPages"></PagerStyle>
									</asp:datagrid></td>
							</tr>
							<tr>
								<td align="center" colSpan="4"><br>
									<asp:button id="btnSave" runat="server" CssClass="btn" Text="保存"></asp:button>&nbsp;&nbsp;<asp:button id="btnCancel" runat="server" CssClass="btn" Text="取消" CausesValidation="False"></asp:button></td>
							</tr>
						</table>
			<script language="javascript">
				
				function ShowCustomFieldPanel()
				{
					if(document.Form1.cbxShowCustomFieldPanel.checked)
					{
						eval("customFieldPage" + ".src=\"ProductCustomField.aspx\";");
					}
					else
					{
						eval("customFieldPage" + ".src=\"\";");
					}
				}
				function CheckAlert()
				{
					if(document.Form1.cbxNeedAlert.checked)
					{
						eval("mininum" + ".style.display=\"\";");
					}
					else
					{
						eval("mininum" + ".style.display=\"none\";");
					}
				}
				function CardManage()
				{
					if(document.Form1.cbxIsCard.checked)
					{
						eval("card" + ".style.display=\"\";");
					}
					else
					{
						eval("card" + ".style.display=\"none\";");
					}
				}
				function ManageCustomFields(pid)
				{
					temp=window.open('ProductCustomField.aspx?productid='+pid,'customfield','width=680,height=600,scrollbars=yes,top=0,left=0');
					temp.focus();
				}
			</script>
		</td>
		<td class="mr1"></td>
	</tr>
</table>
</td>
  </tr>
</table>


<table width="100%" align="center" cellspacing="0" cellpadding="0">
	<tr>
		<td class="bl"></td>
		<td class="bm">&nbsp;</td>
		<td class="br"></td>
	</tr>
</table>
</td>
    <td  class="mr"></td>
  </tr>
</table>
<table width="100%" align="center" cellspacing="0" cellpadding="0">
	<tr>
		<td class="bl"></td>
		<td class="bm">&nbsp;</td>
		<td class="br"></td>
	</tr>
</table>

</div>
    </td>
  </tr>
</table>
		</form>
	</body>
</HTML>
