templateconfig.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  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. <script type="text/javascript" src="/static/js/dist/area/cascade.js"></script>
  45. <script src="https://map.qq.com/api/js?v=2.exp&key=6R4BZ-WAB3W-JITRG-OE7GY-R2753-P3BZ2" type="text/javascript" charset="utf-8"></script>
  46. <style>
  47. .myText{
  48. padding-left: 30px;
  49. font-size: 13px;
  50. color: #C4C4C4;
  51. }
  52. </style>
  53. </head>
  54. <body layadmin-themealias="default">
  55. <div class="layui-fluid">
  56. <div class="layui-card">
  57. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">模板消息设置</span></div>
  58. <div class="layui-tab layui-tab-brief" >
  59. <ul class="layui-tab-title">
  60. <li <?php if( $type==1 ){ ?>class="layui-this"<?php } ?> ><a href="{:U('weprogram/templateconfig', array('type' => 1))}">公众号模板消息</a></li>
  61. <li <?php if( $type==2 ){ ?>class="layui-this"<?php } ?> ><a href="{:U('weprogram/templateconfig', array('type' => 2))}">平台订单通知</a></li>
  62. </ul>
  63. </div>
  64. <?php if( $type == 1 ){ ?>
  65. <div class="layui-card-body" style="padding:15px;display:block" >
  66. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  67. <div class="layui-form-item">
  68. <label class="layui-form-label">公众号APPID</label>
  69. <div class="layui-input-block">
  70. <input type="text" name="parameter[weixin_appid]" class="layui-input" value="{$data['weixin_appid']}" />
  71. </div>
  72. <span class="myText" >登录<span style="font-size: 16px;color:#009688">公众号平台</span>,在管理中心-应用详情中查看</span>
  73. </div>
  74. <div class="layui-form-item">
  75. <label class="layui-form-label">订单支付成功通知</label>
  76. <div class="layui-input-block">
  77. <input type="text" name="parameter[weixin_template_pay_order]" class="layui-input" value="{$data['weixin_template_pay_order']}" />
  78. </div>
  79. <span class="myText" >用户订单支付成功,消息通知用户</span>
  80. </div>
  81. <div class="layui-form-item">
  82. <label class="layui-form-label">订单发货通知</label>
  83. <div class="layui-input-block">
  84. <input type="text" name="parameter[weixin_template_send_order]" class="layui-input" value="{$data['weixin_template_send_order']}" />
  85. </div>
  86. <span class="myText">商品订单发货成功,消息通知用户</span>
  87. </div>
  88. <div class="layui-form-item" >
  89. <label class="layui-form-label">核销成功通知</label>
  90. <div class="layui-input-block">
  91. <input type="text" name="parameter[weixin_template_hexiao_success]" class="layui-input" value="{$data['weixin_template_hexiao_success']}" />
  92. </div>
  93. <span class="myText" >商品订单核销成功,消息通知用户</span>
  94. </div>
  95. <div class="layui-form-item">
  96. <label class="layui-form-label">团长申请成功发送通知</label>
  97. <div class="layui-input-block">
  98. <input type="text" name="parameter[weixin_template_apply_community]" class="layui-input" value="{$data['weixin_template_apply_community']}" />
  99. </div>
  100. <span class="myText" >用户申请团长,平台通过审核以后,消息通知用户团长申请成功</span>
  101. </div>
  102. <div class="layui-form-item">
  103. <label class="layui-form-label">售后订单申请通知(平台)</label>
  104. <div class="layui-input-block">
  105. <input type="text" name="parameter[weixin_template_apply_refund]" class="layui-input" value="{$data['weixin_template_apply_refund']}" />
  106. </div>
  107. <span class="myText" >消息通知平台管理人员,有“售后订单"需要处理</span>
  108. </div>
  109. <div class="layui-form-item">
  110. <label class="layui-form-label">取消订单通知(平台)</label>
  111. <div class="layui-input-block">
  112. <input type="text" name="parameter[weixin_template_cancle_order]" class="layui-input" value="{$data['weixin_template_cancle_order']}" />
  113. </div>
  114. <span class="myText" >消息通知平台管理人员,有“取消订单需要处理</span>
  115. </div>
  116. <div class="layui-form-item">
  117. <label class="layui-form-label">会员下单成功提醒团长</label>
  118. <div class="layui-input-block">
  119. <input type="text" name="parameter[weixin_template_order_buy]" class="layui-input" value="{$data['weixin_template_order_buy']}" />
  120. </div>
  121. <span class="myText" >用户下单成功以后,消息通知团长</span>
  122. </div>
  123. <div class="layui-form-item">
  124. <label class="layui-form-label">同城配送骑手接单通知</label>
  125. <div class="layui-input-block">
  126. <input type="text" name="parameter[weixin_template_order_riders_receive]" class="layui-input" value="{$data['weixin_template_order_riders_receive']}" />
  127. </div>
  128. <span class="myText" >同城配送订单,消息通知骑手进行接单</span>
  129. </div>
  130. <div class="layui-form-item">
  131. <label class="layui-form-label">团长提现到账提醒</label>
  132. <div class="layui-input-block">
  133. <input type="text" name="parameter[weixin_template_apply_tixian]" class="layui-input" value="{$data['weixin_template_apply_tixian']}" />
  134. </div>
  135. <span class="myText" >团长申请提现,消息通知团长提现申请成功</span>
  136. <br>
  137. <div class="layui-form-mid" style="margin-left: 180px;">
  138. 注意,公众号需要是小程序的关联主体。(未填写appid 即不发送模板消息)<br>
  139. <a href="https://shiziyu.liofis.com/公众号模板消息.docx" style="color:blue;">点击下载设置教程</a>
  140. </div>
  141. </div>
  142. <div class="layui-form-item">
  143. <label class="layui-form-label"> </label>
  144. <div class="layui-input-block">
  145. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  146. </div>
  147. </div>
  148. </form>
  149. </div>
  150. <?php }else if( $type == 3 ){ ?>
  151. <div class="layui-card-body" style="padding:15px;display:block" >
  152. <form action="{:U('weprogram/templateconfig_fenxi', array('type' => 3))}" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  153. <div class="layui-form-item">
  154. <label class="layui-form-label">示例:</label>
  155. <div class="layui-input-block">
  156. <blockquote class="layui-elem-quote layui-quote-nm">
  157. {{first.DATA}}<br/><br/>
  158. 产品名称:{{hotelName.DATA}}<br/><br/>
  159. 团购券号:{{voucher_number.DATA}}<br/><br/>
  160. {{remark.DATA}}<br/><br/>
  161. 小程序后台——模板消息——我的模板——某模板详情——详细内容(复制粘粘到此处)<br/>
  162. </blockquote>
  163. </div>
  164. </div>
  165. <div class="layui-form-item">
  166. <label class="layui-form-label">模板详细内容</label>
  167. <div class="layui-input-block">
  168. <textarea name="subtitle" id="subtitle" rows="8" class="form-control" ></textarea>
  169. <div class="layui-form-mid layui-word-aux"></div>
  170. </div>
  171. </div>
  172. <div id="analy_div">
  173. </div>
  174. <div class="layui-form-item">
  175. <label class="layui-form-label">发送会员类型</label>
  176. <div class="layui-input-block">
  177. <label class='radio-inline'>
  178. <input type='radio' name='all_msg_send_type' lay-filter="all_msg_send_type" title="指定会员" value=1 checked />
  179. </label>
  180. <label class='radio-inline'>
  181. <input type='radio' name='all_msg_send_type' lay-filter="all_msg_send_type" title="某个会员组" value=2 />
  182. </label>
  183. <label class='radio-inline'>
  184. <input type='radio' name='all_msg_send_type' lay-filter="all_msg_send_type" title="全部会员" value=3 />
  185. </label>
  186. </div>
  187. </div>
  188. <div class="layui-form-item" id="type_1">
  189. <label class="layui-form-label">关联会员</label>
  190. <div class="layui-input-block">
  191. <div class="input-group " style="margin: 0;">
  192. <input type="text" disabled value="" class="form-control valid" name="" placeholder="" id="agent_id">
  193. <span class="input-group-btn">
  194. <span data-input="#agent_id" id="chose_agent_id" class="btn btn-default">选择会员</span>
  195. </span>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="layui-form-item" id="type_2" style="display:none;">
  200. <label class="layui-form-label must">会员组</label>
  201. <div class="layui-input-block">
  202. <select name="member_group_id">
  203. <?php foreach($member_group_list as $val){ ?>
  204. <option value="{$val['id']}">{$val['groupname']}</option>
  205. <?php } ?>
  206. </select>
  207. </div>
  208. </div>
  209. <div class="layui-form-item">
  210. <label class="layui-form-label">模板ID</label>
  211. <div class="layui-input-block">
  212. <input type="text" name="all_send_template_id" class="layui-input" value="" />
  213. </div>
  214. <div class="layui-form-mid" style="margin-left:25px;">
  215. 开发者调用模板消息接口时需提供模板ID
  216. </div>
  217. </div>
  218. <div class="layui-form-item">
  219. <label class="layui-form-label">点击链接</label>
  220. <div class="layui-input-block">
  221. <div class="input-group " style="margin: 0;">
  222. <input type="text" value="" class="form-control valid" name="link" placeholder="" id="advlink">
  223. <span class="input-group-btn">
  224. <span data-input="#advlink" id="chose_link" class="btn btn-default">选择链接</span>
  225. </span>
  226. </div>
  227. </div>
  228. </div>
  229. <div class="layui-form-item">
  230. <label class="layui-form-label"> </label>
  231. <div class="layui-input-block">
  232. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  233. </div>
  234. </div>
  235. </form>
  236. </div>
  237. <?php }else{ ?>
  238. <div class="layui-card-body" style="padding:15px;display:block" >
  239. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  240. <div class="layui-form-item" id="user_form_item">
  241. <label class="layui-form-label">关联会员</label>
  242. <div class="layui-input-block">
  243. <div class="input-group " style="margin: 0;">
  244. <input type="text" disabled value="" class="form-control valid" name="" placeholder="" id="agent_id">
  245. <span class="input-group-btn">
  246. <span data-input="#agent_id" id="chose_agent_id" class="btn btn-default">选择会员</span>
  247. </span>
  248. </div>
  249. <div class="input-group layui-word-aux">订单信息提示,平台用户下单后通知关联会员进行接单处理</div>
  250. <?php if(!empty($user_list)){ ?>
  251. <?php foreach( $user_list as $a ){ ?>
  252. <div class="input-group mult_choose_member_id" data-member-id="{$a['member_id']}" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;width: 22%;">
  253. <div class="layadmin-text-center choose_user">
  254. <img style="" src="{$a['avatar']}">
  255. <div class="layadmin-maillist-img" style="">{$a['nickname']}</div>
  256. <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)">
  257. <i class="layui-icon"></i>
  258. </button>
  259. </div>
  260. </div>
  261. <?php }} ?>
  262. </div>
  263. </div>
  264. <div class="layui-form-item">
  265. <label class="layui-form-label"> </label>
  266. <div class="layui-input-block">
  267. <?php if( $_GPC['type']!='0' && $_GPC['type']!='1' ){ ?>
  268. <input type="hidden" name="limit_user_list" value="" id="limit_user_list" />
  269. <?php } ?>
  270. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  271. </div>
  272. </div>
  273. </form>
  274. </div>
  275. </div>
  276. <?php } ?>
  277. </div>
  278. </div>
  279. <script src="/layuiadmin/layui/layui.js"></script>
  280. <script>
  281. layui.config({
  282. base: '/layuiadmin/' //静态资源所在路径
  283. }).extend({
  284. index: 'lib/index' //主入口模块
  285. }).use('index');
  286. </script>
  287. <script>
  288. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  289. var layer = layui.layer;
  290. var $;
  291. var cur_open_div;
  292. var can_sub = true;
  293. layui.use(['jquery', 'layer','form'], function(){
  294. $ = layui.$;
  295. var form = layui.form;
  296. form.on('radio(linktype)', function(data){
  297. if (data.value == 2) {
  298. $('#typeGroup').show();
  299. } else {
  300. $('#typeGroup').hide();
  301. }
  302. });
  303. form.on('radio(all_msg_send_type)', function(data){
  304. if (data.value == 1) {
  305. $('#type_1').show();
  306. } else if( data.value == 2 )
  307. {
  308. $('#type_1').hide();
  309. $('#type_2').show();
  310. }
  311. else if( data.value == 3 )
  312. {
  313. $('#type_1').hide();
  314. $('#type_2').hide();
  315. }
  316. });
  317. //subtitle
  318. $(document).on("input propertychange","#subtitle",function(){
  319. //("\r|\n|\\s", "");
  320. var s_content = $('#subtitle').val();
  321. s_content.replace(/\r|\n|\\s/g,"");
  322. var regex3 = /\{\{(.+?)\}\}/g; // {}
  323. var new_arr = s_content.match(regex3);
  324. var s_html = "";
  325. for( var i in new_arr )
  326. {
  327. s_html+=' <div class="layui-form-item">';
  328. s_html+=' <label class="layui-form-label">'+new_arr[i]+'内容</label>';
  329. s_html+=' <div class="layui-input-block">';
  330. s_html+=' <input type="text" name="datas['+new_arr[i]+']" class="layui-input" lay-required="true" value="" />';
  331. s_html+=' </div>';
  332. s_html+=' </div>';
  333. }
  334. $('#analy_div').html(s_html);
  335. });
  336. $('#chose_member_id').click(function(){
  337. cur_open_div = $(this).attr('data-input');
  338. $.post("{:U('user/zhenquery', array('ok' => 1))}", {}, function(shtml){
  339. layer.open({
  340. type: 1,
  341. area: '930px',
  342. content: shtml //注意,如果str是object,那么需要字符拼接。
  343. });
  344. });
  345. })
  346. $('#chose_agent_id').click(function(){
  347. cur_open_div = $(this).attr('data-input');
  348. $.post("{:U('user/zhenquery_many', array('template' => 'mult'))}", {}, function(shtml){
  349. layer.open({
  350. type: 1,
  351. area: '930px',
  352. content: shtml //注意,如果str是object,那么需要字符拼接。
  353. });
  354. });
  355. })
  356. $('#chose_link').click(function(){
  357. cur_open_div = $(this).attr('data-input');
  358. $.post("{:U('util/selecturl', array('ok' => 1))}", {}, function(shtml){
  359. layer.open({
  360. type: 1,
  361. area: '930px',
  362. content: shtml //注意,如果str是object,那么需要字符拼接。
  363. });
  364. });
  365. })
  366. form.on('submit(auto_get)', function(data){
  367. var loadingIndex = layer.load(); // 加载中动画遮罩层(1)
  368. $.ajax({
  369. url: "{:U('weprogram/autotemplateconfig',array('ok'=>'1'))}",
  370. type: 'get',
  371. dataType:'json',
  372. success: function (info) {
  373. layer.close(loadingIndex); // 提交成功失败都需要关闭
  374. if(info.status == 0)
  375. {
  376. layer.msg('请选择会员',{time: 1000});
  377. }else if(info.status == 1){
  378. layer.msg('操作成功',{time: 1000,
  379. end:function(){
  380. var backurl = "{:U('weprogram/templateconfig')}";
  381. location.href = backurl;
  382. // location.href = info.result.url;
  383. }
  384. });
  385. can_sub = true;
  386. }
  387. }
  388. });
  389. return false;
  390. })
  391. //监听提交
  392. form.on('submit(formDemo)', function(data){
  393. var gd_ar = [];
  394. var gd_str = '';
  395. $('.mult_choose_member_id').each(function(){
  396. gd_ar.push( $(this).attr('data-member-id') );
  397. })
  398. gd_str = gd_ar.join(',');
  399. data.field.limit_user_list = gd_str;
  400. $.ajax({
  401. url: data.form.action,
  402. type: data.form.method,
  403. data: data.field,
  404. dataType:'json',
  405. success: function (info) {
  406. if(info.status == 0)
  407. {
  408. layer.msg(info.result.message,{icon: 1,time: 2000});
  409. }else if(info.status == 1){
  410. var go_url = location.href;
  411. if( info.result.hasOwnProperty("url") )
  412. {
  413. go_url = info.result.url;
  414. }
  415. layer.msg('操作成功',{time: 1000,
  416. end:function(){
  417. location.href = info.result.url;
  418. }
  419. });
  420. }
  421. }
  422. });
  423. return false;
  424. });
  425. })
  426. function cancle_bind(obj,sdiv)
  427. {
  428. $('#'+sdiv).val('');
  429. $(obj).parent().parent().remove();
  430. }
  431. </script>
  432. </body>