<!DOCTYPE html>
<html lang="zh">
<head>
    <@meta/>
	<title>渠道配置</title>
    <#include "admin/common/include_hplus.ftl">
    <#include "admin/common/include_form.ftl">
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h3>${entity.channelSubName}渠道配置</h3><a href="<@contextPath/>/marketing/golist?channelConfigId=${channelConfigId}" class="btn btn-link">| 返回列表</a>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" action="<@contextPath/>/saveEntity" method="post">
                        <p>请勿擅自修改(⊙o⊙)</p>
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>渠道名称：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="channelSubName" value="${entity.channelSubName }" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>投放状态：</label>
                            <div class="col-sm-8">
                                <div class="radio i-checks">
                                    <label><input type="radio" value="0" name="launchStatus" checked>暂停</label>
                                    <label><input type="radio" value="1" name="launchStatus" <#if entity.landingConfigExtendId == 1>checked</#if>>投放</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>渠道类型：</label>
                            <div class="col-sm-8">
                                <div class="radio i-checks">
                                    <#list listLandingChannel as c>
                                        <label><input type="radio" name="channelConfigId" value="${c.channelConfigId}" <#if entity.channelConfigId == c.channelConfigId>checked</#if>>${c.name}</label>
                                    </#list>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>ffrom：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="ffrom" value="${entity.ffrom }" <#if entity.landingConfigExtendId??>readonly</#if> required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">链接：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="link" value="${entity.link }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">付款金额：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="payAmount" value="${entity.payAmount }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">短信模板关键字：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="smsKeyword" value="${entity.smsKeyword }">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信小程序AppId：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxmpAppId" value="${entity.wxmpAppId }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信小程序AppSecret：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxmpAppSecret" value="${entity.wxmpAppSecret }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信小程序扩展配置：</label>
                            <div class="col-sm-8">
                                <textarea class="form-control" name="wxmpAppExtCfg">${entity.wxmpAppExtCfg }</textarea>
                                <span class="help-block m-b-none">JSON格式：{"path":"","query":"","ffromToQuery":"true/false"}，ffromToQuery默认为true，生成小程序短链接时path必须。</span>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信公众号AppId：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxsnsAppId" value="${entity.wxsnsAppId }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信公众号AppSecret：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxsnsAppSecret" value="${entity.wxsnsAppSecret }">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信支付AppId：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxpayAppId" value="${entity.wxpayAppId }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信支付AppSecret：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxpayAppSecret" value="${entity.wxpayAppSecret }">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">企微corpid：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxCorpId" value="${entity.wxCorpId }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">企微corpsecret：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxCorpSecret" value="${entity.wxCorpSecret }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">企微营销标签分组名称：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxCorpGroupName" value="${entity.wxCorpGroupName }">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">企微营销标签名称：</label>
                            <div class="col-sm-8">
                                <input class="form-control input-sm" type="text" name="wxCorpTagName" value="${entity.wxCorpTagName }">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">提交</button>
                            </div>
                        </div>
						<input type="hidden" name="landingConfigExtendId" value="${entity.landingConfigExtendId }">
                    </form>
                </div>
            </div>
            </div>
        </div>
    </div>
<script>
    $(function(){

        $.fn.serializeObject = function() {
            var o = {};
            var a = this.serializeArray();
            $.each(a, function() {
                if (o[this.name]) {
                    if (!o[this.name].push) {
                        o[this.name] = [o[this.name]];
                    }
                    o[this.name].push(this.value || null);
                } else {
                    o[this.name] = this.value || null;
                }
            });
            return o;
        };

        $('.form-horizontal').validate({
            onkeyup:false,
            focusCleanup:true,
            submitHandler:function(form){
                App.Ajax.request({
                    url		: '${updateConfigExtendUrl}',
                    headers : {
                        'ffrom' : '${entity.ffrom }'
                    },
                    params  : JSON.stringify($(form).serializeObject()),
                    contentType: "application/json",
                    success: function(result){
                        window.location.href = Config.ROOT + '/marketing/golist?channelConfigId=${channelConfigId}';
                    }
                });
            }
        });

        $.form.render();

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