%%9C^9CD^9CD1571C%%interactive_prize.html.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <?php /* Smarty version 2.6.17, created on 2018-05-26 19:47:06
  2. compiled from admin/activity/interactive_prize.html */ ?>
  3. <?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
  4. smarty_core_load_plugins(array('plugins' => array(array('modifier', 'date_format', 'admin/activity/interactive_prize.html', 77, false),)), $this); ?>
  5. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  6. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array()));
  7. $this->_tpl_vars = $_smarty_tpl_vars;
  8. unset($_smarty_tpl_vars);
  9. ?>
  10. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  11. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array()));
  12. $this->_tpl_vars = $_smarty_tpl_vars;
  13. unset($_smarty_tpl_vars);
  14. ?>
  15. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  16. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array()));
  17. $this->_tpl_vars = $_smarty_tpl_vars;
  18. unset($_smarty_tpl_vars);
  19. ?>
  20. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  21. $this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array()));
  22. $this->_tpl_vars = $_smarty_tpl_vars;
  23. unset($_smarty_tpl_vars);
  24. ?>
  25. <style>
  26. .set-nav {
  27. margin: 0 auto;
  28. }
  29. .set-nav-hr {
  30. background-color: #ddd;
  31. height: 1px;
  32. position: relative;
  33. }
  34. .form-group label {
  35. font-weight: 600;
  36. }
  37. .checkbox-inline, .radio-inline {
  38. font-weight: 400!important;
  39. }
  40. .rowlabel {
  41. font-weight: 300!important;
  42. }
  43. .music_play_hide {
  44. display:none;
  45. }
  46. .add_virtual_data_box {
  47. background-color: #f5f5f5;
  48. display:none;
  49. }
  50. </style>
  51. <div id="activity_container">
  52. <div class="activity_center">
  53. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  54. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array()));
  55. $this->_tpl_vars = $_smarty_tpl_vars;
  56. unset($_smarty_tpl_vars);
  57. ?>
  58. <!-- <form method="post" action="<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
  59. ?c=Admin_Activity_SetInteractive&a=ReqUp"> -->
  60. <input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  61. ">
  62. <div class="panel panel-default">
  63. <div class="panel-heading"><h3 class="panel-title" id="panel-title">奖项设置</h3></div>
  64. <div class="panel-body">
  65. <div class="form-group">
  66. <div>
  67. <table class="table table-hover">
  68. <thead>
  69. <tr>
  70. <th>奖品名称</th>
  71. <th>奖品类型</th>
  72. <th>奖品数量</th>
  73. <th>中奖时间段(时)</th>
  74. <th>(当天)下次中奖时间</th>
  75. <th>状态</th>
  76. <th>编辑</th>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. <?php $_from = $this->_tpl_vars['events_Data']['prize']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
  81. foreach ($_from as $this->_tpl_vars['prize']):
  82. ?>
  83. <tr>
  84. <td><?php echo $this->_tpl_vars['prize']['prize_name']; ?>
  85. </td>
  86. <td><?php echo $this->_tpl_vars['prizeType'][$this->_tpl_vars['prize']['type']]['desc']; ?>
  87. </td>
  88. <?php $this->assign('num', $this->_tpl_vars['prize']['prize_num']-$this->_tpl_vars['prize']['prize_winning_num']); ?>
  89. <td>总数:<?php echo $this->_tpl_vars['prize']['prize_num']; ?>
  90. <?php if ($this->_tpl_vars['prize']['type'] == 1): ?>
  91. <a class="incr_prize_num" data-prize-id="<?php echo $this->_tpl_vars['prize']['id']; ?>
  92. " href="javascript:;">[添加]</a>
  93. <a class="decr_prize_num" data-prize-id="<?php echo $this->_tpl_vars['prize']['id']; ?>
  94. " href="javascript:;">[减少]</a>
  95. <?php endif; ?>
  96. <?php if ($this->_tpl_vars['prize']['type'] == 2): ?>
  97. <a class="add_virtual_data" data-prize-id="<?php echo $this->_tpl_vars['prize']['id']; ?>
  98. " href="javascript:;">[添加]</a>
  99. <a class="" data-prize-id="<?php echo $this->_tpl_vars['prize']['id']; ?>
  100. " href="<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
  101. /?c=Admin_Activity_SetInteractive&a=PageVirtualDataList&prize_id=<?php echo $this->_tpl_vars['prize']['id']; ?>
  102. ">[查看]</a>
  103. <?php endif; ?>
  104. 抽中:<?php echo $this->_tpl_vars['prize']['prize_winning_num']; ?>
  105. 剩余:<?php echo $this->_tpl_vars['num']; ?>
  106. </td>
  107. <td><?php echo $this->_tpl_vars['prize']['begin_hour']; ?>
  108. - <?php echo $this->_tpl_vars['prize']['end_hour']; ?>
  109. </td>
  110. <td><?php echo ((is_array($_tmp=$this->_tpl_vars['prize']['nextTime'])) ? $this->_run_mod_handler('date_format', true, $_tmp, '%Y-%m-%d %H:%M:%S') : smarty_modifier_date_format($_tmp, '%Y-%m-%d %H:%M:%S')); ?>
  111. </td>
  112. <td class="<?php if ($this->_tpl_vars['prize']['display'] == 0): ?>text-danger<?php else: ?>text-success<?php endif; ?>"><?php echo $this->_tpl_vars['eventsDisplayStatus'][$this->_tpl_vars['prize']['display']]['desc']; ?>
  113. </td>
  114. <td><a href="<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
  115. /?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  116. &prize_id=<?php echo $this->_tpl_vars['prize']['id']; ?>
  117. &edit=1">编辑</a></td>
  118. </tr>
  119. <?php if ($this->_tpl_vars['prize']['type'] == 2): ?>
  120. <tr class="add_virtual_data_box box_<?php echo $this->_tpl_vars['prize']['id']; ?>
  121. ">
  122. <td colspan="7">
  123. <form method="post" action="<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
  124. /?c=Admin_Activity_SetInteractive&a=ReqAddPrizeNum&noajax=1">
  125. <input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  126. ">
  127. <input name="prize_id" type="hidden" value="<?php echo $this->_tpl_vars['prize']['id']; ?>
  128. ">
  129. <div class="form-group">
  130. <label class="control-label">添加[<?php echo $this->_tpl_vars['prize']['prize_name']; ?>
  131. ]奖项数据: </label>
  132. <textarea name="virtual_data" class="form-control" rows="3" style="width:300px;"></textarea>
  133. <div class="note">多条数据换行分隔</div>
  134. <button class="add_virtual_data_submit button-primary button-raised button-small">添加</button>
  135. </div>
  136. </form>
  137. </td>
  138. </tr>
  139. <?php endif; ?>
  140. <?php endforeach; endif; unset($_from); ?>
  141. </tbody>
  142. </table>
  143. <a href="javascript:;" class="js_add_prize" data-stat="show"><i class="fa fa-plus"></i> 添加奖项</a>
  144. </div>
  145. <div class="add_prize_form well" style="display: none;"></div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  151. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_right.html", 'smarty_include_vars' => array()));
  152. $this->_tpl_vars = $_smarty_tpl_vars;
  153. unset($_smarty_tpl_vars);
  154. ?>
  155. <div style="clear:both;"></div>
  156. </div>
  157. <div class="add_prize_template" style="display:none;">
  158. <div class="row">
  159. <div class="col-md-4">
  160. <div class="form-group">
  161. <label class="control-label rowlabel">奖项名称: </label>
  162. <div>
  163. <input name="prize_name" type="text" class="form-control" value="">
  164. </div>
  165. </div>
  166. <div class="form-group">
  167. <label class="control-label rowlabel">奖项图片: </label>
  168. <div>
  169. <img id="prize_image_tag" src="http://placehold.it/100&text=100x100" style="width:100px;" class="img-thumbnail">
  170. <input id="prize_image_input" name="prize_image_url" type="hidden" value="" />
  171. <input id="prize_image_upload" type="button" value="选择图片" />
  172. </div>
  173. </div>
  174. </div>
  175. <div class="col-md-3">
  176. <div class="form-inline form-group">
  177. <label class="control-label rowlabel">发奖时间段: </label>
  178. <div>
  179. <input name="begin_hour" type="text" class="form-control" value="0" style="width:50px;"> -
  180. <input name="end_hour" type="text" class="form-control" value="24" style="width:50px;">
  181. </div>
  182. </div>
  183. <div class="form-group">
  184. <label class="control-label rowlabel">是否需要快递: </label>
  185. <div>
  186. <select name="express" class="form-control">
  187. <option value="1">需要</option>
  188. <option value="2">不需要</option>
  189. </select>
  190. </div>
  191. </div>
  192. <div class="form-group">
  193. <label class="control-label rowlabel">属性: </label>
  194. <div>
  195. <select name="prize_type" class="form-control">
  196. <option value="0">选择</option>
  197. <option value="1">实物</option>
  198. <option value="2">虚拟</option>
  199. </select>
  200. </div>
  201. </div>
  202. <div class="prize_num" class="form-group" style="display:none;">
  203. <label class="control-label rowlabel">数量: </label>
  204. <div>
  205. <input name="prize_num" type="text" class="form-control" value="0" style="width:50px;">
  206. </div>
  207. </div>
  208. <div class="virtual_data" class="form-group" style="display:none;">
  209. <label class="control-label rowlabel">虚拟数据:<small class="text-danger">(换行分割)</small></label>
  210. <div>
  211. <textarea name="virtual_data_x" class="form-control" rows="2"></textarea>
  212. </div>
  213. </div>
  214. </div>
  215. <div class="col-md-3">
  216. <div class="form-group">
  217. <label class="control-label rowlabel">白名单:"换行"分割UID</label>
  218. <div>
  219. <textarea name="white_list" class="form-control" rows="3"></textarea>
  220. </div>
  221. </div>
  222. <div class="form-group">
  223. <label class="control-label rowlabel">100%中奖名单:"换行"分割UID</label>
  224. <div>
  225. <textarea name="hundred_percent_list" class="form-control" rows="3"></textarea>
  226. </div>
  227. </div>
  228. <div class="form-group">
  229. <label class="control-label rowlabel">黑名单:"换行"分割UID </label>
  230. <div>
  231. <textarea name="black_list" class="form-control" rows="3"></textarea>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <a href="javascript:;" class="ajax_add_prize_from button button-primary button-raised button-tiny" >添加</a>
  237. </div>
  238. <script>
  239. KISSY.use('node, io, event, dom', function (S, Node, IO, Event, DOM) {
  240. var $ = S.all;
  241. /* $('#activity_submit').on('click',function(){
  242. var events_id = $("input[name=events_id]").val();
  243. location = VG.conf.root_domain + '/?c=Admin_Activity_SetPage&a=PageShow&events_id='+events_id
  244. }); */
  245. $(".incr_prize_num").on('click', function() {
  246. var events_id = $("input[name=events_id]").val();
  247. var prize_id = $(this).attr('data-prize-id');
  248. var prize_num = prompt('请输入增加奖品的数量');
  249. if (!prize_num) {
  250. return false;
  251. }
  252. new IO({
  253. type: "post"
  254. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqAddPrizeNum'
  255. , data: {'prize_id':prize_id, 'prize_num':prize_num, 'events_id':events_id}
  256. , success: function (data) {
  257. if (data.ok) { //ok
  258. alert('操作成功');
  259. location.reload();
  260. } else {
  261. alert('操作失败,原因:'+data.msg);
  262. }
  263. return false;
  264. }
  265. , error: function (NULL, textStatus) {
  266. alert("请求服务器失败,原因:"+textStatus);
  267. }
  268. , dataType: "json"
  269. });
  270. });
  271. $(".decr_prize_num").on('click', function() {
  272. var events_id = $("input[name=events_id]").val();
  273. var prize_id = $(this).attr('data-prize-id');
  274. var prize_num = prompt('请输入减少奖品的数量');
  275. if (!prize_num) {
  276. return false;
  277. }
  278. new IO({
  279. type: "post"
  280. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqMinusPrizeNum'
  281. , data: {'prize_id':prize_id, 'num':prize_num}
  282. , success: function (data) {
  283. if (data.ok) { //ok
  284. alert('操作成功');
  285. location.reload();
  286. } else {
  287. alert('操作失败,原因:'+data.msg);
  288. }
  289. return false;
  290. }
  291. , error: function (NULL, textStatus) {
  292. alert("请求服务器失败,原因:"+textStatus);
  293. }
  294. , dataType: "json"
  295. });
  296. });
  297. //添加奖项
  298. $(".js_add_prize").on('click', function () {
  299. var add_prize_form = $('.add_prize_form');
  300. var add_prize_template = $('.add_prize_template').html();
  301. if ($(this).attr('data-stat') == 'show') {
  302. add_prize_form.html(add_prize_template).show();
  303. $(this).attr('data-stat', 'hide');
  304. //奖品图
  305. var K = KindEditor;
  306. var uploadbutton = K.uploadbutton({
  307. button : K('#prize_image_upload')[0],
  308. fieldName : 'imgFile',
  309. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
  310. afterUpload : function(data) {
  311. if (data.error === 0) {
  312. var url = K.formatUrl(data.url, 'absolute');
  313. K('#prize_image_input').val(data.url);
  314. K('#prize_image_tag').attr('src', data.url);
  315. } else {
  316. alert(data.message);
  317. }
  318. },
  319. afterError : function(str) {
  320. alert('自定义错误信息: ' + str);
  321. }
  322. });
  323. uploadbutton.fileBox.change(function(e) {
  324. uploadbutton.submit();
  325. });
  326. //提交表单
  327. ajax_add_prize_from();
  328. //选择奖项类型
  329. select_prize_type();
  330. } else {
  331. add_prize_form.html('').hide();
  332. $(this).attr('data-stat', 'show');
  333. }
  334. });
  335. //Event.delegate(document, 'change', 'select[name=prize_type]', function (e) {});
  336. $(".add_virtual_data").on('click', function () {
  337. var prize_id = $(this).attr('data-prize-id');
  338. DOM.toggle(".box_"+prize_id);
  339. });
  340. $(".add_virtual_data_submit").on('click', function () {
  341. if (!confirm('确认添加?')) {
  342. return false;
  343. }
  344. });
  345. function select_prize_type() {
  346. $("select[name=prize_type]").on('change', function () {
  347. var type = $(this).val();
  348. if (type == 0) {
  349. $(".prize_num").hide().all('input').val(0);
  350. $(".virtual_data").hide().all('textarea').val('');
  351. }
  352. if (type == 1) {
  353. $(".prize_num").show();
  354. $(".virtual_data").hide().all('textarea').val('');
  355. }
  356. if (type == 2) {
  357. $(".prize_num").hide().all('input').val('');
  358. $(".virtual_data").show();
  359. }
  360. });
  361. }
  362. function ajax_add_prize_from() {
  363. $(".ajax_add_prize_from").on('click', function () {
  364. var events_id = $("input[name=events_id]").val();
  365. var post_data = {};
  366. post_data.events_id = events_id;
  367. post_data.prize_name = $('input[name=prize_name]').val();
  368. post_data.prize_image_url = $("input[name=prize_image_url]").val();
  369. post_data.begin_hour = $("input[name=begin_hour]").val();
  370. post_data.end_hour = $("input[name=end_hour]").val();
  371. post_data.express = $("select[name=express]").val();
  372. post_data.prize_type = $("select[name=prize_type]").val();
  373. post_data.white_list = $("textarea[name=white_list]").val();
  374. post_data.hundred_percent_list = $("textarea[name=hundred_percent_list]").val();
  375. post_data.black_list = $("textarea[name=black_list]").val();
  376. post_data.prize_num = $("input[name=prize_num]").val();
  377. post_data.virtual_data = $("textarea[name=virtual_data_x]").val();
  378. new IO({
  379. type: "post"
  380. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqAddPrize&events_id='+events_id
  381. , data: post_data
  382. , success: function (data) {
  383. if (data.ok) { //ok
  384. alert('操作成功');
  385. location.reload();
  386. } else {
  387. alert('操作失败,原因:'+data.msg);
  388. }
  389. return false;
  390. }
  391. , error: function (NULL, textStatus) {
  392. alert("请求服务器失败,原因:"+textStatus);
  393. }
  394. , dataType: "json"
  395. });
  396. });
  397. }
  398. });
  399. </script>
  400. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  401. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array()));
  402. $this->_tpl_vars = $_smarty_tpl_vars;
  403. unset($_smarty_tpl_vars);
  404. ?>