<!--#include file="../conn.asp"-->
<!--#include file="../inc/exportPinPai.asp"-->
<%
if session("userId23") = "" then
	response.write "<script>alert('请先登录后再操作。');window.open('/login_2.asp','_self');</script>"
	response.End()
end if

if request.QueryString("action")="add" then call addxinxi()
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>申请团购</title>
<link href="../css/comm.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/comm.js"></script>
<script type="text/javascript" src="../js/city.js"></script>
<script language="javascript">
/*表单提交验证*/
function chk()
{
	if(getId("s1").value=="" || getId("s2").value=="" || getId("s3").value=="" || getId("s4").value=="")
	{
		alert("请选择完整汽车信息。");
		getId("s4").focus();
		return false;
	}
	/*
	if(getId("name1").value.Trim()=="")
	{
		alert("请填写您的姓名。");
		getId("name1").focus();
		return false;
	}
	
	if(getId("shouji").value.Trim()=="")
	{
		alert("请填写您的手机号码。");
		getId("shouji").focus();
		return false;
	}
	
	if(/[a-zA-Z]/gi.test(getId("shouji").value)==true)
	{
		alert("请正确填写您的手机号码。");
		getId("shouji").focus();
		return false;
	}
	
	if(getId("shouji").value.length != 11)
	{
		alert("请正确填写您的手机号码。");
		getId("shouji").focus();
		return false;
	}
	
	if(getId("city").value=="")
	{
		alert("请填写您所在的地区。");
		getId("city").focus();
		return false;
	}
	
	if(getId("email").value=="")
	{
		alert("请填写您的邮箱地址。");
		getId("email").focus();
		return false;
	}
	
	if(chkemail(getId("email").value)==0)
	{
		alert("请正确填写您的邮箱地址。");
		getId("email").focus();
		return false;
	}
	*/
}
</script>
</head>

<body>
<div class="bodyDiv">
<!--#include file="tuangou_top.asp"-->
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="29%">&nbsp;</td>
          <td width="1%">&nbsp;</td>
          <td width="70%">&nbsp;</td>
        </tr>
        <tr>
          <td valign="top">
            <!--#include file="model_paihang.asp"-->
            <div><img src="img/Snap2.jpg" width="267" height="44" /></div>
            <div><img src="img/Snap3.jpg" width="267" height="95" /></div>
            <!--#include file="model_shuohua.asp"-->          </td>
          <td><div style="width:12px;"></div></td>
          <td valign="top">
<div style="border:solid 1px #a6bcc9;">
<form name="formd4f5" id="formd4f5" method="post" action="?action=add" onSubmit="return chk()">
    <div style="padding-left:10px;">
        <div><img src="img/Snap12.jpg" width="566" height="25" /></div>
        <div style="font-size:14px; line-height:30px;">本表<font color="#FF0000">*</font>部分为必填内容</div>
        <div style="line-height:27px; margin-right:10px; height:27px; background-image:url(img/Snap13.jpg);"><span style="padding-left:10px; color:#404b4f; font-size:14px;">团购信息</span></div>
        <div>
          <table width="96%" height="59" border="0" align="center" cellpadding="3" cellspacing="0" style="color:#404b4f; font-size:14px;">
            <tr>
              <td><%call exportPinPai()%></td>
            </tr>
            <tr>
              <td>汽车颜色：<input name="carColor" type="text" id="carColor" size="10" /></td>
            </tr>
            <tr>
              <td>
                预购时间：<select name="yugoushijian" id="yugoushijian">
                  <option value="一周内">一周内</option>
                  <option value="半月内">半月内</option>
                  <option value="一月内">一月内</option>
                </select><font color="#FF0000">&nbsp;*&nbsp;</font></td>
            </tr>
          </table>
        </div>
        <!--<div style="line-height:27px; margin-right:10px; height:27px; background-image:url(img/Snap13.jpg);"><span style="padding-left:10px; color:#404b4f; font-size:14px;">联系方式</span></div>-->
        <!--<div>
          <table width="100%" height="59" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><table width="96%" height="59" border="0" align="center" cellpadding="3" cellspacing="0" style="color:#404b4f; font-size:14px;">
                <tr>
                  <td width="12%">姓名：</td>
                  <td width="88%"><input name="name1" type="text" id="name1" maxlength="5" /><font color="#FF0000">&nbsp;*&nbsp;</font></td>
                </tr>
                <tr>
                  <td>性别：</td>
                  <td><select name="sex" id="sex">
                    <option value="男">男</option>
                    <option value="女">女</option>
                  </select><font color="#FF0000">&nbsp;*&nbsp;</font></td>
                </tr>
                <tr>
                  <td>手机：</td>
                  <td><input name="shouji" type="text" id="shouji" maxlength="13" /><font color="#FF0000">&nbsp;*&nbsp;</font></td>
                </tr>
                <tr>
                  <td>地区：</td>
                  <td><script language="javascript">showprovince('province', 'city', '');showcity('city', '');</script><font color="#FF0000">&nbsp;*&nbsp;</font></td>
                </tr>
                <tr>
                  <td>邮箱：</td>
                  <td><input name="email" type="text" id="email" maxlength="50" />
                    <font color="#FF0000">&nbsp;*&nbsp;</font></td>
                </tr>
              </table></td>
            </tr>
          </table>
        </div>-->
        <div style="line-height:27px; margin-right:10px; height:27px; background-image:url(img/Snap13.jpg);"><span style="padding-left:10px; color:#404b4f; font-size:14px;">团购介绍</span></div>
        <div>
          <table width="100%" height="59" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td><textarea name="beizhu" id="beizhu" cols="82" rows="8"></textarea></td>
                </tr>
                <tr>
                  <td height="55" align="center"></td>
                </tr>
              </table></td>
            </tr>
          </table>
        </div>
        <div style="text-align:center; padding-top:10px;"><input type="image" src="img/Snap14.jpg" name="button2" id="button2" value="提交" />&nbsp;&nbsp;<img src="img/Snap15.jpg" width="114" height="34" /></div>
    </div>
</form>
</div></td>
        </tr>
      </table>
      <!--#include file="../model_bottom.asp"-->
</div>
</body>
</html>
<%
function addxinxi()

	dim ggg(6)
	ggg(0) = request.Form("s1")
	ggg(1) = request.Form("s2")
	ggg(2) = request.Form("s3")
	ggg(3) = request.Form("s4")
	ggg(4) = request.Form("carColor")
	ggg(5) = request.Form("yugoushijian")
	ggg(6) = replace(replace(request.Form("beizhu")&""," ","&nbsp;"),vbcrlf,"<br>")
	
	if ggg(0) = "" or ggg(1) = "" or ggg(2) = "" or ggg(3) = "" then call wrong("请填写完整信息。")
	
	if ggg(5) = "一周内" then
		jieshushijian= DateAdd("d",7,now())
	elseif ggg(5)="半月内" then
		jieshushijian= DateAdd("d",15,now())
	elseif ggg(5)="一月内" then
		jieshushijian= DateAdd("d",30,now())
	else
		jieshushijian = now()
	end if
	
	set rs_4b5d = server.CreateObject("adodb.recordset")
	rs_4b5d.open "select top 1 * from tuangouCar",conn,1,3
	rs_4b5d.addnew
		
		rs_4b5d("Sort1")     = ggg(0)
		rs_4b5d("Sort2")     = ggg(1)
		rs_4b5d("Sort3")     = ggg(2)
		rs_4b5d("Sort4")     = ggg(3)
		rs_4b5d("carColor")  = ggg(4)
		rs_4b5d("endTime")   = jieshushijian
		rs_4b5d("yugouTime") = ggg(5)
		rs_4b5d("userId")    = session("userId23")
		rs_4b5d("beizhu")    = ggg(6)
		rs_4b5d("ifshenhe")  = "no"					'默认为未审核
	rs_4b5d.update
	rs_4b5d.close
	set rs_4b5d = nothing
	
	'插入团购汽车统计表
	set rs_tongji = server.CreateObject("adodb.recordset")
	rs_tongji.open "select * from tuangou_tongji where sort1="&ggg(0)&" and sort2="&ggg(1)&" and sort3 = "&ggg(2)&" and sort4="&ggg(3)&"",conn,1,3
	if rs_tongji.eof then
		rs_tongji.addnew
			rs_tongji("sort1")  = ggg(0)
			rs_tongji("sort2")  = ggg(1)
			rs_tongji("sort3")  = ggg(2)
			rs_tongji("sort4")  = ggg(3)
			rs_tongji("carNum") = 1
		rs_tongji.update
	else
		rs_tongji("carNum") = rs_tongji("carNum") + 1
		rs_tongji.update
	end if
	rs_tongji.close
	set rs_tongji = nothing
	
	response.write "<script>alert('申请成功，请等待管理员审核。');window.open('shenqing.asp','_self');</script>"
end function
%>