387df30557e0750392fdea618ee187f9.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <?php if (!defined('THINK_PATH')) exit();?><!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': '<?php echo ($_W['uniacid']); ?>',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '<?php echo ($_W['acid']); ?>',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '<?php echo ($_W['openid']); ?>',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '<?php echo ($_W['uid']); ?>',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '<?php echo ($_W['siteroot']); ?>',
  27. 'siteurl': '<?php echo ($_W['siteurl']); ?>',
  28. 'attachurl': '<?php echo ($_W['attachurl']); ?>',
  29. 'attachurl_local': '<?php echo ($_W['attachurl_local']); ?>',
  30. 'attachurl_remote': '<?php echo ($_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' : <?php echo 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"><?php if(!empty($data['id'])){ ?>编辑<?php }else{ ?>添加<?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">
  64. <input type="hidden" name="data[id]" value="<?php echo ($item[id]); ?>" />
  65. <div class="layui-form-item">
  66. <label class="layui-form-label mustl">打印机名称</label>
  67. <div class="layui-input-block">
  68. <input type="text" name="data[printer_name]" class="form-control" value="<?php echo ($item[printer_name]); ?>" lay-verify='true' style="width: 50%;display: inline-block;" maxlength="100"/>
  69. &nbsp;&nbsp;&nbsp;&nbsp;
  70. <a href="#" style="color: #00a9d0;display:inline;" class="contact">飞鹅官方购买</a>
  71. <div class="content" style="color: black;display:none;">
  72. <div align="center"><img src="/static/images/feie.png" alt="飞鹅打印机" height="135"></div>
  73. <span style="text-align: center;display:block;">扫码购买</span>
  74. </div>
  75. <span class='help-block'>打印机名称,例如:商店打印机器</span>
  76. </div>
  77. </div>
  78. <div class="layui-form-item">
  79. <label class="layui-form-label">打印机类型</label>
  80. <div class="layui-input-block" style="width: 50%;">
  81. <select id="printer_type" name='data[printer_type]' class="form-control select2" lay-filter="printer_type">
  82. <option value="1" <?php if($item['printer_type'] == 1){ ?>selected="selected"<?php } ?>>飞鹅打印机</option>
  83. <option value="2" <?php if($item['printer_type'] == 2){ ?>selected="selected"<?php } ?>>易联云打印机</option>
  84. </select>
  85. <span class='help-block'>选中打印机类型,目前已支持打印机:飞鹅打印机,易联云K4、K5、K6打印机</span>
  86. </div>
  87. </div>
  88. <div class="feie_printer" <?php if(empty($item['printer_type']) || $item['printer_type'] == 1){?>style="display:block;"<?php }else{ ?>style="display:none;"<?php } ?>>
  89. <div class="layui-form-item">
  90. <label class="layui-form-label mustl">sn</label>
  91. <div class="layui-input-block">
  92. <input type="text" name="data[printer_sn]" class="form-control" value="<?php echo ($item[printer_sn]); ?>" lay-verify='true' style="width: 50%;" maxlength="100"/>
  93. <span class='help-block'>支持飞鹅打印机(sn,key在机子底部)</span>
  94. </div>
  95. </div>
  96. <div class="layui-form-item">
  97. <label class="layui-form-label mustl">key</label>
  98. <div class="layui-input-block">
  99. <input type="text" name="data[printer_key]" class="form-control" value="<?php echo ($item[printer_key]); ?>" lay-verify='true' style="width: 50%;" maxlength="100"/>
  100. <span class='help-block'>支持飞鹅打印机(sn,key在机子底部)</span>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="yly_printer" <?php if($item['printer_type'] == 2){ ?> style="display:block;" <?php }else{ ?> style="display:none;" <?php } ?>>
  105. <div class="layui-form-item">
  106. <label class="layui-form-label mustl">应用id</label>
  107. <div class="layui-input-block">
  108. <input type="text" name="data[api_id]" class="form-control" value="<?php echo ($item[api_id]); ?>" lay-verify='true' style="width: 50%;" maxlength="100"/>
  109. <span class='help-block'>应用id(管理中心系统集成里获取)</span>
  110. </div>
  111. </div>
  112. <div class="layui-form-item">
  113. <label class="layui-form-label mustl">应用密钥key</label>
  114. <div class="layui-input-block">
  115. <input type="text" name="data[api_key]" class="form-control" value="<?php echo ($item[api_key]); ?>" lay-verify='true' style="width: 50%;" maxlength="100"/>
  116. <span class='help-block'>apiKey(管理中心系统集成里获取)</span>
  117. </div>
  118. </div>
  119. <div class="layui-form-item">
  120. <label class="layui-form-label mustl">打印机终端号</label>
  121. <div class="layui-input-block">
  122. <input type="text" name="data[printer_yly_sn]" class="form-control" value="<?php echo ($item[printer_sn]); ?>" lay-verify='true' style="width: 50%;" maxlength="100"/>
  123. <span class='help-block'>打印机终端号,终端密钥在机子底部,开发者中心应用类型选择:自由型应用</span>
  124. </div>
  125. </div>
  126. <div class="layui-form-item">
  127. <label class="layui-form-label mustl">终端密钥</label>
  128. <div class="layui-input-block">
  129. <input type="text" name="data[printer_yly_key]" class="form-control" value="<?php echo ($item[printer_key]); ?>" lay-verify='true' style="width: 50%;" maxlength="100"/>
  130. <span class='help-block'>打印机终端号,终端密钥在机子底部,开发者中心应用类型选择:自由型应用</span>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="layui-form-item">
  135. <label class="layui-form-label mustl">打印联数</label>
  136. <div class="layui-input-block">
  137. <input type="text" name="data[printer_num]" class="form-control" value="<?php echo ($item[printer_num]); ?>" lay-verify='true' style="width: 50%;" maxlength="10"/>
  138. <span class='help-block'>同一订单,打印的次数</span>
  139. </div>
  140. </div>
  141. <div class="layui-form-item">
  142. <label class="layui-form-label mustl">状态</label>
  143. <div class="layui-input-block" id="param-items">
  144. <label class="radio-inline">
  145. <input type="radio" name='data[status]' value="1" <?php if( !empty($item['status']) || $item['status']==1){ ?>checked<?php } ?> title="启用" />
  146. </label>
  147. <label class="radio-inline">
  148. <input type="radio" name='data[status]' value="0" <?php if( empty($item['status']) && $item['status'] == 0){ ?>checked<?php } ?> title="禁用" />
  149. </label>
  150. </div>
  151. </div>
  152. <div class="layui-form-item">
  153. <label class="layui-form-label"> </label>
  154. <div class="layui-input-block">
  155. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  156. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  157. <a class="btn btn-default" style='margin-left:10px;' href="<?php echo U('printer/index',array('ok'=>'1'));?>">返回列表</a>
  158. </div>
  159. </div>
  160. </form>
  161. </div>
  162. </div>
  163. </div>
  164. <script src="/layuiadmin/layui/layui.js"></script>
  165. <script>
  166. layui.config({
  167. base: '/layuiadmin/' //静态资源所在路径
  168. }).extend({
  169. index: 'lib/index' //主入口模块
  170. }).use('index');
  171. </script>
  172. <script>
  173. $(document).ready(function(){
  174. $(".contact").mouseover(function(){
  175. $(".content").show("slow");
  176. $(".contact").mouseout(function(){
  177. $(".content").hide("slow");
  178. });
  179. });
  180. })
  181. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  182. var layer = layui.layer;
  183. var $;
  184. var cur_open_div;
  185. layui.use(['jquery', 'layer','form'], function(){
  186. $ = layui.$;
  187. var form = layui.form;
  188. form.on('select(printer_type)', function(data){
  189. var type = data.value;
  190. if(type == 1){
  191. $('.feie_printer').show();
  192. $('.yly_printer').hide();
  193. }else if(type == 2){
  194. $('.feie_printer').hide();
  195. $('.yly_printer').show();
  196. }
  197. });
  198. //监听提交
  199. form.on('submit(formDemo)', function(data){
  200. var loadingIndex = layer.load();
  201. $.ajax({
  202. url: data.form.action,
  203. type: data.form.method,
  204. data: data.field,
  205. dataType:'json',
  206. success: function (info) {
  207. if(info.status == 0)
  208. {
  209. layer.msg(info.result.message,{icon: 1,time: 2000});
  210. layer.close(loadingIndex);
  211. }else if(info.status == 1){
  212. var go_url = location.href;
  213. if( info.result.hasOwnProperty("url") )
  214. {
  215. go_url = info.result.url;
  216. }
  217. layer.msg('操作成功',{time: 1000,
  218. end:function(){
  219. location.href = info.result.url;
  220. }
  221. });
  222. }
  223. }
  224. });
  225. return false;
  226. });
  227. })
  228. </script>
  229. </body>