<!--#include file="top.asp" -->
<!--#include file="../md5.asp"-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="180" valign="top" style="background:url(images/menu_1.jpg);background-repeat:no-repeat"><!--#include file="menu.asp" --></td>
<td valign="top" style="padding:20px">
<%dim action
action=request.QueryString("action")
select case action
case "goumai"
if session("username")="" then
response.write "<span style='height:500px;font-size:12px;padding-top:200px;padding-left:150px;color:red'>您还没有登录</span><script>window.setTimeout(""history.go(-1)"",1000);</script>"
response.End
end if%>
<table border="0" cellspacing="1" cellpadding="5" class="bgcolor">
<tr class="tdcolor"><td colspan="6">请选择购买的商品数量及送货方式再进行下一步操作</td></tr>
<tr class="tdcolor">
<td>商品名称</td>
<td>商品价格</td>
<td>购买数量</td>
<td>商品单位</td>
<td>选择送货方式</td>
<td>卖家商频</td>
</tr>
<%set rs=server.createobject("adodb.recordset")
rs.open"select * from price_user where id="&request("id")&"",conn,1,1
if rs("kucun")<=0 then
response.write"<script language='javascript'>alert('您选择的商品售完或缺货');history.go(-1)</script>"
end if
bookname=rs("bookname")
bookid=rs("id")
money=rs("money")
att=rs("att")
anclassid=rs("anclassid")
nclassid=rs("nclassid")
ppid=rs("ppid")
kucun=rs("kucun")
rs.close
set rs=nothing%>
<form action="?action=goumainext&id=<%=bookid%>" method="post" name="myform">
<input name="Fu" id="Fu" value="<%=request("Fu")%>" type="hidden">
<tr class="tdcolor">
<td><%=bookname%><input name="from" id="from" value="<%=request("Efrom")%>" type="hidden"></td>
<td><%=money%>元</td>
<td><input name="goumaicount" id="goumaicount" class="wenbenkuang" size="3" value="1"></td>
<td>&nbsp;</td>
<td><select name="songhuo" id="songhuo" class="select">
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_songhuo where fangshi=0 order by songidorder",conn,1,1
while not rs.eof
subject=split(rs("subject"),"|")%>
<option value="<%=subject(0)%>"><%=replace(rs("subject"),"|","-")%>元</option>
<%rs.movenext
wend
rs.close%>
</select></td>
<td><%=request("Efrom")%></td>
</tr>
<tr class="tdcolor"><td colspan=6 align="center"><input type="submit" name="submit" value="下一步" class="wenbenkuang"></td>
</tr></form>
</table>

<%case "goumainext"
if session("username")="" then
response.Redirect "index.asp"
response.End
end if%>
<table border="0" cellspacing="1" cellpadding="5" class="bgcolor">
<tr class="tdcolor"><td colspan="8">请确认上一步的操作，核实费用进入下一步</td></tr>
<tr class="tdcolor">
<td>商品名称</td>
<td>商品价格</td>
<td>购买数量</td>
<td>商品单位</td>
<td>送货方式</td>
<td>卖家商频</td>
<td>费用</td>
<td><font color="red">总额</font></td>
</tr>
<%set rs=server.createobject("adodb.recordset")
rs.open"select * from price_user where id="&request("id")&"",conn,1,1
bookname=rs("bookname")
bookid=rs("id")
money=rs("money")
att=rs("att")
anclassid=rs("anclassid")
nclassid=rs("nclassid")
ppid=rs("ppid")
kucun=rs("kucun")
rs.close
rs.open "select * from shop_songhuo where fangshi=0 and subject like '%"&request("songhuo")&"%' order by songidorder",conn,1,1
subject=split(rs("subject"),"|")
rs.close
set rs=nothing
goumaicount=request("goumaicount")
zonge=money*goumaicount+subject(1)%>
<form action="?action=next&id=<%=bookid%>" method="post" name="myform">
<input name="Fu" id="Fu" value="<%=request("Fu")%>" type="hidden">
<tr class="tdcolor">
<td><%=bookname%><input name="from" id="from" value="<%=request("from")%>" type="hidden"></td>
<td><%=money%>元</td>
<td><%=goumaicount%><input name="goumaicount" id="goumaicount" value="<%=goumaicount%>" type="hidden"></td>
<td>件</td>
<td><%=request("songhuo")%><input name="songhuo" id="songhuo" value="<%=request("songhuo")%>" type="hidden"></td>
<td><%=request("from")%></td>
<td><%=subject(1)%>元</td>
<td><font color="red"><%=zonge%>元</font><input name="zonge" id="zonge" value="<%=zonge%>" type="hidden"></td>
</tr>
<tr class="tdcolor"><td colspan=8 align="center"><input type="reset" name="submit" onClick="history.go(-1)" value="上一步" class="wenbenkuang">&nbsp;<input type="submit" name="submit" value="下一步" class="wenbenkuang"></td>
</tr></form>
</table>

<%case "next"
if session("username")="" then
response.Redirect "index.asp"
response.End
end if
set rs=server.createobject("adodb.recordset")
rs.open"select * from price_user where id="&request("id")&"",conn,1,1
bookname=rs("bookname")
bookid=rs("id")
money=rs("money")
att=rs("att")
anclassid=rs("anclassid")
nclassid=rs("nclassid")
ppid=rs("ppid")
kucun=rs("kucun")
rs.close
rs.open "select * from shop_songhuo where fangshi=0 and subject like '%"&request("songhuo")&"%' order by songidorder",conn,1,1
subject=split(rs("subject"),"|")
rs.close
set rs=nothing%>
<table border="0" cellpadding="5" cellspacing="1" class="bgcolor">
<form name="myform" method="post" action="?action=ok">
<tr class="tdcolor">
<td height="25" colspan="2"><b>进一步填写会员收货资料，以便我们能及时地发货。</b>
<input name="Fu" id="Fu" value="<%=request("Fu")%>" type="hidden">
<input name="username" type="hidden" value="<%=session("username")%>">
<input name="userid" type="hidden" value="<%=session("userid")%>">
<input name="bookname" type="hidden" value="<%=bookname%>">
<input name="bookid" type="hidden" value="<%=bookid%>">
<input name="anclassid" type="hidden" value="<%=anclassid%>">
<input name="nclassid" type="hidden" value="<%=nclassid%>">
<input name="ppid" type="hidden" value="<%=ppid%>">
<input name="goumaijia" type="hidden" value="<%=money%>">
<input name="goumaicount" id="goumaicount" value="<%=request("goumaicount")%>" type="hidden">
<input name="songhuo" id="songhuo" type="hidden" value="<%=request("songhuo")%>">
<input name="zhifu" id="zhifu" type="hidden" value="<%=request("zhifu")%>">
<input name="att" type="hidden" value="<%=att%>">
<input name="feiyong" id="feiyong" type="hidden" value="<%=subject(1)%>">
<input name="zonge" id="zonge" type="hidden" value="<%=request("zonge")%>">
<input name="from" id="from" value="<%=request("from")%>" type="hidden">
</td>
</tr>
<tr class="tdcolor">
<td width="20%" height="25">收货人真实姓名：</td>
<td><input name="shouhuoname" id="shouhuoname" class="wenbenkuang">性别：<select name="sex" id="sex" class="select">
<option value="先生">先生</option>
<option value="女士">女士</option>
</select></td>
</tr>
<tr class="tdcolor">
<td height="25">收货人的联系电话：</td>
<td><input name="tel" id="tel" class="wenbenkuang"></td>
</tr>
<tr class="tdcolor">
<td height="25">具体的收货地址：</td>
<td><input name="address" id="address" size="35" class="wenbenkuang"></td>
</tr>
<tr class="tdcolor">
<td height="25">邮政编码：</td>
<td><input name="post" id="post" class="wenbenkuang"></td>
</tr>
<tr class="tdcolor">
<td height="25">Email：</td>
<td><input name="Email" id="Email" class="wenbenkuang"></td>
</tr>
<tr class="tdcolor">
<td height="25">简单留言：</td>
<td><input name="reply" id="reply" size="35" class="wenbenkuang"></td>
</tr>
<tr class="tdcolor">
<td height="25"></td>
<td><input type="reset" name="submit" onClick="history.go(-1)" value="上一步" class="wenbenkuang">&nbsp;<input name="submit" type="submit" value="确定提交订单" class="wenbenkuang"></td>
</tr>
</form>
</table>

<%case "ok"
if session("username")="" then
response.Redirect "index.asp"
response.End
end if
set rs=server.createobject("adodb.recordset")
rs.open"select * from price_action",conn,2,3
rs.addnew
rs("dingdanno")=replace(year(now)&month(now)&day(now)&minute(now),":","")
rs("username")=trim(request("username"))
rs("userid")=request("userid")
rs("bookid")=request("bookid")
rs("bookname")=trim(request("bookname"))
rs("anclassid")=request("anclassid")
rs("nclassid")=request("nclassid")
rs("ppid")=request("ppid")
rs("goumaijia")=request("goumaijia")
rs("goumaicount")=request("goumaicount")
rs("songhuo")=trim(request("songhuo"))
rs("zhifu")=trim(request("zhifu"))
rs("att")=trim(request("att"))
rs("zonge")=request("zonge")
rs("feiyong")=request("feiyong")
rs("shouhuoname")=trim(request("shouhuoname"))
rs("sex")=trim(request("sex"))
rs("tel")=trim(request("tel"))
rs("address")=trim(request("address"))
rs("post")=request("post")
rs("Email")=trim(request("Email"))
rs("reply")=trim(request("reply"))
rs("updatetime")=now()
rs("overdatetime")=now()
rs("from")=trim(request("from"))&"|"&trim(request("Fu"))&"|会员商频"
rs("act")="等待审核"
rs.update
bookid=rs("bookid")
goumaicount=rs("goumaicount")
userid=rs("userid")
goumaijia=rs("goumaijia")
rs.close
rs.open"select * from price_user where id="&bookid,conn,1,3
rs("kucun")=rs("kucun")-goumaicount
rs("chengjiaocount")=rs("chengjiaocount")+1
rs.update
rs.close
rs.open"select * from [user] where userid="&userid,conn,1,3
rs("jifen")=rs("jifen")+100
rs("jiaoyijine")=rs("jiaoyijine")+goumaijia
rs.update
rs.close
set rs=nothing
response.write "<span style='height:500px;font-size:12px;padding-top:200px;padding-left:150px;color:red'>提交成功！我们会尽快安排发货</span><script>window.setTimeout(""location.href='index.asp?action=dingdan'"",1000);</script>"
end select%>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="F1F1F1" style="border-top:1px solid #cccccc"><!--#include file="../copyright.asp" --></td>
</tr>
</table>