<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <form role="form" class="form-horizontal data-from" id="theFrm">
                        <div class="form-group">
                            <label class="control-label col-sm-2">批次</label>
                            <div class="col-sm-6">
                                <select name="bdlx" class="form-control">
                                    <option value="1">补点1</option>
                                    <option value="2">补点2</option>
                                    <option value="3">补点3</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">导入文件</label>
                            <div class="col-sm-6">
                                <div class="input-group">
                                    <input type="text" name="urlfile" id="urlfile" class="form-control" value="">
                                    <a href="javascript:void(0);" class="input-group-addon" id="upload">
                                        上传文件
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div>
                            <div class="row">
                                <div class="col-sm-5 col-sm-offset-5">
                                    <button class="btn btn-primary btn-save" type="button">
                                        <strong>导 入</strong>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
    layui.use(['upload'], function(){
        var upload = layui.upload;
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
            ,url: '/common/upload' //上传接口
            ,accept: 'file'
            ,done: function(res){
                //上传完毕回调
                if(res.status == 'SUCCESS') {
                    $('#urlfile').val(res.fileUrl);
                }
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });

    $(function () {
        //提交按钮
        $(".btn-save").click(function(){
            parent.layer.confirm('是否确认提交？', {
                btn: ['确认','取消'], //按钮
                shade: false //不显示遮罩
            }, function(){
                var params = $("#theFrm").serialize();
                $.post('/finance/receipt2-process',params,function(obj){
                    if(obj.success) {
                        parent.layer.msg('保存成功');
                        parent.refreshList();
                        layer_close();
                    } else {
                        parent.layer.msg(data.msg);
                    }
                },'json');
            }, function(){
                //
            });
        });
    })
</script>
<?php $this->endBlock('footer_js'); ?>
