⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gouwu.asp

📁 网络商店源码 实现商品浏览 购物车 后台管理等
💻 ASP
字号:
<!--#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"> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> 
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="C9C9C8"><img src="../images/block.gif" width="1" height="1"></td>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="168" align="left" valign="top">
            <!--#include file="top_login.asp"-->
          </td>
          <td width="22" align="left" valign="top"><a href="about.asp?action=lxwm"><img src="images/pic_004.gif" width="23" height="136" border="0"></a></td>
          <td width="586" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td align="center"><img src="images/adad.jpg" width="396" height="136"> 
                  </td>
                <td width="22" align="center" valign="top"><a href="about.asp?action=lxwm"><img src="images/pic_003.gif" width="23" height="136" border="0"></a> 
                </td>
                <td width="168" align="center">
                  <!--#include file="top_ad.asp"-->
                </td>
              </tr>
            </table></td>
        </tr>
      </table></td>
    <td width="1" bgcolor="C9C9C8"><img src="../images/block.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="1" bgcolor="C9C9C8"><img src="../images/block.gif" width="1" height="1"></td>
    <td> <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="168" valign="top"> 
            <!--#include file="left.asp"-->
          </td>
          <td width="1" bgcolor="C9C9C8"><img src="images/block.gif" width="1" height="1"></td>
          <td valign="top"> <table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td background="images/bg1_4color_.jpg"><img src=images/bg1_4color_.jpg" width="1" height="3"></td>
              </tr>
            </table>
           <br> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
            
              <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>
            </table>
            <%
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 
%>
            <br>
            <table width=96% border=0 align=center cellpadding=0 cellspacing=1 bgcolor="#CCCCCC">
              <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="Submit222" type="submit" class="go-wenbenkuang" value="清空购物车"  onClick="this.form.action='qkgwc.asp';this.form.submit()">
                       <input name="Submit222" type="submit" class="go-wenbenkuang" id="Submit222"  onClick="this.form.action='jszx.asp';this.form.submit()" value="去收银台">
</div></td>
                </tr>
                <tr bgcolor="#FFFFFF"> 
                  <td height=36 colspan=6 bgcolor="#FFFFFF"> <div align=center>购物车里有商品:<%=shuliang%>件 总数:<%=jianshu%>件 共计:<%=zongji%>元 您有预存款:<%=request.cookies("snsn")("yucun")%>元
                      </div></td>
                </tr>
             
                
               
              </form>
            </table>
            <br> 
            <div align="center"> 
              <!--  <!--#include file="gouwuliucheng.asp"-->
            </div>
          </td>
        </tr>
      </table></td>
    <td width="1" bgcolor="C9C9C8"><img src="../images/block.gif" width="1" height="1"></td>
  </tr>
</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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -