📄 gwc.asp
字号:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="BaseFun.asp"-->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function formaddtogwc_onsubmit(theForm) {
if (theForm.number.value == "")
{
alert("请输入 \"购买册数\" .");
theForm.number.focus();
return (false);
}
if ( (theForm.number.value > 1000)||(theForm.number.value < 1) )
{
alert("请重新输入 \"购买册数\" .");
theForm.number.focus();
return (false);
}
var checkOK = "0123456789";
var checkStr = theForm.number.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("请重新输入 \"购买册数\" .");
theForm.number.focus();
return (false);
}
return (true)
}
//-->
</SCRIPT>
</HEAD>
<BODY style="font-size: 9pt">
<%
ShopID=request.form("ShopID")
XHBID=request.form("XHBID")
number=request.form("number")
flag=Request("flag")
session_id=session.SessionID
select case flag
case "dele"
if ShopID="" or XHBID="" then
Response.Write "购买的过程中出现错误!"
Response.End
end if
case "upda"
if ShopID="" or XHBID="" or isnull(number) then
Response.Write "购买的过程中出现错误!"
Response.End
end if
case "new1"
if ShopID="" or XHBID="" or isnull(number) then
Response.Write "购买的过程中出现错误!"
Response.End
end if
case "new2"
if ShopID="" or XHBID="" or isnull(number) then
Response.Write "购买的过程中出现错误!"
Response.End
end if
case "brow"
'need nothing
case else
Response.Write "购买的过程中出现错误!"
Response.End
end select
set con=server.createobject("ADODB.Connection")
con.open Application("str_con")
set res=server.createobject("ADODB.Recordset")
set res.ActiveConnection = con
set res1=server.createobject("ADODB.Recordset")
set res1.ActiveConnection = con
set res2=server.createobject("ADODB.Recordset")
set res2.ActiveConnection = con
select case flag
case "dele"
con.Execute "delete tempgwc where s_id="&session_id&" and 书店ID='"&ShopID&"' and XHBID="&XHBID ,RecordsAffected,adCmdText
if con.errors.count>0 then
response.write "系统发生错误:"&con.errors(0).description
con.Close
Response.End
end if
case "upda" '修改数量
res.source="select number from tempgwc where s_id='"&session_id&"' and 书店ID='"&ShopID&"' and XHBID='"&XHBID&"'"
res.cursorlocation=3
res.LockType=3
res.open ,,adOpenDaynamic
if res.recordcount=1 then
res("number").value=number
else
Response.Write "购买的过程中出现错误!"
res.Close
con.Close
Response.End
end if
res.Update
if con.errors.count>0 then
response.write "系统发生错误:"&con.errors(0).description
res.Close
con.Close
Response.End
end if
res.close
case "new1" 'XHBID 中的书
res.source="select s_id,书店ID,XHBID,number,正书名,ISBN,定价,折扣,备注 from tempgwc where s_id='"&session_id&"' and 书店ID='"&ShopID&"' and XHBID='"&XHBID&"'"
res.cursorlocation=3
res.LockType=3
res.open ,,adOpenDaynamic
if res.recordcount>1 then
'购物车中有多本同一ID的书
Response.Write "购买的过程中出现错误!"
res.Close
con.Close
Response.End
end if
if res.recordcount=1 then
'购物车中有同一ID的书,修改数量
res("number")=number
else
if ShopID=Application("ZDID") then
res1.source="select 正书名,ISBN,定价,折扣,备注 from bookW where XHBID='"&XHBID&"'"
else
res1.source="select 正书名,ISBN,定价,折扣,备注 from JMSDw where 书店ID='"&ShopID&"' and XHBID='"&XHBID&"'"
end if
res1.cursorlocation=3
res1.open
if res1.recordcount<>1 then
Response.Write "购买的过程中出现错误!"
res.Close
res1.Close
con.Close
Response.End
end if
res.AddNew
res("s_id").value=session_id
res("书店ID").value=ShopID
res("XHBID").value=XHBID
res("number").value=number
zsm=res1("正书名")
res("正书名").value=zsm
isbn=res1("ISBN")
res("ISBN").value=isbn
zk=res1("折扣")
res("折扣").value=zk
bz=res1("备注")
res("备注").value=bz
dj=getPrice(res1("定价"))
if isnumeric(dj) then
res("定价").value=dj
else
Response.Write "购买的过程中出现错误!"
res.Close
res1.Close
con.Close
Response.End
end if
res1.Close
end if 'res.recordcount=1
res.Update
if con.errors.count>0 then
response.write "系统发生错误:"&con.errors(0).description
res.Close
con.Close
Response.End
end if
res.close
case "new2" '老数据 中的书
case "brow" '浏览购物车
'do nothing
case else
Response.Write "购买的过程中出现错误!"
con.Close
Response.End
end select
%>
<p align="center"><font size="4">购物车</font></p>
<p></p>
<%
res.source="select XHBID from tempgwc where s_id='"&session_id&"'"
res.cursorlocation=3
res.open ,,adOpenDaynamic
if res.recordcount<1 then %>
<p> 购物车中没有书籍!</p>
<%
Res.close
con.Close
Response.End
end if
Res.close
%>
<%
'以下计算和显示 总店 的书
res.source="select XHBID from tempgwc where s_id='"&session_id&"' and 书店ID='"&Application("ZDID")&"'"
res.cursorlocation=3
res.open ,,adOpenDaynamic
if res.recordcount>0 then %>
<table border="0" width="100%" style="font-size: 9pt">
<tr>
<td width="100%">尊敬的顾客,您在本站购书可享受如下<font color="#FF0000">优惠</font>:</td>
</tr>
<tr>
<td width="100%">一次性购买 <strong> 非打折书 </strong> 500元(含)以下,享受<font color="#FF0000">8折</font>优惠;</td>
</tr>
<tr>
<td width="100%">一次性购买 <strong> 非打折书 </strong> 500元以上、1000元(含)以下,享受<font color="#FF0000">75折</font>优惠;</td>
</tr>
<tr>
<td width="100%">一次性购买 <strong> 非打折书 </strong> 1000元以上,享受<font color="#FF0000">73折</font>优惠。</td>
</tr>
</table>
<p></p><p></p>
<table border="0" width="100%" style="font-size: 12pt">
<tr>
<td width="100%"><font color="#FF0000">对特价书(已经打折的书),不再享受以上优惠</font></td>
</tr>
</table>
<p></p><p></p>
<div align="center"><center>
<table border="0" width="100%" style="font-size: 9pt">
<tr align="center">
<td bgcolor="yellow"><strong>购买</strong></td>
<td bgcolor="yellow"><strong>书名</strong></td>
<td bgcolor="yellow"><strong>单价(元)</strong></td>
<td bgcolor="yellow"><strong>折扣</strong></td>
<td bgcolor="yellow"><strong>总价(元)</strong></td>
<td bgcolor="yellow"><strong>ISBN</strong></td>
<td bgcolor="yellow"><strong>备注</strong></td>
<td bgcolor="yellow"><strong>取消购买</strong></td>
</tr>
<%
'///////////////////计算和显示 总店的 特价书
res1.source="select XHBID ,number, 正书名,ISBN,定价,折扣,备注 from tempgwc where s_id='"&session_id&"' and 书店ID='"&Application("ZDID")&"' and 折扣 IS NOT NULL ORDER BY 折扣 desc"
res1.cursorlocation=3
res1.open ,,adOpenDaynamic
tot1=0.0 '实洋
tot1_zk=0.0 '实收
if res1.recordcount>0 then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -