addslider.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css" rel="stylesheet">
  44. </head>
  45. <style>
  46. .input-group .form-control{min-width:600px;}
  47. .multi-audio-details .multi-audio-item {
  48. width: 155px;
  49. height: 40px;
  50. position: relative;
  51. float: left;
  52. margin-right: 5px;
  53. }
  54. .multi-audio-details .input-group .form-control {
  55. min-width: auto;
  56. }
  57. </style>
  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"><?php if( !empty($item['id'])){ ?>编辑<?php }else{ ?>添加<?php } ?>幻灯片<?php if( !empty($item['id'])){ ?>({$item['advname']})<?php } ?></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" enctype="multipart/form-data" >
  64. <input type="hidden" name="data[id]" value="{$item['id']}"/>
  65. <div class="layui-form-item">
  66. <label class="layui-form-label">幻灯片名称</label>
  67. <div class="layui-input-block ">
  68. <input type="text" id='advname' lay-verify="required" name="data[advname]" class="form-control" value="{$item['advname']}"/>
  69. </div>
  70. </div>
  71. <div class="layui-form-item">
  72. <label class="layui-form-label">图片</label>
  73. <div class="layui-input-block">
  74. {:tpl_form_field_image2('data[thumb]', $item['thumb'])}
  75. <span class='help-block'>建议尺寸:710 * 320或同比例, 请将所有幻灯片图片尺寸保持一致</span>
  76. </div>
  77. </div>
  78. <div class="layui-form-item">
  79. <label class="layui-form-label">链接类型</label>
  80. <div class="layui-input-block">
  81. <label class='radio-inline'>
  82. <input type='radio' name='data[linktype]' lay-filter="linktype" title="本小程序链接" value=1 <?php if($item['linktype']==1 || empty($item)){ ?>checked<?php } ?> />
  83. </label>
  84. <label class='radio-inline'>
  85. <input type='radio' name='data[linktype]' lay-filter="linktype" title="webview外链" value=0 <?php if( $item['linktype']==0 && !empty($item) ){ ?>checked<?php } ?> />
  86. </label>
  87. <label class='radio-inline'>
  88. <input type='radio' name='data[linktype]' lay-filter="linktype" title="外部小程序链接" value=2 <?php if( $item['linktype']==2 && !empty($item) ){ ?>checked<?php } ?> />
  89. </label>
  90. <label class='radio-inline'>
  91. <input type='radio' name='data[linktype]' title="客服" lay-filter="linktype" value=5 <?php if( $item['linktype']==5 && !empty($item) ){ ?>checked<?php } ?> />
  92. </label>
  93. <label class='radio-inline'>
  94. <input type='radio' name='data[linktype]' title="优惠券" lay-filter="linktype" value=6 <?php if( $item['linktype']==6 && !empty($item) ){ ?>checked<?php } ?> />
  95. </label>
  96. </div>
  97. </div>
  98. <!-- 优惠券 -->
  99. <div class="layui-form-item" id="couponId" style="<?php if( $item['linktype']!=6 ){ ?>display: none;<?php } ?>">
  100. <label class="layui-form-label must">优惠券</label>
  101. <div class="layui-input-block">
  102. <div class="input-group " style="margin: 0;">
  103. <input type="text" disabled value="" class="form-control valid" name="coupon_dan_id" placeholder="" id="coupon_id">
  104. <span class="input-group-btn">
  105. <span data-input="#coupon_id_box" data-name="coupon_id" id="chose_coupon_id" class="btn btn-default">选择优惠券</span>
  106. </span>
  107. </div>
  108. <div class="multi-audio-details container" id="coupon_id_box" style="width:auto;">
  109. <?php if( !empty($couponinfo) ){ ?>
  110. <?php foreach($couponinfo as $c){ ?>
  111. <div class="multi-audio-item " data-id="{$c['id']}">
  112. <div class="input-group">
  113. <input type="text" class="form-control img-textname" readonly="" value="{$c['voucher_title']}">
  114. <input type="hidden" value="{$c['id']}" name="coupon_id[]">
  115. <div class="input-group-btn">
  116. <button class="btn btn-default" data-id="{$c['id']}" onclick="cancle_coupon(this, {$c['id']})" type="button"><i class="fa fa-remove"></i></button>
  117. </div>
  118. </div>
  119. </div>
  120. <?php } ?>
  121. <?php } ?>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="layui-form-item" style="<?php if( $item['linktype']!=2){ ?>display: none;<?php } ?>" id="typeGroup">
  126. <label class="layui-form-label">外链小程序appid</label>
  127. <div class="layui-input-block ">
  128. <input type="text" id='appid' name="data[appid]" class="form-control" value="{$item['appid']}" maxlength="32"/>
  129. </div>
  130. </div>
  131. <div class="layui-form-item" style="<?php if($item['linktype']==5||$item['linktype']==6){ ?>display: none;<?php } ?>" id="typeUrl">
  132. <label class="layui-form-label">链接</label>
  133. <div class="layui-input-block">
  134. <div class="input-group " style="margin: 0;">
  135. <input type="text" value="{$item['link']}" class="form-control valid" name="data[link]" placeholder="" id="advlink">
  136. <span class="input-group-btn" id="chose_link_box" <?php if( $item['linktype']==0 && !empty($item) ){ ?> style="display:none;" <?php } ?> >
  137. <span data-input="#advlink" id="chose_link" class="btn btn-default">选择链接</span>
  138. </span>
  139. </div>
  140. <span class='help-block' <?php if( $item['linktype']==0 && !empty($item) ){ ?> <?php }else{ ?>style="display:none;"<?php } ?> id="chose_link_tip">备注:请使用http或https链接,需要在<a href="http://mp.weixin.qq.com" target="_blank">mp.weixin.qq.com</a>开发-开发设置-业务域名添加上此域名</span>
  141. </div>
  142. </div>
  143. <div class="layui-form-item">
  144. <label class="layui-form-label">排序</label>
  145. <div class="layui-input-block">
  146. <input type="text" name="data[displayorder]" class="form-control" value="{$item['displayorder']}"/>
  147. <span class='help-block'>数字越大,排名越靠前</span>
  148. </div>
  149. </div>
  150. <div class="layui-form-item">
  151. <label class="layui-form-label">状态</label>
  152. <div class="layui-input-block">
  153. <label class='radio-inline'>
  154. <input type='radio' name='data[enabled]' title="显示" value=1 <?php if( $item['enabled']==1 || empty($item)){ ?>checked<?php } ?> />
  155. </label>
  156. <label class='radio-inline'>
  157. <input type='radio' name='data[enabled]' title="隐藏" value=0 <?php if( $item['enabled']==0 && !empty($item) ){ ?>checked<?php } ?> />
  158. </label>
  159. </div>
  160. </div>
  161. <div class="layui-form-item">
  162. <label class="layui-form-label"> </label>
  163. <div class="layui-input-block">
  164. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  165. </div>
  166. </div>
  167. </form>
  168. </div>
  169. </div>
  170. </div>
  171. <script src="/layuiadmin/layui/layui.js"></script>
  172. <script>
  173. layui.config({
  174. base: '/layuiadmin/' //静态资源所在路径
  175. }).extend({
  176. index: 'lib/index' //主入口模块
  177. }).use('index');
  178. </script>
  179. <script>
  180. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  181. var layer = layui.layer;
  182. var $;
  183. var cur_open_div;
  184. var iptname;
  185. layui.use(['jquery', 'layer','form'], function(){
  186. $ = layui.$;
  187. var form = layui.form;
  188. form.on('radio(linktype)', function(data){
  189. if (data.value == 2) {
  190. $('#typeGroup').show();
  191. $('#couponId').hide();
  192. $('#typeUrl').show();
  193. }
  194. else if( data.value == 0 )
  195. {
  196. $('#typeGroup').hide();
  197. $('#chose_link_box').hide();
  198. $('#chose_link_tip').show();
  199. $('#couponId').hide();
  200. $('#typeUrl').show();
  201. }
  202. else if(data.value == 5){
  203. $('#typeGroup').hide();
  204. $('#chose_link_box').hide();
  205. $('#chose_link_tip').hide();
  206. $('#typeUrl').hide();
  207. $('#couponId').hide();
  208. }
  209. else if( data.value == 6 )
  210. {
  211. $('#typeGroup').hide();
  212. $('#chose_link_box').hide();
  213. $('#chose_link_tip').hide();
  214. $('#typeUrl').hide();
  215. $('#couponId').show();
  216. }
  217. else {
  218. $('#typeGroup').hide();
  219. $('#chose_link_box').show();
  220. $('#chose_link_tip').hide();
  221. $('#couponId').hide();
  222. $('#typeUrl').show();
  223. }
  224. });
  225. $('#chose_link').click(function(){
  226. cur_open_div = $(this).attr('data-input');
  227. $.post("{:U('util/selecturl', array('ok' => 1))}", {}, function(shtml){
  228. layer.open({
  229. type: 1,
  230. area: '930px',
  231. content: shtml //注意,如果str是object,那么需要字符拼接。
  232. });
  233. });
  234. })
  235. $('#chose_coupon_id').click(function(){
  236. cur_open_div = $(this).attr('data-input');
  237. iptname = $(this).data('name');
  238. var coupon_ids = [];
  239. $('.multi-audio-item').each(function(){
  240. coupon_ids.push( $(this).attr("data-id") );
  241. })
  242. $.post("{:U('Marketing/couponquery', array('ok' => 1))}", {coupon_ids:coupon_ids}, function(shtml){
  243. layer.open({
  244. type: 1,
  245. area: '930px',
  246. content: shtml //注意,如果str是object,那么需要字符拼接。
  247. });
  248. })
  249. })
  250. //监听提交
  251. form.on('submit(formDemo)', function(data){
  252. $.ajax({
  253. url: data.form.action,
  254. type: data.form.method,
  255. data: data.field,
  256. dataType:'json',
  257. success: function (info) {
  258. if(info.status == 0)
  259. {
  260. layer.msg(info.result.message,{icon: 1,time: 2000});
  261. }else if(info.status == 1){
  262. var go_url = location.href;
  263. if( info.result.hasOwnProperty("url") )
  264. {
  265. go_url = info.result.url;
  266. }
  267. layer.msg('操作成功',{time: 1000,
  268. end:function(){
  269. //var backurl = "{php echo shopUrl('Configindex/slider',array('ok'=>'1'))}";
  270. var backurl = "seller.php?s=/configindex/slider";
  271. location.href = backurl;
  272. // location.href = info.result.url;
  273. }
  274. });
  275. }
  276. }
  277. });
  278. return false;
  279. });
  280. })
  281. function cancle_coupon(obj,sdiv)
  282. {
  283. $('#coupon_id').val('');
  284. $('#'+sdiv).val('');
  285. $(obj).parents('.multi-audio-item').remove();
  286. var coupon_id = "";
  287. var head_arr = [];
  288. $('.mult_heads').each(function(){
  289. head_arr.push( $(this).val() );
  290. })
  291. coupon_id = head_arr.join(',');
  292. $('#coupon_id').val(coupon_id);
  293. //$('.mult_choose_goodsid').remove();
  294. }
  295. </script>
  296. </body>