<!--#include file="conn.asp"-->
<!--#include file="ad_chk.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href=inc/css.css rel=STYLESHEET type=text/css>
<body topmargin="5" leftmargin="5" rightmargin="5" bottommargin="5">
<%
if Request.Cookies("WrzcNethtml")("admin_class")<>0 and Request.Cookies("WrzcNethtml")("admin_class")<>1 then
response.write "你没有这个权限!"
response.end
end if
%>
<%
if request("action")="save" then
hw_id=request("hw_id")
    if not(isnumeric(request("hw_price1"))) or not(isnumeric(request("hw_price2"))) or not(isnumeric(request("hw_kucun"))) or not(isnumeric(request("hw_jifen"))) then
        errmsg="<br>"+"<li>价格、库存、积分必须为数字且不能为空"
        founderr=true
    end if
    
    if request("hw_name")="" then
        errmsg=errmsg+"<br>"+"<li>名称不能为空"
        founderr=true
    end if
    
    if  not(isnumeric(request("hw_buys"))) then
        errmsg=errmsg+"<br>"+"<li>够买数量不能为除数字之外的其它字符"
        founderr=true
    end if
    
    if not(isnumeric(request("hw_xu"))) then
        errmsg=errmsg+"<br>"+"<li>排列序号不能为除数字之外的其它字符"
        founderr=true
    end if
    
    if request("hw_content2")="" then
        errmsg=errmsg+"<br>"+"<li>详细介绍不能为空"
        founderr=true
    end if
    
    if request("hw_pic")<>"" and instr(request("hw_pic"),"*")=0 then
        errmsg=errmsg+"<br>"+"<li>商品图片必须以*号分割，否则将会出错"
        founderr=true
    end if
hw_content=request("hw_content")
'hw_content=replace(hw_content," ","&nbsp; ")
hw_content=replace(hw_content,chr(13)&chr(10),"<br>")

if founderr=true then
response.write errmsg
response.write "<br>"
response.write "<a href=# onClick=history.go(-1)><font color=#ff0000>>></font></a>"
response.end
else

set rs=server.createobject("adodb.recordset")
sql="select top 1 * from WrzcNethtml_hw"
rs.open sql,conn,1,3
rs.addnew
rs("pinpai_id")=request("pinpai_id")
rs("sort_id")=request("sort_id")
rs("nsort_id")=request("nsort_id")
rs("hw_name")=request("hw_name")
if seo_hw1=1 then rs("hw_title")=request("hw_title")
if seo_hw3=1 then rs("hw_keyword")=request("hw_keyword")
if seo_hw5=1 then rs("hw_d")=request("hw_d")
rs("hw_weight")=request("hw_weight")
rs("hw_yunfei")=request("hw_yunfei")
rs("hw_buys")=request("hw_buys")
rs("hw_views")=0
rs("hw_price0")=request("hw_price0")
rs("hw_price1")=request("hw_price1")
rs("hw_price2")=request("hw_price2")
rs("hw_kucun")=request("hw_kucun")
rs("hw_jifen")=request("hw_jifen")
rs("hw_sn")=request("hw_sn")
rs("hw_xu")=request("hw_xu")
rs("hw_content")=hw_content
rs("hw_content2")=request("hw_content2")
rs("kxaa")=request("kxaa")
rs("kxab")=request("kxab")
rs("kxba")=request("kxba")
rs("kxbb")=request("kxbb")
if request("hw_pic")<>"" then
rs("hw_pic")=request("hw_pic")
else
rs("hw_pic")="*img/noimage.jpg"
end if
rs("tjindex")=request("tjindex")
rs("tjsort")=request("tjsort")
rs("tejia")=request("tejia")
rs("hw_date")=now()
rs("ziduan")=request("ziduan0")
for i=1 to 49
rs("ziduan")=rs("ziduan")&"##"&request("ziduan"&i)
next
for i=1 to 5
rs("tao_price"&i)=0
next
rs.update
rs.close
set rs=nothing
call addok(addt,"ad_changehwadd.asp?hw_id="&hw_id,"ad_delhw.asp")
end if
else
hw_id=request("hw_id")
set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNethtml_hw where hw_id="&hw_id&"" 
rs.open sql,conn,1,1
sort=rs("sort_id")
nsort=rs("nsort_id")
%>
<table border="0" cellpadding="5" cellspacing="0" class="st">

<form name="form" method="post" action="ad_changehwadd.asp?hw_id=<%=hw_id%>&action=save">
<tr><td class="s1">商品分类：
<%dim count%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
        <%
        count = 0
        %>
<%
set rss=server.createobject("adodb.recordset")
sql="select * from WrzcNethtml_sort order by sort_id asc"
rss.open sql,conn,1,1
do while not rss.eof
%>
subcat[<%=count%>] = new Array("不选择小类","<%= trim(rss("sort_id"))%>","0");
        <%
        count = count + 1
        rss.movenext
        loop
        rss.close
        set rss=nothing
        %>
        
<%set rss=server.createobject("adodb.recordset")
sql="select * from WrzcNethtml_nsort order by Nsort_id asc"
rss.open sql,conn,1,1%>
        <%
        do while not rss.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rss("Nsort_name"))%>","<%= trim(rss("sort_id"))%>","<%= trim(rss("Nsort_id"))%>");
        <%
        count = count + 1
        rss.movenext
        loop
        rss.close
        set rss=nothing
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.form.Nsort_id.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
  document.form.Nsort_id.options[document.form.Nsort_id.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</script>
<%set rss=server.createobject("adodb.recordset")
rss.open "select * from WrzcNethtml_sort",conn,1,1
if rss.eof and rss.bof then
response.write ""
response.end
else%>
<select name="sort_id" onChange="changelocation(document.form.sort_id.options[document.form.sort_id.selectedIndex].value)" size="1">
<%
do while not rss.eof
%><option value="<%=trim(rss("sort_id"))%>" <%if rss("sort_id")=rs("sort_id") then%>selected<%selclass=rss("sort_id")%><%end if%>><%=trim(rss("sort_name"))%></option>
<%rss.movenext
loop
end if
rss.close
set rss=nothing%></select> 
<select name="Nsort_id">
<option value="0" <%if rs("nsort_id")=0 then response.write " selected"%>>不选择小类</option>
<%set rss=server.createobject("adodb.recordset")
sql="select * from WrzcNethtml_nsort where sort_id="&selclass&""
rss.open sql,conn,1,1
if not(rss.eof and rss.bof) then
%>
<%do while not rss.eof%>
<option value="<%=rss("Nsort_ID")%>" <%if rss("nsort_id")=rs("nsort_id") then response.write " selected"%>><%=rss("Nsort_name")%></option>
<% rss.movenext
loop
end if
rss.close
set rss = nothing%>
</select>
商品品牌：<select name="pinpai_id" size="1"><option value="0">没有品牌</option>
<% 
set rsp=server.CreateObject("adodb.recordset")
rsp.open "select * from WrzcNethtml_pinpai" ,conn,1,1
if not rsp.eof and not rsp.bof then
do while not rsp.eof and not rsp.bof
%>
<option value="<%=rsp("pinpai_id")%>" <%if rsp("pinpai_id")=rs("pinpai_id") then%> selected<%end if%>><%=rsp("pinpai_name")%></option>
<%
rsp.movenext
loop
end if
rsp.close
set rsp=nothing%>
</select></td>
</tr>
<tr> 
  <td class="s0">商品名称：<input type="text" name="hw_name" size="50" class=input value="<%=rs("hw_name")%>"><font color="#FF0000"> 
** </font>购买次数：<input type="text" name="hw_buys" size="6" class=input value="<%=rs("hw_buys")%>"><font color="#FF0000">&nbsp;** <img border="0" src="Img/ad_help.gif" class="helpimg" alt="购买数量：该商品被购买的次数，理论上都是0，如果您想让商品在热销排行显示可以改大"></font>
	<%if yunfei=2 then%>商品运费：<input type="text" name="hw_yunfei" size="6" class=input value="<%=rs("hw_yunfei")%>"><%else%><input type="hidden" name="hw_yunfei" value="<%=rs("hw_yunfei")%>"><%end if%>
	<%if yunfei=3 then%>商品重量：<input type="text" name="hw_weight" size="6" class=input value="<%=rs("hw_weight")%>"><%else%><input type="hidden" name="hw_weight" value="<%=rs("hw_weight")%>"><%end if%>
</td>
</tr>
 <tr><td class="s1">
	 <%if seo_hw1=1 then%>网页标题：<input type="text" name="hw_title" size="50" class=input value="<%=rs("hw_title")%>"><br><%end if%>
	 <%if seo_hw3=1 then%>关 键 字：<input type="text" name="hw_keyword" size="50" class=input value="<%=rs("hw_keyword")%>"><br><%end if%>
	 <%if seo_hw5=1 then%>网页描述：<input type="text" name="hw_d" size="50" class=input value="<%=rs("hw_d")%>"><%end if%>
 </td></tr>
<tr>
  <td class="s0">市场价格：<input type="text" name="hw_price1" size="8" class=input value="<%=rs("hw_price1")%>"><font color="#FF0000"> 
**</font>
    本站价格：<input type="text" name="hw_price2" size="8" class=input value="<%=rs("hw_price2")%>"><font color="#FF0000"> 
** </font>成本价格：<input type="text" name="hw_price0" size="8" class=input value="<%=rs("hw_price0")%>"><font color="#FF0000"> **</font></td>
</tr>
<tr>
  <td class="s1">商品库存：<input type="text" name="hw_kucun" size="8" class=input value="<%=rs("hw_kucun")%>"><font color="#FF0000"> 
**</font> 商品积分：<input type="text" name="hw_jifen" size="8" class=input value="<%=rs("hw_jifen")%>"><font color="#FF0000"> 
**&nbsp;<img border="0" src="Img/ad_help.gif" class="helpimg" alt="商品库存：商品的总量，积分：客户购买该商品后会获得此积分"></font></td>
</tr>
<tr>
  <td class="s0">商品编号：<input type="text" name="hw_sn" size="20" class=input value="<%=rs("hw_sn")%>">&nbsp;&nbsp;&nbsp; 排列序号：<input type="text" name="hw_xu" size="6" class=input value="<%=rs("hw_xu")%>"><font color="#FF0000">&nbsp;**</font><img border="0" src="Img/ad_help.gif" class="helpimg" alt="请输入数字，越大显示越靠前"></td>
</tr>
<tr><td class="s1">
<input type="text" name="kxaa" size="10" class=input value="<%=rs("kxaa")%>">：<input type="text" name="kxab" size="40" class=input value="<%=rs("kxab")%>">
<font color="#FF0000">可选参数一</font>&nbsp;<img border="0" src="Img/ad_help.gif" class="helpimg" alt="前面输入商品参数，后面输入具体选择值，用/隔开；如：选择尺码 41/41/43/44/45"></td></tr>
<tr><td class="s0">
<input type="text" name="kxba" size="10" class=input value="<%=rs("kxba")%>">：<input type="text" name="kxbb" size="40" class=input value="<%=rs("kxbb")%>"><font color="#FF0000"> 
可选参数二</font>&nbsp;<img border="0" src="Img/ad_help.gif" class="helpimg" alt="前面输入商品参数，后面输入具体选择值，用/隔开；如：选择尺码 41/41/43/44/45"></td></tr> 
<% 
set rss=server.CreateObject("adodb.recordset")
rss.open "select * from WrzcNethtml_sort where sort_id="&sort&"",conn,1,1
zd=split(rss("ziduan"),"##")
ziduan=split(rs("ziduan"),"##")
for i=0 to 49
if zd(i)<>"" then%>
<tr><td class="s1"><%=zd(i)%>：<input type="text" name="ziduan<%=i%>" size="50" class=input value="<%=ziduan(i)%>"></td></tr>
<%
end if
next
rss.close
set rss=nothing
%>  
 
<tr> 
  <td class="s0"> 简单介绍：</td>
</tr>
<tr> 
  <td valign="top" class="s1"> 
    <textarea rows="3" name="hw_content" cols="80"><%if rs("hw_content")<>"" then
htmlc=replace(rs("hw_content"),"<br>",chr(13))
htmlc=replace(htmlc,"&nbsp;"," ")    
response.write htmlc
end if%></textarea>
  </td>
</tr>
<tr><td class="s0">详细介绍：</td></tr>
<tr><td align="center" class="s1"><!--#include file="ad_in.asp"--></td></tr>
<tr> 
  <td class="s0"> 商品图片：&nbsp; <img border="0" src="Img/ad_help.gif" class="helpimg" alt="可以输入多个图片，必须用*号隔开"></td>
</tr>
<tr> 
  <td class="s1"> 
    <textarea rows="2" name="hw_pic" cols="80"><%=rs("hw_pic")%></textarea><font color="#FF0000"> **</font></td>
</tr>
<tr> 
  <td class="s0">
<IFRAME src="upfile.asp?atype=hw_pic" frameBorder=0 width="95%" height="30" scrolling=no height=21></IFRAME><img border="0" src="Img/ad_help.gif" class="helpimg" alt="点击“浏览”选择要上传的图片，然后点击“上传”"></td>
</tr>
<tr> 
  <td class="s1">推荐商品：
  <%if rs("tjindex")=0 then%>
  是<input type="radio" name="tjindex" value="1">否<input type="radio" name="tjindex" value="0" checked>
  <%else%>
  是<input type="radio" name="tjindex" value="1" checked>否<input type="radio" name="tjindex" value="0">
  <%end if%>
  <img border="0" src="Img/ad_help.gif" class="helpimg" alt="即：推荐商品">
  </td>
</tr>
<tr> 
  <td class="s0">类别推荐：
  <%if rs("tjsort")=0 then%>
  是<input type="radio" name="tjsort" value="1">否<input type="radio" name="tjsort" value="0" checked>
  <%else%>
  是<input type="radio" name="tjsort" value="1" checked>否<input type="radio" name="tjsort" value="0">
  <%end if%>
  <img border="0" src="Img/ad_help.gif" class="helpimg" alt="分类下推荐商品">
  </td>
</tr>
<tr> 
  <td class="s1">是否特价：
  <%if rs("tejia")=0 then%>
  是<input type="radio" name="tejia" value="1">否<input name="tejia" type="radio" value="0" checked>
  <%else%>
  是<input type="radio" name="tejia" value="1" checked>否<input name="tejia" type="radio" value="0">
  <%end if%>
  <img border="0" src="Img/ad_help.gif" class="helpimg" alt="特价商品">
  </td>
</tr>
<tr> 
  <td class="s0">
<input type="submit" value=" 修改 " name="B1" class=input onClick="document.form.hw_content2.value = document.getElementById('message').contentWindow.document.body.innerHTML;" >
<input type="reset" value=" 重写 " name="B2" class=input>
<input name="hw_content2" type="hidden" id="hw_content2" value="">
</td>
</tr></form></table>
<%
rs.close
set rs=nothing
end if
%><!--#include file="ad_bottom.asp"-->