@{
string RightInfo = ViewBag.RightInfo as string;
string right = ViewBag.right as string;

}
<!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>
    <script src="/admin/js/LAreaData2.js"></script>
    <script src="/admin/js/vue.min.js"></script>
</head>

<body>
    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
      <div class="layui-card">
          <div class="layui-card-body">
        <div class="layui-tab" lay-filter="mytabbar" id="app">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="1">基本信息</li>
                <li lay-id="2">使用范围</li>
                <li lay-id="3">开关设置</li>
                <li lay-id="4">时间限制</li>
                <li lay-id="5">SEO设置</li>
            </ul>
            <div class="layui-tab-content mt20">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">名称</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" id="Name" name="Name" maxlength="50"
                                lay-verify="required|" 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="Explanation" name="Explanation" maxlength="200"
                                lay-verify="" placeholder="请输入说明"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">库存</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="Stock" name="Stock" maxlength="20"
                                lay-verify="required|number|" autocomplete="off" placeholder="请输入库存">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">优惠券类型</label>
                        <div class="layui-input-inline">
                            <select id="Kind" name="Kind" lay-search="" lay-filter="Kind">
                                <option value="">请选择</option>
                                <option value="1">现金抵扣券</option>
                                <option value="2">满减券</option>
                                <option value="3">满折券</option>
                                <option value="4">折扣券</option>
                                <option value="5">运费券</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="Kind != '' && Kind > 1 && Kind < 4">
                        <label class="layui-form-label">满多少可用</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="FullReduceMoney" name="FullReduceMoney"
                                maxlength="20" value="0" lay-verify="number|" autocomplete="off" placeholder="请输入满多少可用">
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="Kind != '' && Kind < 5">
                        <label class="layui-form-label">{{FullReduceText}}</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="FullReduceData" name="FullReduceData"
                                maxlength="20" value="0" lay-verify="number|" autocomplete="off" placeholder="请输入满减数据">
                        </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 type="hidden" id="MerchantId" name="MerchantId" value="" />
                            <div id="MerchantIdTransfer" class="demo-transfer"></div>
                            @{string MerchantsJson = "[";}
                            @{Dictionary<string, string> MerchantsDic = new
                            MySystem.MerchantDictionary().getMerchantsDic();}
                            @foreach (string key in MerchantsDic.Keys)
                            {
                            MerchantsJson += "{\"value\": \"" + key + "\", \"title\": \"" + MerchantsDic[key] + "\"},";
                            }
                            @{MerchantsJson = MerchantsJson.TrimEnd(','); MerchantsJson += "]";}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品分类</label>
                        <div class="layui-input-block">
                            <input type="hidden" id="ProductColId" name="ProductColId" value="" />
                            <div id="ProductColIdTransfer" class="demo-transfer"></div>
                            @{string ColJson = "[";}
                            @{Dictionary<string, string> ColDic = new MySystem.DictionaryClass().getColDic("002");}
                            @foreach (string key in ColDic.Keys)
                            {
                                string kg = "";
                                for (int i = 1; i < key.Length / 3 - 1; i++)
                                {
                                    kg += "　　";
                                }
                                ColJson += "{\"value\": \"" + key + "\", \"title\": \"" + kg + ColDic[key] + "\" },";
                            }
                            @{ColJson = ColJson.TrimEnd(','); ColJson += "]";}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品</label>
                        <div class="layui-input-block">
                            <input type="hidden" id="ProductId" name="ProductId" value="" />
                            <div id="ProductIdTransfer" class="demo-transfer"></div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">创客最高等级</label>
                        <div class="layui-input-inline">
                            <select id="UserMinLevel" name="UserMinLevel" lay-search="">
                                <option value="">请选择</option>
                                @{Dictionary<string, string> UserLevelSetDic = new MySystem.UserDictionary().getUserLevelSet();}
                                @foreach (string key in UserLevelSetDic.Keys)
                                {
                                <option value="@key">@UserLevelSetDic[key]</option>
                                }
                            </select>
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <select id="UserMaxLevel" name="UserMaxLevel" lay-search="">
                                <option value="">请选择</option>
                                    @foreach (string key in UserLevelSetDic.Keys)
                                    {
                                    <option value="@key">@UserLevelSetDic[key]</option>
                                    }
                            </select>
                        </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 type="checkbox" id="IsNewUser" name="IsNewUser" value="1" lay-skin="switch"
                                lay-filter="switchTest" title="开关">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否一次性使用</label>
                        <div class="layui-input-block">
                            <input type="checkbox" id="IsReUse" name="IsReUse" value="1" lay-skin="switch"
                                lay-filter="switchTest" title="开关">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否公开领取</label>
                        <div class="layui-input-block">
                            <input type="checkbox" id="IsPublic" name="IsPublic" value="1" lay-skin="switch"
                                lay-filter="switchTest" title="开关">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公开领取开始时间</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="PublicStartDate" name="PublicStartDate"
                                lay-verify="" autocomplete="off" placeholder="开始时间">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="PublicEndDate" name="PublicEndDate" lay-verify=""
                                autocomplete="off" placeholder="结束时间">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公开每人领取数量</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="PublicMax" name="PublicMax" maxlength="20"
                                lay-verify="required|int|" autocomplete="off" placeholder="请输入公开每人领取数量">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公开每人每天领取数量</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="PublicMaxByDay" name="PublicMaxByDay"
                                maxlength="20" lay-verify="required|int|" autocomplete="off"
                                placeholder="请输入公开每人每天领取数量">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否叠加使用</label>
                        <div class="layui-input-block">
                            <input type="checkbox" id="IsSuperpose" name="IsSuperpose" value="1" lay-skin="switch"
                                lay-filter="switchTest" title="开关">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否与促销活动同时使用</label>
                        <div class="layui-input-block">
                            <input type="checkbox" id="AndPromotion" name="AndPromotion" value="1" 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-inline">
                            <input class="layui-input" type="text" id="ExpireStartDate" name="ExpireStartDate"
                                lay-verify="required|" autocomplete="off" placeholder="开始时间">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="ExpireEndDate" name="ExpireEndDate"
                                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 type="checkbox" id="IsRepeat" name="IsRepeat" value="1" lay-skin="switch"
                                lay-filter="IsRepeat" title="开关">
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="IsRepeat">
                        <label class="layui-form-label">使用时间</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="UseStartTime" name="UseStartDate" lay-verify=""
                                autocomplete="off" placeholder="开始时间">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="UseEndTime" name="UseEndDate" lay-verify=""
                                autocomplete="off" placeholder="结束时间">
                        </div>
                    </div>
                    <div class="layui-form-item" v-else>
                        <label class="layui-form-label">使用时间</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="UseStartDate" name="UseStartDate" lay-verify=""
                                autocomplete="off" placeholder="开始时间">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" id="UseEndDate" name="UseEndDate" lay-verify=""
                                autocomplete="off" placeholder="结束时间">
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="IsRepeat">
                        <label class="layui-form-label">重复类型</label>
                        <div class="layui-input-inline">
                            <select id="RepeatType" name="RepeatType" lay-search="" lay-filter="RepeatType" v-model="RepeatType">
                                <option value="">请选择</option>
                                <option value="1">日</option>
                                <option value="2">周</option>
                                <option value="3">月</option>
                                <option value="4">年</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="RepeatType == 1 && IsRepeat">
                        <label class="layui-form-label">间隔天数</label>
                        <div class="layui-input-inline">
                            <select id="RepeatCondition" name="RepeatCondition" lay-search="">
                                <option value="">请选择</option>
                                @for(int day=1;day<=30;day++)
                                {
                                <option value="@day">@(day)天</option>
                                }
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="RepeatType == 2 && IsRepeat">
                        <label class="layui-form-label">选择星期几</label>
                        <div class="layui-input-block">
                            <input type="hidden" id="RepeatCondition" name="RepeatCondition" value="" />
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="星期一" value="1">
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="星期二" value="2">
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="星期三" value="3">
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="星期四" value="4">
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="星期五" value="5">
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="星期六" value="6">
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="星期日" value="0">
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="RepeatType == 3 && IsRepeat">
                        <label class="layui-form-label">选择日</label>
                        <div class="layui-input-block">
                            <input type="hidden" id="RepeatCondition" name="RepeatCondition" value="" />
                            @for(int day=1;day<=31;day++)
                            {
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="@(day)日" value="@(day)">
                            }
                        </div>
                    </div>
                    <div class="layui-form-item" v-if="RepeatType == 4 && IsRepeat">
                        <label class="layui-form-label">选择月</label>
                        <div class="layui-input-block">
                            <input type="hidden" id="RepeatCondition" name="RepeatCondition" value="" />
                            @for(int day=1;day<=12;day++)
                            {
                            <input type="checkbox" name="RepeatConditionList" lay-skin="primary" title="@(day)月" value="@(day)">
                            }
                        </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" 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" 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="请输入网页描述"></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>
</div>

    <script src="/layuiadmin/layui/layui.js"></script>
    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
    <script src="/other/mybjq/kindeditor-min.js"></script>
    <script src="/other/mybjq/lang/zh_CN.js"></script>
    <script>
        //编辑器
        KindEditor.ready(function (K) {

        });

        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 AreasProvinceInit(tagId, areasVal, form) {
            for (var i = 0; i < provs_data.length; i++) {
                var sel = "";
                if (areasVal.indexOf(provs_data[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' +
                    provs_data[i].text + '</option>');
            }
            form.render();
        }

        function AreasProvinceSelected(tagId, areasVal, form, value) {
            $("#" + tagId + "City").html('<option value="">市</option>');
            var list = citys_data[value];
            for (var i = 0; i < list.length; i++) {
                var sel = "";
                if (areasVal.indexOf(list[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text +
                    '</option>');
            }
            $("#" + tagId + "Area").html('<option value="">县/区</option>');
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
                "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        function AreasCitySelected(tagId, areasVal, form, value) {
            $("#" + tagId + "Area").html('<option value="">县/区</option>');
            var list = dists_data[value];
            for (var i = 0; i < list.length; i++) {
                var sel = "";
                if (areasVal.indexOf(list[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text +
                    '</option>');
            }
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
                "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        function AreasAreaSelected(tagId, form) {
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
                "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        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").replace(osshost, '') + "|";
            });
            $("#" + 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 checkBox(tagId) {
            var text = "";
            $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
                text += $(this).val() + ",";
            });
            $("#" + tagId).val(text);
        }

        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;" />'
            });
        }

        function showProducts(ColIds,MerchantIds){
            $.ajax({
                url: "/Admin/Products/GetProductByCol?r=" + Math.random(1),
                data: "ColIds=" + ColIds + "&MerchantIds=" + MerchantIds,
                dataType: "json",
                success: function (data) {
                    transfer.render({
                        elem: '#ProductIdTransfer'
                        , data: data
                        , title: ['待选项', '选中项']

                        , showSearch: true
                        , onchange: function (obj, index) {
                            if (index == 0) {
                                var source = $("#ProductId").val();
                                $.each(obj, function (index, value) {
                                    var val = obj[index].value;
                                    if (source != "") {
                                        source += "," + val;
                                    } else {
                                        source += val;
                                    }
                                });
                                $("#ProductId").val(source);
                            } else if (index == 1) {
                                var source = "," + $("#ProductId").val() + ",";
                                $.each(obj, function (index, value) {
                                    var val = obj[index].value;
                                    source = source.replace("," + val + ",", ",");
                                });
                                if (source != "") {
                                    if (source == ",") {
                                        source = "";
                                    } else {
                                        source = source.substring(1, source.length - 1);
                                    }
                                }
                                $("#ProductId").val(source);
                            }
                        }
                    });
                }
            });
        }


        var form;
        var tree;
        var element;
        var transfer;
        function init_layui() {
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'],
            function () {
                var $ = layui.$,
                    layer = layui.layer,
                    layedit = layui.layedit,
                    laydate = layui.laydate,
                    croppers = layui.croppers,
                    upload = layui.upload,
                    util = layui.util;
                form = layui.form;
                tree = layui.tree;
                element = layui.element;
                transfer = layui.transfer;
                
                form.on("select(RepeatType)", function (data) {
                    app.RepeatType = data.value;
                    setTimeout(function () {
                        form.render();
                    }, 200);
                });
                form.on("select(Kind)", function (data) {
                    app.Kind = data.value;
                    if(data.value == 1){
                        app.FullReduceText = '抵扣金额';
                    } else if(data.value == 2){
                        app.FullReduceText = '减免金额';
                    } else if(data.value == 3){
                        app.FullReduceText = '折扣率';
                    } else if(data.value == 4){
                        app.FullReduceText = '折扣率';
                    } else if(data.value == 5){
                        app.FullReduceText = '';
                    }
                    setTimeout(function () {
                        form.render();
                    }, 200);
                });
                form.on("switch(IsRepeat)", function (data) {
                    app.IsRepeat = data.elem.checked;
                    if(data.elem.checked){
                        setTimeout(function () {
                            laydate.render({
                                elem: '#UseStartTime',
                                type: 'time'
                            });
                            laydate.render({
                                elem: '#UseEndTime',
                                type: 'time'
                            });
                            form.render();
                        }, 200);
                    } else {
                        setTimeout(function () {
                            laydate.render({
                                elem: '#UseStartDate',
                                type: 'datetime'
                            });
                            laydate.render({
                                elem: '#UseEndDate',
                                type: 'datetime'
                            });
                            form.render();
                        }, 200);
                    }
                });

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

                //日期
                laydate.render({
                    elem: '#UseStartDate',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#UseEndDate',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#PublicStartDate',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#PublicEndDate',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#ExpireStartDate',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#ExpireEndDate',
                    type: 'datetime'
                });


                //上传文件


                //穿梭框
                transfer.render({
                elem: '#MerchantIdTransfer'
                , data: @Html.Raw(MerchantsJson)
                , title: ['待选项', '选中项']

                , showSearch: true
                , onchange: function (obj, index) {
                if (index == 0) {
                var source = $("#MerchantId").val();
                $.each(obj, function (index, value) {
                var val = obj[index].value;
                if (source != "") {
                source += "," + val;
                } else {
                source += val;
                }
                });
                $("#MerchantId").val(source);
                } else if (index == 1) {
                var source = "," + $("#MerchantId").val() + ",";
                $.each(obj, function (index, value) {
                var val = obj[index].value;
                source = source.replace("," + val + ",", ",");
                });
                if (source != "") {
                if (source == ",") {
                source = "";
                } else {
                source = source.substring(1, source.length - 1);
                }
                }
                $("#MerchantId").val(source);
                }
                showProducts($("#ProductColId").val(),$("#MerchantId").val());
                }
                });
                transfer.render({
                elem: '#ProductColIdTransfer'
                , data: @Html.Raw(ColJson)
                , title: ['待选项', '选中项']

                , showSearch: true
                , onchange: function (obj, index) {
                if (index == 0) {
                var source = $("#ProductColId").val();
                $.each(obj, function (index, value) {
                var val = obj[index].value;
                if (source != "") {
                source += "," + val;
                } else {
                source += val;
                }
                });
                $("#ProductColId").val(source);
                } else if (index == 1) {
                var source = "," + $("#ProductColId").val() + ",";
                $.each(obj, function (index, value) {
                var val = obj[index].value;
                source = source.replace("," + val + ",", ",");
                });
                if (source != "") {
                if (source == ",") {
                source = "";
                } else {
                source = source.substring(1, source.length - 1);
                }
                }
                $("#ProductColId").val(source);
                }                
                showProducts($("#ProductColId").val(),$("#MerchantId").val());
                }
                });

                //TreeView，比如权限管理


                //省市区

            });
        }

        //加载vue
        var app = new Vue({
            el: '#app',
            data() {
                return {
                    RepeatType: '',
                    Kind: '',
                    FullReduceText: '',
                    IsRepeat: false,
                };
            },
            mounted() {
                init_layui();
            },
            methods: {
                
            }
        });
    </script>
</body>

</html>
