<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>电站详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css"/>

</head>
<body>
<div class="layui-fluid pd-10">
    <div class="order-win layui-form" id="LAY_app">
        <div class="layui-form-item layui-row">
            <div class="layui-col-sm6 layui-col-md6">
                <label class="layui-form-label">申请原因：</label>
                <div class="layui-input-block">
                    <c:if test="${objType eq '1'}">
                        ${customerEntry.applyReasonName}
                    </c:if>
                    <c:if test="${objType ne '1'}">
                        ${customerEntry.changeReason}
                    </c:if>
                </div>
            </div>
            <div class="layui-col-sm7 layui-col-md7 " >
                <label class="layui-form-label">审核备注：</label>
                <div class="layui-input-block"> <textarea id="examineRemarks" class="idea-text f-l" style="margin: 0px;width: 487px;height: 80px;"></textarea></div>
            </div>
        </div>
    </div>
</div>
<div class="layui-form-item text-c operate-footer">
    <button type="button" class="layui-btn" id="refuseInDoc">同意</button>
    <button type="button" class="layui-btn" id="refuseNotRetaial">驳回</button>
    <button class="layui-btn layui-btn-primary" onclick="closeSelf()">取消</button>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'layedit', 'laydate','jquery','upload','layer'], function () {

        $ = layui.$;
        layer = layui.layer;
        form = layui.form;
        var id = "${customerEntry.id}";
        var objType = "${objType}";
        var refuseFlag = true;
        $('#refuseInDoc').click(function(){
            if(!refuseFlag){
                return;
            }
                    var examineRemarks = $('#examineRemarks').val();

                    refuseFlag = false;
                    $.ajax({
                        type: 'post',
                        url: '${ctx}/customerEntry/examineRetrial',
                        data: {
                            type:'1',
                            id: id,
                            examineRemarks:examineRemarks,
                            objType:objType
                        },
                        success: function(data){
                            if (data.code == '200') {
                                parent.layer.msg('操作成功', {icon: 1});
                                closeSelf();
                                parent.searchOrder();
                            } else if (data.code == '501') {
                                layer.msg(data.errMsg, {icon: 2});
                            } else {
                                layer.msg('操作失败', {icon: 2});
                            }
                        },
                        complete: function(){
                            refuseFlag = true;
                        }
                    });
        });

        var refuseNotFlag = true;
        $('#refuseNotRetaial').click(function(){
            if(!refuseNotFlag){
                return;
            }
            var examineRemarks = $('#examineRemarks').val();
            refuseNotFlag = false;
            $.ajax({
                type: 'post',
                url: '${ctx}/customerEntry/examineRetrial',
                data: {
                    type:'2',
                    id: id,
                    examineRemarks:examineRemarks,
                    objType:objType
                },
                success: function(data){
                    if (data.code == '200') {
                        parent.layer.msg('操作成功', {icon: 1});
                        closeSelf();
                        parent.searchOrder();
                    } else if (data.code == '501') {
                        layer.msg(data.errMsg, {icon: 2});
                    } else {
                        layer.msg('操作失败', {icon: 2});
                    }
                },
                complete: function(){
                    refuseNotFlag = true;
                }
            });
        });


    })

    window.closeSelf = function () {
        var index = parent.layer.getFrameIndex(window.name);
        // window.parent.location.reload();//刷新父级页面
        parent.layer.close(index);//关闭当前页
    }
    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }
</script>
</body>
</html>

