123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- <{include file="./admin/header.html"}>
- <{include file="./admin/left.html"}>
- <{include file="./admin/nav.html"}>
- <{include file="get_kindeditor.html"}>
- <style>
- .set-nav {
- margin: 0 auto;
- }
- .set-nav-hr {
- background-color: #ddd;
- height: 1px;
- position: relative;
- }
- .form-group label {
- font-weight: 600;
- }
- .checkbox-inline, .radio-inline {
- font-weight: 400!important;
- }
- .rowlabel {
- font-weight: 300!important;
- }
- .music_play_hide {
- display:none;
- }
- .add_virtual_data_box {
- background-color: #f5f5f5;
- display:none;
- }
- </style>
- <div id="activity_container">
- <div class="activity_center">
- <{include file="./admin/activity/common_nav.html"}>
- <!-- <form method="post" action="<{$web_cfg.domain}>?c=Admin_Activity_SetInteractive&a=ReqUp"> -->
- <input name="events_id" type="hidden" value="<{$events_Data.events.id}>">
- <div class="panel panel-default">
- <div class="panel-heading"><h3 class="panel-title" id="panel-title">奖项设置</h3></div>
- <div class="panel-body">
- <div class="form-group">
- <div>
- <table class="table table-hover">
- <thead>
- <tr>
- <th>奖品名称</th>
- <th>奖品类型</th>
- <th>奖品数量</th>
- <th>中奖时间段(时)</th>
- <th>(当天)下次中奖时间</th>
- <th>状态</th>
- <th>编辑</th>
- </tr>
- </thead>
- <tbody>
- <{foreach from=$events_Data.prize item=prize}>
- <tr>
- <td><{$prize.prize_name}></td>
- <td><{$prizeType[$prize.type].desc}></td>
- <{assign var=num value=$prize.prize_num-$prize.prize_winning_num}>
- <td>总数:<{$prize.prize_num}>
- <{if $prize.type == 1}>
- <a class="incr_prize_num" data-prize-id="<{$prize.id}>" href="javascript:;">[添加]</a>
- <a class="decr_prize_num" data-prize-id="<{$prize.id}>" href="javascript:;">[减少]</a>
- <{/if}>
- <{if $prize.type == 2}>
- <a class="add_virtual_data" data-prize-id="<{$prize.id}>" href="javascript:;">[添加]</a>
- <a class="" data-prize-id="<{$prize.id}>" href="<{$web_cfg.domain}>/?c=Admin_Activity_SetInteractive&a=PageVirtualDataList&prize_id=<{$prize.id}>">[查看]</a>
- <{/if}>
- 抽中:<{$prize.prize_winning_num}> 剩余:<{$num}>
- </td>
- <td><{$prize.begin_hour}> - <{$prize.end_hour}></td>
- <td><{$prize.nextTime|date_format:'%Y-%m-%d %H:%M:%S'}></td>
- <td class="<{if $prize.display == 0}>text-danger<{else}>text-success<{/if}>"><{$eventsDisplayStatus[$prize.display].desc}></td>
- <td><a href="<{$web_cfg.domain}>/?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<{$events_Data.events.id}>&prize_id=<{$prize.id}>&edit=1">编辑</a></td>
- </tr>
- <{if $prize.type == 2}>
- <tr class="add_virtual_data_box box_<{$prize.id}>">
- <td colspan="7">
- <form method="post" action="<{$web_cfg.domain}>/?c=Admin_Activity_SetInteractive&a=ReqAddPrizeNum&noajax=1">
- <input name="events_id" type="hidden" value="<{$events_Data.events.id}>">
- <input name="prize_id" type="hidden" value="<{$prize.id}>">
- <div class="form-group">
- <label class="control-label">添加[<{$prize.prize_name}>]奖项数据: </label>
- <textarea name="virtual_data" class="form-control" rows="3" style="width:300px;"></textarea>
- <div class="note">多条数据换行分隔</div>
- <button class="add_virtual_data_submit button-primary button-raised button-small">添加</button>
- </div>
- </form>
- </td>
- </tr>
- <{/if}>
- <{/foreach}>
- </tbody>
- </table>
- <a href="javascript:;" class="js_add_prize" data-stat="show"><i class="fa fa-plus"></i> 添加奖项</a>
- </div>
- <div class="add_prize_form well" style="display: none;"></div>
- </div>
- </div>
- </div>
- </div>
- <{include file="./admin/activity/common_right.html"}>
- <div style="clear:both;"></div>
- </div>
- <div class="add_prize_template" style="display:none;">
- <div class="row">
- <div class="col-md-4">
- <div class="form-group">
- <label class="control-label rowlabel">奖项名称: </label>
- <div>
- <input name="prize_name" type="text" class="form-control" value="">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label rowlabel">奖项图片: </label>
- <div>
- <img id="prize_image_tag" src="http://placehold.it/100&text=100x100" style="width:100px;" class="img-thumbnail">
- <input id="prize_image_input" name="prize_image_url" type="hidden" value="" />
- <input id="prize_image_upload" type="button" value="选择图片" />
- </div>
- </div>
- </div>
- <div class="col-md-3">
- <div class="form-inline form-group">
- <label class="control-label rowlabel">发奖时间段: </label>
- <div>
- <input name="begin_hour" type="text" class="form-control" value="0" style="width:50px;"> -
- <input name="end_hour" type="text" class="form-control" value="24" style="width:50px;">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label rowlabel">是否需要快递: </label>
- <div>
- <select name="express" class="form-control">
- <option value="1">需要</option>
- <option value="2">不需要</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label rowlabel">属性: </label>
- <div>
- <select name="prize_type" class="form-control">
- <option value="0">选择</option>
- <option value="1">实物</option>
- <option value="2">虚拟</option>
- </select>
- </div>
- </div>
- <div class="prize_num" class="form-group" style="display:none;">
- <label class="control-label rowlabel">数量: </label>
- <div>
- <input name="prize_num" type="text" class="form-control" value="0" style="width:50px;">
- </div>
- </div>
- <div class="virtual_data" class="form-group" style="display:none;">
- <label class="control-label rowlabel">虚拟数据:<small class="text-danger">(换行分割)</small></label>
- <div>
- <textarea name="virtual_data_x" class="form-control" rows="2"></textarea>
- </div>
- </div>
- </div>
- <div class="col-md-3">
- <div class="form-group">
- <label class="control-label rowlabel">白名单:"换行"分割UID</label>
- <div>
- <textarea name="white_list" class="form-control" rows="3"></textarea>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label rowlabel">100%中奖名单:"换行"分割UID</label>
- <div>
- <textarea name="hundred_percent_list" class="form-control" rows="3"></textarea>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label rowlabel">黑名单:"换行"分割UID </label>
- <div>
- <textarea name="black_list" class="form-control" rows="3"></textarea>
- </div>
- </div>
- </div>
- </div>
- <a href="javascript:;" class="ajax_add_prize_from button button-primary button-raised button-tiny" >添加</a>
- </div>
- <script>
- KISSY.use('node, io, event, dom', function (S, Node, IO, Event, DOM) {
- var $ = S.all;
-
-
- /* $('#activity_submit').on('click',function(){
- var events_id = $("input[name=events_id]").val();
-
- location = VG.conf.root_domain + '/?c=Admin_Activity_SetPage&a=PageShow&events_id='+events_id
- }); */
-
- $(".incr_prize_num").on('click', function() {
- var events_id = $("input[name=events_id]").val();
- var prize_id = $(this).attr('data-prize-id');
- var prize_num = prompt('请输入增加奖品的数量');
- if (!prize_num) {
- return false;
- }
-
- new IO({
- type: "post"
- , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqAddPrizeNum'
- , data: {'prize_id':prize_id, 'prize_num':prize_num, 'events_id':events_id}
- , success: function (data) {
- if (data.ok) { //ok
- alert('操作成功');
- location.reload();
- } else {
- alert('操作失败,原因:'+data.msg);
- }
-
- return false;
- }
- , error: function (NULL, textStatus) {
- alert("请求服务器失败,原因:"+textStatus);
- }
- , dataType: "json"
- });
- });
- $(".decr_prize_num").on('click', function() {
- var events_id = $("input[name=events_id]").val();
- var prize_id = $(this).attr('data-prize-id');
- var prize_num = prompt('请输入减少奖品的数量');
- if (!prize_num) {
- return false;
- }
-
- new IO({
- type: "post"
- , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqMinusPrizeNum'
- , data: {'prize_id':prize_id, 'num':prize_num}
- , success: function (data) {
- if (data.ok) { //ok
- alert('操作成功');
- location.reload();
- } else {
- alert('操作失败,原因:'+data.msg);
- }
-
- return false;
- }
- , error: function (NULL, textStatus) {
- alert("请求服务器失败,原因:"+textStatus);
- }
- , dataType: "json"
- });
- });
-
- //添加奖项
- $(".js_add_prize").on('click', function () {
- var add_prize_form = $('.add_prize_form');
- var add_prize_template = $('.add_prize_template').html();
-
- if ($(this).attr('data-stat') == 'show') {
- add_prize_form.html(add_prize_template).show();
- $(this).attr('data-stat', 'hide');
-
- //奖品图
- var K = KindEditor;
- var uploadbutton = K.uploadbutton({
- button : K('#prize_image_upload')[0],
- fieldName : 'imgFile',
- url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
- afterUpload : function(data) {
- if (data.error === 0) {
- var url = K.formatUrl(data.url, 'absolute');
- K('#prize_image_input').val(data.url);
- K('#prize_image_tag').attr('src', data.url);
- } else {
- alert(data.message);
- }
- },
- afterError : function(str) {
- alert('自定义错误信息: ' + str);
- }
- });
- uploadbutton.fileBox.change(function(e) {
- uploadbutton.submit();
- });
-
- //提交表单
- ajax_add_prize_from();
-
- //选择奖项类型
- select_prize_type();
- } else {
- add_prize_form.html('').hide();
- $(this).attr('data-stat', 'show');
- }
- });
-
- //Event.delegate(document, 'change', 'select[name=prize_type]', function (e) {});
-
- $(".add_virtual_data").on('click', function () {
- var prize_id = $(this).attr('data-prize-id');
- DOM.toggle(".box_"+prize_id);
- });
- $(".add_virtual_data_submit").on('click', function () {
- if (!confirm('确认添加?')) {
- return false;
- }
- });
-
- function select_prize_type() {
- $("select[name=prize_type]").on('change', function () {
- var type = $(this).val();
- if (type == 0) {
- $(".prize_num").hide().all('input').val(0);
- $(".virtual_data").hide().all('textarea').val('');
- }
- if (type == 1) {
- $(".prize_num").show();
- $(".virtual_data").hide().all('textarea').val('');
- }
- if (type == 2) {
- $(".prize_num").hide().all('input').val('');
- $(".virtual_data").show();
- }
- });
- }
-
- function ajax_add_prize_from() {
- $(".ajax_add_prize_from").on('click', function () {
- var events_id = $("input[name=events_id]").val();
-
- var post_data = {};
-
- post_data.events_id = events_id;
- post_data.prize_name = $('input[name=prize_name]').val();
- post_data.prize_image_url = $("input[name=prize_image_url]").val();
- post_data.begin_hour = $("input[name=begin_hour]").val();
- post_data.end_hour = $("input[name=end_hour]").val();
- post_data.express = $("select[name=express]").val();
- post_data.prize_type = $("select[name=prize_type]").val();
- post_data.white_list = $("textarea[name=white_list]").val();
- post_data.hundred_percent_list = $("textarea[name=hundred_percent_list]").val();
- post_data.black_list = $("textarea[name=black_list]").val();
- post_data.prize_num = $("input[name=prize_num]").val();
- post_data.virtual_data = $("textarea[name=virtual_data_x]").val();
-
- new IO({
- type: "post"
- , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqAddPrize&events_id='+events_id
- , data: post_data
- , success: function (data) {
- if (data.ok) { //ok
- alert('操作成功');
- location.reload();
- } else {
- alert('操作失败,原因:'+data.msg);
- }
-
- return false;
- }
- , error: function (NULL, textStatus) {
- alert("请求服务器失败,原因:"+textStatus);
- }
- , dataType: "json"
- });
- });
- }
- });
- </script>
- <{include file="./admin/bottom.html"}>
|