<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!--validate css-->
    <link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
    <!--fileinput css-->
    <link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="plugins/select2/select2.min.css">
    <link rel="stylesheet" href="common/css/uePicPicker.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[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]-->
</head>
<style>

    .datepicker{
        z-index:99999 !important;
    }
</style>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">

<div class="wrapper">
    <div class="content-wrapper" style="margin-left:0;">

        <section class="content-header">
            <h1>
                市场活动管理
                <small>市场活动</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active">市场活动</a></li>
            </ol>
        </section>


        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- general form elements disabled -->
                    <div class="box box-primary">
                        <form role="form" id="myForm">
                            <input name="id" value="$!{data.id}" hidden="true"/>
                            <div class="box-body">
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>编码</label>
                                    <input type="text"
                                           class="form-control" name="number"
                                           id="number"
                                           maxlength="50" placeholder="编码"
                                           value="$!{data.number}"
                                           readonly
                                    >
                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label >活动归属</label>
                                    <select id="belong" name="belong"
                                            class="form-control select2"
                                            data-placeholder="请选择活动归属">
                                        <option value="0">集团</option>
                                        <option value="1">品牌</option>
                                        <option value="2">门店</option>
                                    </select>
                                </div>

                                <div class="form-group form-md-line-input col-md-12" id="brandDiv" style="display: none;">
                                    <label>品牌</label>
                                    <div class="input-group">
                                        <input type="text" name="brandid" id="brandid"
                                               value="$!{data.brandid}"
                                               class="form-control" style="display: none">
                                        <input type="text" id="brandName"
                                               name="brandName" value="$!{data.brandName}"
                                               class="form-control" disabled>
                                        <span class="input-group-btn">
                                            <button type="button" id="brandSelect"
                                                    class="btn btn-info btn-flat">选择</button>
                                         </span>
                                    </div>

                                </div>

                                <div class="form-group form-md-line-input col-md-12" id="storeDiv" style="display: none;">
                                    <label>门店</label>
                                    <div class="input-group">
                                        <input type="text" name="storeid" id="storeid"
                                               value="$!{data.storeid}"
                                               class="form-control" style="display: none">
                                        <input type="text" id="storeName"
                                               name="storeName" value="$!{data.storeName}"
                                               class="form-control" disabled>
                                        <span class="input-group-btn">
                                            <button type="button" id="storeSelect"
                                                    class="btn btn-info btn-flat">选择</button>
                                         </span>
                                    </div>
                                </div>

                                <div class="form-group form-md-line-input col-md-12">
                                    <label >活动类型</label>
                                    <select id="type" name="type"
                                            class="form-control select2"
                                            data-placeholder="请选择活动类型">
                                        <option value="0">告知类</option>
                                        <option value="1">报名类</option>
                                    </select>
                                </div>
                                <div class="form-group form-md-line-input col-md-12" id="cardDiv" style="display: none;">
                                    <label>卡券</label>
                                    <div class="input-group">
                                        <input type="text" name="cardid" id="cardid"
                                               value="$!{data.cardid}"
                                               class="form-control" style="display: none">
                                        <input type="text" id="cardName"
                                               name="cardName" value="$!{data.cardName}"
                                               class="form-control" disabled>
                                        <span class="input-group-btn">
                                            <button type="button" id="cardSelect"
                                                    class="btn btn-info btn-flat">选择</button>
                                         </span>
                                    </div>
                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>支付金额</label>
                                    <input type="text"
                                           class="form-control number" name="price" min="0"
                                           id="price"
                                           maxlength="255" placeholder="支付金额"
                                           value="$!{data.price}"
                                    >
                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>名称</label>
                                    <input type="text"
                                           class="form-control" name="name"
                                           id="name"
                                           maxlength="255" placeholder="名称"
                                           value="$!{data.name}"
                                           required="required"
                                    >
                                </div>
                                <div class="form-group form-md-line-input col-md-12" id="smallimg">
                                </div>

                                <div class="form-group form-md-line-input col-md-12" id="haha">
                                </div>
                                <!--<div class="form-group form-md-line-input">
                                    <label>活动小图封面<font style="font-size: 12px;" color="red">（尺寸：205*202）</font></label>
                                    <div class="input-group">
                                        <input type="text" style="display: none;"
                                               class="form-control" name="smallimg"
                                               id="smallimg"
                                               maxlength="500" placeholder="活动小图封面"
                                               value="$!{data.smallimg}"
                                        >

                                        &lt;!&ndash;<span class="input-group-btn">&ndash;&gt;
                                        &lt;!&ndash;<button type="button" id="smallImgSelect"&ndash;&gt;
                                        &lt;!&ndash;class="btn btn-info btn-flat">选择</button>&ndash;&gt;
                                        &lt;!&ndash;</span>&ndash;&gt;
                                    </div>
                                    <div id="smallImgSelect"
                                         style="text-align: center;line-height: 200px;width: 200px;height: 200px;border: 1px #ccc solid;position: relative;">
                                        <i class="fa fa-plus" style="font-size:50px;color:#ccc"></i>
                                        <img src=""
                                             class="previewImg"
                                             id="previewSmallImg"/>
                                    </div>
                                </div>
                                <div class="form-group form-md-line-input">
                                    <label>活动大图<font style="font-size: 12px;" color="red">（尺寸：640*1040）</font></label>
                                    <div class="input-group">
                                        <input type="text"
                                               class="form-control" name="img" style="display: none;"
                                               id="img"
                                               maxlength="500" placeholder="活动大图"
                                               value="$!{data.img}"
                                        >
                                        &lt;!&ndash;<span class="input-group-btn">&ndash;&gt;
                                        &lt;!&ndash;<button type="button" id="bigImgSelect"&ndash;&gt;
                                        &lt;!&ndash;class="btn btn-info btn-flat">选择</button>&ndash;&gt;
                                        &lt;!&ndash;</span>&ndash;&gt;
                                    </div>
                                    <div id="imgSelect"
                                         style="text-align: center;line-height: 200px;width: 360px;height: 200px;border: 1px #ccc solid;position: relative;">
                                        <i class="fa fa-plus" style="font-size:50px;color:#ccc"></i>
                                        <img class="previewImg"
                                             id="previewImg"/>
                                    </div>
                                </div>-->
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>活动说明</label>
                                    <textarea type="text"
                                           class="form-control" name="explains"
                                           id="explains"
                                           maxlength="255" placeholder="活动说明"
                                           value="$!{data.explains}"
                                           required="required"
                                    >$!{data.explains}</textarea>

                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>活动开始时间</label>
                                    <input type="text" class="form-control pull-right datepicker"
                                           value="$!{actStartTimeStr}"
                                           name="actStartTimeStr" placeholder="开始时间"
                                           readonly="readonly">
                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>活动结束时间</label>
                                    <input type="text" class="form-control pull-right datepicker"
                                           value="$!{actEndTimeStr}"
                                           name="actEndTimeStr" placeholder="结束时间"
                                           readonly="readonly">
                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>报名开始时间</label>
                                    <input type="text" class="form-control pull-right datepicker"
                                           value="$!{signStartTimeStr}"
                                           name="signStartTimeStr" placeholder="开始时间"
                                           readonly="readonly">
                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>报名结束时间</label>
                                    <input type="text" class="form-control pull-right datepicker"
                                           value="$!{signEndTimeStr}"
                                           name="signEndTimeStr" placeholder="结束时间"
                                           readonly="readonly">
                                </div>
                                <div id="hiddenDiv" style="display:none">$!{data.content}</div>
                                <!--<div class="form-group form-md-line-input">
                                    <label>活动详情</label>
                                    <script id="ueditor" type="text/plain"></script>
                                </div>
-->
                            </div>

                            <div class="box-footer">
                                #if($shiro.hasPermission("qy:market:edit"))
                                <input class="btn btn-primary" id="save" value="保存" type="submit">
                                #end
                                <a href="#springUrl('/a/market/list')" class="btn btn-default">取消</a>
                            </div>
                        </form>
                        <!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->

<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<!-- datepicker start -->
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- datepicker end -->
<!-- Uedit Start -->
<script type="text/javascript" charset="utf-8"
        src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
        src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8"
        src="plugins/ueditor-min-1.4.3/p/main.js"></script>
<script type="text/javascript" charset="utf-8"
        src="plugins/ueditor-min-1.4.3/q/main.js"></script>
<!-- Select2 -->
<script src="plugins/select2/select2.full.min.js"></script>
<!-- Uedit End -->
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="js/jquery.serializejson.js"></script>
<script src="common/js/cfapp.js"></script>

<script src="common/component/uePicPicker.js"></script>
<script src="plugins/Sortable/Sortable.min.js"></script>

<!-- END PAGE LEVEL PLUGINS -->
<script>
    var smallPP = null;
    var picPicker = null;
    $().ready(function () {
        Cfapp.init();
        recdTypeAdd.init();

       // initUeditor();//编辑器
        initStoreSelect();//门店选择
        initBrandSelect();//品牌选择
        initBelongSel();//活动归属
        initDatepicket();//日期选择
        initPicsSel();//图片选择
        initCardSelect();//卡券选择
        initTypegSel();//活动类型
    });
    var initTypegSel=function () {
        var type = '$!{data.type}';
        if (type) {
            $("#type").find(
                "option[value='" + type + "']").attr(
                "selected", true);
        }
        if(type=="0"){
            $("#cardDiv").hide();
            $("#cardid").val("");
        }else if(type=="1"){
            $("#cardDiv").show();
        }

        $("#type").on("change",function () {
            var val=$(this).val();
            if(val=="0"){
                $("#cardDiv").hide();
                $("#cardid").val("");
            }else if(val=="1"){
                $("#cardDiv").show();
            }
        })
    };
    var initCardSelect=function () {
        /**
         * 卡券
         */
        var typeURL = "#springUrl('/a/card/cardFetechData')";
        //选择卡券
        $("#cardSelect").click(function () {
            Cfapp.f7({
                dataUrl: typeURL,
                checkType: 'single', // 多选为multi
                title: "选择卡券",
                btnoktext: "确定",
                btncanceltext: "取消",
                columns: ['选择', '名称'],
                isSearch: '0',
                searchColumns: ["title"],//搜索的字段名称
                searchColumnsRemarks: ['名称'],//搜索的字段备注
                aoColumns: [{
                    "mData": "id"
                }, {
                    "mData": "title"
                }],
                aoColumnDefs: [{
                    "aTargets": [0],
                    "mData": "id",
                    "mRender": function (a, b, c, d) {
                        return '<input type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.title + '">';
                    }
                }],
                success: function () {

                },
                cancel: function () {

                },
                storeFields: 'cardid', // 储存的字段
                displayFields: 'cardName'
            })
        })
    };
    var initPicsSel=function () {

        var smallimg = "$!{data.smallimg}";

        smallPP = new uePicPicker({
            tarId: 'smallimg',
            title: '小图',
            sizeDes: '640*300',
            max: 1,
            datas: smallimg=='' ? null : smallimg.split(","),
            success: null
        });
        smallPP.init();


        var img = '$!{data.img}';

        picPicker = new uePicPicker({
            tarId: 'haha',
            title: '图片',
            sizeDes: '640*300',
            max: 1,
            datas: img=='' ? null : img.split(","),
            success: null
        });
        picPicker.init();

    };
    var initDatepicket=function(){
        $('.datepicker').datepicker({
            show: true,
            format: 'yyyy-mm-dd',
            autoclose: true,
            language: 'zh-CN',
            todayBtn: 'linked',
            clearBtn: 'linked'

        });
    };
    var initUeditor=function(){
        ue = UE.getEditor('ueditor', {
            toolbars: [[
                'insertimage',
                'insertvideo',
                'redo', //重做
                'bold', //加粗
                'indent', //首行缩进
                'italic', //斜体
                'underline', //下划线
                'strikethrough', //删除线
                'subscript', //下标
                'fontborder', //字符边框
                'superscript', //上标
                'formatmatch', //格式刷
                'source', //源代码
                'blockquote', //引用
                'pasteplain', //纯文本粘贴模式
                'selectall', //全选
                'print', //打印
                'preview', //预览
                'horizontal', //分隔线
                'removeformat', //清除格式
                'time', //时间
                'date', //日期
                'unlink', //取消链接
                'insertrow', //前插入行
                'insertcol', //前插入列
                'mergeright', //右合并单元格
                'mergedown', //下合并单元格
                'deleterow', //删除行
                'deletecol', //删除列
                'splittorows', //拆分成行
                'splittocols', //拆分成列
                'splittocells', //完全拆分单元格
                'deletecaption', //删除表格标题
                'inserttitle', //插入标题
                'mergecells', //合并多个单元格
                'deletetable', //删除表格
                'cleardoc', //清空文档
                'insertparagraphbeforetable', //"表格前插入行"
                'insertcode', //代码语言
                'fontfamily', //字体
                'fontsize', //字号
                'paragraph', //段落格式
                'edittable', //表格属性
                'edittd', //单元格属性
                'link', //超链接
                'emotion', //表情
                'spechars', //特殊字符
                'insertvideo', //视频

                'justifyleft', //居左对齐
                'justifyright', //居右对齐
                'justifycenter', //居中对齐
                'justifyjustify', //两端对齐
                'forecolor', //字体颜色
                'backcolor', //背景色
                'insertorderedlist', //有序列表
                'insertunorderedlist', //无序列表
                'fullscreen', //全屏
                'directionalityltr', //从左向右输入
                'directionalityrtl', //从右向左输入
                'rowspacingtop', //段前距
                'rowspacingbottom', //段后距
                'pagebreak', //分页
                'insertframe', //插入Iframe
                'imagenone', //默认
                'imageleft', //左浮动
                'imageright', //右浮动
                'attachment', //附件
                'imagecenter', //居中
                'wordimage', //图片转存
                'lineheight', //行间距
                'edittip ', //编辑提示
                'customstyle', //自定义标题
                'autotypeset', //自动排版
                'touppercase', //字母大写
                'tolowercase', //字母小写

                'inserttable', //插入表格
                'drafts', // 从草稿箱加载
                'charts', // 图表
            ]]
        });
        //数据
        ue.addListener("ready", function () {
            var hiddenHtml = $("#hiddenDiv").html();
            ue.setContent(hiddenHtml);
        })

    };
    var initBelongSel=function () {
        var belong = '$!{data.belong}';
        if (belong) {
            $("#belong").find(
                "option[value='" + belong + "']").attr(
                "selected", true);
        }
        if(belong=="0"){
            $("#storeDiv").hide();
            $("#brandDiv").hide();
            $("#storeid").val("");
            $("#brandid").val("");
        }else if(belong=="1"){
            $("#storeDiv").hide();
            $("#brandDiv").show();
            $("#storeid").val("");
        }else if(belong=="2"){
            $("#storeDiv").show();
            $("#brandDiv").hide();
        }
        $("#belong").on("change",function () {
            var val=$(this).val();
            if(val=="0"){
                $("#storeDiv").hide();
                $("#brandDiv").hide();
                $("#storeid").val("");
                $("#brandid").val("");
            }else if(val=="1"){
                $("#storeDiv").hide();
                $("#brandDiv").show();
                $("#storeid").val("");
           }else if(val=="2"){
               $("#storeDiv").show();
                $("#brandDiv").hide();
            }
        })
    };
    var initStoreSelect=function () {
        /**
         * 门店
         */
        var typeURL = "#springUrl('/a/store/listData')";
        //选择门店
        $("#storeSelect").click(function () {
            Cfapp.f7({
                dataUrl: typeURL,
                checkType: 'single', // 多选为multi
                title: "选择门店",
                btnoktext: "确定",
                btncanceltext: "取消",
                columns: ['选择', '名称', '地址'],
                isSearch: '0',
                searchColumns: ["name"],//搜索的字段名称
                searchColumnsRemarks: ['名称'],//搜索的字段备注
                aoColumns: [{
                    "mData": "id"
                }, {
                    "mData": "name"
                }, {
                    "mData": "address"
                }],
                aoColumnDefs: [{
                    "aTargets": [0],
                    "mData": "id",
                    "mRender": function (a, b, c, d) {
                        return '<input type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.name + '">';
                    }
                }],
                success: function () {

                },
                cancel: function () {

                },
                storeFields: 'storeid', // 储存的字段
                displayFields: 'storeName'
            })
        })
    };
    var initBrandSelect=function () {
        /**
         * 品牌
         */
        var typeURL = "#springUrl('/a/brand/listData')";
        //选择品牌
        $("#brandSelect").click(function () {
            Cfapp.f7({
                dataUrl: typeURL,
                checkType: 'single', // 多选为multi
                title: "选择品牌",
                btnoktext: "确定",
                btncanceltext: "取消",
                columns: ['选择', '名称', 'LOGO'],
                isSearch: '0',
                searchColumns: ["name"],//搜索的字段名称
                searchColumnsRemarks: ['名称'],//搜索的字段备注
                aoColumns: [{
                    "mData": "id"
                }, {
                    "mData": "name"
                }, {
                    "mData": "logo"
                }],
                aoColumnDefs: [{
                    "aTargets": [0],
                    "mData": "id",
                    "mRender": function (a, b, c, d) {
                        return '<input type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.name + '">';
                    }
                }, {
                    "aTargets": [2],
                    "mData": "cover",
                    "mRender": function (a, b, c, d) {//a表示createtime对应的值，c表示当前记录行对象
                       /* if (a.substring(0, 7) == "http://") {

                        } else {
                            a = protocol + '//' + host + a;
                        }*/
                        return "<img src='" + a + "' style='width: 80px;height:80px;' />";
                    }
                }],
                success: function () {

                },
                cancel: function () {

                },
                storeFields: 'brandid', // 储存的字段
                displayFields: 'brandName'
            })
        })
    };
    var recdTypeAdd = function () {
        var initForm = function () {
            var initFormCtrl = function () {
                bindEvent();
            };
            var bindEvent = function () {
                $("#myForm").validate({
                    rules: {},
                    messages: {},
                    submitHandler: function (form) {
                        $("#save").attr("disabled", true);
                        var dataJson = $("#myForm").serializeJSON();
                        //dataJson.content = ue.getContent();
                        var smallImgs = smallPP.getStringValues();
                        var imgs = picPicker.getStringValues();

                        dataJson.smallimg = smallImgs.substring(0, smallImgs.lastIndexOf(','));
                        dataJson.img = imgs.substring(0, imgs.lastIndexOf(','));
                        $.getJSON("#springUrl('/a/market/formData')", dataJson, function (returnobj) {
                            $("#save").attr("disabled", false);
                            if (returnobj.errorNo == 2) {  //保存成功
                                Cfapp.confirm({
                                    message: "添加成功",
                                    btnoktext: "继续添加",
                                    btncanceltext: "关闭",
                                    success: function () {
                                        location.href = "#springUrl('/a/market/form')";
                                    },
                                    cancel: function () {
                                        location.href = "#springUrl('/a/market/list')";
                                    }
                                });
                            } else if (returnobj.errorNo == 0) {  //修改成功
                                Cfapp.alert({
                                    message: "更新成功",
                                    btntext: "确定",
                                    success: function () {
                                        location.href = "#springUrl('/a/market/list')";
                                    }
                                });
                            } else {
                                Cfapp.alert({
                                    message: "创建失败",
                                    btntext: "确定",
                                    success: function () {
                                        location.href = "#springUrl('/a/market/list')";
                                    }
                                });
                            }
                        });
                    }
                })
            };
            initFormCtrl();
        };
        return {

            //main function to initiate the module
            init: function () {
                initForm();
            }

        };
    }();
</script>
</body>
<!-- END BODY -->
</html>