<%'guidedisplay=1%>

<!--#include file="admin_start.asp" -->

<%
id=request("sort_id")
if id="" then id=0

if not MySys.check.isInteger(id) then
   MySys.Error.info = "请提交合法的商品分类id！"&id
   MySys.Error.location = "back"
   MySys.Error.err()
End If

id=int(id)

rs.open"select sort_id from jins_goods_sort where sort_id="&id&" ",conn,1,1
if rs.eof and id>0 then
   MySys.Error.info = "您请求的商品分类不存在！"
   MySys.Error.location = "back"
   MySys.Error.err()
End If
dim s

Session("FB_EM_1_ACC_uppath")="../GOODSPIC/$_TEMP_$"
%>
<body topmargin="30" marginwidth="10" marginheight="10">
<form name=edit_html target=admin_edit_html method=post><input type=hidden name=c value=''><input type=hidden name=formname value=''><input type=hidden name=inputname value=''></form>
<form name=edit_template target=admin_edit_template method=post><input type=hidden name=c value=''><input type=hidden name=c_sql value=''><input type=hidden name=formname value=''><input type=hidden name=inputname value=''></form>
<table cellpadding="3" cellspacing="4" width="90%" height="30" align=center style='border:1px solid #ebebeb' >
	<tr>
		<td width="2%" align=right><img alt='点击弹开编辑框' onclick="opencat(basic_open)" style='CURSOR: hand' src="Images/index_search.gif" width="8" height="16"></td>
		<td  width="98%" align=left>
		<font color="#ebebeb"> | </font>
		<img alt='点击弹开提示信息框' onclick="opencat(help_ads_open)" style='CURSOR: hand' src="Images/icon_info.gif" width="13" height="13" hspace="0" align="absmiddle">			
		<font color="#ebebeb"> | </font>
		添加商品
	    </td>
	</tr>		
	<tr id="help_ads_open" style="display:  ">
		<td colspan="10" align=left>
		<table cellpadding="4" cellspacing="2" width="99%" height="30" align=center style='border:1px dashed #B7B7B7' >
			<tr>
				<td colspan="8" width='100%' style="line-height:150% ">
				·添加商品时请选择相应的分类，<br>
				·包裹容量一项表示每个包裹所能放入的商品数，比如小饰品一个包裹可以放几件。<br>
				·商品的小图片的大小限定为90*90 像素，即宽高都不超过90 但图片的比例不会改变，系统会按原始图片的宽高比进行缩略。<br>
				·商品的大图片的大小限定为200*200 像素。<br>
				·商品的更多图片需要在商品加入成功后在编辑时添加。<br>
				·商品的详细介绍可以点击 <img border=0 src="Images/old.gif" width="21" height="20" align="absmiddle"> 在新窗口中进行详细的编辑。<br>
			</td>
			</tr>
		</table>
		</td>
	</tr>
	
<%
if request("sort_chose")<>"1" then
%>
<form name=goods_list action="admin_goods_add.asp" method=get>
	<tr id="basic_open" >
		<td colspan="10" align=left style='padding-bottom:5px'>
		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="100" align=center style='border:1px dashed #808080;padding:20px' >
			<tr>
				<td  width="40%" align=right>选择商品的分类：</td>
				<td  width="60%" align=left>
				<select name=sort_id >
				<%
				'set s=MySys.temp.search
				MySys.temp.search.list_Sort "", "jins_goods_sort",0,"根目录|"&id
				response.write MySys.temp.search.sort_list
				'set s=nothing
				%>
				</select>
				</td>
			</tr>
			<tr>
			<td height='1' colspan="9" background='images/dot03.gif'></td>
		</tr>
		
		<tr>
		  <td height='30' colspan="8" width='100%' align=center >
		  <input type=hidden name=sort_chose value="1" >
		  <input type=submit value="开始添加商品！" >
		   <input type=reset value="重置" > 
		   <input onclick='history.back(-1)' type=button value="返回" >	  </td>
		</tr>

		</table>
		</td>
	</tr>
</form>
<%
else
%>
<form name=goods action="admin_goods_edit_handle.asp?action=add" method=post>
	<tr id="basic_open" >
		<td colspan="10" align=left style='padding-bottom:5px'>
		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >
			<tr>
				<td  width="25%" align=right>商品分类:</td>
				<td  width="75%" align=left>
				<select name=sort_id >
				<%
				'set s=MySys.temp.search
				MySys.temp.search.list_Sort "", "jins_goods_sort",0,"根目录|"&id
				response.write MySys.temp.search.sort_list
				'set s=nothing
				%>
				</select>
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right>商品名称:</td>
				<td  width="75%" align=left>
				<input value='' name='goods_name' size=52>
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right>商品属性:</td>
				<td  width="75%" align=left>
				<select name=goods_commend >
				<option value=1  >推荐</option>
				<option value=0  >不推荐</option>
				</select>
				
				 + <select name=goods_new >
				<option value=1  >新品</option>
				<option value=0  >非新品</option>
				</select>
				
				 + <select name=goods_special >
				<option value=1  >特价</option>
				<option value=0  >非特价</option>
				</select>
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right>商品开关:</td>
				<td  width="75%" align=left>
				<select name=goods_open >
				<option value=1  >打开</option>
				<option value=0  >关闭</option>
				</select>
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right>奖励积分:</td>
				<td  width="75%" align=left>
				<input value='' name='goods_reward' size=10>
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right>上市日期:</td>
				<td  width="75%" align=left>
				<select name=goods_publishtime_year >
				<option value='<%=year(now)%>' selected ><%=year(now)%></option>
				<%=MySys.functions.ListDate("","","year")%>
				</select> 年 
				<select name=goods_publishtime_month >
				<option value='<%=month(now)%>' selected ><%=month(now)%></option>
				<%=MySys.functions.ListDate("","","month")%>
				</select> 月 
				<select name=goods_publishtime_day >
				<option value='<%=day(now)%>' selected ><%=day(now)%></option>
				<%=MySys.functions.ListDate("","","day")%>
				</select> 日 
				</td>
			</tr>
	        <tr>
				<td  width="25%" align=right>商品库存:</td>
				<td  width="75%" align=left>
				 <input value='' name='goods_stocks' size=10>
				</td>
			</tr>
		    <tr>
			  <td  width="25%" align=right valign=top>详细介绍:</td>
			  <td  width="75%" align=left>
                <textarea id="goods_content" name="goods_content" cols="43" rows="6"></textarea>
                <!--<a title='点击进行详细编辑！' href="javascript:edit_html.c.value=shopping_payment.payment_property.value;edit_html.action='admin_edit_html.asp?formname=shopping_payment&inputname=payment_property';newwin=window.open('admin_edit_html.asp?formname=shopping_payment&inputname=payment_property','admin_edit_html','toolbar=no,location=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=600,height=400');edit_html.submit();newwin.focus();" >//-->
                <a title='点击进行详细编辑！' href="javascript:openedit_template('goods','goods_content','','','<%=int(timer)%>','商品详细介绍编辑 > 新的商品 > '+goods.goods_name.value,'yes');" >
				<img border=0 src="Images/old.gif" width="21" height="20" align="top">
				</a>
			</td>
			</tr>

		</table><br>

		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >
			<tr>
				<td  width="25%" align=right>商品规格:</td>
				<td  width="75%" align=left>
				<input value='' name='goods_standards' size=52>
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right>商品单位:</td>
				<td  width="75%" align=left>
				<input value='' name='goods_unit' size=7>
				包裹容量:
				<input value='1' name='goods_unit_deliver' size=4> 个/包裹(用于计算送货费用的包裹数量)
				</td>
			</tr>
		</table><br>

		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >
			<tr>
				<td  width="25%" align=right>商品折扣:</td>
				<td  width="75%" align=left>
				<input value='' name='goods_rebate' size=7> 折
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right>市场价:</td>
				<td  width="75%" align=left>
				<%=MySys.info.unit_money(1)%> <input value='' name='goods_price_mart' size=8> 
				</td>
			</tr>
			<%
			ii=0
			set rs_t=conn.execute("select sort_description,sort_name from jins_customer_sort order by sort_grade")
			do while not rs_t.eof
			if MySys.check.DbNameSearch("jins_goods_list","goods_price_"&rs_t("sort_name")) then
			%>
			<tr>
				<td valign='middle' align=right width=25% ><%=rs_t("sort_description")%>价:</td>
				<td valign='middle' align=left width=75% >
				<%=MySys.info.unit_money(1)%> <input size=8 name=goods_price_<%=rs_t("sort_name")%> value='' > 
				</td>
			</tr>
			<%
			end if
			rs_t.movenext
			loop
			set rs_t=nothing
			%>
		</table><br>
		
		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >
			<%

			dim property_temp_detail
			dim i_temp_detail_goods
			set s=MySys.temp.search
			property_temp_detail=s.ListSortProperty("goods",id)
			set s=nothing
			property_temp_detail=split(property_temp_detail,",")
			
			for i_temp_detail_goods=0 to ubound(property_temp_detail)
			
				c_i= split(property_temp_detail(i_temp_detail_goods),"|")(2)
				if c_i<>"" then c_i=split(c_i,"&")(0)
				
				response.write "<tr>"
				response.write "<td align=right width=25% valign=top >"&split(property_temp_detail(i_temp_detail_goods),"|")(0)&":</td>"
				response.write "<td align=left width=75% valign=top >"
				
				select case split(property_temp_detail(i_temp_detail_goods),"|")(1)
				case "0"
				     response.write "<input name='goods_property_"&i_temp_detail_goods&"' value='"&c_i&"' type=text size=52 >"
					 
				case "1"
				      
					 'response.write c_i
					 'response.end 
					 response.write "<select name='goods_property_"&i_temp_detail_goods&"' value='"&c_i&"' >"
				     if c_i<>"" then response.write "<option value='"&c_i&"' selected>"&c_i&"</option>" 
					 if split(property_temp_detail(i_temp_detail_goods),"|")(2)<>"" then 
						 c_p=split(split(property_temp_detail(i_temp_detail_goods),"|")(2),"&")
						 for n_p=0 to ubound(c_p)
							response.write "<option value='"&c_p(n_p)&"' >"&c_p(n_p)&"</option>" 
						 next
					 end if
				     response.write "</select>"		
					 			 
				case "2"
			         
					 if split(property_temp_detail(i_temp_detail_goods),"|")(2)<>"" then 
						 c_p=split(split(property_temp_detail(i_temp_detail_goods),"|")(2),"&")
						 for n_p=0 to ubound(c_p)
							response.write "<input type=checkbox name='goods_property_"&i_temp_detail_goods&"' value='"&c_p(n_p)&"' "
							if c_i<>"" then 
								cc_i=split(c_i,"&")
								for ii_c=0 to ubound(cc_i)
									if c_p(n_p)=cc_i(ii_c) then 
										response.write " checked "
										exit for
									end if
								next
							end if
							response.write ">"&c_p(n_p)&"<br>" 
						 next
					 else
				         if c_i<>"" then response.write "<input type=checkbox name='goods_property_"&i_temp_detail_goods&"' value='"&c_i&"' checked>"
					 end if
					 
				case "3"
				     response.write "<input name='goods_property_"&i_temp_detail_goods&"' value='"&c_i&"' type=text size=52 >"
					 
				case "4"
				     response.write "<input name='goods_property_"&i_temp_detail_goods&"' value='"&c_i&"' type=text size=52 >"
					 
				case "5"
				     response.write "<input name='goods_property_"&i_temp_detail_goods&"' value='"&c_i&"' type=text size=52 > 格式 “ 2005-3-20 ”"
					 
				end select

			    response.write "</td></tr>"
			next
			response.write "<input type=hidden name=n_goods_property value='"&i_temp_detail_goods&"'> "
			%>

		</table><br>		

		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >

			<tr>
				<td  width="25%" align=right >商品图片(小):</td>
				<td  width="75%" align=left >
				<input name=goods_pic type=text size=50  value="" >
				<input type="button"  value="从本地上传" onClick="window.open('admin_upload.asp?formname=goods&editname=goods_pic&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
			    <img style='CURSOR: hand' onclick='javascript:window.open("../"+goods.goods_pic.value);' border=0 src='images/btn_pre2.gif' align='absbottom' >
				</td>
			</tr>
			<tr>
				<td  width="25%" align=right >商品图片(大):</td>
				<td  width="75%" align=left >
				<input name=goods_picture type=text size=50  value="" >
				<input type="button"  value="从本地上传" onClick="window.open('admin_upload.asp?formname=goods&editname=goods_picture&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
			    <img style='CURSOR: hand' onclick='javascript:window.open("../"+goods.goods_picture.value);' border=0 src='images/btn_pre2.gif' align='absbottom' >
				</td>
			</tr>
		</table>	
		</td>
	</tr>

	<tr>
		<td height='1' colspan="9" background='images/dot03.gif'></td>
	</tr>
	
	<tr>
	  <td height='30' colspan="8" width='100%' align=center >
	  <input type=submit value="提交设置！" >
	   <input type=reset value="重置" > 
	   <input onclick='history.back(-1)' type=button value="返回" >	  </td>
	</tr>
	</form>
<%end if%>

</table>		
<SCRIPT language=javascript>
	function opencat(cat)
	{
 	 	if(cat.style.display=="none"){
     	cat.style.display="";
  		} else {
     	cat.style.display="none"; 
  		}
	}</SCRIPT>
<%
rs.close
%>
<!--#include file="admin_end.asp" -->