index.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="stylesheet" href="/static/css/bootstrap.min.css">
  7. <script src="/static/js/jquery.min.js"></script>
  8. <script src="/static/js/bootstrap.min.js"></script>
  9. <script src="/static/js/myfun.js"></script>
  10. <title>耐蚀钢报名表</title>
  11. <style>
  12. .container {
  13. width: 1300px;
  14. margin: 40px auto;
  15. }
  16. .table {
  17. margin-top: 30px;
  18. }
  19. .table,
  20. th {
  21. text-align: center;
  22. }
  23. .input-group {
  24. width: 500px;
  25. }
  26. .page_navigation {
  27. float: right;
  28. }
  29. /* #qrcode img {
  30. margin: 0 auto;
  31. } */
  32. .c-red {
  33. color: red;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <div class="container">
  39. <div style="position: relative;">
  40. <div class="input-group" >
  41. <input type="text" class="form-control" placeholder="Search for 姓名 or 单位 or 电话" id="key" name="key"
  42. value="<?php echo isset($key)? $key : '';?>" style="width: 300px; height: auto;">
  43. <span class="input-group-btn">
  44. <button class="btn btn-default" type="button" onclick="search()">查询</button>
  45. <button class="btn btn-default" type="button" onclick="celerSearch()">清除</button>
  46. <button class="btn btn-primary " data-toggle="modal" data-target="#myModal"
  47. style="background-color: pink;color: white;margin-left: 10px;">新增</button>
  48. <!-- <button class="btn btn-primary" onclick="printReceipt()" style="margin-left: 10px;">打印收据</button> -->
  49. <a class="btn btn-primary" href="/admin/index/export" style="background-color: rgb(26, 127, 241);color: white;margin-left: 10px;">导出</a>
  50. </span>
  51. </div>
  52. <span class="input-group-btn" style="position: absolute;top:0;right: 180px;">
  53. <button class="btn btn-primary" type="button" data-toggle="modal" data-target="#reModal">修改密码</button>
  54. <button class="btn btn-default" type="button" onclick="logout()"><?php echo $username;?> 退出</button>
  55. </span>
  56. </div>
  57. <table class="table table-hover table-bordered">
  58. <tr class="active">
  59. <th>选择</th>
  60. <th>id</th>
  61. <th style="width: 100px;">姓名</th>
  62. <th>所在机构</th>
  63. <th>电话</th>
  64. <th>费用类型</th>
  65. <th>是否签到</th>
  66. <th>是否缴费</th>
  67. <th>金额</th>
  68. <th>操作</th>
  69. </tr>
  70. <?php
  71. $feeType = [1=>'普通', 2=>'学生'];
  72. $memberType = [10=>'正常', 90=>'免注册'];
  73. foreach ($data['list'] as $val) {
  74. ?>
  75. <tr class="data-row">
  76. <td><input type="checkbox" name="checkbox[]" value="<?php echo $val['id']?>"></td>
  77. <td><?php echo $val['id']?></td>
  78. <td><?php echo $val['truename']?></td>
  79. <td><?php echo $val['organization']?></td>
  80. <td><?php echo $val['phone']?></td>
  81. <td><?php echo $feeType[$val['fee_type']]?></td>
  82. <td><?php echo $val['status'] ? '是' : '否'; ?></td>
  83. <td><?php echo $val['is_pay'] ? '是' : '否'; ?></td>
  84. <td><?php echo $val['money']?></td>
  85. <td class="td-manager">
  86. <!-- <a href="javascript:;" onclick="doPrint(<?php echo $val['id'];?>)">打印</a> -->
  87. <a href="/admin/index/info/id/<?php echo $val['id'];?>">详细信息</a>
  88. <a href="javascript:;" onclick="update(<?php echo $val['id'];?>)">修改</a>
  89. <a href="javascript:;" onclick="del(<?php echo $val['id'];?>, this)">删除</a>
  90. </td>
  91. </tr>
  92. <?php
  93. }
  94. ?>
  95. </table>
  96. <div>
  97. <nav aria-label="Page navigation" class="page_navigation">
  98. <ul class="pagination">
  99. <?php
  100. $total = $data['total'];
  101. $page = $data['page'];
  102. $limit = $data['limit'];
  103. $pages = intval($total/$limit) + 1;
  104. ?>
  105. <li>
  106. <a href="?page=<?php echo ($page-1)==0 ? 1 : $page-1; ?><?php echo isset($key) ? '&key='.$key : '';?>" aria-label="Previous">
  107. <span aria-hidden="true">&laquo;</span>
  108. </a>
  109. </li>
  110. <?php
  111. $li = (($pages - $page) >= 5 ? 4 : $pages - $page) + 1;
  112. for ($i=0;$i<$li;$i++) {
  113. ?>
  114. <li><a href="?page=<?php echo $i + $page; ?><?php echo isset($key) ? '&key='.$key : '';?>"><?php echo $i + $page; ?></a></li>
  115. <?php
  116. }
  117. ?>
  118. <li>
  119. <a href="?page=<?php echo ($page+1)>=$pages ? $pages : $page+1; ?><?php echo isset($key) ? '&key='.$key : '';?>" aria-label="Next">
  120. <span aria-hidden="true">&raquo;</span>
  121. </a>
  122. </li>
  123. </ul>
  124. </nav>
  125. </div>
  126. </div>
  127. <!-- 弹窗 -->
  128. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  129. <div class="modal-dialog">
  130. <div class="modal-content">
  131. <div class="modal-header">
  132. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  133. <h4 class="modal-title" id="myModalLabel">新建</h4>
  134. </div>
  135. <div class="modal-body">
  136. <form id="form-add">
  137. <input type="hidden" name="id" id="id" value="0">
  138. <div class="form-group">
  139. <span class="c-red">* </span><label for="truename">姓 名</label>
  140. <input type="text" class="form-control" id="truename" name="truename" placeholder="姓 名">
  141. </div>
  142. <div class="form-group">
  143. <label for="organization">所在机构</label>
  144. <input type="text" class="form-control" id="organization" name="organization"
  145. placeholder="所在机构">
  146. </div>
  147. <div class="form-group">
  148. <label for="position">职 务</label>
  149. <input type="text" class="form-control" id="position" name="position" placeholder="职 务">
  150. </div>
  151. <div class="form-group">
  152. <label for="sex">性 别</label>
  153. <input type="radio" name="sex" value="1" id="sex1" checked>男
  154. <input type="radio" name="sex" value="2" id="sex2">女
  155. </div>
  156. <div class="form-group">
  157. <span class="c-red">* </span><label for="phone">电 话</label>
  158. <input type="text" class="form-control" id="phone" name="phone" placeholder="电 话">
  159. </div>
  160. <div class="form-group">
  161. <label for="email">邮 箱</label>
  162. <input type="text" class="form-control" id="email" name="email" placeholder="邮 箱">
  163. </div>
  164. <div class="form-group">
  165. <label for="feeType">费用类型</label>
  166. <input type="radio" name="feeType" id="feeType1" value="1" checked>普通
  167. <input type="radio" name="feeType" id="feeType2" value="2">学生
  168. </div>
  169. <div class="form-group">
  170. <label for="isPay">是否有报告</label>
  171. <input type="radio" name="isReport" id="isReport1" value="1">是
  172. <input type="radio" name="isReport" id="isReport2" value="0" checked>否
  173. </div>
  174. <div class="form-group">
  175. <label for="report_title">报告题目</label>
  176. <input type="text" class="form-control" id="reportTitle" name="reportTitle" placeholder="报告题目">
  177. </div>
  178. <div class="form-group">
  179. <label for="feeType">房 型</label>
  180. <input type="radio" name="roomType" id="roomType1" value="1" checked>标准间
  181. <input type="radio" name="roomType" id="roomType2" value="2">商务间
  182. </div>
  183. <div class="form-group">
  184. <label for="isPay">是否合住</label>
  185. <input type="radio" name="isShare" id="isShare1" value="1">是
  186. <input type="radio" name="isShare" id="isShare2" value="0" checked>否
  187. </div>
  188. <div class="form-group">
  189. <label for="isPay">付款方式</label>
  190. <input type="radio" name="payType" id="payType1" value="0" checked>汇款
  191. <input type="radio" name="payType" id="payType2" value="1">现场缴费
  192. </div>
  193. <div class="form-group">
  194. <label for="isPay">是否缴费</label>
  195. <input type="radio" name="isPay" id="isPay1" value="1">是
  196. <input type="radio" name="isPay" id="isPay2" value="0" checked>否
  197. </div>
  198. <div class="form-group">
  199. <label for="money">金 额</label>
  200. <input type="number" class="form-control" id="money" name="money" placeholder="金额">
  201. </div>
  202. <!-- 开票信息 -->
  203. <div class="form-group">
  204. <label>开票类型</label>
  205. <div>
  206. <label class="radio-inline">
  207. <input type="radio" value="1" name="taxType" id="taxType1" checked onclick=text(value)>普票
  208. </label>
  209. <label class="radio-inline">
  210. <input type="radio" value="2" name="taxType" id="taxType2" onclick=text(value)>专票
  211. </label>
  212. </div>
  213. </div>
  214. <div class="form-group">
  215. <label>发票抬头</label>
  216. <input type="text" class="form-control" name="taxTitle" placeholder="发票抬头"/>
  217. </div>
  218. <div class="form-group">
  219. <label>纳税人识别号</label>
  220. <input type="text" class="form-control" name="taxNumber" placeholder="纳税人识别号"/>
  221. </div>
  222. <div id='isShow' style="display: none;">
  223. <div class="form-group">
  224. <label>开户行及账号</label>
  225. <input type="text" class="form-control" name="bankAccount" placeholder="开户行及账号"/>
  226. </div>
  227. <div class="form-group">
  228. <label>地 址</label>
  229. <div>
  230. <input type="text" class="form-control" name="companyAddress" placeholder="地 址"/>
  231. </div>
  232. </div>
  233. <div class="form-group">
  234. <label>开户电话</label>
  235. <input type="text" class="form-control" name="companyPhone" placeholder="开户电话"/>
  236. </div>
  237. </div>
  238. <div class="form-group">
  239. <label>邮寄地址</label>
  240. <input type="text" class="form-control" name="mailingAddress" placeholder="邮寄地址"/>
  241. </div>
  242. <div class="form-group">
  243. <label >邮 编</label>
  244. <input type="text" class="form-control" name="postcode" placeholder="邮 编"/>
  245. </div>
  246. <!-- 开票信息 end -->
  247. <div class="form-group">
  248. <label for="remark">备注</label>
  249. <textarea id="remark" name="remark" class ="form-control"></textarea>
  250. </div>
  251. </form>
  252. </div>
  253. <div class="modal-footer">
  254. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  255. <button type="button" class="btn btn-primary" onclick="save()">提交</button>
  256. </div>
  257. </div><!-- /.modal-content -->
  258. </div>
  259. </div><!-- /.modal -->
  260. <div class="modal fade" id="reModal" tabindex="-1" role="dialog" aria-labelledby="reModalLabel" aria-hidden="true">
  261. <div class="modal-dialog">
  262. <div class="modal-content">
  263. <div class="modal-header">
  264. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  265. <h4 class="modal-title" id="reModalLabel">修改密码</h4>
  266. </div>
  267. <div class="modal-body">
  268. <form id="form-repassword">
  269. <div class="form-group">
  270. <label>原密码</label>
  271. <input type="password" class="form-control" name="oldpassword" placeholder="原密码"/>
  272. </div>
  273. <div class="form-group">
  274. <label >新密码</label>
  275. <input type="password" class="form-control" name="newpassword" placeholder="新密码"/>
  276. </div>
  277. <div class="form-group">
  278. <label >确认密码</label>
  279. <input type="password" class="form-control" name="repassword" placeholder="确认密码"/>
  280. </div>
  281. </form>
  282. </div>
  283. <div class="modal-footer">
  284. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  285. <button type="button" class="btn btn-primary" onclick="rePasswd()">提交</button>
  286. </div>
  287. </div><!-- /.modal-content -->
  288. </div>
  289. </div><!-- /.modal -->
  290. </body>
  291. <script>
  292. // 退出登陆
  293. function logout() {
  294. var r=confirm("纳尼,要退出?")
  295. if (r==true) {
  296. window.location.href = "/admin/login/logout";
  297. }
  298. }
  299. function rePasswd() {
  300. var oldpassword = $('input[name="oldpassword"]').val();
  301. var newpassword = $('input[name="newpassword"]').val();
  302. var repassword = $('input[name="repassword"]').val();
  303. if (isEmpty(oldpassword) || isEmpty(newpassword) || isEmpty(repassword)) {
  304. alert('原密码新密码不能为空');
  305. return false;
  306. }
  307. if (newpassword!=repassword) {
  308. alert('新密码不一致');
  309. return false;
  310. }
  311. $.ajax({
  312. url: "/admin/user/repassword",
  313. type: "POST",
  314. data: {'oldpassword': oldpassword, 'newpassword': newpassword},
  315. dataType: 'json',
  316. success: function (res) {
  317. console.log(res);
  318. alert(res.msg);
  319. if (res.code == 0) {
  320. window.location.href = "/admin/login/logout";
  321. }
  322. }
  323. })
  324. }
  325. function search() {
  326. var key = $("#key").val();
  327. window.location.href = "?key=" + key;
  328. }
  329. function celerSearch() {
  330. window.location.href = "/";
  331. }
  332. // 开票类型
  333. function text(val) {
  334. if (val == 2) {
  335. document.querySelector('#isShow').style.display = 'block'
  336. } else {
  337. document.querySelector('#isShow').style.display = 'none'
  338. }
  339. }
  340. function update(id) {
  341. $("#id").val(id);
  342. $.ajax({
  343. url: "/admin/index/info/id/" + id,
  344. type: "GET",
  345. data: {},
  346. dataType: 'json',
  347. success: function (res) {
  348. console.log(res);
  349. if (res.code == 0) {
  350. var data = res.data;
  351. $("#id").val(data.id);
  352. $("#truename").val(data.truename);
  353. $("#organization").val(data.organization);
  354. $("#position").val(data.position);
  355. $('input[name="sex"]').prop('checked', false);
  356. if (data.sex==2) {
  357. $("#sex2").prop('checked', true);
  358. } else {
  359. $("#sex1").prop('checked', true);
  360. }
  361. $("#phone").val(data.phone);
  362. $("#email").val(data.email);
  363. $('input[name="feeType"]').prop('checked', false);
  364. if (data.fee_type==1) {
  365. $("#feeType1").prop('checked', true);
  366. } else {
  367. $("#feeType2").prop('checked', true);
  368. }
  369. $('input[name="isReport"]').prop('checked', false);
  370. if (data.is_report==1) {
  371. $("#isReport1").prop('checked', true);
  372. } else {
  373. $("#isReport").prop('checked', true);
  374. }
  375. $("#reportTitle").val(data.report_title);
  376. $('input[name="roomType"]').prop('checked', false);
  377. if (data.room_type==1) {
  378. $("#roomType1").prop('checked', true);
  379. } else {
  380. $("#roomType2").prop('checked', true);
  381. }
  382. $('input[name="isShare"]').prop('checked', false);
  383. if (data.is_share==1) {
  384. $("#isShare").prop('checked', true);
  385. } else {
  386. $("#isShare2").prop('checked', true);
  387. }
  388. $('input[name="payType"]').prop('checked', false);
  389. if (data.pay_type==1) {
  390. $("#payType1").prop('checked', true);
  391. } else {
  392. $("#payType2").prop('checked', true);
  393. }
  394. // $("#isPay").val(data.isPay);
  395. $('input[name="isPay"]').prop('checked', false);
  396. if (data.is_pay==1) {
  397. $("#isPay1").prop('checked', true);
  398. } else {
  399. $("#isPay2").prop('checked', true);
  400. }
  401. $("#money").val(data.money);
  402. $('input[name="taxType"]').prop('checked', false);
  403. if (data.pay_type==2) {
  404. $("#taxType2").prop('checked', true);
  405. document.querySelector('#isShow').style.display = 'block';
  406. } else {
  407. $("#taxType1").prop('checked', true);
  408. document.querySelector('#isShow').style.display = 'none';
  409. }
  410. $('input[name="taxTitle"]').val(data.tax_title);
  411. $('input[name="taxNumber"]').val(data.tax_number);
  412. $('input[name="bankAccount"]').val(data.bank_account);
  413. $('input[name="companyAddress"]').val(data.company_address);
  414. $('input[name="companyPhone"]').val(data.company_Phone);
  415. $('input[name="mailingAddress"]').val(data.mailing_address);
  416. $('input[name="postcode"]').val(data.postcode);
  417. $("#remark").val(data.remark);
  418. $('#myModal').modal("show");
  419. } else {
  420. alert(res.msg);
  421. }
  422. return false;
  423. }
  424. });
  425. }
  426. function save() {
  427. var truename = $("#truename").val();
  428. var phone = $("#phone").val();
  429. // console.log(truename);
  430. // console.log(phone);
  431. if (isEmpty(truename) || isEmpty(phone)) {
  432. alert('姓名 or 电话不能为空');
  433. return false;
  434. }
  435. var data = $('#form-add').serializeArray();
  436. $.ajax({
  437. url: "/admin/index/save",
  438. type: "POST",
  439. data: data,
  440. dataType: 'json',
  441. success: function (res) {
  442. // console.log(res);
  443. $("#id").val(0);
  444. if (res.code == 0) {
  445. alert('保存成功');
  446. window.location.reload();
  447. } else {
  448. alert(res.msg);
  449. }
  450. return false;
  451. }
  452. });
  453. }
  454. function del(id, that) {
  455. $.ajax({
  456. url: "/admin/index/delete",
  457. type: "POST",
  458. data: {
  459. 'id': id
  460. },
  461. dataType: 'json',
  462. success: function (res) {
  463. // console.log(res);
  464. if (res.code == 0) {
  465. alert('删除成功');
  466. $(that).parents('tr').remove();
  467. // window.location.reload();
  468. } else {
  469. alert(res.msg);
  470. }
  471. return false;
  472. }
  473. });
  474. }
  475. function doPrint(id) {
  476. $.ajax({
  477. url: "/admin/index/do_print",
  478. type: "POST",
  479. data: {'id': id},
  480. dataType: 'json',
  481. success: function (res) {
  482. if (res.code == 0) {
  483. // qrcode.clear();
  484. var data = res.data;
  485. let str = '<div style="margin: 10px auto; text-align: center;">';
  486. str += '<img src="' + data.img + '">';
  487. str += '<p style="font-size: 14px;margin-top: 10px;"><font style="vertical-align: inherit;">' + data.id + ' ' + data.truename + '</font></p>';
  488. str += '<p style="font-size: 14px;"><font style="vertical-align: inherit;">'+data.organization+'</font></p>';
  489. str += '</div>';
  490. window.document.body.innerHTML = str;
  491. // console.log(str);
  492. setTimeout(function(){ window.print(); }, 500);
  493. } else {
  494. alert(res.msg);
  495. }
  496. return false;
  497. }
  498. });
  499. }
  500. //定义打印前事件
  501. var beforePrint = function () {
  502. console.log("打印前");
  503. };
  504. //定义打印后事件
  505. var afterPrint = function () {
  506. console.log("打印后");
  507. window.location.reload();
  508. }
  509. // //监听window状态
  510. // if (window.matchMedia) {
  511. // var mediaQueryList = window.matchMedia('print');
  512. // //为印添加事件
  513. // mediaQueryList.addListener(function (mql) {
  514. // console.log(mql);
  515. // if (mql.matches) {
  516. // beforePrint();
  517. // } else {
  518. // afterPrint();
  519. // }
  520. // });
  521. // }
  522. //打印前事件
  523. window.onbeforeprint = beforePrint;
  524. //打印后事件
  525. window.onafterprint = afterPrint;
  526. function printReceipt() {
  527. var checkbox = $('.data-row input[name="checkbox[]"]');
  528. var ids = new Array();
  529. checkbox.each(function (x) {
  530. if (this.checked)
  531. ids.push(this.value);
  532. })
  533. console.log(ids);
  534. window.open('/admin/index/print_receipt?ids='+ids);
  535. return false;
  536. }
  537. </script>
  538. </html>