<!--#include file="../setting/conn.asp"--><%:SoonBiz.chkadmin:act=SoonBiz.ract():Select Case act:Case "" : indexpage:Case "delorder" : delorder:Case "readorder" : readorder:Case "marksended" : marksended :Case "paytheorder" : paytheorder :Case "savepay" : savepay :Case "recycle" : recycle :Case "restore" :SoonBiz.execute("update "& sheethead &"_productorder set isdel=0 where id in("& SoonBiz.rids &")"):SoonBiz.ok:Case "remove" :SoonBiz.execute("delete from "& sheethead &"_productorder where id in("& SoonBiz.rids &")"):SoonBiz.ok:Case "empty" :SoonBiz.execute("delete from "& sheethead &"_productorder where isdel=1"):SoonBiz.ok:End Select:SoonBiz.AdFoot():Setallnothing:Sub listfilter():Response.Write "<div class=""listfilter"">":Response.Write " <form method=get action=""?"">":Response.Write " <input type=""hidden"" name=""act"" value=""list"">":Response.Write " <input type=""text"" name=""keyword"" class='inputsearch' size='16'/> ":Response.Write " <select name=""myfield"" id=""myfield"">":Response.Write " <option value=""m_username"" selected=""selected"">按用户名</option>":Response.Write " <option value=""m_nickname"">按昵称</option>":Response.Write " </select>":Response.Write " <input type=""text"" name=""date1"" id=""date1"" size=""11"" maxlength=""11""> - <input type=""text"" name=""date2"" id=""date2"" value="""& soonbiz.format_time(now(),4) &""" size=""11"" maxlength=""11""> ":Response.write " <input type=""submit"" value=""搜索"" class=""submit"" />":Response.write " </form>":Response.write "</div>":End Sub:Sub indexpage():Dim o_state:Dim sql:Dim astr:SoonBiz.LoadTemplatesAdmin("admin_order"):o_state=SoonBiz.rid("o_state"):sql="select * from ["& sheethead &"_productorder] where isdel=0 ":astr=SoonBiz.PlusSQL(sql,"?act="& act &"&amp;page={$page}")
If o_state>-1 Then 
astr(0)=astr(0) & " and o_state="& o_state:astr(2)=astr(2) & "CheckSel(""o_state"","& o_state &")"
End If:astr(0)=astr(0) &" order by id desc ":SoonBiz.topplus="<script type=""text/javascript"">var ordertype="""& ordertype &""";</script>":SoonBiz.title="定单管理":SoonBiz.adhead:SoonBiz.Nstate("定单管理")
If len(Request.QueryString("page"))=0 Then orderintroduce 
Response.Write Replace(Replace(template.html(2),"{$optionlist}",SoonBiz.optionlist(ordertype,"|",0)),"{$now}",soonbiz.format_time(now(),4)):HtmlStr=Template.Html(0):Response.Write Replace(HtmlStr,"{$trhtml}",SoonBiz.ReplaceMdb("",astr(0),Template.html(1),"",0)):Response.write SoonBiz.PageList(""):Response.Write "<script type=""text/javascript"">"& astr(2) &"</script>":End Sub:Sub recycle() :Dim sql:SoonBiz.LoadTemplatesAdmin("admin_order"):sql="select * from ["& sheethead &"_productorder] where isdel=1 order by id desc ":HtmlStr=Template.html(4):HtmlStr=Replace(HtmlStr,"{$trhtml}",SoonBiz.ReplaceMdb("",sql,Template.html(5),"",0)):HtmlStr=Replace(HtmlStr,"{$pagelist}",SoonBiz.PageList("")):SoonBiz.topplus="<script type=""text/javascript"">var ordertype="""& ordertype &""";</script>":SoonBiz.title="定单回收站":SoonBiz.adhead:SoonBiz.Nstate("定单回收站"):Response.Write HtmlStr:End Sub:Sub orderintroduce():Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write "<tr><th colspan=2>定单统计</th></tr>":Response.Write "<tr>":Response.write"<td>等待支付的定单:"& SoonBiz.execute("select count(id) from "& sheethead &"_productorder where isdel=0 and (o_state=0 or o_state=2)")(0) &"</td>":Response.Write "<td>已经付款等待发货的定单:"& SoonBiz.execute("select count(id) from "& sheethead &"_productorder where isdel=0 and o_state=3")(0) &"</td>":Response.Write "</tr>":Response.Write "<tr>":Response.Write "<td>已经发货的定单:"& SoonBiz.execute("select count(id) from "& sheethead &"_productorder where isdel=0 and o_state=4")(0) &"</td>":Response.Write "<td>等待客服确认的定单:"& SoonBiz.execute("select count(id) from "& sheethead &"_productorder where isdel=0 and o_state=1")(0) &"</td>":Response.Write "</tr>":Response.Write "</table>":Response.Write "<br />":End Sub:Sub delorder() :SoonBiz.execute("update "& sheethead &"_productorder set isdel=1 where id=" & SoonBiz.rid("id")):SoonBiz.ok:End Sub:Sub readorder():Dim tr:Dim sql:SoonBiz.LoadTemplatesAdmin("admin_order"):sql="select * from ["& sheethead &"_productorder] where id="&SoonBiz.rid("id"):SoonBiz.topplus="<script type=""text/javascript"">var ordertype="""& ordertype &""";</script>":SoonBiz.adhead:SoonBiz.Nstate("定单管理"):Response.Write SoonBiz.ReplaceMdb("查看定单",sql,Template.html(3),"",1):Response.Write "<br />":Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write "<tr>":Response.Write "<th width=50>商品ID</th>":Response.Write "<th>商品名称</th>":Response.Write "<th>单价</th>":Response.Write "<th>重量</th>":Response.Write "<th>单件运费</th>":Response.Write "<th>数量</th>":Response.Write "</tr>":Dim o_idlist,o_count,o_pricelist,o_weightlist,o_translist,o_productname,o_state,o_mailpay:Dim jinfang:Dim rs,i:sql="select o_idlist,o_count,o_pricelist,o_weightlist,o_translist,o_productname,o_state,o_mailpay from "& sheethead &"_productorder where id=" & SoonBiz.rid("id"):Set rs=SoonBiz.Execute(sql):o_idlist=Split(rs(0),"|||"):o_count=Split(rs(1),"|||"):o_pricelist=Split(rs(2),"|||"):o_weightlist=Split(rs(3),"|||"):o_translist=Split(rs(4),"|||"):o_productname=Split(rs(5),"|||"):o_state=cint(rs(6)):o_mailpay=rs(7):rs.close:Set rs=Nothing:jinfang=UBound(o_idlist):For i=0 To jinfang-1:Response.write "<tr>":Response.Write "<td>"& o_idlist(i) &"</td>":Response.write "<td>"& o_productname(i) &"</td>" :Response.write "<td align=right><script type=""text/javascript"">format_currency("& o_pricelist(i) &");</script></td>" :Response.Write "<td align=right>"& o_weightlist(i) &"</td>":Response.Write "<td align=right><script type=""text/javascript"">format_currency("& o_translist(i) &")</script></td>":Response.write "<td align=right>"& o_count(i) & "</td>" :Response.write "</tr>":Next:Response.write "</table>":Response.Write "<br />":Response.Write "<div class=""operate"">":Response.Write "<form id=""myform"" name=""myform"" method=post action="""">":Response.Write "<tr>":Response.Write "<td>":Response.Write "<input type='button' onClick='history.back()' value='返回上一步'> ":Response.write "<input type='button' id='mailcharge' value='修改运费' onclick=""edit('editmailcharge',280,120)"" /> ":Response.write "<input type='button' id='sended' value='标记为已经发货' onclick=""Csubmit('myform','?act=marksended&id="& SoonBiz.rid("id") &"','确认标记为已经发货吗');""/> ":Response.Write "</td>":Response.Write "</tr>":Response.Write "</form>":Response.Write "</div>":Response.Write "<div id='bg'></div>":Response.Write "<script type=""text/javascript"">"
If o_state=3 or o_state=4 Then Response.Write "getobj('mailcharge').disabled=true;"
If o_state<>3 Then Response.Write "getobj('sended').disabled=true;" 
Response.Write "</script>":Response.Write "<div class='edit' id='editmailcharge' style=""display:none"">":Response.Write " <h1>修改运费</h1>":Response.Write " <span class='close'><a href='javascript:closediv(""editmailcharge"")'><img src='../images/close.gif' align='absmiddle' /></a></span>":Response.Write " <form method=""post"" action=""?act=savepay&id="& SoonBiz.rid("id") &""">":Response.Write " <input type=""text"" id=""o_mailpay"" name=""o_mailpay"" value="""& o_mailpay &""" />":Response.Write " <input type=""submit"" value=""提交"" />":Response.Write " </form>":Response.Write "</div>":End Sub:Sub marksended() :SoonBiz.execute("update "& sheethead &"_productorder set o_state=4 where o_state=3 and id=" & SoonBiz.rid("id") ):SoonBiz.AdSuccess("标记成功"):End Sub:Sub savepay() :Dim o_mailpay:Dim rs:id=SoonBiz.rid("id"):o_mailpay=SoonBiz.Requeststr("运费","o_mailpay","post",0,0,9999,0,1):ShowErr(""):Set rs=SoonBiz.execute("select o_state from "& sheethead &"_productorder where id=" & id )
If rs.eof Then
ShowErr("这个定单不存在,或已经删除")
Else
If cint(rs(0))=3 or cint(rs(0))=4 Then'myand)another:''fromifmightcome:_:theirbuteach:between
ShowErr("这个定单已经付款了,不能重新计算运费")
End If
End If:rs.close:Set rs=Nothing:SoonBiz.execute("update "& sheethead &"_productorder set o_mailpay=" & o_mailpay & ",o_state=2,isupdate=1 where id=" & id ):SoonBiz.AdSuccess("保存运费成功"):End Sub:Sub paytheorder() :Dim user_money,user_name,user_nickname:Dim moneycount :Dim arrs,rs,sql:id=SoonBiz.rid("id"):Set rs=SoonBiz.execute("select o_userid,o_orderid,o_title,o_moneycount,o_mailpay,o_state from "& sheethead &"_productorder where id=" & id )
If rs.eof Then
ShowErr("定单不存在") 
Else:arrs=rs.getrows(1)'hadtheir:asmustbe"never::make=into/at:atmanyfrom
End If:rs.close:Set rs=Nothing:Select Case arrs(5,0):Case 0:ShowErr("正在计算运费,请暂后支付") :Case 2:ShowErr("已经支付成功,正在配货") :Case 3:ShowErr("已经发货,不需要再支付") :End Select:Set rs=SoonBiz.execute("select user_money,user_paypass,user_name,user_nickname from "& sheethead &"_user where id=" & arrs(0,0))
If rs.eof Then
ShowErr("用户不存在") 
Else:user_money=rs(0):user_name=rs(2):user_nickname=rs(3)
End If:rs.close:Set rs=Nothing:moneycount=arrs(3,0) + arrs(4,0)
If user_money < moneycount Then'$them(must"::"bysee"::herebut::of:
ShowErr("这个用户款项不足,不能进行在线支付") 
End If:SoonBiz.execute("update "& sheethead &"_user set user_money=user_money - "& moneycount &" where id=" & arrs(0,0)):sql="insert into "& sheethead &"_money (m_userid,m_username,m_nickname,m_count,m_orderid,m_title,m_donickname,m_paytype,stime) values (":sql=sql & arrs(0,0) :sql=sql & "," & "'"& user_name &"'":sql=sql & "," & "'"& user_nickname &"'":sql=sql & "," & moneycount :sql=sql & ",'" & arrs(1,0) & "'" :sql=sql & ",'" & arrs(2,0) & "(" & arrs(1,0) & ")'" :sql=sql & ",'" & SoonBiz.user_nickname & "'":sql=sql & ",3" :sql=sql & ","& soonbizcom :sql=sql & ")":SoonBiz.execute(sql):SoonBiz.execute("update "& sheethead &"_productorder set o_state=2 where id="& id) :SoonBiz.AdSuccess("支付成功"):End Sub
%>