📄 shop_pay.asp
字号:
<!-- #include file="include/con_shop.asp" -->
<!-- #include file="include/jk_email.asp" -->
<!-- #include file="include/jk_md5.asp" -->
<%
dim shop_session,sdim,ssum
shop_session=trim(request.cookies(joekoe_cms.web_cookies)("bag_"&n_sort))
tit="收 银 台"
call web_head(0,0,0,0,0)
call shop_load()
'----------------------------左边 开始----------------------------
call shop_left()
call shop_left_nsort(0)
call shop_top(10,10)
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
call shop_bag_close()
if var_null(shop_session)="" then
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td align=center><b><%response.write tit%> 错误</b></td></tr>
<tr class=bg_td><td align=center height=150><font class=red>您目前好像还没有选购<%response.write web_dim(44)%>!</font><br><br><input type=button value='点击继续购物' onClick="javascript:window.location.href='shop.asp';"></td></tr>
</table>
<%
else
select case action
case "pay"
call shop_pay_chk()
case else
call shop_pay_bag()
call shop_pay_type()
end select
end if
response.write ukong
'----------------------------中间 结束----------------------------
call shop_end()
call web_end(0,0)
sub shop_pay_chk()
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td align=center><b><%response.write tit%> 生成订单</b></td></tr>
<%
if not joekoe_cms.chk() then
response.write "<tr class=bg_td><td height=100 align=center><font class=red>"&web_nopost&"</font></td></tr>"
response.write vbcrlf&"</table>"
exit sub
end if
dim oid,ordernum,isuser,nname,address,code,phone,email,payment,payment2,remark,carry_num,dim_carry,carry,carry_price,ispayment,ispay,found_err,p_order_true
nname=joekoe_cms.code_form(request.form("nname"))
address=joekoe_cms.code_form(request.form("address"))
code=joekoe_cms.code_form(request.form("code"))
phone=joekoe_cms.code_form(request.form("phone"))
email=joekoe_cms.code_form(request.form("email"))
payment=joekoe_cms.code_form(request.form("payment"))
remark=joekoe_cms.code_form(request.form("remark"))
remark=left(remark,250)
carry_num=trim(request.form("carry_num"))
if not isnumeric(carry_num) then carry_num=0
found_err=""
if nname="" or address="" then
found_err=found_err&"+请输入 <font class=red>收货人姓名</font> 和 <font class=red>收货人地址</font>!<br>"
end if
if not isnumeric(code) or len(code)<>6 then
found_err=found_err&"+请输入正确格式的 <font class=red>邮政编码</font>!<br>"
end if
if phone="" then
found_err=found_err&"+请输入 <font class=red>联系电话</font> 等信息!<br>"
end if
if email_ok(email,50)=false then
found_err=found_err&"+请输入正确格式的 <font class=red>电子信箱</font>!<br>"
end if
if found_err<>"" then
response.write found_error(found_err,240)
response.write vbcrlf&"</table>"
exit sub
end if
isuser=0
carry=""
ispayment=0
ispay=0
if login_mode<>"" then isuser=1
dim_carry=split(web_dim(48),":")
if int(carry_num)>ubound(dim_carry) then carry_num=0
for i=0 to ubound(dim_carry)
if int(i)=int(carry_num) then
carry=left(dim_carry(i),instr(dim_carry(i),",")-1)
carry_price=right(dim_carry(i),len(dim_carry(i))-instr(dim_carry(i),","))
exit for
end if
next
erase dim_carry
if carry="" or not isnumeric(carry_price) then
carry="未设定"
carry_price=0
end if
payment2=payment
if payment="onlinepay" then
payment="在线支付"
ispayment=1
end if
ordernum=joekoe_cms.time_type(joekoe_cms.now_time,11)
p_order_true=true
sql="select top 1 id from shop_orders where ordernum='"&ordernum&"'"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then p_order_true=false
rs.close
if p_order_true=false then
response.write "<tr class=bg_td><td height=100 align=center><font class=red>对不起,购买"&web_dim(44)&"的用户太多,请稍候再提交购买!</font></td></tr>"
response.write vbcrlf&"</table>"
exit sub
end if
sql="insert into shop_orders(username,isuser,ordernum,nname,address,code,phone,email,payment,remark,tim,types,carry,carry_price,ispayment,ispay) " & _
"values ('"&login_username&"',"&isuser&",'"&ordernum&"','"&nname&"','"&address&"','"&code&"','"&phone&"','"&email&"','"&payment&"','"&remark&"','"&joekoe_cms.now_time&"',0,'"&carry&"',"&carry_price&","&ispayment&","&ispay&")"
call joekoe_cms.exec(sql,0)
oid=first_id("shop_orders","id")
dim pid,n_serial,n_price,n_name,n_discount,n_num
ssum=carry_price
sdim=split(shop_session,",")
for i=0 to ubound(sdim)
pid=left(sdim(i),instr(sdim(i),"$")-1)
n_num=right(sdim(i),len(sdim(i))-instr(sdim(i),"$"))
if isnumeric(pid) and joekoe_cms.int_true(n_num) then
sql="select top 1 name,serial,price,discount,is_emoney,emoney from shop_product where hidden=1 and id="&pid
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
n_name=joekoe_cms.code_form(rs("name"))
n_serial=joekoe_cms.code_form(rs("serial"))
n_price=rs("price")
n_discount=rs("discount")
ssum=ssum+fm_price(n_price*(n_discount/100),1)*n_num
sql="insert into shop_oorders(oid,pid,serial,name,price,discount,num) " & _
"values("&oid&","&pid&",'"&n_serial&"','"&n_name&"',"&n_price&","&n_discount&","&n_num&")"
call joekoe_cms.exec(sql,0)
call joekoe_cms.exec("update shop_product set buy_counter=buy_counter+1 where id="&pid,0)
end if
rs.close
end if
next
erase sdim
call joekoe_cms.exec("update shop_orders set prices="&ssum&" where id="&oid,0)
response.cookies(joekoe_cms.web_cookies)("bag_"&n_sort)=""
%>
<tr class=bg_td><td align=center height=50>恭喜:订单已经成功递交!订单号:<font size=3 class=red><b><%response.write ordernum%></b></font></td></tr>
<tr class=bg_td><td align=center>确认您的货款后,我们将按您的运送方式向您发货或与您联系。</td></tr>
<tr class=bg_td><td align=center>请牢记您的订单号(<font class=red><%response.write ordernum%></font>),以便查询!</td></tr>
<tr class=bg_td><td align=center height=50><input type=button value='继续购物' onClick="javascript:window.location.href='shop.asp';">
<%
if int(ispayment)=1 then
dim puser
puser=login_username
if login_mode="" then
puser="_"&nname
end if
response.write " <input type=button value='在线支付' onClick=""javascript:joekoe_online_pay();"">"
dim obj_pay
set obj_pay=new joekoe_pay
obj_pay.pay_sort="shop"
obj_pay.pay_username=puser
obj_pay.pay_address=address
obj_pay.pay_post=code
obj_pay.pay_phone=phone
obj_pay.pay_email=email
obj_pay.pay_carry=carry&"("&carry_price&"元)"
obj_pay.pay_remark=remark
obj_pay.back_url=joekoe_cms.own_http()&"pay_return_shop.asp"
obj_pay.pay_ordernum=ordernum
obj_pay.pay_amount=ssum
call obj_pay.pay_frm(1)
set obj_pay=nothing
end if
%>
</td></tr>
</table>
<%
end sub
sub shop_pay_type()
%>
<script language=javascript>
<!--
function pay_frm_submit(nfrm)
{
if (nfrm.nname.value.length==0)
{
alert("请输入收货人姓名!");
nfrm.nname.focus();
return false;
}
if (nfrm.address.value.length==0)
{
alert("请输入收货人具体地址!");
nfrm.address.focus();
return false;
}
if (nfrm.code.value.length==0)
{
alert("请输入邮政编码!");
nfrm.code.focus();
return false;
}
if (nfrm.phone.value.length==0)
{
alert("请输入联系电话!");
nfrm.phone.focus();
return false;
}
if (nfrm.email.value.length==0)
{
alert("请输入电子邮件!");
nfrm.email.focus();
return false;
}
var cf=window.confirm("您确定填写的收货信息准确无误吗?\n\n提交生成订单后将不可更改!");
if (cf)
{ return true; }
else
{ return false; }
}
-->
</script>
<table cellspacing=1 cellpadding=4 class=table>
<form name=shop_pay_frm action='?action=pay' method=post onsubmit="javascript:frm_submitonce(this);">
<input type=hidden name=chk value='yes'>
<tr><td colspan=2 class=td align=center><b><%response.write tit%> 填写收货信息</b></td></tr>
<tr class=bg_td>
<td width='20%'>收货人姓名:</td>
<td width='80%'><input type=text name=nname value='<%response.write login_username%>' size=20 maxLength=20><%if login_mode<>"" then response.write " <font class=red>(会员:"&login_username&")</font>"%></td>
</tr>
<tr class=bg_td>
<td>收货人地址:</td>
<td><input type=text name=address size=50 maxLength=200></td>
</tr>
<tr class=bg_td>
<td>邮政编码:</td>
<td><input type=text name=code size=15 maxLength=6></td>
</tr>
<tr class=bg_td>
<td>联系电话:</td>
<td><input type=text name=phone size=30 maxLength=20></td>
</tr>
<tr class=bg_td>
<td>电子信箱:</td>
<td><input type=text name=email size=30 maxLength=50></td>
</tr>
<tr class=bg_td>
<td>付款方式:</td>
<td>
<select type=text name=payment>
<option value='onlinepay'>在线支付 ☆推荐☆</option>
<option value='银行转帐'>银行转帐</option>
<option value='邮局汇款'>邮局汇款</option>
<option value='现金支付'>现金支付</option>
</select></td>
</tr>
<tr class=bg_td>
<td>运送方式:</td>
<td>
<table border=0>
<%
dim dim_carry,carry,carry_price
carry="未设定"
carry=0
dim_carry=split(web_dim(48),":")
for i=0 to ubound(dim_carry)
carry=left(dim_carry(i),instr(dim_carry(i),",")-1)
carry_price=right(dim_carry(i),len(dim_carry(i))-instr(dim_carry(i),","))
response.write vbcrlf&" <tr><td><input type=radio name=carry_num value='"&i&"'"
if i=0 then response.write " checked"
response.write " class=bg_td>"&carry&"("
if int(carry_price)=0 then
response.write "免费"
else
response.write "加"&carry_price&web_dim(45)
end if
response.write ")</td></tr>"
next
erase dim_carry
%>
</table>
</td>
</tr>
<tr class=bg_td>
<td valign=top><br>备注信息:<br><=250</td>
<td><textarea name=remark cols=50 rows=5></textarea></td>
</tr>
<tr class=bg_tds><td colspan=2 align=center height=40><input type=button value='返回上一步' onclick="javascript:window.history.go(-1);"> <input type=submit value='执行下一步' onclick="javascript:return pay_frm_submit(this.form);"></td></tr>
</form>
</table>
<%
end sub
sub shop_pay_bag()
dim nid,nnum,price,price_now,discount,name,ds
ssum=0
ds=" disabled"
sdim=split(shop_session,",")
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr class=bg><td colspan=7 height=30 align=center><font class=red>以下是您所选购的<%response.write web_dim(44)%>清单</font></td></tr>
<tr height=22 align=center>
<td width='8%' class=td>序号</td>
<td width='38%' class=td><%response.write web_dim(44)%>名称</td>
<td width='8%' class=td>数量</td>
<td width='13%' class=td>原价(<%response.write web_dim(45)%>)</td>
<td width='8%' class=td>折扣</td>
<td width='13%' class=td>现价(<%response.write web_dim(45)%>)</td>
<td width='12%' class=td><%response.write web_dim(9)%>支付</td>
</tr>
<%
for i=0 to ubound(sdim)
nid=left(sdim(i),instr(sdim(i),"$")-1)
nnum=right(sdim(i),len(sdim(i))-instr(sdim(i),"$"))
if isnumeric(nid) and joekoe_cms.int_true(nnum) then
sql="select top 1 name,serial,price,discount,is_emoney,emoney from shop_product where hidden=1 and id="&nid
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
name=joekoe_cms.code_html(rs("name"),1,0)
price=fm_price(rs("price"),1)
discount=rs("discount")
price_now=fm_price(price*(discount/100),1)
discount=fm_discount(discount)
ssum=ssum+price_now*nnum
%>
<tr class=bg_td align=center>
<td><%response.write i+1%></td>
<td align=left><a href='###' alt='<%response.write web_dim(44)%>编号:<%response.write rs("serial")%><br>点击浏览<%response.write web_dim(44)%>详细信息' onclick="javascript:open_view('shop_view.asp?id=<%response.write nid%>',1);"><%response.write name%></a></td>
<td><%response.write nnum%></td>
<td align=right><%response.write price%></td>
<td>
<%
if discount=fm_discount(100) then
response.write "<font class=gray>"&discount&"</font>"
else
response.write "<font class=red2>"&discount&"</font>"
end if
%>
</td>
<td align=right><font class=blue><%response.write price_now%></font></td>
<td>
<%
if rs("is_emoney") then
response.write rs("emoney")
else
response.write "<font class=gray>不可用</font>"
end if
%>
</td>
</tr>
<%
ds=""
end if
rs.close
end if
next
%>
<tr class=bg_tds><td colspan=7 height=30 align=right>
<%
if ds="" then
response.write "您所选购的"&web_dim(44)&"总的有效金额:<font class=red>"&fm_price(ssum,1)&"</font> "&web_dim(45)
else
response.write "您目前还没有选购"&web_dim(44)
end if
%>
</td></tr>
</table>
<%
erase sdim
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -