<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<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" />
    <style>
        .layui-table th {
            text-align: center;
        }
    </style>
</head>
<body>
<form class="layui-form" lay-filter="form" action="" style="width: 80%; margin-top: 20px">
    <div class="layui-form-item">
        <label class="layui-form-label">违规通道</label>
        <div class="layui-input-block">
            <select name="channel" lay-verify="required">
                <option value="" selected>请选择</option>
                <option value="1">随行付</option>
                <option value="3">瑞银信</option>
                <option value="4">银盛</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">支付方式</label>
        <div class="layui-input-block">
            <select name="payWay" lay-verify="required">
                <option value="" selected>请选择</option>
                <option value="01">支付宝</option>
                <option value="02">微信</option>
                <option value="03">银联</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">同步子商户</label>
        <div class="layui-input-block">
            <input type="checkbox" name="connectFlag" lay-skin="switch" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="remark" required placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即拉黑</button>
            <button type="reset" onclick="parent.layer.closeAll();" class="layui-btn layui-btn-primary">取消</button>
        </div>
    </div>
</form>

<script>
    let userId = '${userId}';
    layui.use(['layer', 'form'], function () {
        let form = layui.form;

        form.on('submit(formDemo)', function(data) {
            let paramData = data.field;
            if (paramData.connectFlag == 'on') {
                paramData.connectFlag = '1';
            } else {
                paramData.connectFlag = '0';
            }
            paramData.userId = userId;
            let loadingIdx = layer.load(1, {
                shade: [0.1,'#000'] //0.1透明度的白色背景
            });
            $.ajax({
                url: ctx + "/riskBlacklist/toBlackList"
                , type: 'post'
                , contentType: 'application/json'
                , data: JSON.stringify(paramData)
                , success(d) {
                    layer.close(loadingIdx);
                    if (d.code == 200) {
                        parent.layer.closeAll();
                        parent.layer.msg(d.message);
                    } else {
                        layer.confirm(d.message);
                    }
                }
            })

            return false;
        })
    })
</script>
</body>
</html>