popadv_add.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  42. <link href="/static/css/snailfish.css" rel="stylesheet">
  43. <style>
  44. .content{
  45. display:none;
  46. width:200px;
  47. height:200px;
  48. border-radius:10px;
  49. padding:20px;
  50. position:relative;
  51. top:15px;
  52. left:50%;
  53. background-color:FFFFFF;
  54. border:1px solid;
  55. }
  56. </style>
  57. </head>
  58. <body layadmin-themealias="default">
  59. <div class="layui-fluid">
  60. <div class="layui-card">
  61. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">添加弹窗广告</span></div>
  62. <div class="layui-card-body" style="padding:15px;">
  63. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item">
  64. <div class="layui-form-item">
  65. <label class="layui-form-label mustl"></label>
  66. <div class="layui-input-block">
  67. <span class='help-block'>使用弹窗广告请<span style="color:red;">开启redis服务</span>,否则无法使用</span>
  68. </div>
  69. </div>
  70. <div class="layui-form-item">
  71. <label class="layui-form-label mustl">活动名称</label>
  72. <div class="layui-input-block">
  73. <input type="text" name="data[adv_name]" class="form-control" value="" lay-verify='true' style="width: 50%;display: inline-block;" placeholder="请输入20个字以内名称" maxlength="20"/>
  74. </div>
  75. </div>
  76. <div class="layui-form-item">
  77. <label class="layui-form-label">全部广告</label>
  78. <div class="layui-input-block" style="width: 100%;">
  79. <a href="javascript:void(0)" id="addAdv" style="display:inline-block;color: #428bca;margin-top: 5px;">添加广告</a>
  80. &nbsp;&nbsp;&nbsp;&nbsp;
  81. <a href="javascript:void(0)" id="delAdv" style="display:inline-block;color: #428bca;margin-top: 5px;">删除广告</a>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #98999a;">(删除广告从最后一个开始删除,第一个广告无法删除)</span>
  82. </div>
  83. </div>
  84. <div class="adv_list" id="adv_list_1">
  85. <input type="hidden" name="aid[]" value="1"/>
  86. <div class="layui-form-item">
  87. <label class="layui-form-label">广告<span class="adv_num">1</span>图片</label>
  88. <div class="layui-input-block">
  89. {:tpl_form_field_image2('thumb[]', '')}
  90. <span class='help-block'>建议尺寸:710 * 320或同比例, 请将所有幻灯片图片尺寸保持一致</span>
  91. </div>
  92. </div>
  93. <div class="layui-form-item">
  94. <label class="layui-form-label">广告<span class="adv_linkurl">1</span>跳转</label>
  95. <div class="layui-input-block">
  96. <label class='radio-inline'>
  97. <input type='radio' name='data[linktype_1]' lay-filter="linktype_1" title="本小程序链接" value="1" checked="checked"/>
  98. </label>
  99. <label class='radio-inline'>
  100. <input type='radio' name='data[linktype_1]' lay-filter="linktype_1" title="webview外链" value="0"/>
  101. </label>
  102. <label class='radio-inline'>
  103. <input type='radio' name='data[linktype_1]' lay-filter="linktype_1" title="外部小程序链接" value="2"/>
  104. </label>
  105. </div>
  106. </div>
  107. <div class="layui-form-item" style="display: none;" id="typeGroup_1">
  108. <div class="layui-input-block " style="text-align: left;">
  109. <label class="layui-form-label" style="text-align: left;">外链小程序appid</label>
  110. <input type="text" id='appid' name="data[appid_1]" class="form-control" value="" maxlength="32" style="width:70%;"/>
  111. </div>
  112. </div>
  113. <div class="layui-form-item">
  114. <div class="layui-input-block" style="text-align: left;">
  115. <label class="layui-form-label" style="text-align: left;">链接</label>
  116. <div class="input-group " style="margin: 0;width:50%;">
  117. <input type="text" value="" class="form-control valid" name="data[link_1]" placeholder="" id="advlink_1">
  118. <span class="input-group-btn" id="chose_link_box_1">
  119. <span data-input="#advlink_1" id="chose_link_1" class="btn btn-default">选择链接</span>
  120. </span>
  121. </div>
  122. <span class='help-block' style="display:none;" id="chose_link_tip_1">备注:请使用http或https链接,需要在<a href="http://mp.weixin.qq.com" target="_blank">mp.weixin.qq.com</a>开发-开发设置-业务域名添加上此域名</span>
  123. </div>
  124. </div>
  125. </div>
  126. <div id="adv_end_list"></div>
  127. <div class="layui-form-item">
  128. <label class="layui-form-label mustl">广告时间</label>
  129. <div class="layui-input-block">
  130. {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $item['begin_time']),'endtime'=>date('Y-m-d H:i', $item['end_time'])),true);}
  131. </div>
  132. </div>
  133. <div class="layui-form-item">
  134. <label class="layui-form-label">投放会员</label>
  135. <div class="layui-input-block" >
  136. <input type="radio" lay-filter="is_limit_goodsbuy" name="data[send_person]" value="1" checked title="指定用户发送" />
  137. <input type="radio" lay-filter="is_limit_goodsbuy" name="data[send_person]" value="2" title="按用户分组等级发送" />
  138. <input type="radio" lay-filter="is_limit_goodsbuy" name="data[send_person]" value="3" title="全部发送({$membercount}人)" />
  139. </div>
  140. </div>
  141. <div class="layui-form-item" id="type_1">
  142. <label class="layui-form-label">关联会员</label>
  143. <div class="layui-input-block">
  144. <div class="input-group " style="margin: 0;">
  145. <input type="text" disabled value="" class="form-control valid" name="" placeholder="" id="agent_id">
  146. <span class="input-group-btn">
  147. <span data-input="#agent_id" id="chose_agent_id" class="btn btn-default">选择会员</span>
  148. </span>
  149. </div>
  150. </div>
  151. </div>
  152. <div class="layui-form-item" id="type_2" style="display:none;">
  153. <label class="layui-form-label must">会员组</label>
  154. <div class="layui-input-block">
  155. <select name="data[member_group_id]">
  156. <?php foreach($list as $val){ ?>
  157. <option value="{$val['id']}">{$val['groupname']}({$val['membercount']}人)</option>
  158. <?php } ?>
  159. </select>
  160. </div>
  161. </div>
  162. <div class="layui-form-item">
  163. <label class="layui-form-label mustl">投放页面</label>
  164. <div class="layui-input-block" id="param-items">
  165. <label class="radio-inline">
  166. <input type="radio" name='data[pop_page]' lay-filter="pop_page" value="0" checked title="商城首页" />
  167. </label>
  168. <label class="radio-inline">
  169. <input type="radio" name='data[pop_page]' lay-filter="pop_page" value="1" title="商城分类" />
  170. </label>
  171. <label class="radio-inline">
  172. <input type="radio" name='data[pop_page]' lay-filter="pop_page" value="2" title="商城购物车" />
  173. </label>
  174. <label class="radio-inline">
  175. <input type="radio" name='data[pop_page]' lay-filter="pop_page" value="3" title="商城个人中心" />
  176. </label>
  177. </div>
  178. </div>
  179. <div class="layui-form-item">
  180. <label class="layui-form-label mustl">出现次数</label>
  181. <div class="layui-input-block" id="param-items">
  182. <div class="input-group">
  183. <input type="radio" name='data[is_index_show]' value="0" checked title='<font id="index_show_txt_1">首页</font><font>访问页面时出现,之后不再出现</font>'/>
  184. </div>
  185. <div class="input-group">
  186. <input type="radio" name='data[is_index_show]' value="1" title='<font id="index_show_txt">首页</font><font>访问页面时出现,之后每</font>&nbsp;&nbsp;<input type="text" value="" class="" name="data[show_hour]" style="width: 100px;" maxlength="10">&nbsp;&nbsp;<font>小时出现1次</font>' />
  187. </div>
  188. <span class='help-block'>出现频次时间间隔不能大于投放时间,在广告投放时间内,用户访问投放页面会弹出广告,请设置广告出现的频次</span>
  189. </div>
  190. </div>
  191. <div class="layui-form-item">
  192. <label class="layui-form-label">排序</label>
  193. <div class="layui-input-block">
  194. <input type="text" name="data[sort_order]" class="form-control" value=""/>
  195. <span class='help-block'>数字越大,排名越靠前</span>
  196. </div>
  197. </div>
  198. <div class="layui-form-item">
  199. <label class="layui-form-label">状态</label>
  200. <div class="layui-input-block">
  201. <label class='radio-inline'>
  202. <input type='radio' name='data[status]' title="开启" value="1" />
  203. </label>
  204. <label class='radio-inline'>
  205. <input type='radio' name='data[status]' title="关闭" value="0" checked />
  206. </label>
  207. </div>
  208. </div>
  209. <div class="layui-form-item">
  210. <label class="layui-form-label"> </label>
  211. <div class="layui-input-block">
  212. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  213. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  214. <a class="btn btn-default" style='margin-left:10px;' href="{:U('popadv/index',array('ok'=>'1'))}">返回列表</a>
  215. </div>
  216. </div>
  217. </form>
  218. </div>
  219. </div>
  220. </div>
  221. <script src="/layuiadmin/layui/layui.js"></script>
  222. <script>
  223. layui.config({
  224. base: '/layuiadmin/' //静态资源所在路径
  225. }).extend({
  226. index: 'lib/index' //主入口模块
  227. }).use('index');
  228. </script>
  229. <script>
  230. $(document).ready(function(){
  231. $(".contact").mouseover(function(){
  232. $(".content").show("slow");
  233. $(".contact").mouseout(function(){
  234. $(".content").hide("slow");
  235. });
  236. });
  237. })
  238. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  239. var layer = layui.layer;
  240. var $;
  241. var cur_open_div;
  242. layui.use(['jquery', 'layer','form'], function(){
  243. $ = layui.$;
  244. var form = layui.form;
  245. form.on('radio(pop_page)', function(data){
  246. if (data.value == 1) {
  247. $('#index_show_txt').html('商城分类');
  248. $('#index_show_txt_1').html('商城分类');
  249. } else if (data.value == 2) {
  250. $('#index_show_txt').html('商城购物车');
  251. $('#index_show_txt_1').html('商城购物车');
  252. } else if (data.value == 3) {
  253. $('#index_show_txt').html('商城个人中心');
  254. $('#index_show_txt_1').html('商城个人中心');
  255. } else{
  256. $('#index_show_txt').html('首页');
  257. $('#index_show_txt_1').html('首页');
  258. }
  259. });
  260. form.on('radio(linktype_1)', function(data){
  261. if (data.value == 2) {
  262. $('#typeGroup_1').show();
  263. $('#chose_link_box_1').hide();
  264. }
  265. else if( data.value == 0 )
  266. {
  267. $('#typeGroup_1').hide();
  268. $('#chose_link_box_1').hide();
  269. $('#chose_link_tip_1').show();
  270. }
  271. else {
  272. $('#typeGroup_1').hide();
  273. $('#chose_link_box_1').show();
  274. $('#chose_link_tip_1').hide();
  275. }
  276. });
  277. form.on('radio(is_limit_goodsbuy)', function(data){
  278. if(data.value == 1)
  279. {
  280. $('#type_1').show();
  281. $('#type_2').hide();
  282. }else if(data.value == 2)
  283. {
  284. $('#type_1').hide();
  285. $('#type_2').show();
  286. }
  287. else{
  288. $('#type_1').hide();
  289. $('#type_2').hide();
  290. }
  291. });
  292. $('#chose_link_1').click(function(){
  293. cur_open_div = $(this).attr('data-input');
  294. $.post("/seller.php?s=/util/selecturl/ok/1", {}, function(shtml){
  295. layer.open({
  296. type: 1,
  297. area: '930px',
  298. content: shtml //注意,如果str是object,那么需要字符拼接。
  299. });
  300. });
  301. })
  302. $('#chose_agent_id').click(function(){
  303. cur_open_div = $(this).attr('data-input');
  304. $.post("/seller.php?s=/user/zhenquery_many/template/mult", {}, function(shtml){
  305. layer.open({
  306. type: 1,
  307. area: '930px',
  308. content: shtml //注意,如果str是object,那么需要字符拼接。
  309. });
  310. });
  311. })
  312. $('#chose_member_id').click(function(){
  313. cur_open_div = $(this).attr('data-input');
  314. $.post("/seller.php?s=/user/query/is_quan/1", {}, function(shtml){
  315. layer.open({
  316. type: 1,
  317. area: '930px',
  318. content: shtml //注意,如果str是object,那么需要字符拼接。
  319. });
  320. });
  321. })
  322. $('#addAdv').click(function(){
  323. var count = $('.adv_list').length;
  324. if(count < 5){
  325. $.ajax({
  326. url: "/seller.php?s=/popadv/add_adv",
  327. type: "post",
  328. data: {num:count+1},
  329. dataType:'json',
  330. success: function (info) {
  331. $('#adv_end_list').before(info.html);
  332. layui.form.render();
  333. }
  334. });
  335. }else{
  336. layer.msg('广告最多添加5条',{icon:5});
  337. }
  338. })
  339. $('#delAdv').click(function(){
  340. var count = $('.adv_list').length;
  341. if(count > 1){
  342. $('.adv_list')[count-1].remove();
  343. }else{
  344. layer.msg('广告不能少于1条',{icon:5});
  345. }
  346. });
  347. //监听提交
  348. form.on('submit(formDemo)', function(data){
  349. var loadingIndex = layer.load();
  350. var member_id_ar = [];
  351. var member_id_str = '';
  352. $('.mult_choose_member_id').each(function(){
  353. member_id_ar.push( $(this).attr('data-member-id') );
  354. });
  355. member_id_str = member_id_ar.join(',');
  356. data.field.member_id = member_id_str;
  357. console.log(data.field);
  358. $.ajax({
  359. url: data.form.action,
  360. type: data.form.method,
  361. data: data.field,
  362. dataType:'json',
  363. success: function (info) {
  364. if(info.status == 0)
  365. {
  366. layer.msg(info.result.message,{icon: 1,time: 2000});
  367. layer.close(loadingIndex);
  368. }else if(info.status == 1){
  369. var go_url = location.href;
  370. if( info.result.hasOwnProperty("url") )
  371. {
  372. go_url = info.result.url;
  373. }
  374. layer.msg('操作成功',{time: 1000,
  375. end:function(){
  376. location.href = info.result.url;
  377. }
  378. });
  379. }
  380. }
  381. });
  382. return false;
  383. });
  384. })
  385. function cancle_bind(obj,sdiv)
  386. {
  387. $('#'+sdiv).val('');
  388. $(obj).parent().parent().remove();
  389. }
  390. </script>
  391. </body>