🔓 Ultimate Webshell - Penetration Testing Tool

📖 File Reader

<?php /*a:3:{s:55:"D:\XiangMu\hecheng\app\admin\view\goods\goods_list.html";i:1740191745;s:49:"D:\XiangMu\hecheng\app\admin\view\public\top.html";i:1723193413;s:49:"D:\XiangMu\hecheng\app\admin\view\public\vue.html";i:1677287072;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="/public/layui-v2.9.14/layui/css/layui.css" rel="stylesheet">
    <title></title>
    <style>
        element.style {
            height: 1020px!important;
        }
        .demoTable {
            padding:1rem 1rem 0rem 1rem;
        }
    </style>
</head>
<style>
    /*弹窗样式*/
    .gui_box1_1{display: flex;align-items: center;margin-top: 16px;flex-wrap: wrap;}
    .gui_box1_1_span{font-size: 13px;color: #333333;width: 80px;text-align: right;display: block;}
    .gui_box1_1_int{border: 1px solid #DCDCDC;width: 100px;border-radius: 4px;
        display: flex;align-items: center;margin-left: 10px;}
    .gui_box1_1_int input{height: 30px;line-height: 30px;font-size: 12px;
        border: 0;outline: none;width: 86%;margin-left: 2%;}
    .gui_box1_1_int text{display: inline-block;font-size: 14px;cursor: pointer;}
    .gui_box1_1_tian{font-size: 12px;border: 1px dashed #DCDCDC;width: 100px;height: 32px;
        text-align: center;line-height: 32px;border-radius: 4px;cursor: pointer;margin-left: 10px;}

    .gui_yan{display: flex;align-items: center;flex-wrap: wrap;margin-top: 14px;}
    .gui_yan_1{border: 1px solid #019688;color: #019688;font-size: 12px;padding: 2px 6px;border-radius: 4px;margin-left: 10px;display: flex;align-items: center;margin-top: 10px;}
    .gui_yan_box1{display: flex;align-items: center;flex-wrap: wrap;}
    .gui_yan_1 text{display: inline-block;width: 10px;text-align: center;margin-left: 6px;cursor: pointer;}
    .gui_yan_box1 input{height: 30px;border: 1px solid #DCDCDC;padding-left: 10px;line-height: 30px;border-radius: 6px;
        outline: none;font-size: 12px;}
    .gui_yan_box1{margin-left: 20px;}
    .gui_yan_box1 a{background: #019688;width: 60px;height: 32px;text-align: center;line-height: 32px;font-size: 13px;
        color: #ffffff;border-radius: 4px;display: inline-block;margin-left: 10px;}

    .sheng{background: #019688;color: #ffffff;width: 30%;height: 34px;line-height: 34px;text-align: center;border-radius: 4px;margin: 20px auto;}

    .gui_box2{display: flex;align-items: center;flex-wrap: wrap;margin-top: 18px;}
    .gui_box2_1{display: flex;align-items: center;}
    .gui_box2_1 span{width: 60px;text-align: right;}
    .gui_box2_1 input{width: 60px;height: 30px;padding-left: 10px;border: 1px solid #DCDCDC;outline: none;
        border-radius: 6px;}
    .gui_box2_shan{width: 70px;height: 30px;border: 1px solid #DCDCDC;color: #000000;text-align: center;line-height: 30px;
        border-radius: 4px;font-size: 13px;cursor: pointer;}
    .upload{width: 32px;height: 32px;position: relative;margin-left: 30px;margin-right: 10px;}
    .test{position: absolute;left: 0;width: 100%;height: 100%;outline: none;opacity: 0;}
    .img_center{border: 1px dashed rgba(198, 196, 196, 0.86);width: 32px;height: 32px;border-radius: 4px;}
    .img_center img{width: 100%;height: 100%;}
    .qing_an{display: flex;align-items: center;margin-top: 30px;margin-left: 5%;}
    .qing_an input{height: 34px;border: 0;outline: none;margin-left: 20px;}
    .qing_an_1{background: #ed3f14;color: #ffffff;border-radius: 4px;width: 60px;}
    .qing_an_2{background: #019688;color: #ffffff;border-radius: 4px;width: 100px;}
    .tan_jia_meng{position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 99999;background: rgba(0,0,0,0.4);display: none;}
    .tan_jia_meng2{position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 99999;background: rgba(0,0,0,0.4);display: none;}
    /*图册样式*/
    .modal-dialog {width: 700px;margin: -20px auto;}
    .box .handAdd{position: absolute;height: 100%;width: 100%;opacity: 0;border:0px ;background: rgba(0,0,0,0);}
    .box{position: relative;margin-right: 10px;font-size: 30px;height:100px;width:100px;display: flex;justify-content: center;align-items: center;border:1px solid #DCDCDC;border-radius: 5px;}
    .imglist {margin-top: 10px;}
    .imglist .listItem input{border: 0px;height: 100%;width: 100%;text-align:center;background: rgba(0,0,0,0);}
    .imglist .listItem{position:relative;float: left;margin: 10px;margin-left: 0px; /*height:90px ;*/}
    .imglist .listItem img{height: 100%;width: 100%;}
    .imglist .listItem .x{display: flex;cursor: pointer;font-size: 10px;border-radius: 100%;justify-content: center;align-items: center;line-height: 7.5px;position: absolute;color: #ffffff;top: -7px;z-index:999;right:-7px;height:15px;width: 15px;background:#999;
    }
    .imglist .listItem .text{display: flex;font-size: 10px;justify-content: center;align-items: center;position: absolute;line-height:10px;color: #fff;bottom: 0%;right:0px;height:20%;width: 100%;z-index: 999;background: rgba(0,0,0,.3);}
</style>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="renderer" content="webkit" />
    <title><?php echo htmlentities($config['name']); ?></title>
    <meta name="keywords" content="" />
    <meta name="description" content=""/>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <link rel="shortcut icon" href="favicon.ico" />
    <link href="/public/admin/css/jquery.contextMenu.min.css" rel="stylesheet"/>
    <link href="/public/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/admin/css/plugins/jsTree/style.min.css" rel="stylesheet">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/public/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/public/admin/css/plugins/summernote/summernote.css" rel="stylesheet" />

    <link href="/public/admin/css/plugins/summernote/summernote-bs3.css" rel="stylesheet" />
    <link href="/public/admin/css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
    <link href="/public/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/admin/css/style.css?v=4.1.0" rel="stylesheet">

    <script src="/public/layui-v2.9.14/layui/layui.js"></script>
    <script src="/public/admin/js/jquery-2.2.0.min.js"></script>
    <script>
        layui.use('upload', function(){
            var $ = layui.jquery,upload = layui.upload;
        });
    </script>
    <style>
        /*分页样式*/
        .pagination{width: 100%;display: flex;align-items: center;justify-content: flex-end;}
    </style>
</head>

<script src="/public/admin/js/jquery-2.2.0.min.js"></script>
<script src="/public/vue/vue.js"></script>
<script src="/public/vue/axios.min.js"></script>
<script src="/public/vue/vue-resource.min.js"></script>
<script src="/public/vue/request_admin.js"></script>

<body>
<!--平台管理员-->
<?php if($admin_info['role_type'] == 1): ?>
<style>
    /*列表自定义样式*/
    body {background-color: transparent!important;}
    @media (max-width: 767px) {
        /* 手机 */
        .list_left{width:25%;margin-right:1%;float:left;height:100%;min-height:780px;background-color:#FFFFFF;}
        .list_right{width:74%;float:left;background-color:#FFFFFF;height:100%;min-height:780px;}
    }
    @media (min-width: 768px) {
        /* 电脑 */
        .list_left{width:15%;margin-right:0.5%;float:left;height:100%;min-height:780px;background-color:#FFFFFF; }
        .list_right{width:84%;float:left;background-color:#FFFFFF;height:100%;min-height:780px;}
    }
    .list_left{overflow: hidden;}
    /*定义滚动条高宽及背景*/
    .left_cat{height: 93%;overflow:scroll;overflow:hidden;overflow:auto;white-space: nowrap; }
    .left_cat::-webkit-scrollbar {width: 4px;height: 8px;}
    .left_cat::-webkit-scrollbar-track{background-color: #FFFFFF;}
    .left_cat::-webkit-scrollbar-thumb {background-color: #dcdcdc;border-radius: 10px;}
    /*树组件*/
    .layui-tree-iconClick{display: none!important;}   /*多选图标隐藏*/
    .layui-form-checkbox[lay-skin=primary] i{left: 9px;}
    .layui-tree-entry{height: auto;}
    .layui-tree-txt {margin-left: 10px;}
</style>
<!--左侧列表-->
<div class="list_left">
    <h2 style="margin-left:10px;margin-right: 10px;font-size: 17px;text-align: center;">所属分类</h2>
    <div class="left_cat" id="ID-tree-demo-showCheckbox"></div>
</div>
<!--右侧列表-->
<div class="list_right">
    <!--搜索栏-->
    <div class="demoTable">
        <fieldset class="layui-elem-field">
            <legend style="margin-bottom:0px;">搜索栏</legend>
            <div class="layui-field-box">
                <form class="layui-form layui-row layui-col-space16" onkeydown="if(event.keyCode==13)return false;" onSubmit="return checkSubmit();">
                    <div class="layui-col-md4">
                        <div class="layui-input-wrap">
                            <input class="layui-input" id="name" placeholder="请输入产品名称 / 店铺名称" autocomplete="off">
                        </div>
                    </div>
                    <!--                    <div class="layui-col-md4" style="width: 200px;">-->
                    <!--                        <div class="layui-input-wrap">-->
                    <!--                            <select class="layui-select" id="act_id">-->
                    <!--                                <option value="">请选择分类</option>-->
                    <!--                                <?php if(is_array($goods_act) || $goods_act instanceof \think\Collection || $goods_act instanceof \think\Paginator): if( count($goods_act)==0 ) : echo "" ;else: foreach($goods_act as $key=>$goods_act): ?>-->
                    <!--                                <option value="<?php echo htmlentities($goods_act['id']); ?>"><?php echo htmlentities($goods_act['name']); ?></option>-->
                    <!--                                <?php endforeach; endif; else: echo "" ;endif; ?>-->
                    <!--                            </select>-->
                    <!--                        </div>-->
                    <!--                    </div>-->
                    <div class="layui-col-md4">
                        <button type="button" class="layui-btn" data-type="reload" lay-filter="demo-table-search">搜索</button>
                    </div>
                </form>
            </div>
        </fieldset>
    </div>
    <!--表格处理-->
    <div style="margin-left:1.1rem!important;margin-right:1.1rem!important;">
        <table class="layui-hide" id="demo" lay-filter="test"></table>
    </div>
</div>
<?php endif; ?>

<!--店铺管理员-->
<?php if($admin_info['role_type'] == 2): ?>
<!--搜索栏-->
<div class="demoTable">
    <fieldset class="layui-elem-field">
        <legend style="margin-bottom:0px;">搜索栏</legend>
        <div class="layui-field-box">
            <form class="layui-form layui-row layui-col-space16" onkeydown="if(event.keyCode==13)return false;" onSubmit="return checkSubmit();">
                <div class="layui-col-md4">
                    <div class="layui-input-wrap">
                        <input class="layui-input" id="name" placeholder="请输入产品名称" autocomplete="off">
                    </div>
                </div>
                <div class="layui-col-md4">
                    <button type="button" class="layui-btn" data-type="reload" lay-filter="demo-table-search">搜索</button>
                </div>
            </form>
        </div>
    </fieldset>
</div>
<!--表格处理-->
<div style="margin-left:1.1rem!important;margin-right:1.1rem!important;">
    <table class="layui-hide" id="demo" lay-filter="test"></table>
</div>
<?php endif; ?>


<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <?php if($table_jurisdiction['is25_show'] == 1): ?>
        <button class="layui-btn layui-btn-sm" lay-event="add" style="width: 100px;">创建</button>
        <?php endif; ?>
    </div>
</script>
<script type="text/html" id="barDemo">
    <?php if($table_jurisdiction['is26_show'] == 1): ?>
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="guige">规格</a>
    <?php endif; if($table_jurisdiction['is60_show'] == 1): ?>
    <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="tuce">图册</a>
    <?php endif; if($table_jurisdiction['is27_show'] == 1): ?>
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <?php endif; if($table_jurisdiction['is28_show'] == 1): ?>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    <?php endif; ?>
</script>
<script type="text/html" id="switchTpl">
    <input type="checkbox" name="is_sold" value="{{d.goods_id}}" lay-skin="switch" lay-text="是|否" lay-filter="is_sold_Demo" {{d.is_sold == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="switchTpl2">
    <input type="checkbox" name="is_competitive" value="{{d.goods_id}}" lay-skin="switch" lay-text="是|否" lay-filter="is_competitive_Demo" {{d.is_competitive == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="switchTpl3">
    <input type="checkbox" name="is_new" value="{{d.goods_id}}" lay-skin="switch" lay-text="是|否" lay-filter="is_new_Demo" {{d.is_new == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="switchTpl4">
    <input type="checkbox" name="is_discounts" value="{{d.goods_id}}" lay-skin="switch" lay-text="是|否" lay-filter="is_discounts_Demo" {{d.is_discounts == 1 ? 'checked' : '' }}>
</script>
<!--列表缩略图-->
<script type="text/html" id="list_img">
    <img src="{{d.img}}" style="" width="28" height="21" onclick="showBigImage('{{d.img}}','{{d.goods_id}}')"  alt=""/>
</script>

<!--规格弹窗-->
<div class="tan_jia_meng">
    <div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog" style="width: 60%;">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" onclick="close2()"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
                    </button>
                    <h4 class="modal-title">规格创建</h4>
                </div>
                <div class="modal-body" style="height: 400px;overflow: auto;">
                    <!-- 规则名称-->
                    <div class="gui_box1_1">
                        <span class="gui_box1_1_span" style="overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">规则名称:</span>
                        <div class="gui_box1_1_tian" onclick="guige_name_add()">+添加新规则</div>
                    </div>
                    <div class="gui_box1_1">
                        <div id="name_list" style="display: flex;align-items: center;">
                        </div>
                    </div>
                    <!--规则属性-->
                    <span id="guige_shuxing">
                    </span>
                    <div class="sheng" onclick="guige_add()">生成</div>
                    <!--生成的记录-->
                    <span id="guige_list">
                    </span>
                </div>
                <div class="modal-footer">
                    <input type="hidden" id="goods_id" value="0">
                    <button type="button" class="btn btn-white" data-dismiss="modal" onclick="close2()">关闭</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="close2()">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--相册弹窗-->
<div class="tan_jia_meng2">
    <div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog" style="width: 60%;">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" onclick="close2()"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
                    </button>
                    <h4 class="modal-title">图册编辑</h4>
                </div>
                <div class="modal-body" style="height: 400px;overflow:scroll;">
                    <form method="post" onSubmit="return chkform(this)" name="photo_form" id="photo_form" action="" enctype="multipart/form-data">
                        <div class="box">
                            <div>+</div>
                            <input class="handAdd" type="file" id="img" name="photo_img"/>
                            <input type="hidden" id="photo_goods_id" name="goods_id" value="0">
                        </div>
                        <span class="help-block m-b-none" style="color:red;">尺寸:265 x 224</span>

                    </form>
                    <div class="imglist" id="imglist">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(function(){
        //定义全局变量
        window.check_reload = function () {
            table.reload('demo');
            return true;
        };
        // 得到需要的内置组件
        var layer = layui.layer; //弹层
        var table = layui.table
            ,form = layui.form; //表格
        var dropdown = layui.dropdown; //下拉菜单
        var checkedValues = {};

        // 执行一个 table 实例
        table.render({
            elem: '#demo'
            ,height: 600
            ,url: "<?php echo Url('Goods/goods_list_ajax'); ?>" //数据接口(此处为静态数据,仅作演示)
            ,title: '用户表'
            ,page: true //开启分页
            ,limit:20
            //,toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
            ,toolbar: '#toolbarDemo' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
            ,defaultToolbar: ['filter']//自定义右侧
            ,totalRow: false //开启合计行
            ,cols: [[ //表头
                {type: 'checkbox'}
                ,{field: 'goods_id', title: 'ID', width:70, sort: true,align: "center"}
                ,{field: 'img', title: '缩略图', minWidth: 10,width:73,align: 'center',templet:'#list_img'}
                ,{field: 'shop_name', title: '所属店铺', width:140,align: "center",templet:field_shop_name,hide: true}
                ,{field: 'name', title: '产品名称', width:300}
                ,{field: 'name_act', title: '所属分类', width:120,align: "center",hide:true}
                ,{field: 'price', title: '售价', width:80,align: "center"}
                ,{field: 'is_sold', title:'上架', width:80,align: 'center', templet: '#switchTpl', unresize: true}
                // ,{field: 'is_competitive', title:'精品', width:80,align: 'center', templet: '#switchTpl2', unresize: true}
                // ,{field: 'is_new', title:'新品', width:80,align: 'center', templet: '#switchTpl3', unresize: true}
                // ,{field: 'is_discounts', title:'特惠', width:80,align: 'center', templet: '#switchTpl4', unresize: true}
                ,{field: 'stocks', title: '库存', width:80,align:'center',templet:stocks}
                ,{field: 'sort', title: '排序', width:80,edit:'text',align:'center',sort: true}
                ,{field: 'state', title: '状态', width:100,align:'center',templet:field_state,hide: true}
                ,{field: 'add_time', title: '创建时间', width: 145,align: "center", sort: true}
                ,{ fixed: 'right', title: '操作', width: 230, align:'center', toolbar: '#barDemo'}
            ]],response: {
                statusCode: 200 //重新规定成功的状态码为 200,table 组件默认为 0
            }, done: function (res, curr, count) {
                var admin_role_type = "<?php echo htmlentities($admin_info['role_type']); ?>";
                if (admin_role_type == 1){ //平台管理员
                    table.hideCol('demo', [
                        {field: 'shop_name', hide: false},
                        {field: 'name_act', hide: false},
                    ]);
                }else if(admin_role_type == 2){ //店铺管理员
                    table.hideCol('demo', [
                        {field: 'state', hide: false},
                    ]);
                }
            }
        });
        /*是否显示*/
        form.on('switch(is_sold_Demo)', function(obj){
            if (obj.elem.checked == true){var value = 1;}else{var value = 0;}
            req_post("<?php echo Url('Goods/goods_field_update'); ?>",{'id':this.value,'field_name':'is_sold','value':value}).then(res=>{
                if (res.code == 405){
                    parent.layer.msg(res.msg, {shift: 2});
                    setTimeout(() => {
                        obj.elem.checked = false;
                        form.render();
                    }, 1800);
                }
            });
        });
        /*是否精品*/
        form.on('switch(is_competitive_Demo)', function(obj){
            if (obj.elem.checked == true){var value = 1;}else{var value = 0;}
            req_post("<?php echo Url('Goods/goods_field_update'); ?>",{'id':this.value,'field_name':'is_competitive','value':value}).then(res=>{
            });
        });
        /*是否新品*/
        form.on('switch(is_new_Demo)', function(obj){
            if (obj.elem.checked == true){var value = 1;}else{var value = 0;}
            req_post("<?php echo Url('Goods/goods_field_update'); ?>",{'id':this.value,'field_name':'is_new','value':value}).then(res=>{
            });
        });
        /*是否特惠*/
        form.on('switch(is_discounts_Demo)', function(obj){
            if (obj.elem.checked == true){var value = 1;}else{var value = 0;}
            req_post("<?php echo Url('Goods/goods_field_update'); ?>",{'id':this.value,'field_name':'is_discounts','value':value}).then(res=>{
            });
        });
        /*设置字段*/
        function stocks(data){
            var stocks = data.stocks;
            if (stocks == 0){
                return "<span style='color:red;'>0</span>"
            }else{
                return stocks;
            }
        }
        function field_shop_name(data)
        {
            if (data.shop_name == ''){
                return "<span style='color:#16b777;'>平台直售</span>"
            }else{
                return data.shop_name;
            }
        }
        function field_state(data)
        {
            if (data.state == 0){
                return '<button type="button" class="layui-btn layui-btn-xs layui-btn-radius" style="width: 70px;height: 22px;line-height: 21px;transform: scale(0.9);background-color:#999">待审核</button>';
            }else if(data.state == 1) {
                return '<button type="button" class="layui-btn layui-btn-xs layui-btn-radius" style="width: 70px;height: 22px;line-height: 21px;transform: scale(0.9);background-color:#5fb878">已通过</button>';
            }else if(data.state == 2){
                return '<button type="button" class="layui-btn layui-btn-xs layui-btn-radius" style="width: 70px;height: 22px;line-height: 21px;transform: scale(0.9);background-color:#da4a40">已驳回</button>';
            }
        }
        /*单元格编辑监听事件*/
        table.on('edit(test)',function(obj){
            var field_name = obj.field;
            var value = '';
            if (field_name == 'sort'){
                value = obj.data.sort;
                if (value != 0){
                    var reg = /(^-?\d+$)/;
                    if(!reg.test(value)){
                        parent.layer.msg('排序格式错误', {shift: 2});
                        return false;
                    }
                }
            }
            req_post("<?php echo Url('Goods/goods_field_update'); ?>",{'id':obj.data.goods_id,'field_name':field_name,'value':value}).then(res=>{
                if (res.code == 200){
                    layer.msg(res.msg, {
                        icon: 1,
                        time: 1800,
                        end: function () {
                        }
                    })
                }
            });

        })
        /*搜索处理*/
        var $ = layui.$, active = {
            reload: function(){
                //执行重载
                table.reload('demo', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                        name:$('#name').val(),
                        act_id:$('#act_id').val(),
                        checked_act_id:checkedValues,
                    }
                });
            }
        };
        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        /*左侧多选列表*/
        layui.use(function(){
            var tree = layui.tree
            req_post("<?php echo Url('Goods/act_checked_data'); ?>").then(res=>{
                if (res.code == 200){
                    var data = res.data.checked_data;
                    // 渲染
                    tree.render({
                        elem: '#ID-tree-demo-showCheckbox',
                        data: data,
                        showCheckbox:true,
                        showLine:true,//是否开启节点连接线
                        edit: [] // 开启节点的右侧操作图标
                    });
                }
            });
        });
        /*左侧多选列表-选中处理*/
        layui.use(['form'], function() {
            var form = layui.form;
            // 获取已选中的值
            form.on('checkbox', function(data){
                if (data.elem.value != 'on') {
                    if (data.elem.checked) {
                        checkedValues[data.value] = data.value;
                    } else {
                        delete checkedValues[data.value];
                    }
                    //执行重载
                    table.reload('demo', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }
                        , where: {
                            name: $('#name').val(),
                            act_id: $('#act_id').val(),
                            checked_act_id: checkedValues,
                        }
                    });
                }
            });
        });
        /*头工具栏事件*/
        table.on('toolbar(test)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id)
                ,data = checkStatus.data; //获取选中的数据
            switch(obj.event){
                case 'add':
                    parent.layer.open({
                        type: 2,
                        title: '创建',
                        shadeClose: true,
                        shade: 0.5,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['70%','80%'],
                        content:'/admin/Goods/goods_update',
                        end:function(res,err) {
                        }
                    });
                    //window.location.href="/admin/Goods/goods_add";
                    break;
            };
        });
        /*表格工具事件*/
        table.on('tool(test)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
            var data = obj.data //获得当前行数据
                ,layEvent = obj.event; //获得 lay-event 对应的值
            if(layEvent === 'guige'){
                $("#myModal").css('display','block');
                $(".tan_jia_meng").css('display','block');
                $("#goods_id").val(data.goods_id);
                guige(data.goods_id);
            }else if(layEvent === 'tuce'){
                $("#myModal2").css('display','block');
                $(".tan_jia_meng2").css('display','block');
                photo(data.goods_id);
            }else if(layEvent === 'edit'){
                parent.layer.open({
                    type: 2,
                    title: '编辑',
                    shadeClose: true,
                    shade: 0.5,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['70%','80%'],
                    content:'/admin/Goods/goods_update?goods_id='+data.goods_id,
                    end:function(res,err) {
                    }
                });
                // window.location.href="/admin/Goods/goods_edit?goods_id="+data.goods_id;
            }else if(layEvent === 'del'){
                parent.layer.confirm('您确定删除么?', {
                    btn: ['确定', '取消'], //按钮
                    shade: 0.5 //不显示遮罩
                }, function () {
                    //执行关闭
                    var index = parent.layer.confirm();
                    parent.layer.close(index);
                    req_post("<?php echo Url('Goods/goods_del'); ?>",{'goods_id':data.goods_id}).then(res=>{
                        if (res.code == 200){
                            layer.msg(res.msg, {
                                icon: 1,
                                time: 1800,
                                end: function () {
                                    table.reload('demo');
                                }
                            })
                        }
                    });
                }, function () {
                    parent.layer.msg('已取消', {shift: 2});
                });
            }
        });
    });
    /*缩略图点击放大*/
    function showBigImage(img,id) {
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            shadeClose: true, //点击阴影关闭
            content: "<img src=" + img + " />"
        });
    }
    /*表单提交成功*/
    function Fromsucceed(){
        check_reload();
    }
    /*弹窗关闭*/
    function close2(){
        $("#myModal").css('display','none');
        $(".tan_jia_meng").css('display','none');
        $("#myModal2").css('display','none');
        $(".tan_jia_meng2").css('display','none');
    }
</script>
<!--规格操作处理-->
<script>
    //规格查看
    function guige(goods_id){
        $("#goods_id").val(goods_id);
        $.ajax({
            type: "POST",
            url: "<?php echo Url('Goods/guige_info'); ?>",
            data: {'goods_id':goods_id},
            dataType: "json",
            success: function(res){
                $("#name_list").html(res.data.guige_name);
                $("#guige_shuxing").html(res.data.guige_shuxing);
                $("#guige_list").html(res.data.guige_list);
            }
        });
    }
    //规格名称创建
    function guige_name_add(){
        var goods_id = $("#goods_id").val();
        $.ajax({
            type: "POST",
            url: "<?php echo Url('Goods/guige_name_add'); ?>",
            data: {'goods_id':goods_id},
            dataType: "json",
            success: function(res){
                guige(goods_id);
            }
        });
    }
    //规格名称删除
    function guige_name_del(guige_id){
        var goods_id = $("#goods_id").val();
        $.ajax({
            type: "POST",
            url: "<?php echo Url('Goods/guige_name_del'); ?>",
            data: {'guige_id':guige_id,'goods_id':goods_id},
            dataType: "json",
            success: function(res){
                guige(goods_id);
            }
        });
    }
    //规格属性创建
    function guige_shuxing_add(goods_id,guige_id){
        var name = $("#shuxing"+guige_id).val();
        if (name == ''){
            layer.msg('请输入属性值', {icon: 2,time:1800});
            return false;
        }
        $.ajax({
            type: "POST",
            url: "<?php echo Url('Goods/guige_shuxing_add'); ?>",
            data: {'goods_id':goods_id,'guige_id':guige_id,'name':name},
            dataType: "json",
            success: function(res){
                guige(goods_id);
            }
        });
    }
    //规格属性删除
    function guige_shuxing_del(goods_id,guige_id,guige_value_k){
        $.ajax({
            type: "POST",
            url: "<?php echo Url('Goods/guige_shuxing_del'); ?>",
            data: {'goods_id':goods_id,'guige_id':guige_id,'guige_value_k':guige_value_k},
            dataType: "json",
            success: function(res){
                guige(goods_id);
            }
        });
    }
    //规格生成
    function guige_add(){
        var goods_id = $("#goods_id").val();
        $.ajax({
            type: "POST",
            url: "<?php echo Url('Goods/guige_add'); ?>",
            data: {'goods_id':goods_id},
            dataType: "json",
            success: function(res){
                layer.msg(res.msg,{
                    icon:1,
                    time:1800,
                    end:function () {
                        guige(goods_id);
                    }
                })
            }
        });
    }
    //规格记录删除
    function guige_list_del(guige_id,goods_id){
        parent.layer.confirm('您确定删除规格数据么?', {
            btn: ['确定','取消'], //按钮
            shade: false //不显示遮罩
        }, function(){
            //执行关闭
            var index = parent.layer.confirm();
            parent.layer.close(index);
            $.ajax({
                type: "POST",
                url: "<?php echo Url('Goods/guige_list_del'); ?>",
                data: {'guige_id':guige_id,'goods_id':goods_id},
                dataType: "json",
                success: function(res){
                    layer.msg(res.msg,{
                        icon:1,
                        time:1800,
                        end:function () {
                            guige(goods_id);
                        }
                    })
                }
            });
        }, function(){
            parent.layer.msg('已取消', {shift: 2});
        });
    }
</script>
<!--图册操作处理-->
<script>
    //查询图册
    function photo(id){
        $("#photo_goods_id").val(id);
        $.ajax({
            type:'post',
            url:'<?php echo url("Goods/goods_photo"); ?>',
            data:{'goods_id':id},
            dataType: "json",
            success: function(res) {
                $("#imglist").html(res.data.str);
            }
        });
    }
    //图片上传
    $('#img').change(function(){
        layer.msg('正在上传~');
        var goods_id = $("#photo_goods_id").val();
        var formData =new FormData($('#photo_form')[0])
        $.ajax({
            type:'post',
            url:'<?php echo url("Goods/goods_photo_upload"); ?>',
            data:formData,
            cache: false,
            contentType: false,
            processData: false,
            dataType: "json",
            success: function(res) {
                $("#photo_form").val('');
                if (res.code == 200){
                    layer.msg(res.msg,{
                        icon:1,
                        time:1800,
                        end:function () {
                            photo(goods_id);
                        }
                    })
                }else{
                    layer.msg(res.msg, {icon: 2,time:1800});
                }
            }
        });

    })
    //图片删除
    function photo_del(id) {
        $.ajax({
            type:'post',
            url:'<?php echo url("Goods/goods_photo_del"); ?>',
            data:{'id':id},
            dataType: "json",
            success: function(res) {
                if (res.code == 200){
                    layer.msg(res.msg,{
                        icon:1,
                        time:1800,
                        end:function () {
                            photo(res.data.goods_id);
                        }
                    })
                }else{
                    layer.msg(res.msg, {icon: 2,time:1800});
                }
            }
        });
    }
</script>
</body>
</html>