printer_config.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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:460px;
  53. background-color:FFFFFF;
  54. border:1px solid;
  55. }
  56. .layadmin-name{background-color: #009688;
  57. color: #fff;
  58. width: 90px;
  59. text-align: center;
  60. height: 22px;}
  61. </style>
  62. </head>
  63. <body layadmin-themealias="default">
  64. <div class="layui-fluid">
  65. <div class="layui-card">
  66. <div class="layui-card-header layui-elem-quote">当前位置:打印机设置</span></div>
  67. <div class="layui-card-body" style="padding:15px;">
  68. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item">
  69. <?php if($data['open_feier_print'] != 0){ ?>
  70. <div class="layui-form-item">
  71. <label class="layui-form-label">旧版打印机设置</label>
  72. <div class="layui-input-block" style="width: 50%;">
  73. <div id="share">
  74. <input type="checkbox" lay-skin="primary" id="feierprint" name="data[open_feier_print]" class="form-control valid" <?php if( !empty($data) && $data['open_feier_print'] != 0 ){ ?>checked<?php } ?> value="<?php echo $data['open_feier_print'];?>" title="继续使用旧版本设置" ></input>
  75. </div>
  76. <span style="color:red;">(此处勾选,又设置了新的小票打印机,可能导致打印多份)</span>
  77. <span class='help-block'>继续使用原有的打印机设置,旧版打印机与“默认订单打印机”一起打印小票,也可以关闭旧版打印机设置使用新版本“默认打印机”</span>
  78. <div id="share_div" <?php if( !empty($data) && $data['open_feier_print'] != 0 ){ ?> style="display:none;"<?php }else{ ?> style="display:block;"<?php } ?>>
  79. <?php if($data['open_feier_print'] == 1){ ?>
  80. <div class="input-group" style="margin: 10px 0;">飞鹅打印机</div>
  81. <div class="input-group fixsingle-input-group">
  82. <div class="input-group-addon"><b>sn:</b></div>
  83. <input type="text" name="data[feier_print_sn]" class="form-control" value="{$data['feier_print_sn']}" />
  84. <div class="input-group-addon"><b>key:</b></div>
  85. <input type="text" name="data[feier_print_key]" class="form-control" value="{$data['feier_print_key']}" />
  86. <div class="input-group-addon"><b>打印联数:</b></div>
  87. <input type="text" name="data[feier_print_lian]" class="form-control" value="<?php echo !isset($data['feier_print_lian']) ? 1 : $data['feier_print_lian']; ?>" />
  88. </div>
  89. <span class='help-block'>支持飞鹅打印机 (sn,key在机子底部),打印联数最小为1</span>
  90. <?php }else if($data['open_feier_print'] == 2){ ?>
  91. <div class="input-group" style="margin: 10px 0;">易联云打印机</div>
  92. <div class="input-group fixsingle-input-group">
  93. <div class="input-group-addon"><b>应用id:</b></div>
  94. <input type="text" name="data[yilian_client_id]" class="form-control" value="{$data['yilian_client_id']}" />
  95. <div class="input-group-addon"><b>应用密钥:</b></div>
  96. <input type="text" name="data[yilian_client_key]" class="form-control" value="{$data['yilian_client_key']}" />
  97. </div>
  98. <div class="input-group fixsingle-input-group">
  99. <div class="input-group-addon"><b>打印机终端号:</b></div>
  100. <input type="text" name="data[yilian_machine_code]" class="form-control" value="{$data['yilian_machine_code']}" />
  101. <div class="input-group-addon"><b>终端密钥:</b></div>
  102. <input type="text" name="data[yilian_msign]" class="form-control" value="{$data['yilian_msign']}" />
  103. <div class="input-group-addon"><b>打印联数:</b></div>
  104. <input type="text" name="data[yilian_print_lian]" class="form-control" value="<?php echo !isset($data['yilian_print_lian']) ? 1 : $data['yilian_print_lian']; ?>" />
  105. </div>
  106. <span class='help-block'>支持易联云K4、K5、K6打印机 (打印机终端号,终端密钥在机子底部,开发者中心应用类型选择: 自有型应用),没有开发者账号<a href="https://dev.yilianyun.net/" target="_blank">请点击申请</a></span>
  107. <?php } ?>
  108. </div>
  109. </div>
  110. </div>
  111. <?php } ?>
  112. <div class="layui-form-item">
  113. <label class="layui-form-label">默认订单打印机</label>
  114. <div class="layui-input-block" style="width: 50%;">
  115. <div class="input-group " style="margin: 0;">
  116. <input type="text" disabled value="" class="form-control valid" name="" placeholder="" id="printer_id">
  117. <span class="input-group-btn">
  118. <span data-input="#printer_id" id="chose_printer" class="btn btn-default">选择打印机</span>
  119. </span>
  120. <span class='help-block' style="display: table-row;">选择打印机进行订单打印,支持多台打印机一起打印</span>
  121. </div>
  122. <?php if(!empty($printer_list)){ ?>
  123. <?php foreach( $printer_list as $item ){ ?>
  124. <div class="input-group mult_choose_printerid" data-printerid="{$item['id']}" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;width: 20%;">
  125. <div class="layadmin-text-center choose_user">
  126. <div class="layadmin-name" style="">{$item['printer_name']}</div>
  127. <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)">
  128. <i class="layui-icon"></i>
  129. </button>
  130. </div>
  131. </div>
  132. <?php }} ?>
  133. </div>
  134. </div>
  135. <div class="layui-form-item">
  136. <label class="layui-form-label">订单打印方式</label>
  137. <div class="layui-input-block ">
  138. <input type="checkbox" lay-skin="primary" name="data[is_print_cancleorder]" class="form-control valid" <?php if( !empty($data) && $data['is_print_cancleorder'] ==1 ){ ?>checked<?php } ?> value="1" title="取消订单打印" />
  139. <input type="checkbox" lay-skin="primary" name="data[is_print_admin_cancleorder]" class="form-control valid" <?php if( !empty($data) && $data['is_print_admin_cancleorder'] ==1 ){ ?>checked<?php } ?> value="1" title="后台整单立即退款打印" />
  140. <input type="checkbox" lay-skin="primary" name="data[is_print_dansupply_order]" class="form-control valid" <?php if( !empty($data) && $data['is_print_dansupply_order'] ==1 ){ ?>checked<?php } ?> value="1" title="独立供应商订单打印" />
  141. <input type="checkbox" lay-skin="primary" name="data[is_print_member_note]" class="form-control valid" <?php if( !empty($data) && $data['is_print_member_note'] ==1 ){ ?>checked<?php } ?> value="1" title="小票打印内容包含“会员详情-备注信息”" />
  142. <input type="checkbox" lay-skin="primary" name="data[is_print_order_note]" class="form-control valid" <?php if( !empty($data) && $data['is_print_order_note'] ==1 ){ ?>checked<?php } ?> value="1" title="小票打印内容包含“订单提交页自定义备注信息”" />
  143. <br/>
  144. <div class="layui-form-mid layui-word-aux">
  145. 默认付款后自动打印
  146. </div>
  147. </div>
  148. </div>
  149. <div class="layui-form-item">
  150. <label class="layui-form-label"> </label>
  151. <div class="layui-input-block">
  152. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  153. </div>
  154. </div>
  155. </form>
  156. </div>
  157. </div>
  158. </div>
  159. <script src="/layuiadmin/layui/layui.js"></script>
  160. <script>
  161. layui.config({
  162. base: '/layuiadmin/' //静态资源所在路径
  163. }).extend({
  164. index: 'lib/index' //主入口模块
  165. }).use('index');
  166. </script>
  167. <script>
  168. $(document).ready(function(){
  169. })
  170. function cancle_bind(obj,sdiv)
  171. {
  172. $('#'+sdiv).val('');
  173. $(obj).parent().parent().remove();
  174. }
  175. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  176. var layer = layui.layer;
  177. var $;
  178. var cur_open_div;
  179. layui.use(['jquery', 'layer','form'], function(){
  180. $ = layui.$;
  181. var form = layui.form;
  182. $('#chose_printer').click(function(){
  183. cur_open_div = $(this).attr('data-input');
  184. $.post("{:U('printer/query_printer', array('template' => 'mult', 'unselect_printerid' => $id))}", {}, function(shtml){
  185. layer.open({
  186. type: 1,
  187. area: '930px',
  188. content: shtml //注意,如果str是object,那么需要字符拼接。
  189. });
  190. });
  191. })
  192. $('#share').click(function(){
  193. var isChecked = $('#feierprint').prop('checked');
  194. if (isChecked == 0) {
  195. $('#share_div').show();
  196. } else {
  197. $('#share_div').hide();
  198. }
  199. })
  200. //监听提交
  201. form.on('submit(formDemo)', function(data){
  202. var loadingIndex = layer.load();
  203. var printer_ar = [];
  204. var printer_str = '';
  205. $('.mult_choose_printerid').each(function(){
  206. printer_ar.push( $(this).attr('data-printerid') );
  207. })
  208. printer_str = printer_ar.join(',');
  209. data.field.is_printer_list = printer_str;
  210. console.log(data.field);
  211. $.ajax({
  212. url: data.form.action,
  213. type: data.form.method,
  214. data: data.field,
  215. dataType:'json',
  216. success: function (info) {
  217. if(info.status == 0)
  218. {
  219. layer.msg(info.result.message,{icon: 1,time: 2000});
  220. layer.close(loadingIndex);
  221. }else if(info.status == 1){
  222. var go_url = location.href;
  223. if( info.result.hasOwnProperty("url") )
  224. {
  225. go_url = info.result.url;
  226. }
  227. layer.msg('操作成功',{time: 1000,
  228. end:function(){
  229. location.href = info.result.url;
  230. }
  231. });
  232. }
  233. }
  234. });
  235. return false;
  236. });
  237. })
  238. </script>
  239. </body>