<!--#include file="head.asp"-->
<style>body{background-color: #fff;}</style>

<%
'call chkyanzheng("mydingdan_all")

call logadd(request.Cookies("aynameid"),"浏览mydingdan_all",9,0)

if SafeRequest("isb")<>"y" then
'if Ubound(split(trim(request.ServerVariables("HTTP_REFERER")),"mydingdan.asp"))<=0 then
response.Cookies("date1")=""
response.Cookies("date2")=""
response.Cookies("dingdan")=""
response.Cookies("shangid")=""
response.Cookies("zhuangtai")=""
response.Cookies("youhui")=""
response.Cookies("lianxifs")=""
end if


link="mydingdan_all?cact=&isb=y"

if trim(SafeRequest("dingdan"))<>"" then
response.Cookies("dingdan")=trim(SafeRequest("dingdan"))
else
response.Cookies("dingdan")=""
end if
if request.Cookies("dingdan")<>"" then sqldd=sqldd&" and aydingdansum='"&request.Cookies("dingdan")&"'"


act=SafeRequest("act")
if act="cha" then
sqldd=""

date1=SafeRequestform("date1")
date2=SafeRequestform("date2")

dingdan=trim(SafeRequestform("dingdan"))
shangid=SafeRequestform("shangid")
zhuangtai=SafeRequestform("zhuangtai")
youhui=SafeRequestform("youhui")
lianxifs=SafeRequestform("lianxifs")

if date1<>"" then
response.Cookies("date1")=date1
else
response.Cookies("date1")=""
end if
if date2<>"" then
response.Cookies("date2")=date2
else
response.Cookies("date2")=""
end if

if dingdan<>"" then
response.Cookies("dingdan")=dingdan
else
response.Cookies("dingdan")=""
end if

if lianxifs<>"" then
response.Cookies("lianxifs")=lianxifs
else
response.Cookies("lianxifs")=""
end if

if shangid<>"0" then
response.Cookies("shangid")=shangid
else
response.Cookies("shangid")=""
end if

if zhuangtai<>"99" then
response.Cookies("zhuangtai")=zhuangtai
else
response.Cookies("zhuangtai")=""
end if


if youhui<>"" then
response.Cookies("youhui")=youhui
else
response.Cookies("youhui")=""
end if


end if

if request.Cookies("date1")<>"" then 
sqldd=sqldd&" and  datediff(day,aydingdansj,'"&request.Cookies("date1")&"')<=0"
end if
if request.Cookies("date2")<>"" then 
sqldd=sqldd&" and  datediff(day,aydingdansj,'"&request.Cookies("date2")&"')>=0"
end if

if request.Cookies("dingdan")<>"" then sqldd=sqldd&" and aydingdansum='"&request.Cookies("dingdan")&"'"
if request.Cookies("shangid")<>"" then sqldd=sqldd&" and ayddshangid='"&request.Cookies("shangid")&"'"
if request.Cookies("zhuangtai")<>"" then sqldd=sqldd&" and aydingdanzt='"&request.Cookies("zhuangtai")&"'"
if request.Cookies("lianxifs")<>"" then sqldd=sqldd&" and ayddcontact='"&request.Cookies("lianxifs")&"'"

if request.Cookies("youhui")<>"" then
if request.Cookies("youhui")=1 then sqldd=sqldd&" and ayddyouhuiquanzhi<>''"
if request.Cookies("youhui")=2 then sqldd=sqldd&" and ayddyouhuiquanzhi is null"
end if



if act="hebin" then
list1=SafeRequestform("list1")
if list1="" then call PopErr("未找到此项目")

	hebinid=split(list1,",")
	
	if Ubound(hebinid)<1 then call PopErr("请至少选择2个订单进行合并")


sql="select aydingdanid,aydingdansum from "&request.Cookies("ddku")&" where aydingdanid="&trim(hebinid(0))&"" 
rs.open sql,conn,1,3 
if not (rs.bof and rs.eof) then
ddd=trim(rs("aydingdansum"))
else
call PopErr("出现错误err1")
end if
rs.close
	
	For dianka=1 To Ubound(hebinid) 
	sql="select aydingdanid,aydingdansum from "&request.Cookies("ddku")&" where aydingdanid="&trim(hebinid(dianka))&"" 
	rs.open sql,conn,1,3 
	if rs.bof and rs.eof then
	call PopErr("未找到此项目err2")
	else
	ddhcard=trim(rs("aydingdansum"))
	rs.close

		
	end if
	next
	call logadd(request.Cookies("aynameid"),"订单合并成功",0,0)
	call PopErr2("订单合并成功！","mydingdan")
end if
%>

<script src="/Template/date.js" type="text/javascript"></script>

<SCRIPT LANGUAGE="JavaScript">
var checkflag1 = "false";
function check1(field) {
if (checkflag1 == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag1 = "true";
return "false"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag1 = "false";
return "true"; }
}

function unselectall1()
{
    if(document.myform.chkAll1.checked){
	document.myform.chkAll1.checked = document.myform.chkAll1.checked&0;
	checkflag1 = "false";
    } 	
}
</script>

<main>
<div  class="container">
<div class="ui-lrctnei">
<%call userleft()%>
<div class="r"> 
<div class="ui-content">
                        
					
                            
<div class="neiye">


            <!-------------------------------------- 开始 -------------------------------------->									
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">订单交易记录
			<%
            rs.open "select aydlsjuserid from aydailishang where aydlsjuserid='"&clng(request.Cookies("aynameid"))&"'" ,conn,1,1
            if not(rs.bof and rs.eof) then
            response.Write "&nbsp;&nbsp;<a href=mydingdan_daili>[查看代理商订单]</a>"
            end if
            rs.close
            %>
            </div>
           	<div class="gexian"></div>
   	 		<div class="neitablewu">
					<table>
                  		<tr>
                          <td>

            <form action="?act=cha&isb=y" method="post" name="chaxun" id="chaxun">
            
            &nbsp;订单编号：
            <input name="dingdan" type="text" id="dingdan" class="reginputd" value="<%if request.Cookies("dingdan")<>"" then response.Write server.HTMLEncode(trim(request.Cookies("dingdan")))%>" size="17" maxlength="20">

            &nbsp;联系方式：
            <input name="lianxifs" type="text" id="lianxifs" class="reginputd" value="<%if request.Cookies("lianxifs")<>"" then response.Write server.HTMLEncode(trim(request.Cookies("lianxifs")))%>" size="17" maxlength="20">

            <select name="shangid" id="shangid" class="reginputd">
              	  <%
                  sql="select aygoodsuoyouid,aygoodsx,aygoodid,aygoodname from aygood where aygoodsuoyouid="&request.Cookies("aynameid")&" order by aygoodsx asc" 
                  rs.open sql,conn,1,1
                  if rs.bof and rs.eof then %>
                  <option value="0">未找到商品</option>
                  <%else%>
                  <option value="0">全部商品</option>
                 <% do while not rs.eof%>
                <option value="<%=rs("aygoodid")%>" 
                  <%
                  if request.Cookies("shangid")<>"" then
                  if clng(request.Cookies("shangid"))=clng(rs("aygoodid")) then response.Write("selected")
                  end if%>>
                  <%=rs("aygoodname")%>
                  </option>
              	  <%	
                  rs.movenext 
                  loop
                  
                  end if
                  rs.close
                  %>
            </select>

			<br>
            &nbsp;起始时间：
            <input name="date1" type="text" class="reginputd" id="date1" onFocus="this.select()" onClick="fPopCalendar(event,this,this)" 
            value="<%if request.Cookies("date1")<>"" then response.Write request.Cookies("date1")%>" size="17" readonly="readonly" /> 
            &nbsp;截止时间：
            <input name="date2" type="text" class="reginputd" id="date2" onFocus="this.select()" onClick="fPopCalendar(event,this,this)" 
            value="<%if request.Cookies("date2")<>"" then response.Write request.Cookies("date2")%>" size="17" readonly="readonly" />

            <select name="zhuangtai" id="zhuangtai" class="reginputd">
              <option value="99">支付状态</option>
              <option value="99">不限</option>
              <option value="0" 
              <%
                if request.Cookies("zhuangtai")<>"" then
                if cint(request.Cookies("zhuangtai"))=0 then response.Write("selected")
                end if
              %>
              >未支付</option>
              <option value="1"
                <%
                if request.Cookies("zhuangtai")<>"" then
                if cint(request.Cookies("zhuangtai"))=1 then response.Write("selected")
                end if
              %>>支付成功</option>
              <option value="2"
                <%
                if request.Cookies("zhuangtai")<>"" then
                if cint(request.Cookies("zhuangtai"))=2 then response.Write("selected")
                end if
              %>>支付失败</option>
            </select>
            
            <select name="youhui" id="youhui" class="reginputd">
              <option value="0">优惠券</option>
              <option value="0">不限</option>
              <option value="1"
              <%
                if request.Cookies("youhui")<>"" then
                if cint(request.Cookies("youhui"))=1 then response.Write("selected")
                end if
              %>>使用</option>
              <option value="2"
              <%
                if request.Cookies("youhui")<>"" then
                if cint(request.Cookies("youhui"))=2 then response.Write("selected")
                end if
              %>>未使用</option>
            </select>


            &nbsp;<input type="submit" name="Submit" value=" 订单查询 " class="logindlregedit">
            </form>
                         </td>
                        </tr>
                    </table>
       		</div>
            <div class="gexian20"></div>

            <!-------------------------------------- 结束 -------------------------------------->
                   
                   
           
            
            
            
            <!-------------------------------------- 开始 -------------------------------------->									
                	<div class="neitable">
                    <form action="?page=<%=page%>" method="post" name="myform" id="myform"> 
					<table>
                        <tr class="hd">
                        	<td>订单编号</td>
        					<td>相关</td>
                      		<td>商品名称</td>
                      		<td>数量</td>
                            <td>总价</td>
                            <td>订单状态</td>
                            <td>支付渠道</td>
                            <td>联系方式</td>
                            <td>订单时间</td>
                      </tr>
				    <%
                        set rsdd=server.CreateObject("adodb.recordset")
                        sql="select isptdxdd,dailikuo,ayddyouhuiquan,aydingdanyj,aydingdanjin,ayddquantity,aydingdanuser,aygooddlid,aydingdanid,ayddzffangshi,aydingdanzt,aydingdansum,isalipayfz,aydingdanzj,ayddshangid,ayddbody,ayddcontact,aydingdansj from "&request.Cookies("ddku")&" where aydingdanuser="&clng(request.Cookies("aynameid"))&""&sqldd&" order by aydingdanid desc" 
                        rs.open sql,conn,1,1
                        rs.pagesize=50
                        pagecount=rs.pagecount 
                        if request("page")="" then 
                        page=1
                        else
                        page=int(request("page")) 
                        end if
                        if page<=0 then page=1 
                        if request("page")="" then page=1
                        if not(rs.bof and rs.eof) then
                        rs.absolutepage=page
                        n=0
						jin=0
                        do while not rs.eof%>
                  		<tr onmouseover=this.bgColor='#FAFAFA' onmouseout=this.bgColor='#ffffff'>
                       	  <td>
                    		<a href="mydingdanc?id=<%=rs("aydingdanid")%>&ddh=<%=trim(rs("aydingdansum"))%>"><%=trim(rs("aydingdansum"))%></a>
                            </td>
                            <td>
                            <%
							if trim(rs("dailikuo"))<>"" then
							dailikuo=trim(rs("dailikuo"))            '代理关系
							dailistr=split(dailikuo,"|")
							For dsum=0 To Ubound(dailistr) 
							'response.Write dailistr(dsum)&"<br>"
								dailiuserstr=split(dailistr(dsum),",")
								if clng(dailiuserstr(3))=clng(request.Cookies("aynameid")) then   '代理关系 本商户ID
								'response.Write clng(dailiuserstr(4))    '商家代理ID
								%>
								<span style="color: #009933">[<%=totruename(dailiuserstr(4))%>]</span>
								<%exit for
								end if
							next
							end if
							%>
                            
                            <%if cint(rs("isalipayfz"))=1 then response.Write"<span style=color:#FF6600>[秒结]</span>"%>
                            
                            <%if trim(rs("ayddyouhuiquan"))<>"" then 
							response.Write"<span style=color:#FF6600>[优惠]</span>"
							end if%>
                            
                            <%if ccur(rs("ayddquantity"))>1 then
                            if ccur(rs("aydingdanjin"))<ccur(rs("aydingdanyj")) then
                            response.Write"<span style=color:#FF6600>[批发]</span>"
                            end if
                            end if
                            %>
                            <%if cint(rs("isptdxdd"))=1 then response.Write"<span style=color:#60C>[代售]</span>"%>
                            </td>
                          	<td>
							<%
                            set rsgood=server.CreateObject("adodb.recordset")
                            rsgood.open "select aygoodid,aygoodname from aygood where aygoodid="&clng(rs("ayddshangid"))&"",conn,1,1
                            if not(rsgood.bof and rsgood.eof) then 
                            if len(trim(rsgood("aygoodname")))>15 then
                            response.Write left(rsgood("aygoodname"),15)&"…"
                            else
                            response.Write rsgood("aygoodname")
                            end if
                            else
                            response.Write("商品或已删除")
                            end if
                            rsgood.close
                            %>
                        </td>
                          	<td><%=rs("ayddquantity")%>张</td>
                			<td>
							<%
                            if trim(rs("aydingdanzj"))<>"" then
                            response.Write Formatnumber(rs("aydingdanzj"),2,true,-1,0)&"元"
                            else
                            response.Write ("-")
                            end if
                            %>
                        </td>
                            <td>
							<%
							if cint(rs("aydingdanzt"))=1 then jin=ccur(jin)+ccur(rs("aydingdanzj"))
							
									if cint(rs("aydingdanzt"))=0 then response.Write("未付款")
									if cint(rs("aydingdanzt"))=1 then response.Write("<font color=#00CC00>支付成功</font>")
									if cint(rs("aydingdanzt"))=2 then response.Write("<font color=red>支付失败</font>")
									if cint(rs("aydingdanzt"))=4 then response.Write("<a style=color:#F00 href=mydingdanc?id="&rs("aydingdanid")&"&ddh="&trim(rs("aydingdansum"))&">[已支付,卡密不足]</a>")

                            %>
                        </td>
                            <td>
							<%
                            if int(rs("ayddzffangshi"))=0 then response.Write "网银"
                            if int(rs("ayddzffangshi"))=1 then response.Write "充值卡"
                            if int(rs("ayddzffangshi"))=2 then response.Write "支付宝"
                            if int(rs("ayddzffangshi"))=3 then response.Write "财付通"
                            if int(rs("ayddzffangshi"))=4 then response.Write "微信"
                            if int(rs("ayddzffangshi"))=5 then response.Write "QQ钱包"
							if int(rs("ayddzffangshi"))=6 then response.Write "京东"
							if int(rs("ayddzffangshi"))=7 then response.Write "云闪付"
                            if int(rs("ayddzffangshi"))=10 then response.Write "<span style=color:#F3C>支付宝</span>"
                            if int(rs("ayddzffangshi"))=12 then response.Write "<span style=color:#F3C>财付通</span>"
                            if int(rs("ayddzffangshi"))=13 then response.Write "<span style=color:#F3C>微信</span>"
							if int(rs("ayddzffangshi"))=14 then response.Write "<span style=color:#F3C>QQ钱包</span>"
							if int(rs("ayddzffangshi"))=15 then response.Write "<span style=color:#F3C>京东</span>"
							if int(rs("ayddzffangshi"))=16 then response.Write "<span style=color:#F3C>云闪付</span>"
                            if int(rs("ayddzffangshi"))=99 then response.Write "账户余额"
                            %>
                          </td>
                            <td>
							<%
								if trim(rs("ayddcontact"))<>"" then
								response.Write rs("ayddcontact")
								else
								response.Write("-")
								end if
                            %>
                            </td>
                            <td><%=rs("aydingdansj")%></td>
                            
                    </tr>
						<%
                        n=n+1
                        rs.movenext
                        if n>=rs.pagesize then exit do  
                        loop
                        end if
                        zongshu=rs.RecordCount
                        rs.close%>
                        
                        <tr>
                        <td colspan="9" style="text-align:left">&nbsp;&nbsp;
                        &nbsp;<%call pageye()%>
                        &nbsp;该页成功金额<%=Formatnumber(jin,2,true,-1,0)%>元
                        </td>
                      </tr>

                    </table>
                    </form>
            		</div>
            <!-------------------------------------- 结束 -------------------------------------->
                        
            
            


                                                                 
                   
            <div class="gexian20"></div>
            <div class="mzsmbox2" style="padding-top:20px;">
            重要提示：
			虚假卡密,无效卡密,重复卡密,卡密为联系QQ提卡,云盘,消极处理投诉或不回复不理睬,有以上情况者将撤销可信商家标示或停封商户号！
            </div>

            </div>
            
           




        <div class="clearfix"></div>



</div>








</div>
</div>
</div>
</div>
</main>


<footer>
<div class="container">
</div>
</footer>

</body>
</html>