<!--#include file="conn.asp"-->
<!--#include file="fuction.asp" -->
<%
dim shopid,username,action
action=request.QueryString("action")
if trim(request.cookies("snsn")("username"))="" then 
username=session("tmp_usersessionid")
else
username=trim(request.cookies("snsn")("username"))
end if
shopid=request.QueryString("id")
'//删除收藏
select case action
case "del"
if Not isChkInteger(request.QueryString("actionid")) then
	%>
	<script language=javascript>
		alert("参数错误！");
		window.close();
	</script>
	<%
	response.end
end if

conn.execute "delete from shop_action where actionid="&request.QueryString("actionid")
if request.QueryString("ll")=22 then
response.redirect "myuser.asp?action=shoucang"
else
response.redirect "gouwu.asp?action=show"
end if
response.End
case "add"
'//商品，判断是否存在
if not isChkInteger(shopid) then
%>
<script language=javascript>
		alert("参数错误！");
		window.close();
	</script>
	<%
response.end
end if
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_snsn where shopid="&shopid,conn,1,1
if trim(request.cookies("snsn")("username"))="" then
  danjia=rs_s("shichangjia")
else
if request.Cookies("snsn")("reglx")=1 then 
	danjia=rs_s("huiyuanjia")
else
	danjia=rs_s("vipjia")
end if
end if
kucun=rs_s("kucun")
shopname=rs_s("shopname")
rs_s.close
set rs_s=nothing
if kucun<=0 then
response.write "<script language=javascript>alert('你选购的商品“"&shopname&"”暂时缺货不能放到购物车里，请选购其它商品！');window.history.go(-1);</script>"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select shopid,username,shopcount,zonger from shop_action where username='"&checkFFSQLStr(username)&"' and shopid="&shopid&" and zhuangtai=7",conn,1,3
if rs.recordcount=1 then
if kucun<(rs("shopcount")+1) then
response.write "<script language=javascript>alert('你选购的商品“"&shopname&"”暂时缺货不能放到购物车里，请选购其它商品！');window.history.go(-1);</script>"
response.end
end if
rs("zonger")=(rs("shopcount")+1)*danjia
rs("shopcount")=rs("shopcount")+1
rs.update
rs.close
set rs=nothing
response.Redirect "gouwu.asp?action=show"
else
'//添加购物
rs.close
set rs=server.CreateObject("adodb.recordset")
rs.open "select shopid,username,zhuangtai,zonger,shopcount from shop_action",conn,1,3
rs.addnew
rs("shopid")=shopid
rs("username")=username
rs("zhuangtai")=7
rs("shopcount")=1
rs("zonger")=danjia
rs.update
rs.close
set rs=nothing
response.Redirect "gouwu.asp?action=show"
end if
case "show"
'//////////////////
%>
<!--#include file="webconfig.asp"-->
<!--#include file="fuction.asp"-->
<html>
<head>
<title><%=webname%>--我的购物车</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">
<!--#include file="webtop.asp"--><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onMouseOver="window.status='【<%=webname%>】<%=weburl%> 如果您喜欢本站,别忘了把本站介绍给您的好友哦！：）';return true"> 
<div align="center">
<TABLE id=table1 style="MARGIN: 0px auto; BORDER-BOTTOM: #ffffff 0px solid" 
height="100%" cellSpacing=0 borderColorDark=#FFFFFF cellPadding=0 width=976 
borderColorLight=#CECECE border=1>
  <TBODY>
  <TR><!--sart left-->
    <TD vAlign=top width=234 bgcolor="#F1F1F1">
      <p align="center"> <!--#include file="left.asp"--></TD><!---end left--><!--start right-->
    <TD vAlign=top align=middle width=736>
		<table width="100%"  border="0" cellspacing="0" cellpadding="0" id="table2">
        <tr> 
          <td width="1" bgcolor="C9C9C8"><img src="images/block.gif" width="1" height="1"></td>
          <td valign="top"> 
           <br> 
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" id="table3">
              <tr> 
                <td height="1" bgcolor="cccccc"><img src="images/dot_03.gif" width="9" height="1" border="0"></td>
              </tr>
              <tr> 
                <td height="25" bgcolor="efefef"> <strong>&nbsp;&nbsp;<img src="images/dot_03.gif" width="9" height="9" border="0"> 
                  </strong><b>我的购物车</b></td>
              </tr>
              <tr> 
                <td height="1" bgcolor="cccccc"><img src="images/dot_03.gif" width="9" height="1" border="0"></td>
              </tr>
            </table>
            <br>
            <%
set rs=server.CreateObject("adodb.recordset")
rs.open "select shop_action.actionid,shop_action.shopid,shop_action.shopcount,shop_action.zonger,shop_snsn.shopname,shop_snsn.shichangjia,shop_snsn.huiyuanjia,shop_snsn.vipjia from shop_snsn inner join  shop_action on shop_snsn.shopid=shop_action.shopid where shop_action.username='"&username&"' and shop_action.zhuangtai=7",conn,1,1 
%>
            <table width=96% border=0 align=center cellpadding=0 cellspacing=1 bgcolor="#CCCCCC" id="table4">
              <form name='form1' method='post' action=xgsl.asp>
                <tr bgcolor="f1f1f1"> 
                  <td width=223 height="22"> <div align=center>商品名称</div></td>
                  <td width=99 height="22"> <div align=center>单价 
                      <%if request.cookies("snsn")("reglx")=2 then %>
                      (VIP) 
                      <%else%>
                      (会员) 
                      <%end if%>
                    </div></td>
                  <td width=49 height="22"> <div align=center>VIP价格</div></td>
                  <td width=83 height="22"> <div align=center>数量</div></td>
                  <td width=77 height="22"> <div align=center>总价</div></td>
                  <td width=24 height="22"> <div align=center>删</div></td>
                </tr>
                <%shuliang=rs.recordcount
jianshu=0
zongji=0
do while not rs.eof%>
                <tr bgcolor="#FFFFFF"> 
                  <td width="223" height="22" bgcolor="#FFFFFF" style='PADDING-LEFT: 5px'> 
                    <div align=left><a href=list.asp?id=<%=rs("shopid")%> target=_blank><%=rs("shopname")%></a> 
                      <input name=shopid type=hidden value="<%=rs("shopid")%>" >
                      <input name=actionid type=hidden value="<%=rs("actionid")%>" >
                    </div></td>
                  <td width="99" height="22" bgcolor="#FFFFFF"> <div align=center> 
                      <%
if request.Cookies("snsn")("reglx")=2 then 
	response.write rs("vipjia")
else
	response.write rs("huiyuanjia")
end if%>
                      元</div></td>
                  <td width="49" height="22" bgcolor="#FFFFFF"> <div align=center><%=rs("vipjia")%> 
                    </div></td>
                  <td width="83" height="22" bgcolor="#FFFFFF"> <div align=center><font color=#dd6600> 
                      <input name=shopcount value="<%=rs("shopcount")%>" size=6 class="wenbenkuang">
                      </font></div></td>
                  <td width="77" height="22" bgcolor="#FFFFFF"> <input type=hidden value=<%=rs("zonger")%> name="zonger"> 
                    <div align=center><font color=#FF3300><%=rs("zonger")%></font>元</div></td>
                  <td width="24" height="22"> <div align=center> <a href=gouwu.asp?action=del&actionid=<%=rs("actionid")%>> 
                      <img src=images/trash.gif width=15 height=17 border=0></a></div></td>
                </tr>
                <%
jianshu=jianshu+rs("shopcount")
zongji=zongji+rs("zonger")
rs.movenext
loop
rs.close
set rs=nothing%>
                <tr bgcolor="#FFFFFF"> 
                  <td height=30 colspan=6 bgcolor="#FFFFFF"> <div align=center> 
                      <input name="Submit32" type="button" class="go-wenbenkuang" value="继续购物" onClick="javascript:window.history.go(-1)">
                      <input name="Submit2" type="submit" class="go-wenbenkuang" value="修改数量"  onClick="this.form.action='xgsl.asp';this.form.submit()">
                      <input name="Submit223" type="submit" class="go-wenbenkuang" value="清空购物车"  onClick="this.form.action='qkgwc.asp';this.form.submit()">
                      <input name="Submit222" type="submit" class="go-wenbenkuang" value="去收银台"  onClick="this.form.action='jszx.asp';this.form.submit()">
                    </div></td>
                </tr>
                <tr bgcolor="#FFFFFF"> 
                  <td height=36 colspan=6 bgcolor="#FFFFFF"> <div align=center> 
                      购物车里有商品：<%=shuliang%>件　总数：<%=jianshu%>件　共计：<%=zongji%>元　您有预存款：<%=request.cookies("snsn")("yucun")%>元 
                      <%if request("lx")<>1 then %>
                      <br>
                      购物车将在6分钟后自动关闭 
                      <script language="Javascript">
function closeinfo(){window.close();}
setTimeout("closeinfo()", 600000);
</script>
                      <%end if%>
                    </div></td>
                </tr>
                <%set snsn=server.CreateObject("adodb.recordset")
	snsn.open "select * from shop_action_jp where username='"&checkFFSQLStr(request.cookies("snsn")("username"))&"' and zhuangtai=7",conn,1,1
	if snsn.recordcount>0 then%>
                <tr bgcolor="#FFFFFF"> 
                  <td colspan=5 bgcolor="#FFFFFF">
					<table width="100%" border="0" cellspacing="0" cellpadding="0" id="table5">
                      <tr> 
                        <td><IMG height=5 src="images/block.gif" width=1></td>
                      </tr>
                    </table>
                    <table width="96%" border="0" cellspacing="1" cellpadding="1" bgcolor="#CCCCCC" align="center" id="table6">
                      <tr bgcolor="#FFFFFF"> 
                        <td height="22" colspan="3"><b>您已选择的奖品清单</b></td>
                      </tr>
                      <tr align="center" bgcolor="f1f1f1"> 
                        <td height="22">奖品名称</td>
                        <td height="22">使用积分</td>
                        <td height="22">删除</td>
                      </tr>
                      <%
	while not snsn.eof%>
                      <tr bgcolor="#FFFFFF"> 
                        <td height="22"> 
                          <%
	set snsn1=server.CreateObject("adodb.recordset")
	snsn1.open "select * from shop_jiangpin where shopid="&snsn("shopid"),conn,1,1
	if snsn1.recordcount=1 then
	response.write "<a href='listjp.asp?id="&snsn("shopid")&"' target=_blank>"&snsn1("shopname")&"</a>"
	end if
	snsn1.close
	set snsn1=nothing%>
                        </td>
                        <td height="22" align="center"><%=snsn("jifen")%></td>
                        <td height="22" align="center"><a href="jifen.asp?actionid=<%=snsn("actionid")%>&action=del&ll=22"><img src=images/trash.gif width=15 height=17 border=0></a></td>
                      </tr>
                      <%
	snsn.movenext
	wend%>
                    </table>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="table7">
                      <tr> 
                        <td><IMG height=5 src="images/block.gif" width=1></td>
                      </tr>
                    </table></td>
                </tr>
                <%end if
snsn.close
set snsn=nothing%>
              </form>
            </table>
            <br> 
            <div align="center"> 
              <!--  <!--#include file="gouwuliucheng.asp"-->
            </div>
            </td>
        </tr>
      </table></TD><!--end right--></TR></TBODY></TABLE></div>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> 
</table>
<%
end select%>
<!--#include file="copyright.asp"-->
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
function checkk()
{
   if(checkspace(document.form2.searchkey.value)&&((document.form2.action.value=="3")||(document.form2.action.value=="1")))  {
	document.form2.searchkey.focus();
	alert("请输入查讯关键字！");
	return false;
  }
   document.form2.submit();
}

//-->
</script>