www.gusucode.com > 凡人网络购物系统 2008源码程序 > buy.asp

    <!--#include file="conn.asp"-->
<!--#include file="IncAsp/venshop_top.asp"-->
<div align="center">
<table cellpadding="0" cellspacing="0" class="all_t1">
<tr><td class="all_l_td" valign="top">
<!--#include file="IncAsp/venshop_log.asp"--><div class="d5"></div>
</td>
<td valign="top" class="all_c_td">


<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="sort">&nbsp;<IMG src="Skin/<%=venshop_skin%>/home.gif" border=0 align="absmiddle"> 您的位置: <a href="index.asp">首页</a> >>&nbsp;购物车</td></tr>
</table>
<%if Request.Cookies("venshop")("user_name")="" and Request.Cookies("venshop")("guest")="" then
response.redirect "login.asp?comurl=buy.asp"
response.end
else
if Request.Cookies("venshop")("user_name")<>"" then
user_name=Request.Cookies("venshop")("user_name")
elseif Request.Cookies("venshop")("guest")<>"" then
user_name=Request.Cookies("venshop")("guest")
end if


if request("action")="change" then	'更改数量
if request("count")="" or Not(isNumeric(request("count"))) then
    count=1
else
    count=Cint(request("count"))
end if
basket_id=request("basket_id")
set rs=server.createobject("adodb.recordset")
sql="select hw_id,basket_count from venshop_basket where user_name='"&user_name&"' and basket_id="&basket_id&" and basket_check=0"
rs.open sql,conn,1,3
if not rs.eof then
hw_id=rs("hw_id")
set rsh=server.createobject("adodb.recordset")
sql="select hw_kucun from venshop_hw where hw_id="&hw_id&""
rsh.open sql,conn,1,1
hw_kucun=rsh("hw_kucun")
if count>hw_kucun then
Response.Write"<script language=javascript>alert('定购数量不能大于库存');window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
else
rsh.close
set rsh=nothing
rs("basket_count")=count
rs.update
end if
end if
rs.close
set rs=nothing
response.redirect "buy.asp"
response.End

elseif request("action")="del" then		'删除定购
basket_id=request("basket_id")
set rs=server.createobject("adodb.recordset")
sql="select * from venshop_basket where user_name='"&user_name&"' and basket_id="&basket_id&" and basket_check=0"
rs.open sql,conn,1,3
if rs.eof then
response.redirect "buy.asp"
response.End
else
rs.delete
rs.update
end if
rs.close
set rs=nothing
response.redirect "buy.asp"
response.End
end if
%>

<table border="0" cellpadding="0" cellspacing="0" class="useri">
<tr><td height="150">


<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
		<td align="center" class="cartshowa">商品名称</td>
		<td align="center" class="cartshowa">单价(<%=danwei%>)</td>
		<td align="center" class="cartshowa">数量</td>
		<td align="center" class="cartshowa">合计(<%=danwei%>)</td>
		<td align="center" class="cartshowa">类型</td>
		<td align="center" class="cartshowa" width="180">操作</td>
</tr>
<%set rs=server.createobject("adodb.recordset")
sql="select * from venshop_basket where user_name='"&user_name&"' and basket_check=0"
rs.open sql,conn,1,1
if rs.eof then%>
<tr><td height="50" colspan="6" align="center">你没有选择任何商品</td></tr>
<%
else
i=0
do while not rs.eof
i=i+1
%>
<form name="form1" method="POST" action="buy.asp?action=change&basket_id=<%=rs("basket_id")%>"><tr>
<td align="center" class="cartshow<%=(i mod 2)%>"><a target="_blank" href="<%if rs("tao_id")>0 then%>views_tao.asp?hw_id=<%=rs("hw_id")%>&tao_id=<%=rs("tao_id")%><%else%>views.asp?hw_id=<%=rs("hw_id")%><%end if%>"><%=rs("hw_name")%></a></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=fuhao%><%=trim(rs("hw_price"))%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><input type="text" name="count" size="2" value="<%=rs("basket_count")%>"></td>
<td align="center" class="cartshow<%=(i mod 2)%>" class="cartshow<%=(i mod 2)%>"><%=fuhao%><%=rs("basket_count")*trim(rs("hw_price"))%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=rs("kxa")%>-<%=rs("kxb")%></td>
<td align="center" class="cartshow<%=(i mod 2)%>">
<input type="submit" value="更改数量" name="B1">
<input onclick="javascript:window.open('buy.asp?action=del&basket_id=<%=rs("basket_id")%>','_self','')" type="button" value="取消定购"></td>
</tr></form>
<%totalcash=totalcash+(rs("basket_count")*trim(rs("hw_price")))
totalisbn=totalisbn+rs("basket_count")*rs("hw_jifen")
totalw=totalw+(rs("basket_count")*trim(rs("hw_weight")))
totaly=totaly+(rs("basket_count")*trim(rs("hw_yunfei")))
totalc=totalc+rs("basket_count")
rs.movenext
loop
end if
rs.close
set rs=nothing%></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td height="30" colspan="8" align="right">
<%if Request.Cookies("venshop")("user_type")="" then
zhekou=100
usertype_name="未登录用户"
zhekouyu="不享受折扣价"
else
user_type=Request.Cookies("venshop")("user_type")
set rs=server.createobject("adodb.recordset")
sql="select * from venshop_usertype where usertype_id="&user_type&""
rs.open sql,conn,1,1
if rs.eof then
zhekou=100
usertype_name="一般用户"
zhekouyu="不享受折扣价"
else
zhekou=rs("usertype_zhekou")
usertype_name=rs("usertype_name")
zhekouyu="享受原价"&zhekou&"%的折扣价"
end if
rs.close
set rs=nothing
end if%>
<p style="line-height: 200%; margin-left:5px; margin-right:15px; margin-top:5px; margin-bottom:5px">
共 <span class="price"><%=totalc%></span> 件商品&nbsp;价格总计:<span class="price"><%=fuhao%> <%=totalcash%> <%=danwei%></span>&nbsp;&nbsp;您是:<font color="#0000FF"><%=usertype_name%></font>(<%=zhekouyu%>)<br>
折后价格:<span class="price"><%=fuhao%> <%=FormatNum(totalcash*zhekou/100)%> <%=danwei%></span>&nbsp;&nbsp;获得积分:<%=totalisbn%><br>
<%if yunfei=2 then%>预计运费合计:<%=fuhao%> <%=totaly%> <%=danwei%><%elseif yunfei=3 then%>重量合计:<%=totalw%> kg<%end if%><br>
<%if mian<>0 then%><%if int(mian)>int(totalcash*zhekou/100) then%>还差<%=fuhao%><%=mian-int(totalcash*zhekou/100)%> <%=danwei%>即可免费送货!<%else%>满<%=fuhao%><%=mian%> <%=danwei%>免运费,您的订单可以免费送货!<%end if%><br><%end if%>
<input onclick="javascript:window.open('index.asp','_self','')" type="button" value="继续购物">&nbsp;
<input onclick="javascript:window.open('cash.asp','_self','')" type="button" value="现在结算"></td></tr>
</table>


</td></tr>
</table>
<%end if%>
</td></tr></table></div><!--#include file="IncAsp/venshop_copy.asp"-->