Authored by xiaofeng.yao@yoho.cn

优化优惠码

... ... @@ -59,12 +59,27 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
$('#pushlog').text('开始监听推送记录').attr('onclick','getPushlog('+default_interval+')');
}
}
//预览优惠券元素
function preview() {
var code = $("input[name=code]").val();
var banner_txt = $("textarea[name=banner_txt]").val();
var find = /#code#/g;
var replace = "<b class='coupon-code'>["+code+"]</b>";
banner_txt = banner_txt.replace(find,replace);
var help_title = $("input[name=help_title]").val();
help_txt = $("textarea[name=help_txt]").val();
help_title = "<h4>"+help_title+"</h4>";
$("#coupon_preview").html(banner_txt+help_title+help_txt);
}
<?php
$this->endBlock();
$this->registerJs($this->blocks['javascript'],View::POS_END)
?>
</script>
<style>
.coupon-code {color: #fcc800}
</style>
<div class="row">
<div class="col-md-6">
<form id="form" method="POST" action="">
... ... @@ -102,7 +117,8 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
<div class="row">
<div class="col-sm-9 col-sm-offset-3">
<button class="btn btn-primary mr5">保存</button>
<a href="<?=$_refer?>" class="btn btn-dark">取消</a>
<a href="<?=$_refer?>" class="btn btn-dark mr5">取消</a>
<a class="btn btn-dark" onclick="preview()">预览</a>
</div>
</div>
</div><!-- panel-footer -->
... ... @@ -110,6 +126,19 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
</form>
</div>
<div class="col-md-6">
<p>Notice:优惠码替换占位符用<code>#code#</code>,换行符用<code>&lt;br/&gt;</code></p>
<div class="panel panel-default">
<div class="panel-heading">
<h4>预览</h4>
</div>
<div class="panel-body">
<div id="coupon_preview">
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
... ...