<!--#include file="userCheck.asp"-->
<!--#include file="conn.asp"-->
<%
dim action, type1, carId, page_size, prm
action    = request.QueryString("action")		'判断要进行已出售和未出售操作
type1     = request.QueryString("type1")		'判断是已出售操作还是未出售操作
carId     = request.QueryString("carId")		'获得汽车的ID号
page_size = 15
prm       = ""

page = request.QueryString("page")
if page="" or isnumeric(page)=false then page=1

if request.QueryString("ac")="sqtuijian" then call shenqingtuijian()			'点击了申请推荐按钮
if request.QueryString("ac")="qxtuijian" then call quxiaotuijian()				'点击了取消推荐按钮

if action = "ifchushou" then

	if type1 = "weichushou" then
		conn.execute("update product set chushou = 1 where id="& carId &"")
	elseif type1 = "yichushou" then
		conn.execute("update product set chushou = 0 where id="& carId &"")
	end if

	response.Redirect("user_mypro.asp")
end if

sql="select * from product where userId="& session("userId23") &" and fa_chuqiu = '出售' order by id desc"
rs.open sql,conn,1,1

if not rs.eof then
	have = 1
	rs.pagesize     = page_size
	rs.absolutePage = page
	recordCountNum  = rs.recordcount
else
	have = 0
end if

%>
<!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 language="javascript" src="inc/showo_page.js" type="text/javascript"></script>
<style type="text/css">
a:link{color:#333333; text-decoration:none;}
a:visited{color:#333333; text-decoration:none;}
a:hover{color:#FF6600; text-decoration:none;}
</style>
</head>

<body>
<table width="910" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="2" colspan="2"><!--#include file="user_top.asp"--></td>
  </tr>
  <tr>
    <td width="178" style="border-right:dotted 1px #CCCCCC; background-color:#F8F8F6;" height="200" valign="top"><!--#include file="user_left.asp"--></td>
    <td width="732" valign="top">
	  <div style=" margin-top:2px;">
	  <div style="line-height:180%; text-align:left; padding:2px 10px;">
	  <div align="center"><strong>"推荐二手车"让您爱车的信息比别人多百倍展示机会</strong></div>
&nbsp;&nbsp;&nbsp;&nbsp;本网“推荐二手车”分布在每辆二手车信息页面的右侧，又有机会在钱江晚报上刊登，增加比平时发布信息多百倍的被浏览和推荐的机会，推荐二手车是经易卡搜搜吧         <font color="#FF0000">详情点击进入&gt;&gt;&gt;</font></div>
	  <div style="font-weight:bold; text-align:center; line-height:30px;">出售信息管理&nbsp;<a href="user_csAdd.asp">添加</a></div>
		
		<table width="100%" height="52" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#ABABAB">
        <tr bgcolor="#dedede"> 
          <td width="5%">编号</td>
          <td width="22%">型号</td>
          <td width="12%">价格</td>
          <td width="15%">发布日期</td>
          <td width="8%">审核</td>
          <td width="13%">推荐</td>
          <td width="14%">修改</td>
          <td width="11%">是否出售</td>
        </tr>
		<%
		dim i
		i = 1
		do while not rs.eof and i <= page_size
		%>
        <tr bgcolor="#FFFFFF">
          <td height="24"><div style="width:30px;"><%=rs("id")%></div></td>
          <td><div style="width:170px;"><%="<a href='view2Car.asp?id="& rs("id") &"' target='_blank'>"&exportpinp(rs("productSort"),"pinpaiandxinghao")&"</a>"%></div></td>
          <td><div style="width:80px;"><%=rs("memberPrice")%>元</div></td>
          <td><div style="width:90px;"><%=formatdatetime(rs("fa_time"),2)%></div></td>
          <td><div style="width:50px;">
            <%if rs("fabu")=1 then response.Write "通过" else response.Write "待审核"%>
          </div></td>
          <td>
		  <%
		tmp_mmod = 0
		tmp_mmod = rs("recommend")
		if tmp_mmod = 0 then
		  	response.write "<a href='?ac=sqtuijian&carId="& rs("id") &"' onclick='return confirm('注意：申请推荐如果被管理员审核通过将扣取您帐号中50枚易卡贝贝。\n\n提交申请不扣除任何易卡贝贝积分。')'>申请推荐</a>"
		elseif tmp_mmod = 1 then
			response.write "<a href='?ac=qxtuijian&carId="& rs("id") &"'>取消推荐</a>"
		elseif tmp_mmod = 2 then
			response.write "<a href='?ac=qxtuijian&carId="& rs("id") &"'>取消申请</a>"
		end if
		  %>
          </td>
          <td><a href="user_csAdd.asp?action=xiugai&carId=<%=rs("id")%>">修改</a></td>
          <td>
		  <%if rs("chushou")=0 then 
		  		response.write "<a href='user_mypro.asp?action=ifchushou&type1=weichushou&carId="& rs("id") &"'>未出售</a>"
			else
				response.write "<a href='user_mypro.asp?action=ifchushou&type1=yichushou&carId="& rs("id") &"'><span style='color:#FF0000;'>已出售</span></a>"
			end if
		  %>          </td>
        </tr>
		<%
		i = i + 1
		rs.movenext
		loop
		rs.close
		%>
      </table>
<%if have = 1 then%>
<div><Script Language="JavaScript">
ShowoPage("<table style='BORDER-COLLAPSE: collapse' borderColor='#111111' height='10' cellSpacing='0' cellPadding='0' width='95%' border='0'><tr><td vAlign='bottom'  style='font-family: Verdana,宋体; font-size: 11.5px; line-height: 15px'>","</td></tr></table>","页次:<font color='red'>","</font>/","","&nbsp;","&nbsp;每页<font color='red'>","</font>&nbsp;","&nbsp;共计:<font color='red'>","</font></td><td vAlign='bottom' align='right'  style='font-family: Verdana,宋体; font-size: 11.5px; line-height: 15px'>","<font face=webdings>9</font>","<font face=webdings>7</font>","<font face=webdings>8</font>","<font face=webdings>:</font>","&nbsp;&nbsp;跳转:","<font color='orange'>[","]</font>","","","<font color='red'>","</font>","","",<%=recordCountNum%>,<%=page_size%>,4,"?p=parm1&<%=prm%>")
</Script></div>
<%end if%>
      </div>
	  </td>
  </tr>
</table>
<table width="910" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><!--#include file="model_bottom.asp"--></td>
  </tr>
</table>

</body>
</html>
<%
'点击申请推荐
sub shenqingtuijian()


	'检查易卡贝贝数量时候达到50枚要求
	set rs_123 = conn.execute("select * from userJiFen where userId="& session("userId23") &"")
	if not rs_123.eof then
		
		if rs_123("yikabeibei") <= 49 then
			call wrong("对不起，您的易卡贝贝数量不到50枚，不能申请推荐车辆。")
		end if
	
	else
		call wrong("对不起，您的易卡贝贝数量不到50枚，不能申请推荐车辆。")
	end if
	set rs_123 = nothing


	dim tmp_sqtj
	tmp_sqtj = request.QueryString("carId")
	conn.execute("update product set recommend = 2 where id ="& carId &"")
	response.Redirect "?page="& page &""
end sub



'点击取消推荐
sub quxiaotuijian()
	dim tmp_sqtj
	tmp_sqtj = request.QueryString("carId")
	conn.execute("update product set recommend = 0 where id ="& carId &"")
	response.Redirect "?page="& page &""
end sub
%>