<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:63:"D:\wwwroot\pay.6gym.com\public/../app/index\view\admin\land.html";i:1612239074;}*/ ?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><?php echo $web_config['web_site']; ?> - 6gym.com 6G源码 </title>
    <link rel="stylesheet" href="/static/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/assets/module/admin.css?v=318" media="all"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        /** 数据表格中的select尺寸调整 */
        .layui-table-view .layui-table-cell .layui-select-title .layui-input {
            height: 28px;
            line-height: 28px;
        }

        .layui-table-view [lay-size="lg"] .layui-table-cell .layui-select-title .layui-input {
            height: 40px;
            line-height: 40px;
        }

        .layui-table-view [lay-size="lg"] .layui-table-cell .layui-select-title .layui-input {
            height: 40px;
            line-height: 40px;
        }

        .layui-table-view [lay-size="sm"] .layui-table-cell .layui-select-title .layui-input {
            height: 20px;
            line-height: 20px;
        }

        .layui-table-view [lay-size="sm"] .layui-table-cell .layui-btn-xs {
            height: 18px;
            line-height: 18px;
        }
    </style>
</head>
<body onscroll="layui.admin.hideFixedEl();">
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar table-tool-mini">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label w-auto">商户用户名:</label>
                        <div class="layui-input-inline">
                            <input name="name" class="layui-input" type="text" placeholder="请输入商户用户名"/>
                            
                        </div>
                        </div>
                         <div class="layui-inline">
                        <label class="layui-form-label w-auto">账号备注:</label>
                        <div class="layui-input-inline">
                            <input name="username" class="layui-input" type="text" placeholder="请输入账号备注"/>
                            
                        </div>
                        </div>
                         <div class="layui-inline">
                        <label class="layui-form-label w-auto">通道:</label>
                        <div class="layui-input-inline">
                            <select name="typec">
                                <option value="">选择通道</option>
                                <?php if(is_array($game_list) || $game_list instanceof \think\Collection || $game_list instanceof \think\Paginator): $i = 0; $__LIST__ = $game_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <option value="<?php echo $vo['id']; ?>"><?php echo $vo['game_name']; ?></option>
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </select>
                        </div>
                        </div>
                        <div class="layui-inline" style="padding-right: 110px;">
                        <button class="layui-btn icon-btn" lay-filter="tbBasicTbSearch" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        <button id="tbBasicExportBtn" class="layui-btn icon-btn" type="button">
                            <i class="layui-icon">&#xe67d;</i>导出
                        </button>
                       
                    </div>
                </div>
            </form>
            <!-- 数据表格 -->
            <table id="tbBasicTable" lay-filter="tbBasicTable"></table>
        </div>
    </div>
  
</div>
<!-- 固定底部按钮 -->
<script type="text/html" id="dialogEditDialog1">
    <form id="dialogEditForm1" lay-filter="dialogEditForm1" class="layui-form model-form no-padding">
        <input name="id" type="hidden"/>
	
        <div class="model-form-body" style="max-height: 530px;overflow-y: inherit;">
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">商户:</label>
                <div class="layui-input-block">
                    <input name="name" placeholder="商户用户名" class="layui-input"
                           lay-verify="required" required />
                </div>
            </div> 
            
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">账号备注:</label>
                <div class="layui-input-block">
                    <input name="username"  placeholder="账号备注" class="layui-input"
                           lay-verify="required" required />
                </div>
            </div>
		   <div id="org"></div>
         
            
            
            
           	<div class="layui-form-item">
                <label class="layui-form-label layui-form-required">回调方式:</label>
                <div class="layui-input-block">
                    <select name="method" lay-verify="required" required>
                        <option value="post">POST</option>
                        <option value="get">GET</option>
                    </select>
                </div>
            </div>
			
        </div>
        <div class="layui-form-item text-right model-form-footer">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="dialogEditSubmit1" lay-submit>保存</button>
        </div>
    </form>
</script>

<!-- 表格操作列 -->
<script type="text/html" id="tbBasicTbBar">
    <a class="layui-btn layui-btn-xs" data-dropdown="#userTbDrop{{d.LAY_INDEX}}" no-shade="true">
        操作<i class="layui-icon layui-icon-drop" style="font-size: 12px;margin-right: 0;"></i></a>
    <!-- 下拉菜单 -->
    <ul class="dropdown-menu-nav dropdown-bottom-right layui-hide" id="userTbDrop{{d.LAY_INDEX}}">
        <div class="dropdown-anchor"></div>
        <li><a lay-event="edit"><i class="layui-icon layui-icon-edit"></i>修改</a></li>
        <li><a lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a></li>
    </ul>
   
</script>

<!-- 表格状态列 -->
<script type="text/html" id="userTbState">
    <input type="checkbox" lay-filter="userTbStateCk" value="{{d.id}}" lay-skin="switch"
           lay-text="正常|锁定" {{d.ban==1?'checked':''}} style="display: none;"/>
    <p style="display: none;">{{d.ban==1?'正常':'锁定'}}</p>
</script>
<!-- 表格轮询列 -->
<script type="text/html" id="userTblx">
    <input type="checkbox" lay-filter="userTblxCk" value="{{d.id}}" lay-skin="switch"
           lay-text="开启|关闭" {{d.land_lx==1?'checked':''}} style="display: none;"/>
    <p style="display: none;">{{d.land_lx==1?'开启':'关闭'}}</p>
</script>
<!-- js部分 -->
<script type="text/javascript" src="/static/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/static/assets/js/common.js?v=318"></script>
<script>
    layui.use(['layer', 'form','admin','table', 'util', 'dropdown','baseTable','element'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var dropdown = layui.dropdown;
        var admin = layui.admin;
        var element = layui.element;
        /* 渲染表格 */
        var insTb = table.render({
            elem: '#tbBasicTable',
            url: "<?php echo url('admin/land_list'); ?>",
            page: true,
            limit: 15,
            cellMinWidth: 100,
            cols: [[
                {type: 'checkbox'},
               
                {field: 'mid', title: 'MID', align: 'left',width:80},
                {field: 'name', title: '商户', align: 'left',width:120},
                {field: 'username', title: '账号备注', align: 'left',width:160},
                {field: 'typec', title: '所属通道', align: 'left',width:160},
                {field: 'r_money', title: '日限额', align: 'left',templet: function(d){return d.r_money+'元'},width:90},
                {field: 'z_money', title: '总限额', align: 'left',templet: function(d){return d.z_money+'元'},width:90},
                {field: 'jr_pay', title: '今日充值', align: 'left',templet: function(d){return d.jr_pay+'元'},width:90},
                {field: 'zr_pay', title: '昨日充值', align: 'left',templet: function(d){return d.zr_pay+'元'},width:90},
                {field: 'z_pay', title: '总充值', align: 'left',templet: function(d){return d.z_pay+'元'},width:90},
                {field: 'ban', title: '状态', templet: '#userTbState', width: 100},
                {field: 'ck', title: 'CK金额', width: 150},
                {field: 'method', title: '回调方式',width:100},
                {field: 'land_lx', title: '轮询', templet: '#userTblx', width: 100},
                {title: '操作', toolbar: '#tbBasicTbBar', align: 'left', minWidth: 80}
            ]]
        });

        /* 表格搜索 */
        form.on('submit(tbBasicTbSearch)', function (data) {
            insTb.reload({where: data.field, page: {curr: 1}});
            return false;
        });

        /* 表格工具条点击事件 */
        table.on('tool(tbBasicTable)', function (obj) {
            var data = obj.data; // 获得当前行数据
            if (obj.event === 'edit') { // 修改
            
                showMode(data);
            } else if (obj.event === 'del') { // 删除
                del(data);
            } 
            dropdown.hideAll();
        });
        
        function del(data){
            layer.confirm('确认要删除该账号吗？', {
                shade: .1,
                skin: 'layui-layer-admin'
                }, function (i) {
                layer.close(i);
                    layer.load(2);
                    $.get('<?php echo url("admin/land_del"); ?>', {
                        id: data.id
                    }, function (res) {
                        layer.closeAll('loading');
                        if (res.code == 1) {
                            layer.msg(res.msg, {icon: 1});
                            insTb.reload({page: {curr: 1}});
                           
                        } else {
                            layer.msg(res.msg, {icon: 2});
                        }
                    }, 'json');
                                
           });
        
        }
        
        function showMode(mData){
            console.log(mData);
			admin.open({
                type: 1,
                title: mData?"编辑":'添加',
				area: ['640px', '500px'],
                content: $('#dialogEditDialog1').html(),
                success: function (layero, dIndex) {
                    
                    
                    $('#org').append('<div class="layui-form-item"><label class="layui-form-label layui-form-required">CK表:</label><div class="layui-input-block"><div class="layui-tab layui-tab-card" lay-filter="cktab" lay-allowClose="true"><ul class="layui-tab-title"></ul><div class="layui-tab-content" style="height: 100px;"></div></div></div></div>');
                    
                    var myJson = $.parseJSON(mData.json); 
                    var i = 0;
                    for(var p in myJson){
                      if(p == 'ck'){
                      //腾讯任意金额
                      element.tabAdd('cktab', {
                        title: p,
                        content: '<textarea name="1'+p+'" placeholder="请输入CK" class="layui-textarea" >'+myJson[p]+'</textarea>',
                        id: p
                      });   
                      }else if(p.substr(2) >= 0){
                      //腾讯固额
                      element.tabAdd('cktab', {
                        title: p.substr(2)+'元CK',
                        content: '<textarea name="'+p+'" placeholder="请输入CK" class="layui-textarea" >'+myJson[p]+'</textarea>',
                        id: p
                      });
                      }else if( p.substr(2) == '_type'){
                      //支付类型
                      if(myJson[p] == '0'){
                          var selected_type_0 = 'selected';
                      }else if(myJson[p] == '1'){
                          var selected_type_1 = 'selected';
                      }
                      element.tabAdd('cktab', {
                        title: '支付类型',
                        content: '<select name="'+p+'" lay-verify="required" required><option value="0" '+selected_type_0+'>微信</option><option value="1" '+selected_type_1+'>支付宝</option></select>',
                        id: p
                      });
                      
                      }else if(p.substr(2) == '_ck'){
                      //YY,抖音,虎牙等
                      title = 'CK';
                      
                      if(p == 'dy_ck'){
                          title = '抖音号';
                      }
                      
                      if(p == 'yy_ck' && mData.typec_id == 24){
                          title = 'YY号';
                      }
                      
                      element.tabAdd('cktab', {
                        title:title,
                        content: '<textarea name="'+p+'" placeholder="请输入CK" class="layui-textarea" >'+myJson[p]+'</textarea>',
                        id: p
                      });   
                      }else if(p.substr(2) == '_ms'){
                      //支付模式
                      if(myJson[p] == '0'){
                          var selected_ms_0 = 'selected';
                      }else if(myJson[p] == '1'){
                          var selected_ms_1 = 'selected';
                      }
                      element.tabAdd('cktab', {
                        title: '支付模式',
                        content: '<select name="'+p+'" lay-verify="required" required><option value="0" '+selected_ms_0+'>H5</option><option value="1" '+selected_ms_1+'>扫码</option></select>',
                        id: p
                      });   
                      }else if(p.substr(2) == 'ck'){
                      //YYCK
                      element.tabAdd('cktab', {
                        title: 'CK',
                        content: '<textarea name="'+p+'" placeholder="请输入CK" class="layui-textarea" >'+myJson[p]+'</textarea>',
                        id: p
                      });   
                      }
                      if(i == 0){
                      element.tabChange('cktab', p);
                      }
                      
                      i = 1;
                    }
                    
                   
                    
                    
                  
                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                    form.val('dialogEditForm1',mData);
                    form.render(null, 'dialogEditForm1');
                    
                    // 表单提交事件
                    form.on('submit(dialogEditSubmit1)', function (data) {
						var loadIndex = layer.load(2);
                        $.post('<?php echo url("admin/land_save"); ?>', data.field, function (res) {
                            layer.close(loadIndex);
                            if (0 != res.code) {                                
                                layer.msg(res.msg, {icon: 1});
                                insTb.reload({page: {curr: 1}});
                            } else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }, 'json');
                        return false;
                    });

                }
            });
		}
		
		 /* 修改账户状态 */
        form.on('switch(userTbStateCk)', function (obj) {
            var loadIndex = layer.load(2);
            $.get('<?php echo url("admin/land_status_save"); ?>', {
                id: obj.elem.value,
                ban: obj.elem.checked ? 1 : 0
            }, function (res) {
                layer.close(loadIndex);
                if (res.code !=0) {
                    layer.msg(res.msg, {icon: 1});
                } else {
                    layer.msg(res.msg, {icon: 2});
                    $(obj.elem).prop('checked', !obj.elem.checked);
                    form.render('checkbox');
                }
            }, 'json');
        });
        
         /* 修改轮询状态 */
        form.on('switch(userTblxCk)', function (obj) {
            var loadIndex = layer.load(2);
            $.get('<?php echo url("admin/land_status_save"); ?>', {
                id: obj.elem.value,
                land_lx: obj.elem.checked ? 1 : 0
            }, function (res) {
                layer.close(loadIndex);
                if (res.code !=0) {
                    layer.msg(res.msg, {icon: 1});
                } else {
                    layer.msg(res.msg, {icon: 2});
                    $(obj.elem).prop('checked', !obj.elem.checked);
                    form.render('checkbox');
                }
            }, 'json');
        });

        // 导出excel
        $('#tbBasicExportBtn').click(function () {
            var checkRows = table.checkStatus('tbBasicTable');
            if (checkRows.data.length === 0) {
                layer.msg('请选择要导出的数据', {icon: 2});
            } else {
                table.exportFile(insTb.config.id, checkRows.data, 'xls');
            }
        });

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