<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1" /> 
    <title>点缀支付样例-订单查询</title>
</head>
<?php
ini_set('date.timezone','Asia/Shanghai');
require_once "../lib/DzPay.Api.php";

$input = new Query();
if(isset($_REQUEST["merchantOrderNo"]) && $_REQUEST["merchantOrderNo"] != ""){
	$merchantOrderNo = $_REQUEST["merchantOrderNo"];
    $input->SetMerchantOrderNo($merchantOrderNo);

    $pay = new Pay();
    $result = $pay->Query($input);
    if($result->GetSuccess())
    {
        echo '商户单号：'.$result->GetData('MerchantOrderNo').',平台单号：'.$result->GetData('PlatformOrderNo').'订单状态：';
        switch($result->GetData('Status')){
            case 1:
                echo '支付成功';
                break;
            case 2:
                echo '待支付';
                break;
            case 3:
                echo '支付失败';
                break;
            case 4:
                echo '待退款';
                break;
            case 5:
                echo '已退款';
                break;
            case 6:
                echo '部分退款';
                break;
            case 7:
                echo '待撤销';
                break;
            case 8:
                echo '已撤销';
                break;
            case 9:
                echo '冻结';
                break;
            case 10:
                echo '异常';
                break;
            case 11:
                echo '已关闭';
                break;
        }
    }
    else
    {
        echo $result->GetData("RespMessage");
    }
    exit();
}

if(isset($_REQUEST["channelOrderNo"]) && $_REQUEST["channelOrderNo"] != ""){
	$channelNo = $_REQUEST["channelOrderNo"];
    $input->SetChannelOrderNo($channelNo);

    $pay = new Pay();
    $result = $pay->Query($input);
    if($result->GetSuccess())
    {
        echo '商户单号：'.$result['MerchantOrderNo'].',平台单号：'.$result['PlatformOrderNo'].'订单状态：';
        switch($result['Status']){
            case 1:
                echo '支付成功';
                break;
            case 2:
                echo '待支付';
                break;
            case 3:
                echo '支付失败';
                break;
            case 4:
                echo '待退款';
                break;
            case 5:
                echo '已退款';
                break;
            case 6:
                echo '部分退款';
                break;
            case 7:
                echo '待撤销';
                break;
            case 8:
                echo '已撤销';
                break;
            case 9:
                echo '冻结';
                break;
            case 10:
                echo '异常';
                break;
            case 11:
                echo '已关闭';
                break;
        }
    }
    else
    {
        echo $result->GetData("RespMessage");
    }
    exit();
}
?>
<body>  
	<form action="#" method="post">
        <div style="margin-left:2%;color:#f00">渠道订单号和商户订单号选少填一个，商户订单号优先：</div><br/>
        <div style="margin-left:2%;">渠道订单号：</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="channelOrderNo" /><br /><br />
        <div style="margin-left:2%;">商户订单号：</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="merchantOrderNo" /><br /><br />
		<div align="center">
			<input type="submit" value="查询" style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="callpay()" />
		</div>
	</form>
</body>
</html>