<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
end if
end if
%>
<title>添加新商品</title>
<script language = "JavaScript">


function checkpro()
{
    if(checkspace(document.myform.name.value)) {
	document.myform.name.focus();
    alert("请输入商品名称！");
	return false;
  }

     if(checkspace(document.myform.price1.value)) {
	document.myform.price1.focus();
    alert("请输入商品市场价格！");
	return false;
  }
     if(checkspace(document.myform.price2.value)) {
	document.myform.price2.focus();
    alert("请输入商品会员价格！");
	return false;
  }
      if(checkspace(document.myform.vipprice.value)) {
	document.myform.vipprice.focus();
    alert("请输入VIP月会员商品价格！");
	return false;
  }
 
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
	function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}
//-->
</script>

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" BGCOLOR="#39867B"> 
<tr> <td BGCOLOR="#39867B" height="20" align="center"><font color="#FFFFFF">添加新商品</font></td></tr> 
<tr>  
<td bgcolor="#FFFFFF"> 
<form name="myform" method="post" action="saveaddpro.asp?action=add">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="0">
  <% set rs=server.createobject("adodb.recordset")     
     rs.open "select * from sundxProlist",conn,1,1
     %>
          
        <tr BGCOLOR="#ffffff"> 
    <td width="5%">选择分类： </td>
    <td height="30" >
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style='PADDING-LEFT: 6px;BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid;  BORDER-LEFT: #cccccc 1px solid; COLOR: #333333; BORDER-BOTTOM: #cccccc 1px solid; '>
   
    <% 
		  set menurs=server.CreateObject("adodb.recordset")
		  menurs.open "select * from category order by categoryorder",conn,1,1
		 if menurs.eof and menurs.bof then
               response.write "请先添加商品大类。"

             else      
           do while not menurs.eof
    %>
    <tr> 
     <td width="120" style='PADDING-LEFT: 6px;BORDER-RIGHT: #cccccc 1px solid;  BORDER-BOTTOM: #cccccc 1px solid; '>        
   
<font color=#333333> <strong><%=trim(menurs("category"))%></strong></font></td> 
             <% menurs1
		  set menurs1=server.CreateObject("adodb.recordset")
		  menurs1.open "select * from sorts where categoryid="&menurs("categoryid")&"  order by sortsorder",conn,1,1
              if menurs1.eof and menurs1.bof then
          
           
               else%>
        <td style='PADDING-LEFT: 6px;BORDER-BOTTOM: #cccccc 1px solid; '>  
           <%  do while not menurs1.eof%>
           <% = Trim(menurs1("sorts")) %> <input type="checkbox" name="sortsid" id="sortsid"   value="<% = Trim(menurs1("sortsid")) %>"  > &nbsp;&nbsp;
              <%  menurs1.movenext
		  loop
                 end if
		  menurs1.close
		  set menurs1=nothing %>
          </td>    </tr> 
   
   
             <%  menurs.movenext
		  loop
                end if
		  menurs.close
		  set menurs=nothing %>

</table>
</td>
  </tr>
          <tr> 
            <td><input name="prename" type="text" id="prename" value="<% =rs(0) %>" size="10"> 
            </td>
            <td> <input name="name" type="text" id="name" size="30"> 商品类别: <select name="recommend" id="recommend">
                      <option value="0" selected>普通</option>
                       <option value="1">新品</option>
                       <option value="2">推荐</option>
                       <option value="3">特价</option>
                       <option value="4">赠品</option>
              </select>
            </td>
          </tr>
          <tr> 
            <td><input name="company" type="text" id="company" value="<% =rs(1) %>" size="10"> 
            </td>
            <td> <input name="brand" type="text" id="brand" size="30" ><%
set rsbrand=server.createobject("adodb.recordset")
rsbrand.open "select * from sundxbrand order by brandTop ",conn,1,1
%>
              <select name="Selectbrand" onChange="(document.myform.brand.value=this.options[this.selectedIndex].value)">
                <option selected>请选择品牌</option>
				<% Do While Not rsbrand.Eof %>
                <option value="<% = Trim(rsbrand("brandName")) %>"><% = rsbrand("brandName")%></option>
                <%
rsbrand.movenext
Loop
rsbrand.close
set rsbrand=nothing
%>
              </select></td>
          </tr>
          <tr> 
            <td><input name="intro" type="text" id="intro" value="<% =rs(2) %>" size="10"></td>
            <td> <input name="introduce" type="text" id="introduce" size="30" ></td>
          </tr>
          <tr> 
            <td height="20"><input name="predate" type="text" value="<% =rs(3) %>" size="10"></td>
            <td > <select name="productdateyear" id="productdateyear">
                <%dim i
for i=1990 to 2020
response.write "<option value="&i&">"&i&"</option>"
next
%>
              </select>
              年 
              <select name="productdatemonth" id="productdatemonth">
                <option value="01">01</option>
                <option value="02">02</option>
                <option value="03">03</option>
                <option value="04">04</option>
                <option value="05">05</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09">09</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
              </select>
              月 <select name="productdateday" id="productdateday">
                <option value="01">01</option>
                <option value="02">02</option>
                <option value="03">03</option>
                <option value="04">04</option>
                <option value="05">05</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09">09</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
                <option value="13">13</option>
                <option value="14">14</option>
                <option value="15">15</option>
                <option value="16">16</option>
                <option value="17">17</option>
                <option value="18">18</option>
                <option value="19">19</option>
                <option value="20">20</option>
                <option value="21">21</option>
                <option value="22">22</option>
                <option value="23">23</option>
                <option value="24">24</option>
                <option value="25">25</option>
                <option value="26">26</option>
                <option value="27">27</option>
                <option value="28">28</option>
                <option value="29">29</option>
                <option value="30">30</option>
                <option value="31">31</option>
              </select>
              日</td>
          </tr>
          <tr> 
            <td> <input name="price" type="text" id="price" value="<% =rs(4) %>" size="10"></td>
            <td >市场价：
<input name="price1" type="text" id="price1" size="6" onKeyPress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" 
onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))" VALUE="1">
              元，网店价： 
              <input name="price2" type="text" id="price2" onKeyPress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" value="1" size="6" 
onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
              元，平衡费（商品邮寄超重超体积时用）： 
              <INPUT NAME="vipprice" TYPE="text" ID="vipprice" ONKEYPRESS	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" value="0" SIZE="6" 
ONPASTE		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
ONDROP		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
              元，是否参与折扣： 
              <select name="amount" id="amount">
                <option value="1" selected>是</option>
                <option value="0">否</option>
              </select>
            </td>
          </tr>
          <tr> 
            <td><input name="prestock" type="text" id="prestock" value="<% =rs(5) %>" size="10"></td>
            <td > 库　存： 
              <INPUT NAME="stock" VALUE="1" SIZE="6" TYPE="text">
              件，赠送积分： 
              <INPUT NAME="score" VALUE="1" SIZE="4" TYPE="text" ONKEYPRESS	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
ONPASTE		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
ONDROP		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))">
              分(库存为0显示缺货，库存小于0商品隐藏)</td>
          </tr>
          <tr> 
            <td> <input name="other" type="text" id="other" value="<% =rs(6) %>" size="10"></td>
            <td> <input name="grade" type="text" id="grade" value="精 品" size="30"></td>
          </tr>
          <tr> 
            <td><input name="pretype" type="text" id="pretype" value="<% =rs(7) %>" size="10"></td>
            <td><input name="type" type="text" id="type" size="30"></td>
          </tr>
          <tr> 
            <td height="9"> <input name="graph" type="text" id="graph" value="<% =rs(8) %>" size="10"></td>
            <td> <input name="pic" type="text" id="pic" size="30" VALUE="images/emptybook.jpg"> 
              <input type="button" name="Submit11" value="上传图片" onClick="window.open('proupfile.asp?formname=myform&editname=pic&uppath=images/upfile&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> 
            </td>
          </tr>
         <tr> 
            <td height="9"> <input name="graph01" type="text" id="graph01" value="<% =rs(8) %>" size="10"></td>
            <td> <input name="pic1" type="text" id="pic1" size="30" VALUE="images/emptybook.jpg"> 
              <input type="button" name="Submit119" value="上传图片" onClick="window.open('pproupfile.asp?formname=myform&editname=pic1&uppath=images/upfile&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> (如果开启缩略图功能只要上传大图，自动生成小图地址)
            </td>
          </tr>
          <tr> 
            <td height="9"> <input name="graph02" type="text" id="graph02" value="<% =rs(8) %>" size="10"></td>
            <td> <input name="pic2" type="text" id="pic2" size="30" VALUE="images/emptybook.jpg"> 
              <input type="button" name="Submit11" value="上传图片" onClick="window.open('proupfile.asp?formname=myform&editname=pic2&uppath=images/upfile&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> 
            </td>
          </tr>
         <tr> 
            <td height="9"><input name="graph2" type="text" id="graph2" value="<% =rs(9) %>" size="10"></td>
            <td height="9"><INPUT NAME="photo" TYPE="text" ID="photo" SIZE="30">
             <input type="button" name="Submit119" value="上传图片" onClick="window.open('proupfile.asp?formname=myform&editname=photo&uppath=images/upfile&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> 
           </td>
          </tr>
          <tr> 
            <td height="9"><input name="link" type="text" id="link" value="<% =rs(10) %>" size="10"></td>
            <td height="9"><input name="addlink" type="text" id="addlink" size="30"></td>
          </tr>
          <tr> 
            <td><input name="web" type="text" id="web" size="12" value="演示网址"></td>
            <td><input name="weblink" type="text" id="weblink" value="<%=rs("weblink")%>" size="30"></td>
         <tr> 
            <tr> 
            <td><input name="download" type="text" id="download" size="12" value="免费试用"></td>
            <td><input name="downloadlink" type="text" id="downloadlink" value="<%=rs("downloadlink")%>" size="30"></td>
          </tr>
          <tr> 
            <td valign="top"><input name="description" type="text" id="description" value="<% =rs(11) %>" size="10"> 
            </td>
            <td> <INPUT type="hidden" name="detail" value="<% =rs(11) %>">	
              <iframe ID="detail" src="htmledit/ewebeditor.asp?id=detail&style=standard" frameborder="0" scrolling="no" width="550" HEIGHT="350"></iframe> 
            </td>
          </tr>
          <tr> 
            <td height="25"></td>
            <td> <input type="submit" name="Submit" value="添 加" onClick="return checkpro();">
               </td>
            <% rs.close
        set rs = nothing
        conn.Close
        set conn = nothing %>
          </tr>
        </table></form></td></tr> </table>
<!--#include file="footer.asp"-->