<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<% data_path="../../" 'ACC连接数据库路径，对SQL无效 %>
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../../inc/Function.asp"-->
  <!--#include file="../checkrole.asp"-->
 <%
     call checkuser("ly")
	if issession=0 then
	username=Replace_Text(request.Cookies("Yxmember"))
	gsid=Replace_Text(request.Cookies("Yxmemberid"))
	else
	username=session("user")
	gsid=session("id")
	end if 
	 
  Response.Buffer = true
  Response.ExpiresAbsolute=now()-1
  Response.Expires=0
  Response.CacheControl="no-cache"
 if Not ChkPost then 
		response.write "<script language='javascript'>"
		response.write"parent.location.href='"&HOPE_InstallDir&"login/login1.asp';</SCRIPT>"
		response.end
end if


 %>
<script Language="JavaScript">
function check()
{
  if (trim(form1.messageTitle.value)=="") {
		alert("主题不能为空！");
		form1.messageTitle.focus();		
		    return (false);
  }
    if (trim(form1.Verifycode.value)=="") {
		alert("验证码不能为空！");
		form1.Verifycode.focus();		
		    return (false);
  }
  
  if (trim(form1.messageContent.value)=="") {
		alert("主要内容不能为空！");
		form1.messageContent.focus();		
		    return (false);
  }
 
}
//-->
function trim(inputString) {
	   
              if (typeof inputString != "string") { return inputString; }
              var retValue = inputString;
              var ch = retValue.substring(0, 1);
              while (ch == " ") { 
	          //检查字符串开始部分的空格
                  retValue = retValue.substring(1, retValue.length);
                  ch = retValue.substring(0, 1);
              }
              ch = retValue.substring(retValue.length-1, retValue.length);
              while (ch == " ") {
                 //检查字符串结束部分的空格
                 retValue = retValue.substring(0, retValue.length-1);
                 ch = retValue.substring(retValue.length-1, retValue.length);
              }
              while (retValue.indexOf("  ") != -1) { 
	         //将文字中间多个相连的空格变为一个空格
                 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
              }
              return retValue;
           } 

//--> 
</script>
<%
year_now = year(date())
month_now = month(date())
day_now = day(date()) 
 
dim sql
dim rs
dim id

 id=Replace_Text(request("id"))
 
sql="select Websen_productshow.*,Websen_corporation.* from Websen_productshow,Websen_corporation where Websen_productshow.id="&id&" and Websen_corporation.id=Websen_productshow.gsid  and  Websen_corporation.flag=1"
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
if rs.eof then
response.write "<p align='center'>对不起，没有您要查询的信息</p>"
else
gsidt=rs("gsid")
if gsidt=gsid then
  response.write"<SCRIPT language=JavaScript>alert('请不要向自己询价！');"
  response.write"javascript:window.close();</script>"
  response.end
end if
 
set rsblak=conn.execute("select id from Websen_memberRelation where [user]='"&rs("user")&"' and secuser='"&username&"' and relation=-1")
if not (rsblak.eof and rsblak.bof) then
  response.write"<SCRIPT language=JavaScript>alert('对方已把您列入黑名单中，\n\n不能向对方询价。');"
  response.write"javascript:window.close();</script>"
  response.end
end if
%>
<title>留言询价</title>
<!--#include file="../../inc/head.asp"-->
<%

if issession=0 then 
safecode=Replace_Text(request.Cookies("safecode"))
else
safecode=Session("SafeCode")
end if

sendButton=Replace_Text(request("sendButton"))
  
if sendButton<>"" then

if Replace_Text(request("Verifycode"))="" then
response.Write("<script language=javascript>alert('请输入正确的验证码！');history.back(-1);</script>")
response.End()
end if

if not isnumeric(request("Verifycode")) then
response.Write("<script language=javascript>alert('请输入正确的验证码！');history.back(-1);</script>")
response.End()
end if
if    Replace_Text(request.form("messageContent"))="" then 
response.Write("<script language=javascript>alert('请输入询价的主要内容！');history.back(-1);</script>")
response.End()
end if
if cstr(Replace_Text(request("Verifycode")))<>cstr(safecode) then 
 response.Write("<script language=javascript>alert('亲爱的会员，您的验证码输入错误，请再试一下！');history.back(-1);</script>")
response.End()
 else

title=Replace_Text(request.form("messageTitle"))
title=left(title,25)
content=Replace_Text(request.form("messageContent"))
needtrust=Replace_Text(request.form("needtrust"))
sendemail=Replace_Text(request.form("sendemail"))
saveSendMessage=Replace_Text(request.form("saveSendMessage"))
sendContact=Replace_Text(request.form("sendContact"))
checkdate=Replace_Text(request.form("checkdate"))
start_year=Replace_Text(request.form("start_year"))
start_month=Replace_Text(request.form("start_month"))
start_day=Replace_Text(request.form("start_day"))
requestinfo=Replace_Text(request.form("requestinfo"))
mycid=Replace_Text(request.form("mycid"))

if saveSendMessage<>"" then
set rs1=server.createobject("adodb.recordset")
sql1="select * from Websen_getprice1 where (id is null)" 
rs1.open sql1,conn,1,3
rs1.addnew
rs1("title")=title
rs1("content")=content

if sendemail<>"" then rs1("sendemail")=1

if needtrust<>"" then rs1("needtrust")=1

if sendContact<>"" then rs1("sendcontact")=1

if checkdate<>"" then 
rs1("checkdate")=1
rs1("limitedtime")=start_year&"年"&start_month&"月"&start_day
end if
rs1("requestinfo")=requestinfo
rs1("mycid")=mycid
rs1("sendcid")=gsid
rs1("datetime")=now()
rs1.update
end if

set rs=server.createobject("adodb.recordset")
sql="select * from Websen_getprice where (id is null)" 
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("content")=content

if sendemail<>"" then rs("sendemail")=1

if needtrust<>"" then rs("needtrust")=1

if sendContact<>"" then rs("sendcontact")=1

if checkdate<>"" then 
rs("checkdate")=1
rs("limitedtime")=start_year&"年"&start_month&"月"&start_day
end if
rs("requestinfo")=requestinfo
rs("mycid")=mycid
rs("sendcid")=gsid
rs("datetime")=now()
if saveSendMessage<>"" then
rs("getprice1id")=rs1("id")
rs1.close
set rs1=nothing
end if
rs.update

rs.close
set rs=nothing

conn.close
set conn=nothing
 
response.write"<SCRIPT language=JavaScript>alert('恭喜！询价成功！');"
response.write"javascript:window.close();</script>"
response.end
end if
if issession=0 then 
 response.Cookies("safecode")=""
else
 Session("SafeCode")=""
end if
end if
%><br>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F5F5F5" bordercolor="#F5F5F5">
<tr ><td height="30"  ><Font   color="#E32D0D" style="font-size:14px"  ><b>
 【产品留言询价】:
</b> <%=rs("cpmc")%></Font></td></tr>
<tr><td height="1"  bgcolor="#CCCCCC"></td></tr></table>
 <TABLE width=778 border=0 align="center" cellPadding=0 cellSpacing=0>

<FORM name=form1 action="" method=post onsubmit="return check();">
<input type=hidden value=<%=rs("gsid")%> name=mycid>
<tr> <td> <TABLE width=778 border=0 align="center" cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD width=250>&nbsp;</TD>
    <TD><STRONG></STRONG></TD>
  </TR></TBODY></TABLE>
<TABLE width=778 border=0 align="center" cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD vAlign=top><table cellspacing="1" cellpadding="5" width="100%" bgcolor="F3F3F3" 
            border="0">
      <tbody>
        <tr bgcolor="#ffffff">
          <td class="C" align="right" width="100" 
                bgcolor="F3F3F3"><b>发送给：</b></td>
          <td bgcolor="#F3F3F3" class="C"><div id="nav"><%=rs("qymc")%></div></td>
        </tr>
        <tr bgcolor="#ffffff">
          <td class="C" align="right" bgcolor="#FFFFFF"><b>附加码： </b></td>
          <td class="C"><input name="Verifycode"   size="5" maxlength="5"  onKeyUp="value=value.replace(/[^\d]/g,'') "   tonbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>
            请在附加码框中输入： <img src="<%=HOPE_InstallDir%>vCode.asp?" onclick="this.src+=Math.random()" alt="图片看不清？点击重新得到验证码" style="cursor:hand;" /></td>
        </tr>
        <tr bgcolor="#ffffff">
          <td class="C" align="right" bgcolor="F3F3F3"><b>主题：</b></td>
          <td bgcolor="#F3F3F3"><input maxlength="25"  size="50" value="我对您在发布的“<%=rs("cpmc")%>”很感兴趣" 
            name="messageTitle" />          </td>
        </tr>
        <tr bgcolor="#ffffff">
          <td class="C" valign="top" nowrap="nowrap" align="right" 
                  bgcolor="#F9F9F9"><b>主要内容：</b></td>
          <td bgcolor="#F9F9F9"><textarea name="messageContent" rows="10" cols="50"><%=Replace_Text(request.form("messageContent"))%></textarea>          </td>
        </tr>
 
      </tbody>
    </table></TD>
 
  </TR></TBODY></TABLE>
   <TABLE width=778 border=0 align="center" cellPadding=0 cellSpacing=0 bgColor=#ffffff>
  <TBODY>
  <tr><td height="30" bgcolor="#F3F3F3">
  
      <INPUT type=checkbox disabled CHECKED value=1 
            name=sendMessage>  网上留言 （限1500字） 
      <INPUT type=checkbox 
            CHECKED value=true name=saveSendMessage>  保存到“我发出的留言” <INPUT type=checkbox CHECKED value=true name=sendContact> 发送我的联系方式 
  
  </td></tr>
  <TR>
    <TD height="30"   >
      <INPUT type=checkbox value=yes name=checkDate>对方在 
      <select name="start_year">
              <%for i=2008 to 2020 %>
              <%if clng(i) = clng(year_now) then%>
               
					<option selected value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
				
              <%else%>
              
					<option value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
				
              <%end if%>
              <%next%>
              
       	  </select> 年
            <select name="start_month">
                    
              <%for i=1 to 12%>
              <%if clng(i) = clng(month_now) then%>
              <option selected value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%else%>
              <option  value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%end if%>
              <%next%>
              
       	    </select> 月
	       	  <select name="start_day">
                    
              <% for i=1 to 31%>
              <%if clng(i) = clng(day_now) then%>
              <option selected value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%else%>
              <option  value="<%Response.Write i%>">
              <%Response.Write i%>
              </option>
              <%end if%>
              <%next%>
              
	       	  </select> 日前答复！(如您希望对方在此前答复,请将方框点选为 <INPUT type=checkbox CHECKED value=yes 
      name=checkDate3 disabled >
	  )</TD>
  </TR></TBODY></TABLE><BR>
      <table width="778" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#9ec4e5">
        <tbody>
          <tr bgcolor="#e6f7ff">
            <td class="M" nowrap="nowrap" colspan="3">我需要进一步了解的信息：</td>
          </tr>
          <tr bgcolor="#ffffff">
            <td class="C" nowrap="nowrap"><input type="checkbox" value="产品规格、型号" name="requestInfo" />
              产品规格、型号 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="单价" name="requestInfo" />
              单价 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="价格条款" name="requestInfo" />
              价格条款 </td>
          </tr>
          <tr bgcolor="#ffffff">
            <td class="C" nowrap="nowrap"><input type="checkbox" value="原产地" name="requestInfo" />
              原产地 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="供货能力" name="requestInfo" />
              供货能力 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="销售条款及附加条件" 
      name="requestInfo" />
              销售条款及附加条件 </td>
          </tr>
          <tr bgcolor="#ffffff">
            <td class="C" nowrap="nowrap"><input type="checkbox" value="最小订货量" name="requestInfo" />
              最小订货量 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="交货期" name="requestInfo" />
              交货期 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="能否提供样品" name="requestInfo" />
              能否提供样品 </td>
          </tr>
          <tr bgcolor="#ffffff">
            <td class="C" nowrap="nowrap"><input type="checkbox" value="产品担保" name="requestInfo" />
              产品担保 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="包装方式" name="requestInfo" />
              包装方式 </td>
            <td class="C" nowrap="nowrap"><input type="checkbox" value="质量/安全认证" name="requestInfo" />
              质量/安全认证 </td>
          </tr>
        </tbody>
  </table>
      <BR>

<TABLE width=750 border=0 align="center" cellPadding=0 cellSpacing=0 bgColor=#ffffff>
  <TBODY>
  <TR>
      <TD align=left><A class=C 
      href="<%=HOPE_InstallDir%>member/modify/modify_info.asp" 
      target=_blank></A></TD>
    </TR></TBODY></TABLE><BR>
<TABLE width=500 border=0 align="center" cellPadding=4 cellSpacing=0>
  <TBODY>
  <TR align=middle>
    <TD noWrap><INPUT type=submit value="  发送  " name=sendButton > 
     <INPUT type=reset value="  重填  " name=resetButton> 
  </TD></TR></TBODY></TABLE>
  </td></tr></FORM></table>
  <BR>
  <!--#include file="../../inc/end.asp"-->
<BR>
<BR>
<%end if%>
<%
 
 
rs.close
set rs=nothing
conn.close
set conn=nothing
%>