📄 shopping.asp
字号:
<!--#include file="connection.asp"-->
<%if request.cookies("bookshop")("username")="" then
'response.Redirect "login.asp"
response.write "<script language=javascript>window.location.reload('login.asp')</script>"
response.End
end if%>
<!--#include file="webconfig.asp"-->
<html>
<head>
<title><%=webname%>--我要下订单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/default.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
<table width="96%" border="0" align="center" cellpadding="2" cellspacing="1">
<tr>
<td><img src="images/dingdan.gif" width="266" height="43"></td>
</tr>
</table>
<%dim bookid,action,i,sendmailZ
action=request.QueryString("action")
if request.QueryString("id")="" then
bookid=request("bookid")
else
bookid=replace(request.QueryString("id"),"'","")
end if
if bookid="" then
response.write "<script language=javascript>alert('对不起,您没有选择商品!');window.location.reload('javascript:window.close()')</script>"
response.End
end if
select case action
'//////////////////////////////////
case ""
set rs=conn.execute("select bookid,bookname,shichangjia,huiyuanjia,tuantijia,tuantidazhe,dazhe from shop_books where bookid in ("&bookid&") order by bookid")%>
<table width="96%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
<form name="form1" method="post" action="">
<tr bgcolor="#FF8E19">
<td><div align="center"><font color="#FFFFFF">商品名称</font></div></td>
<td bgcolor="#FF8E19"><div align="center"><font color="#FFFFFF">市场价</font></div></td>
<td bgcolor="#FF8E19"><div align="center"><font color="#FFFFFF">
<%if request.cookies("bookshop")("grtt")=1 then response.write "团体价" else response.write "会员价" end if%>
</font></div></td>
<td bgcolor="#FF8E19"><div align="center">
<blockquote>
<font color="#FFFFFF">折 扣</font>
</blockquote>
</div></td>
<td bgcolor="#FF8E19"><div align="center"><font color="#FFFFFF">数 量</font></div></td>
<td bgcolor="#FF8E19"><div align="center"><font color="#FFFFFF">小 计</font></div></td>
<td bgcolor="#FF8E19"><div align="center"><font color="#FFFFFF">修改数量</font></div></td>
</tr>
<%dim iii '定义总价
iii=0
dim bookscount,books '定义判断有几个bookid
bookscount=request.QueryString("id").count
do while not rs.eof
dim quatity '判断input 名
Quatity = CInt( Request( "ckxp"&rs("bookid")) )
If Quatity <=0 Then Quatity = 1
%>
<tr bgcolor="#FDE6A4">
<td STYLE='PADDING-LEFT: 5px'><%=trim(rs("bookname"))%> <input type=hidden name=bookname value=<%=trim(rs("bookname"))%>></td>
<td><div align="center"><%=formatnumber(rs("shichangjia"),2)&"元"%></div></td>
<td><div align="center">
<% if request.cookies("bookshop")("grtt")=1 then response.write formatnumber(rs("tuantijia"),2)&"元" else response.write formatnumber(rs("huiyuanjia"),2)&"元" end if%>
</div></td>
<input type=hidden name=huiyuanjia value=<%=rs("huiyuanjia")%>>
<input type=hidden name=tuantijia value=<%=rs("tuantijia")%>>
<td><div align="center">
<%if request.cookies("bookshop")("grtt")=1 then
response.write formatnumber(rs("tuantidazhe")*100,2)&"%"
else
response.write formatnumber(rs("dazhe")*100,2)&"%"
end if%>
</div></td>
<td><div align="center">
<input name="<%="ckxp"& rs("bookid")%>" type="text" size="3" value="<%=Quatity%>" onkeypress= "return regInput(this, /^[0-9]*$/, String.fromCharCode(event.keyCode))"onpaste = "return regInput(this,/^[0-9]*$/, window.clipboardData.getData('Text'))"ondrop= "return regInput(this,/^[0-9]*$/,event.dataTransfer.getData('Text'))">
</div></td>
<td><div align="center">
<%select case request.cookies("bookshop")("grtt")
case "0","2"
if Quatity<=1 then
response.write formatnumber(rs("huiyuanjia")*1,2)&"元"
else
response.write formatnumber(rs("huiyuanjia")*Quatity,2)&"元"
end if
case "1"
if Quatity<=1 then
response.write formatnumber(rs("tuantijia")*1,2)&"元"
else
response.write formatnumber(rs("tuantijia")*Quatity,2)&"元"
end if
end select
if request.cookies("bookshop")("grtt")=1 then
iii=formatnumber(rs("tuantijia")*Quatity+iii,2 )
else
iii=formatnumber(rs("huiyuanjia")*Quatity+iii,2 )
end if
%>
</div></td>
<td><div align="center">
<input type="submit" name="Submit" value="修改" onclick="this.form.action='shopping.asp?id=<%=bookid%>';this.form.submit()">
</div></td>
</tr>
<%if bookscount=1 then books=rs("bookid")
rs.movenext
loop
rs.close
set rs=nothing%>
<tr bgcolor="#FDE6A4">
<td height="18" colspan="7" ><div align="right"><font color="#FF0000">总计:<%=iii%>元 </font></div></td>
<input type=hidden value=<%=iii%> name=gouwuzonger>
</tr>
<tr bgcolor="#FDE6A4">
<td height="32" colspan="7" ><div align="center">
<input type="submit" name="Submit2" value="下一步" onclick="this.form.action='?action=ckxp1&id=<%=bookid%>';this.form.submit()" >
<%if bookscount=1 then%>
<input type="button" name="Submit22" value="放入收藏架" onClick="location.href='shoucang.asp?id=<%=books%>&action=add'">
<%end if%>
</div></td>
</tr>
</form>
</table>
<%
'/////////////////////////////////////////
case "ckxp1"
'response.Write bookid
set rs=conn.execute("select shouname,userid,shousex,useremail,shengshi,shouhuodizhi,youbian,usertel,zhifufangshi,songhuofangshi,userzhenshiname from [shop_users] where username='"&request.cookies("bookshop")("username")&"'")
dim userid
userid=rs("userid")%>
<table width="96%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
<form name="shouhuoxx" method="post" action="shopping.asp?action=ok&id=<%=bookid%>&userid=<%=userid%>">
<%dim rs2
set rs2=server.CreateObject("adodb.recordset")
'付值某图书的数量
rs2.open "select bookid from shop_books where bookid in ("&bookid&") order by bookid",conn,1,1
do while not rs2.eof
if len(request("ckxp"&rs2("bookid")))>3 then
response.write "<script language=javascript>alert('对不起,您不可以对某种商品选择过多的订购数量!');window.location.reload('javascript:history.go(-1)')</script>"
response.End
end if
%>
<input name="<%="ckxp"&rs2("bookid")%>" type="hidden" value="<%=cint(request("ckxp"&rs2("bookid")))%>">
<%
rs2.movenext
loop
rs2.close
set rs2=nothing%>
<input name=gouwuzonger value=<%=request("gouwuzonger")%> type=hidden>
<tr bgcolor="#FDE6A4">
<td width="166" STYLE='PADDING-LEFT: 20px'>收货人姓名:</td>
<td width="600" height="28" STYLE='PADDING-LEFT: 20px'><input name="shouhuoname" type="text" id="shouhuoname" size="12" value=<%=trim(rs("shouname"))%>>
性 别:
<select name="shousex" id="shousex">
<%select case rs("shousex")
case ""
response.write "<option value=0 selected>男</option><option value=1>女</option>"
case "0"
response.write "<option value=0 selected>男</option><option value=1>女</option>"
case "1"
response.write "<option value=0 >男</option><option value=1 selected>女</option>"
end select%>
</select> <input type=hidden name=userzhenshiname value=<%=trim(rs("userzhenshiname"))%>> </td>
</tr>
<tr bgcolor="#FDE6A4">
<td STYLE='PADDING-LEFT: 20px'><%if request.Cookies("bookshop")("grtt")=1 then
response.Write "公司所在省/市:"
else
response.Write "收货人省/市:"
end if%></td>
<td height="28" STYLE='PADDING-LEFT: 20px'><input name="shengshi" type="text" id="shengshi" value=<%=trim(rs("shengshi"))%>></td>
</tr>
<tr bgcolor="#FDE6A4">
<td STYLE='PADDING-LEFT: 20px'><%if request.Cookies("bookshop")("grtt")=1 then
response.Write "公司地址:"
else
response.Write "详细地址:"
end if%></td>
<td height="28" STYLE='PADDING-LEFT: 20px'><input name="shouhuodizhi" type="text" id="shouhuodizhi" size="40" value=<%=trim(rs("shouhuodizhi"))%>>
<%if request.Cookies("bookshop")("grtt")=1 then response.Write "(收货地址)"%></td>
</tr>
<tr bgcolor="#FDE6A4">
<td STYLE='PADDING-LEFT: 20px'>地址类别:</td>
<td height="28" STYLE='PADDING-LEFT: 20px'><select name="dizhileixing" id="dizhileixing">
<option value="家庭住址" <%if request.cookies("bookshop")("grtt")<>1 then response.write "selected"%>>家庭住址</option>
<option value="单位地址" <%if request.cookies("bookshop")("grtt")=1 then response.write "selected"%>>单位地址</option>
</select>
(节假日送货时间顺延)</td>
</tr>
<tr bgcolor="#FDE6A4">
<td STYLE='PADDING-LEFT: 20px'>邮编:</td>
<td height="28" STYLE='PADDING-LEFT: 20px'> <%response.write "<input name=youbian type=text id=youbian maxlength='6' onkeypress = ""return regInput(this, /^[0-9]*$/, String.fromCharCode(event.keyCode))"" onpaste= ""return regInput(this,/^[0-9]*$/, window.clipboardData.getData('Text'))"" ondrop= ""return regInput(this, /^[0-9]*$/, event.dataTransfer.getData('Text'))"" value="&cstr(rs("youbian"))&">"%></td>
</tr>
<tr bgcolor="#FDE6A4">
<td STYLE='PADDING-LEFT: 20px'><%if request.Cookies("bookshop")("grtt")=1 then
response.Write "公司电话:"
else
response.Write "电话:"
end if%></td>
<td height="28" STYLE='PADDING-LEFT: 20px'><input name="usertel" type="text" id="usertel" size="12" value=<%=trim(rs("usertel"))%>></td>
</tr>
<tr bgcolor="#FDE6A4">
<td STYLE='PADDING-LEFT: 20px'><%if request.Cookies("bookshop")("grtt")=1 then
response.Write "公司邮箱:"
else
response.Write "电子邮件:"
end if%></td>
<td height="28" STYLE='PADDING-LEFT: 20px'><input name="useremail" type="text" id="useremail" value=<%=trim(rs("useremail"))%>></td>
</tr>
<%=trim(request("useremail"))%>
<tr bgcolor="#FDE6A4">
<td height="32" STYLE='PADDING-LEFT: 20px'>配送方式:</td>
<td height="28" STYLE='PADDING-LEFT: 20px'> <%dim rs3
'//////////判断送货方式
set rs3=server.CreateObject("adodb.recordset")
rs3.Open "select * from shop_songhuo where fangshi=0 order by songidorder",conn,1,1
response.Write "<select name=songhuofangshi size="&rs3.recordcount&" id=songhuofangshi>"
do while not rs3.EOF
response.Write "<option value="&rs3("songid")
if int(rs("songhuofangshi"))=int(rs3("songid")) then
response.Write " selected>"
else
response.Write ">"
end if
response.Write trim(rs3("subject"))&"</option>"
rs3.MoveNext
loop
response.Write "</select>"
rs3.Close
set rs3=nothing
%> </td>
</tr>
<tr bgcolor="#FDE6A4">
<td height="32" STYLE='PADDING-LEFT: 20px'>支付方式:</td>
<td height="28" STYLE='PADDING-LEFT: 20px'> <%
'//////////判断支付方式
'//判断用户预付款
dim yufu,yufukuan
set yufu=server.CreateObject("adodb.recordset")
yufu.open "select yufukuan from [shop_users] where username='"&request.cookies("bookshop")("username")&"' ",conn,1,1
if ccur(yufu("yufukuan"))>ccur(request("gouwuzonger")) then yufukuan="yes"
yufu.close
set yufu=nothing
set rs3=server.CreateObject("adodb.recordset")
rs3.open "select * from shop_songhuo where fangshi=1 order by songidorder",conn,1,1
if yufukuan="yes" then '//如果预付款够
response.Write "<select name=zhifufangshi size="&rs3.recordcount+1&" id=zhifufangshi>"
response.write "<option value=9999 selected>使用预付款</option>"
do while not rs3.eof
response.Write "<option value="&rs3("songid")&">"&trim(rs3("subject"))&"</option>"
rs3.movenext
loop
response.Write "</select>"
else '//如果预付款不够
response.Write "<select name=zhifufangshi size="&rs3.recordcount&" id=zhifufangshi>"
do while not rs3.eof
response.Write "<option value="&rs3("songid")
if int(rs("zhifufangshi"))=int(rs3("songid")) then
response.Write " selected>"
else
response.Write ">"
end if
response.Write trim(rs3("subject"))&"</option>"
rs3.movenext
loop
response.Write "</select>"
end if
rs3.close
set rs3=nothing
rs.close
set rs=nothing%> </select></td>
</tr>
<tr bgcolor="#FDE6A4">
<td height="32" STYLE='PADDING-LEFT: 20px'>配送说明:</td>
<td height="28" bgcolor="#FDE6A4" STYLE='PADDING-LEFT: 20px'><input type="radio" name="fangshi" value="0">
需电话确认,配送时间:
<input name="time1" type="text" id="time1" value="9:00am-18:00pm" size="14">
<br>
<input name="fangshi" type="radio" value="1" checked>
无需电话确认,直接配送,配送日期范围:
<input name="date2" type="text" id="date2" value=" 月 日- 月 日" size="16">
<br>
配送时间:
<input name="time2" type="text" id="time2" value="9:00am-18:00pm" size="14"></td>
</tr>
<tr bgcolor="#FDE6A4">
<td height="32" STYLE='PADDING-LEFT: 20px'>简单留言:</td>
<td height="28" STYLE='PADDING-LEFT: 20px'><textarea name="liuyan" cols="40" rows="5" id="liuyan">可填写其他联系方式,比如手机。或需要开发票,请将票头写出来。</textarea></td>
</tr>
<tr bgcolor="#FF8E19">
<td height="32" colspan="2" STYLE='PADDING-LEFT: 20px'><%if request.cookies("bookshop")("grtt")=1 then%> <input type="submit" name="Submit3" value="提交订单" onClick="return companyssxx();" id=dddd>
<%else%> <input type="submit" name="Submit3" value="提交订单" onClick="return ssxx();" id=ddd>
<%end if%> </td>
</tr>
</form>
</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
function regInput(obj, reg, inputStr)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -