📄 shop_emoney_pay.asp
字号:
<!-- #include file="include/con_shop.asp" -->
<!-- #include file="include/jk_email.asp" -->
<!-- #include file="include/jk_val_code.asp" -->
<%
dim p_id,psort
p_id=trim(request.querystring("id"))
if not joekoe_cms.int_true(p_id) then p_id=0
psort=left(index_url,3)&"ep"
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)
'----------------------------中间 开始----------------------------
select case action
case "pay"
call shop_emoney_pay_chk()
case else
call shop_emoney_pay_bag()
end select
'----------------------------中间 结束----------------------------
call web_end(0,0)
sub shop_emoney_pay_chk()
dim n_price,ordernum,nname,pnum,pname,address,code,phone,email,remark,serial,carry_num,dim_carry,carry,carry_price,found_err,p_order_true,allemoney
%>
<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
if val_chk(psort)=false then
response.write "<tr class=bg_td><td height=100 align=center>您提交的 <font class=red>验 证 码</font> 为空或有错误,请勿非法提交!</td></tr>"
response.write vbcrlf&"</table>"
exit sub
end if
sql="select top 1 emoney from shop_product where hidden=1 and is_emoney=1 and id="&p_id
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
rs.close
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
n_price=rs(0)
rs.close
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"))
serial=joekoe_cms.code_form(request.form("serial"))
pnum=joekoe_cms.code_form(request.form("pnum"))
pname=joekoe_cms.code_form(request.form("pname"))
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
if not isnumeric(pnum) then pnum=1
allemoney=int(pnum*n_price)
if allemoney>login_emoney then
response.write "<script language=javascript>alert('您所拥有的 "&joekoe_cms.web_unit&" 不够,请重新选择购买的数量!');history.back(-1)</script>"
exit sub
end if
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,340)
response.write vbcrlf&"</table>"
exit sub
end if
carry=""
dim_carry=split(web_dim(49),":")
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
allemoney=allemoney+carry_price
ordernum="e"&joekoe_cms.time_type(joekoe_cms.now_time,11)
p_order_true=true
sql="select top 1 id from shop_emoney_notes 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_emoney_notes(ordernum,pid,serial,name,emoney,num,emoneys,username,nname,address,code,phone,email,remark,tim,types,carry,carry_price) " & _
"values ('"&ordernum&"',"&p_id&",'"&serial&"','"&pname&"',"&n_price&","&pnum&","&allemoney&",'"&login_username&"','"&nname&"','"&address&"','"&code&"','"&phone&"','"&email&"','"&remark&"','"&joekoe_cms.now_time&"',0,'"&carry&"',"&carry_price&")"
call joekoe_cms.exec(sql,0)
call joekoe_cms.exec("update user_data set emoney=emoney-"&allemoney&" where username='"&login_username&"'",0)
%>
<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';">
</td></tr>
</table>
<%
call val_chk_end(psort)
end sub
sub shop_emoney_pay_type()
%>
<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>
<table border=0>
<%
dim dim_carry,carry,carry_price
carry="未设定"
carry=0
dim_carry=split(web_dim(49),":")
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&joekoe_cms.web_unit
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=submit value=' 提 交 支 付 ' onclick="javascript:return pay_frm_submit(this.form);"> <input type=reset value='重新填写'></td></tr>
</form>
<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>
<%
end sub
sub shop_emoney_pay_bag()
dim epname,epprice,epserial,epemoney,ds,chk_emoney
ds=false
chk_emoney=true
sql="select top 1 * from shop_product where is_emoney=1 and id="&p_id
%>
<table cellspacing=1 cellpadding=4 class=table>
<form name=shop_pay_frm action='?id=<%response.write p_id%>&action=pay' method=post onsubmit="javascript:frm_submitonce(this);">
<%response.write val_code_num(psort,1)%>
<tr><td colspan=2 class=td align=center><b>以下是您所选购的<%response.write web_dim(44)%></b></td></tr>
<%
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
epname=joekoe_cms.code_js(rs("name"),0)
epemoney=rs("emoney")
epserial=rs("serial")
%>
<tr class=bg_td>
<td width='20%'><%response.write web_dim(44)%>名称:</td>
<td width='80%'><b><font class=red><%response.write epname%></font></b></td>
</tr>
<input type=hidden name=pname value='<%response.write epname%>'>
<tr class=bg_td>
<td><%response.write web_dim(44)%>编号:</td>
<td><%response.write epserial%></td>
</tr>
<input type=hidden name=serial value='<%response.write epserial%>'>
<tr class=bg_td>
<td>所需<%response.write joekoe_cms.web_unit%>:</td>
<td><font class=red2><%response.write epemoney%></font> <%response.write joekoe_cms.web_unit%></font></td>
</tr>
<tr class=bg_td>
<td>购买数量:</td>
<td><input type=text name=pnum size=6 maxlength=6 value='1'></td>
</tr>
<%
ds=true
end if
rs.close
if ds=false then
response.write "<tr class=bg_tds><td colspan=2 height=30 align=center>您目前还没有选购"&web_dim(44)&" </td></tr>"
chk_emoney=false
end if
if login_emoney<epemoney then
response.write "<tr class=bg_tds><td colspan=2 height=30 align=center>您目前有 <font class=red2>"&login_emoney&"</font> "&joekoe_cms.web_unit&",暂时还不够支付此"&web_dim(44)&"! </td></tr>"
chk_emoney=false
end if
if chk_emoney=true then
%>
<tr class=bg_tds><td colspan=2 height=30 align=right>
<%
response.write "您目前拥有的 <b><font class=blue>"&joekoe_cms.web_unit&"</font></b> 数量为:<font class=red2>"&login_emoney&"</font> 个"
%>
</td></tr>
<%
call shop_emoney_pay_type()
end if
%>
</table>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -