<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('收支明细')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-account-edit">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">交易时间：</label>
                <div class="col-sm-8" id="trade_date">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">交易流水号：</label>
                <div class="col-sm-8" id="trade_flow_no">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">财务流水号：</label>
                <div class="col-sm-8" id="flow_no">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">账务处理时间：</label>
                <div class="col-sm-8" id="accounts_deal_date">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">账务处理类型：</label>
                <div class="col-sm-8" id="accounts_deal_type">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">交易金额（元）：</label>
                <div class="col-sm-8" id="amount">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">交易后余额（元）：</label>
                <div class="col-sm-8" id="balance">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">资金流向：</label>
                <div class="col-sm-8" id="direction">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">处理状态：</label>
                <div class="col-sm-8" id="hand_status">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">订单创建时间：</label>
                <div class="col-sm-8" id="create_date">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">服务类型：</label>
                <div class="col-sm-8" id="serviceType">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">交易类型：</label>
                <div class="col-sm-8" id="trade_type">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">收款方账户：</label>
                <div class="col-sm-8" id="account_in">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">收款方名称：</label>
                <div class="col-sm-8" id="account_in_name">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">付款方账户：</label>
                <div class="col-sm-8" id="account_out">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">付款方名称：</label>
                <div class="col-sm-8" id="account_out_name">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">备注：</label>
                <div class="col-sm-8" id="memo">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">电子回单：</label>
                <div class="col-sm-8" id="trade_voucher">

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">支付凭证：</label>
                <div class="col-sm-8" id="pay_voucher">

                </div>
            </div>

    	</form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var pageParam = parent.pageParam;
        if(pageParam.row != null){
            $('#trade_date').html(pageParam.row.trade_date);
            $('#trade_flow_no').html(pageParam.row.trade_flow_no);
            $('#flow_no').html(pageParam.row.flow_no);
            $('#accounts_deal_date').html(pageParam.row.accounts_deal_date);
            $('#accounts_deal_type').html(pageParam.row.accounts_deal_type);
            $('#amount').html(pageParam.row.amount);
            $('#balance').html(pageParam.row.balance);
            $('#direction').html(pageParam.row.direction);
            $('#hand_status').html(pageParam.row.hand_status);
            $('#create_date').html(pageParam.row.create_date);
            $('#serviceType').html(pageParam.row.serviceType);
            $('#trade_type').html(pageParam.row.trade_type);
            $('#account_in').html(pageParam.row.account_in);
            $('#account_in_name').html(pageParam.row.account_in_name);
            $('#account_out').html(pageParam.row.account_out);
            $('#account_out_name').html(pageParam.row.account_out_name);
            $('#memo').html(pageParam.row.memo);
        }
	    var prefix = ctx + "manage/com-wallet";

        $(document).ready(function () {

            //ajax获取后台数据，渲染，如果是修改的话
            if (typeof(pageParam.row.comId)!="undefined") {
                //电子回单
                $.operate.post(prefix+'/get-com-account-trade-voucher'
                    ,{comId:pageParam.row.comId,tradeFlowNo:pageParam.row.trade_flow_no,walletAccountNo:pageParam.row.wallet_account_no}
                    , function(json){
                        if (json.retType=='0') {
                            var base = '-';
                            if(json.data.base_content){
                                base = '<a href="'+json.data.base_content+'" style="margin-right: 5px;" target="_blank" class="btn btn-info btn-sm "><i class="glyphicon glyphicon-cloud-download"></i>下载</a>';
                            }
                            $("#trade_voucher").html(base);
                        }else{
                            $("#trade_voucher").html('-');
                        }
                    });
                //电子回单
                $.operate.post(prefix+'/get-com-account-pay-voucher'
                    ,{comId:pageParam.row.comId,tradeFlowNo:pageParam.row.trade_flow_no,walletAccountNo:pageParam.row.wallet_account_no}
                    , function(json){
                        if (json.retType=='0') {
                            var base = '-';
                            if(json.data.base_content){
                                base = '<a href="'+json.data.base_content+'" style="margin-right: 5px;" target="_blank" class="btn btn-info btn-sm "><i class="glyphicon glyphicon-cloud-download"></i>下载</a>';
                            }
                            $("#pay_voucher").html(base);
                        }else{
                            $("#pay_voucher").html('-');
                        }
                    });
            } else {
                console.log("hide div");
            }
        });
    </script>
</body>
</html>
