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

📄 shop_bag.asp

📁 漂亮的企业网站系统v11 1、整体修改了上一版的一些BUG。 2、修改了页面底部的统计形式。 3、修改了“公告更新”栏目
💻 ASP
字号:
<!-- #include file="include/config_shop.asp" -->
<!-- #include file="include/conn.asp" -->
<%
dim pid,num,sum,buttoncan,shop_session,sdim,snum,tid,tnum,tprice,tprices
tit="购 物 车"

call web_head(0,0,0,0,0)

shop_session=trim(request.cookies(web_cookies)("shop"))
pid=trim(request.querystring("id"))
if isnumeric(pid) then
  sql="select name from product where hidden=1 and id="&pid
  set rs=conn.execute(sql)
  if not(rs.eof and rs.bof) then
    if len(shop_session)<1 then
      shop_session=pid&",1"
    else
      if int(instr("#"&shop_session,"#"&pid&","))<1 then
        shop_session=shop_session&"#"&pid&",1"
      end if
    end if
    response.cookies(web_cookies)("shop")=shop_session
    if request.cookies(web_cookies)("iscookies")="yes" then
      response.cookies(web_cookies).expires=date+365
    end if
  end if
  rs.close:set rs=nothing
end if

action=trim(request.querystring("action"))
select case action
case "shopbag"
  shop_session=""
  pid=replace(trim(request.form("pid")),", ",",")
  sdim=split(pid,",")
  snum=ubound(sdim)
  for i=0 to snum
    tnum=trim(request.form("num"&sdim(i)))
    if not(isnumeric(tnum)) then tnum=1
    if len(shop_session)<1 then
      shop_session=sdim(i)&","&tnum
    else
      if int(instr("#"&shop_session,"#"&sdim(i)&","))<1 then
        shop_session=shop_session&"#"&sdim(i)&","&tnum
      end if
    end if
    response.cookies(web_cookies)("shop")=shop_session
    if request.cookies(web_cookies)("iscookies")="yes" then
      response.cookies(web_cookies).expires=date+365
    end if
  next
  erase sdim
case "clear"
  shop_session=""
  response.cookies(web_cookies)("shop")=shop_session
  if request.cookies(web_cookies)("iscookies")="yes" then
    response.cookies(web_cookies).expires=date+365
  end if
end select
'------------------------------------left----------------------------------
call format_login()
call shop_sort()
call shop_left()
'----------------------------------left end--------------------------------
call web_center(0)
'-----------------------------------center---------------------------------
response.write ukong
%>
<table border=0><tr><td class=red height=30>以下是您所选购的物品清单</td></tr></table>
<%response.write table1%>
<tr height=22<%response.write table2%> align=center background="IMAGES/<%response.write web_var(web_config,5)%>/bg_td.gif"> 
<td width='6%' class=end><b>购买</td>
<td width='22%' class=end><b>产品编号</td>
<td width='38%' class=end><b>产品名称</td>
<td width='12%' class=end><b>产品单价</td>
<td width='10%' class=end><b>数量</td>
<td width='12%' class=end><b>产品总价</td>
</tr>
<form name=shop_frm action='shop_bag.asp?action=shopbag' method=post>
<%
sum=0
buttoncan=" disabled"
sdim=split(shop_session,"#")
snum=ubound(sdim)
for i=0 to snum
  tid=left(sdim(i),instr(sdim(i),",")-1)
  tnum=right(sdim(i),len(sdim(i))-instr(sdim(i),","))
  sql="select serial,name,price_1,price_2 from product where hidden=1 and id="&tid
  set rs=conn.execute(sql)
  if not(rs.eof and rs.bof) then
    if login_mode="" then
      tprice=rs("price_1")
    else
      tprice=rs("price_2")
    end if
    tprices=tprice*tnum
    sum=sum+tprices
%>
<tr align=center<%response.write table3%>> 
<td><input type=checkbox name=pid value='<%response.write tid%>' checked class=bg_1></td>
<td><%response.write rs("serial")%></td>
<td><%response.write rs("name")%></td>
<td><%response.write tprice%>&nbsp;</td>
<input type=hidden name=numm<%response.write tid%> value='<%response.write tnum%>'>
<td><input type=text name=num<%response.write tid%> value='<%response.write tnum%>' size=4 onKeyUp="javascript:shop_checknum(num<%response.write tid%>,numm<%response.write tid%>);"></td>
<td><%response.write tprices%></td>
</tr>
<%
    buttoncan=""
  end if
  rs.close:set rs=nothing
next
erase sdim
%>
<tr<%response.write table4%>><td align=right colspan=6 height=25 class=red>总价格:&nbsp;<%response.write sum%>&nbsp;&nbsp;&nbsp;</td></tr>
<tr<%response.write table3%>><td colspan=6 align=center height=40>
<input type=submit value='确认更改'<%response.write buttoncan%>>&nbsp;&nbsp;
<input type=button value='继续购物' onclick="location.href='shop.asp';">&nbsp;&nbsp;
<input type=button value='清空购物车' onclick="javascript:shop_clear();"<%response.write buttoncan%>>&nbsp;&nbsp;
<input type=button value='去收银台' onclick="location.href='shop_pay.asp';"<%response.write buttoncan%>>
</td></tr>
</form>
</table>
<script language="Javascript">
<!--
function shop_fucchecknum(num)
{
  var i,j,strTemp="0123456789";
  if (num.length== 0)
    return 0
  for (i=0;i<num.length;i++)
  {
    j=strTemp.indexOf(num.charAt(i));  
    if (j==-1)
      return 0;
  }
  return 1;
}

function shop_clear(){ 
  if (confirm("确定要清空购物车?")==1){
  window.location.href="shop_bag.asp?action=clear"}
}

function shop_checknum(num1,num2) 
{
  if ((shop_fucchecknum(num1.value)==0) )
  {  
    num1.value=num2.value;
    return false;
  }
}

function shop_checknumnull(num1) {
  if (num1.value=="")
  {  
    alert("请填写购买产品的数量");
    theform.focus();
    return false;
  }
}
//-->
</SCRIPT>
<table border=0><tr><td class=red height=30>注意:改变商品数量和减少商品种类需按“确认更改”按钮</td></tr></table>
<%
'---------------------------------center end-------------------------------
call web_end(0)
%>

⌨️ 快捷键说明

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