<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="renderer" content="webkit">
    <!-- 移动设备 viewport -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <jsp:include page="../../../common.jsp" />
</head>
<body style="padding: 1rem 0">
<form class="layui-form" action="" style="width: 90%">
    <input name="id" value="${entity.id}" hidden/>
    <div class="layui-form-item">
        <label class="layui-form-label">随行付MCC</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="standardMccCode" value="${entity.standardMccCode}"  lay-verify="required" autocomplete="off"  placeholder="请输入随行付MCC" class="layui-input"/>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">通道MCC</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <input name="mccCode" value="${entity.mccCode}" lay-verify="required"  autocomplete="off" placeholder="请输入通道MCC" class="layui-input"/>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">通道</label>
        <div class="layui-input-block" style="margin-left:0px">
            <div class="layui-input-block">
                <select name="channelId" class="layui-select" lay-verify="required">
                    <option value="">请选择</option>
                    <c:forEach var="channel" items="${channelList }">
                        <option value="${channel.id}" ${entity.channelId eq channel.id ? 'selected' : '' } >${channel.channelName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="button" id="close" class="layui-btn layui-btn-primary">关闭</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use(['form','layer'], function(){
        var form = layui.form;
        var layer = layui.layer;
        //监听提交
        form.on('submit(formDemo)', function(data){
            var index = layer.load(1,{shade: [0.1,'#000'] });
            $.ajax({
                url: '${ctx}/mccInfo/mccReflect/save',
                method: 'post',
                data: JSON.stringify(data.field),
                dataType: 'JSON',
                contentType:"application/json",
                success: function(res) {
                    layer.close(index);
                    layer.msg(res.message, { icon: res.code == 200 ? 1 : 2, time: 1000 }, function () {
                        if(res.code == 200){
                            let index = parent.layer.getFrameIndex(window.name);
                            parent.search();
                            parent.layer.close(index);
                        }
                    });
                }
            })
            return false;
        });
        $('#close').click(function() {
            parent.layer.closeAll();
        });
    });
</script>
</body>
</html>
