openInvoice.php 5.59 KB
<?php
use yii\helpers\Url;

$this->title = '订单开票';
$this->params['breadcrumbs'][] = '交易管理';
$this->params['breadcrumbs'][] = '订单详情';
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
    .red-cls{color:red;}
</style>
<div class="panel panel-default">
    <div class="panel-heading">
        <p class="panel-title">
            开票信息
        </p>
    </div>
    <div class="panel-body instant">
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">类型:</label>
            <div class="col-sm-4 text-left form-inline">
                <input class="form-control type" type="radio" name="type" value="0" checked="checked">公司&nbsp;&nbsp;&nbsp;&nbsp;
                <input class="form-control type" type="radio" name="type" value="1">个人
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">抬头*:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="head" id="head" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">纳税人识别码:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="taxpayer_id_number" id="taxpayer_id_number" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">email*:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="email" name="email" id="email" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">备注:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="remark" id="remark" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">开票公司注册地:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="register_address" id="register_address" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">开票公司电话:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="register_tel" id="register_tel" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">开票公司开户行:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="bank" id="bank" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">开票公司开户行账号:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="bank_account" id="bank_account" value="">
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">其他订单号:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="text" name="order_nos" id="order_nos" value="" placeholder="多个单用逗号分开前后并去除空格" />
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label text-right">开票金额:</label>
            <div class="col-sm-4 text-left">
                <input class="form-control" type="number" name="amount" id="amount" value=""> <span class="red-cls">不能大于订单实付金额。线下支付的这里必填</span>
            </div>
        </div>

    </div>
    <div class="panel-footer text-center">
        <button type="button" class="btn btn-primary ladda-button" data-style="slide-up" id="openInvoiceBtn">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
</div>

<input type="hidden" value="<?=$id ?>" id="id">
<script type="text/javascript">
    var postURL = '<?=Url::toRoute("/trade/order/do-open-invoice/",['orderId' => $id])?>';
    $(document).ready(function () {
        $('#openInvoiceBtn').click(function(e){
            var that = $(this);
            if (!confirm('确认开票信息了么?')) {
                return false;
            }
            that.attr('disabled', true);
            $.post(postURL,{
                'orderId': $('#id').val(),
                'type': $('.type:checked').val(),
                'head': $('#head').val(),
                'taxpayer_id_number': $('#taxpayer_id_number').val(),
                'email': $('#email').val(),
                'remark': $('#remark').val(),
                'register_address': $('#register_address').val(),
                'register_tel': $('#register_tel').val(),
                'bank': $('#bank').val(),
                'bank_account': $('#bank_account').val(),
                'order_nos': $('#order_nos').val(),
                'amount': $('#amount').val(),
            },function(res){
                if (res.success) {
                    alert('开票成功,过2分钟后请查阅邮箱');

                } else {
                    alert(res.error);
                }
                that.removeAttr('disabled');
            },'json')
        })

    });
</script>