@using MySystem.Models;
@{MerchantCol editData = ViewBag.data as MerchantCol;}
@{
    string SysUserName = ViewBag.SysUserName as string;
    string right = ViewBag.right as string;
    string MerchantId = ViewBag.MerchantId as string;
    int MerchantIdForInt = int.Parse(MerchantId);
}
<!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">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <script src="/admin/js/jquery-1.10.1.min.js"></script>
    <style>
        .layui-input-inline{
            width: 175px !important;
        }
        .layui-form-label{
            width: 85px !important;
        }
        .layui-inline{
            margin-right: 0px !important;
        }        
        .w100{
            width: 100px !important;
        }
        .ml50{
            margin-left: 50px !important;
        }
    </style>
</head>
<body>

    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
        <input type="hidden" name="ColId" value="@editData.ColId" />
        <input type="hidden" name="OldEnName" value="@editData.ColEnName" />
        <div class="layui-card">
          <div class="layui-card-body">
        <div class="layui-tab" lay-filter="mytabbar"alue="@MerchantId" />
        <div class="layui-tab" lay-filter="test">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="1">基本信息</li>
                <li lay-id="2">SEO设置</li>
            </ul>
            <div class="layui-tab-content mt20">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">上级栏目</label>
                            <div class="layui-input-inline">
                                <select id="PColId" name="PColId" lay-search="">
                                    <option value="">作为顶级栏目</option>
                                    @{List<MySystem.Models.MerchantCol> ColId = new MySystem.Models.WebCMSEntities().MerchantCol.Where(m => m.MerchantId == MerchantIdForInt).OrderBy(m => m.ColId).ToList();}
                                    @foreach (MySystem.Models.MerchantCol subColId in ColId)
                                    {
                                        string kg = "";
                                        for (int i = 1; i < subColId.ColId.Length / 3; i++)
                                        {
                                            kg += "　　";
                                        }
                                        <option value="@subColId.ColId">@(kg+subColId.ColName)</option>
                                    }
                                </select>
                                <script>$("#PColId").val("@ViewBag.PColId");</script>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">栏目名</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" id="ColName" name="ColName" value="@editData.ColName" maxlength="50" lay-verify="required;" autocomplete="off" placeholder="请输入名称">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">英文名</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" id="ColEnName" name="ColEnName" value="@editData.ColEnName" maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入英文名">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">简介</label>
                        <div class="layui-input-block">
<textarea class="layui-textarea" id="ColDetail" name="ColDetail" lay-verify="" placeholder="请输入简介">@editData.ColDetail</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图标</label>
                        <div class="layui-input-block">
                            <div class="layui-upload">
                                <input type="hidden" id="ColPicPath" name="ColPicPath" value="@editData.ColPicPath">
                                <button class="layui-btn" type="button" id="ColPicPathBtn">选择图片</button>
                                <div class="layui-inline layui-word-aux">大小限制为100K</div>
                            </div>
                            <div class="mt10" id="ColPicPathImage">
                                @if (!string.IsNullOrEmpty(editData.ColPicPath))
                                {
                                    <img src="@(MySystem.OssHelper.Instance.SourceHost)@editData.ColPicPath" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic('@(MySystem.OssHelper.Instance.SourceHost)@editData.ColPicPath')">
                                }
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">推荐</label>
                        <div class="layui-input-block">
                            <input type="checkbox" id="Recommend" name="Recommend" value="1" @(editData.Recommend == 1 ? "checked=checked" : "") lay-skin="switch" lay-filter="switchTest" title="开关">
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">网页标题</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" id="SeoTitle" name="SeoTitle" value="@editData.SeoTitle" maxlength="50" autocomplete="off" placeholder="请输入网页标题">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">网页关键字</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" id="SeoKeyword" name="SeoKeyword" value="@editData.SeoKeyword" maxlength="50" autocomplete="off" placeholder="请输入网页关键字">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">网页描述</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="SeoDescription" id="SeoDescription" placeholder="请输入网页描述">@editData.SeoDescription</textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit" value="确认">
        </div>
    </div>
    </div>
    </div>

    <script src="/layuiadmin/layui/layui.js"></script>
    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
    <script src="/other/mybjq/kindeditor-min.js"></script>
    <script src="/other/mybjq/lang/zh_CN.js"></script>
    <script>
        var ids = "";
        function getChildren(obj) {
            $.each(obj, function (index, value) {
                var id = obj[index].id;
                ids += id + ",";
                var children = obj[index].children;
                if (children) {
                    getChildren(children);
                }
            });
        }

        function movePrev(obj, tagId) {
            $(obj).parent().prev().insertAfter($(obj).parent());
            checkPics(tagId);
        }
        function moveNext(obj, tagId) {
            $(obj).parent().next().insertBefore($(obj).parent());
            checkPics(tagId);
        }
        function deletePic(obj, tagId) {
            $(obj).parent().remove();
            checkPics(tagId);
        }
        function checkPics(tagId) {
            var pics = "";
            var texts = "";
            $("#" + tagId + "Image div img").each(function (i) {
                pics += $(this).attr("src") + "|";
            });
            $("#" + tagId + "Image div input").each(function (i) {
                texts += $(this).val() + "|";
            });
            if (pics == "") {
                $("#" + tagId).val("");
            } else {
                pics = pics.substring(0, pics.length - 1);
                texts = texts.substring(0, pics.length - 1);
                $("#" + tagId).val(pics + "#cut#" + texts);
            }
        }
        function showBigPic(picpath) {
            parent.layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['auto', 'auto'],
                content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
            });
        }


        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
            var $ = layui.$
                , form = layui.form
                , element = layui.element
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate
                , croppers = layui.croppers
                , upload = layui.upload
                , transfer = layui.transfer
                , util = layui.util
                , tree = layui.tree;

            //Hash地址的定位
            var layid = location.hash.replace(/^#test=/, '');
            element.tabChange('test', layid);
            element.on('tab(test)', function (elem) {
                location.hash = 'test=' + $(this).attr('lay-id');
            });

            //日期


            //上传文件
            WebUploadJs('ColPicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MerchantColColPicPath"))),  function (filename) {
                $('#ColPicPathImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
                $('#ColPicPath').val(filename);
            });


            //穿梭框


            //TreeView，比如权限管理

        })

    </script>
</body>
</html>