shouhuolist.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="ctx" content="" />
  6. <link rel="stylesheet" type="text/css" href="/static/easyui/themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="/static/easyui/themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="/static/styles/demo.css">
  9. <link rel="stylesheet" type="text/css" href="/static/uploadify/uploadify.css">
  10. <link rel="stylesheet" type="text/css" href="/Public/libs/css/export.css">
  11. <script type="text/javascript" src="/static/basejs/jquery-1.8.0.min.js"></script>
  12. <script type="text/javascript" src="/static/easyui/jquery.easyui.min.js"></script>
  13. <script type="text/javascript" src="/static/easyui/easyui-lang-zh_CN.js"></script>
  14. <script type="text/javascript" src="/static/uploadify/jquery.uploadify.js"></script>
  15. <script type="text/javascript" src="/static/basejs/th.js"></script>
  16. <script type="text/javascript" src="/static/easyui/src/jquery.window.js"></script>
  17. <script type="text/javascript" src="/static/easyui/formatter.js"></script>
  18. <script type="text/javascript" src="/static/easyui/easyui-extend.js"></script>
  19. <script type="text/javascript" src="/static/easyui/easyui-validatebox-extend.js"></script>
  20. <script type="text/javascript" src="/static/easyui/easyui-loading.js"></script>
  21. <script type="text/javascript" src="/static/basejs/jquery.qrcode.min.js"></script>
  22. <script type="text/javascript" src="/static/basejs/LodopFuncs.js"></script>
  23. <script type="text/javascript" src="/static/basejs/newqcode.js"></script>
  24. <script type="text/javascript" src="/static/basejs/template.js"></script>
  25. <style>
  26. .tg1 {border-collapse:collapse;border-spacing:0;font-weight:500;width:1186px}
  27. .tg1 td{font-family:Arial, sans-serif;font-size:18px;/*padding:10px 5px;*/border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
  28. .tg1 th{font-family:Arial, sans-serif;font-size:20px;font-weight:500;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
  29. .tg1 .tg-s6z21{text-align:center;}
  30. .tg1 .code{font-size:11px;}
  31. .tg1 .tg-031e{text-align:center;}
  32. td{
  33. padding: 3px 0px;
  34. }
  35. .tg1 .tg-s6z2 img{ width:100px;}
  36. .tg1 .font_bold{ font-size: 16px;font-weight:500; }
  37. .head td{text-align: center;border: none;font-weight: 400;font-size: 28px}
  38. .head1 td{text-align: center;border: none;font-weight: 400;font-size: 24px}
  39. .info td{border:none}
  40. .tg2 {border-collapse:collapse;border-spacing:0;font-weight:500;width:1086px}
  41. .tg2 td{
  42. font-size: 16px;
  43. /*text-align: center;*/
  44. }
  45. .table{
  46. width: 1186px;
  47. position: relative;
  48. }
  49. #print span{
  50. font-size: 16px;
  51. }
  52. </style>
  53. <script src="/static/basejs/jQuery.print.js"></script>
  54. </head>
  55. <body class="easyui-layout">
  56. <div data-options="region:'north',title:'',split:true" style="height: 540px;border:none">
  57. <div id="fahuoListToolbar">
  58. <form id="searchBthForm" class="smShow">
  59. <table style="width:100%;white-space: nowrap;padding:10px;">
  60. <tr>
  61. <td align="left">
  62. 请输入订单号:
  63. </td>
  64. <td>
  65. <input name="order_number" class="" style="width:150px" type="text" value="" data-options="required:true"/>
  66. </td>
  67. <td align="left">
  68. 公司名称:
  69. </td>
  70. <td>
  71. <select name="supplier_name" style="height:30px;">
  72. <volist name="userlist" id="val">
  73. <option value="{$val.nickname}">{$val.nickname}</option>
  74. </volist>
  75. </select>
  76. </td>
  77. <td align="left">
  78. 发货单状态:
  79. </td>
  80. <td align="left">
  81. <select name="status" style="height:30px;width:150px">
  82. <option value="2">已收货</option>
  83. <option value="0">待收货</option>
  84. <!--<option value="1">已删除</option>-->
  85. </select>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td align="left">
  90. 发货开始时间:
  91. </td>
  92. <td>
  93. <input id ="startDate" name="startDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  94. </td>
  95. <td align="left">
  96. 发货结束时间:
  97. </td>
  98. <td>
  99. <input id ="endDate" name="endDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  100. </td>
  101. <td colspan="2" align="left">
  102. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchBthFun()">查询</a>
  103. </td>
  104. <tr/>
  105. <tr>
  106. <td colspan="10" class="export-tips"></td>
  107. </tr>
  108. <tr>
  109. <td align="left">
  110. 二维码扫码:
  111. </td>
  112. <td>
  113. <input id = "shdh_qrcode" name="shdh" class="" style="width:150px" type="text" value=""/>
  114. </td>
  115. <td colspan="5" align="left">
  116. <a href="#" class="easyui-linkbutton changeBthShouhuo" data-options="iconCls:'icon-search'">收货</a>
  117. </td>
  118. </tr>
  119. </table>
  120. </form>
  121. </div>
  122. <table id="fahuoList">
  123. </table>
  124. <div class="body"></div>
  125. </div>
  126. <div data-options="region:'center',title:'所属发货单信息',split:true" >
  127. <div id="exportGridToolbar">
  128. <form id="searchTgForm">
  129. <input name="exportId" id='exportId' type="hidden"/><!-- 标签类型 -->
  130. </form>
  131. </div>
  132. <table id=exportGrid></table>
  133. </div>
  134. <div class="table" style="display: none;margin:0px 30px;">
  135. <div id="print">
  136. <div style="width: 1100px;height: 100px;position: relative;">
  137. <div style="float: left">
  138. <div style="width: 1000px;font-weight: 400;font-size: 28px;text-align: center;line-height: 50px;" class="company"></div>
  139. <div style="width: 1000px;font-weight: 400;font-size: 24px;text-align: center;line-height: 50px;">送货单</div>
  140. </div>
  141. <div id="qrcode" style="display:inline-block;width: 105px;height: 105px;position: absolute;right: 100px;top: -5px;">
  142. <img src="" style="width: 105px;height: 105px;" id="myImage" alt=""/>
  143. </div>
  144. </div>
  145. <table class="tg1" style="margin-top: 3px;">
  146. <!--<tr>-->
  147. <!--<td style="border: none"></td>-->
  148. <!--</tr>-->
  149. <tr class="info">
  150. <td colspan="6">客户名称:河南中烟工业有限责任公司黄金叶生产制造中心</td>
  151. <td colspan="4" >送货单号:<span style="font-size: 16px;" id="shdh"></span></td>
  152. <!--<td rowspan="2" style="border: none" width="8%"></td>-->
  153. </tr>
  154. <tr class="info">
  155. <td colspan="6">送货地址:河南省郑州市经开区第三大街9号</td>
  156. <td colspan="4" >送货日期:<span style="font-size: 16px;" id="shrq_date"></span></td>
  157. </tr>
  158. </table>
  159. <!--<div style=" width:1258px">-->
  160. <!--<hr />-->
  161. <!--</div>-->
  162. <!--<span>送货单备注:<span id=><span id='note'></span></span>-->
  163. <!--<br> -->
  164. <br>
  165. <table class="tg1" style="table-layout:fixed;width: 1020px" id="table">
  166. </table>
  167. <table class="tg2" style="margin-top: 3px;">
  168. <tr class="footer">
  169. <td colspan="4">发货单位:<span class="company"></span></td>
  170. <td colspan="3">司机/司机电话:<span id="deliveryman"></span></td>
  171. <td colspan="3">车牌号:<span id="carid"></span></td>
  172. </tr>
  173. <tr class="footer">
  174. <td colspan="7">发货单位地址:<span id="address"></span></td>
  175. <td colspan="3">收货单位(签名、盖章)</td>
  176. </tr>
  177. </table>
  178. </div>
  179. </div>
  180. <script>
  181. var fahuoList,exportGrid;
  182. bt_is_load=true;//定义防重复弹出小标签全局变量
  183. $(document).ready(function () {
  184. //初始化日期输入框
  185. initDateBox();
  186. fahuoList = $('#fahuoList').datagrid({
  187. url: '/index.php?s=/Admin/Export/getShouhuoData',
  188. method: 'post',
  189. toolbar: '#fahuoListToolbar',
  190. striped : true,
  191. showFooter:false,
  192. rownumbers: false, // 如果为true,则显示一个行号列。
  193. singleSelect: false, // 如果为true,则只允许选择一行。
  194. nowrap: false, // 如果为true,则在同一行中显示数据。设置为true可以提高加载性能。
  195. fit: true, // datagrid自适应宽高
  196. fitColumns: true, // 使列自动展开/收缩到合适的数据表格宽度。
  197. autoRowHeight: false, // 定义设置行的高度,根据该行的内容。设置为false可以提高负载性能。
  198. sortName: 'id', // 排序字段
  199. sortOrder: 'desc', // 排序方式
  200. pagination: true, // 显示分页工具条
  201. pageSize: 100,//初始化页面大小
  202. pageList: [10, 20, 30, 50, 100, 500,1000,2000,5000,10000],// 初始化页面大小选择列表
  203. queryParams: $('#searchBthForm').serializeObject(),
  204. columns: [[
  205. {field: 'ck', checkbox: true},
  206. {field: 'shdh', title: '送货单号', sortable: true, width: 200},
  207. {field: 'order_number', title: '订单号', sortable: true, width: 200},
  208. {field: 'deliveryman', title: '司机', width: 200},
  209. {field: 'plate_number', title: '车牌号', align: 'center', sortable: true, width: 100},
  210. {field: 'supplier_name', title: '供应商名称', align: 'center', sortable: true, width: 100},
  211. {field: 'create_time', title: '送货日期', align: 'center', sortable: true, width: 150,
  212. formatter: function(value,row,index){
  213. return UnixToDate(value,true,8);
  214. }
  215. },
  216. {field:'id',title:'ID',align:'center',sortable:false,width:100,hidden:true},
  217. {field: 'file_dir', title: '发货单', align: 'center', sortable: true, width: 200,
  218. formatter: function(value,row,index){
  219. if(row.status != 1){
  220. return "<a href='javascript:;' onclick='dayin("+row.id+")'>预览</a>";
  221. }else{
  222. return "";
  223. }
  224. }
  225. },
  226. {field:'status',title:'状态',align:'center',sortable:false,width:100,
  227. formatter: function(value,row,index){
  228. if(value==0){
  229. return '待收货';
  230. }else if (value==2){
  231. return '已收货';
  232. }else {
  233. return '已删除';
  234. }
  235. }
  236. },
  237. {field:'option',title:'操作',align:'center',sortable:false,width:100,
  238. formatter: function(value,row,index){
  239. if(row.status==2){
  240. return '<a class="green" data-id='+row.id+' onclick="deal('+row.id+')">取消</a>';
  241. }else{
  242. //return '<a class="green" data-id='+value+' onclick="fa('+value+')">发货</a>';
  243. }
  244. }
  245. }
  246. ]],
  247. onClickRow: function (rowIndex, rowData) {
  248. $('#fahuoList').datagrid('unselectRow', rowIndex);
  249. },
  250. onClickCell:function(rowIndex, field, value){
  251. },
  252. onLoadError: function () {
  253. $.messager.alert('系统提示', '数据加载错误,请刷新重试!', 'error');
  254. return false;
  255. },
  256. onBeforeLoad: function (param,data) {
  257. if (fahuoList != null) {
  258. fahuoList.datagrid('loadData', {total: 0, rows: []});
  259. }
  260. $('#shdh_qrcode').focus();
  261. },
  262. onLoadSuccess: function(data,options){
  263. $('#shdh_qrcode').focus();
  264. },
  265. onClickRow: function (rowIndex, rowData) {
  266. $('#exportId').val(rowData.large_id);
  267. exportGrid.datagrid('load', $('#searchTgForm').serializeObject());
  268. $('#shdh_qrcode').focus();
  269. },
  270. });
  271. });
  272. $('#shdh_qrcode').keypress(function(e){
  273. if(e.which == 13) {
  274. var id_str = '';
  275. var shdh = $('input[name="shdh"]').val();
  276. $('.datagrid-row-checked').each(function (i, item) {
  277. id_str += $(this).children('td:nth-child(8)').children().text() + ',';
  278. });
  279. $.ajax({
  280. url: "/index.php?s=/Admin/Export/changeShouhuo",
  281. type: "post",
  282. dataType: "json",
  283. data: {id: id_str, shdh: shdh},
  284. success: function (data) {
  285. // console.log(data);
  286. if (data != null) {
  287. $('.body').loadend();
  288. if (data.status == 0) {
  289. $.messager.alert('系统提示', data.msg, 'warning',function(){
  290. });
  291. $('#shdh_qrcode').focus();
  292. return false;
  293. } else {
  294. $.messager.alert('系统提示', data.msg, 'success',function(){
  295. setTimeout(500);
  296. });
  297. window.location.href = data.url;
  298. fahuoList.datagrid('load', $('#searchBthForm').serializeObject());
  299. $('#shdh_qrcode').focus();
  300. }
  301. }
  302. },
  303. error: function (error) {
  304. }
  305. });
  306. }
  307. });
  308. function dayin(id){
  309. $.ajax({
  310. method:"POST",
  311. url:"/index.php?s=/Admin/Export/print1",
  312. data:{id:id},
  313. dataType:'JSON',
  314. success:function(res){
  315. $(".company").html(res.supplier_name); //供应商
  316. $("#shdh").html(res.shdh); //送货单号
  317. $("#shrq_date").html(res.shrq_date); //送货日期
  318. $("#carid").html(res.plate_number); //车牌号
  319. $("#deliveryman").html(res.deliveryman+'&nbsp;&nbsp;'+res.shr_phone);//送货人
  320. $("#address").html(res.address); //发货单位地址
  321. var arr = res.arr;
  322. var note='';
  323. var html = '<tr><th class="tg-s6z2">物料名称</th>' +
  324. '<th class="tg-s6z2">生产批号</th>' +
  325. '<th class="tg-s6z2">大件</th>' +
  326. '<th class="tg-s6z2">小件</th>' +
  327. '<th class="tg-s6z2">单位</th>' +
  328. '<th class="tg-s6z2">实发数量</th>' +
  329. '<th class="tg-s6z2">备注</th>' +
  330. '<th id="explain" rowspan="'+(res.count+1)+'" width="7%" style="border: none"><span style="writing-mode: tb-rl;height: 300px;font-size:16px;text-align: center;">' +
  331. '蓝联(回):业务 黄联(回):运输 '+'<br>'+'白联:存根 红联:财务 绿联:客户</span></th></tr>';
  332. for (var i=0;i < arr.length;i++){
  333. html+= '<tr><td class="tg-031e">'+arr[i].matter_name+'</td>';
  334. html+= '<td class="tg-031e" style="word-break:break-all;">'+(arr[i].bach_num?arr[i].bach_num:'')+'</td>';
  335. html+= '<td class="tg-031e">'+arr[i].large_num+'</td>';
  336. html+= '<td class="tg-031e">'+arr[i].small_num+'</td>';
  337. html+= '<td class="tg-031e">'+(arr[i].mater_type==1?'万张':"kg")+'</td>';
  338. //小件单位为kg
  339. // if(arr[i].mater_type==1){
  340. // html+='<td class="tg-031e">'+parseFloat(arr[i].num)*parseFloat(arr[i].small_num)/10000+'</td>';
  341. // html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseInt(arr[i].num)+'张'+'</td>';
  342. // }else{
  343. // html+='<td class="tg-031e">'+parseFloat(arr[i].num)*arr[i].small_num+'</td>';
  344. // html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseFloat(arr[i].num)+'kg'+'</td>';
  345. // }
  346. //小件单位为g
  347. if(arr[i].mater_type==1){
  348. html+='<td class="tg-031e">'+parseFloat(arr[i].num)*parseFloat(arr[i].small_num)/10000+'</td>';
  349. html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseInt(arr[i].num)+'张'+'</td>';
  350. }else{
  351. html+='<td class="tg-031e">'+parseFloat(arr[i].num)*parseFloat(arr[i].small_num)/1000+'</td>';
  352. html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseFloat(arr[i].num)/1000+'kg'+'</td>';
  353. }
  354. }
  355. html+= '<tr><td class="tg-031e">送货单备注</td><td colspan="6" class="tg-031e">'+res.note+'</td></tr>';
  356. $("#table").html(html)
  357. $('#myImage').attr("src", res.qrcode_add);
  358. $.print('#print');
  359. return false;
  360. }
  361. })
  362. }
  363. function deal(id){
  364. $.messager.confirm('再次确认', '确定取消收货请选择“确定”', function(r){
  365. if (r){
  366. // exit action;
  367. $('.body').loading();
  368. $.ajax({
  369. url: "/index.php?s=/Admin/Export/dealShouhuo",
  370. type: "post",
  371. dataType: "json",
  372. data: {id:id},
  373. success: function (data) {
  374. $('.body').loadend();
  375. if (data != null) {
  376. if (data.status == 0) {
  377. $.messager.alert('系统提示', data.msg, 'error');
  378. fahuoList.datagrid('load', $('#searchBthForm').serializeObject());
  379. } else {
  380. $.messager.alert('系统提示', data.msg, 'info',function(){
  381. fahuoList.datagrid('load', $('#searchBthForm').serializeObject());
  382. });
  383. }
  384. }
  385. },
  386. error: function (error) {
  387. }
  388. })
  389. }
  390. });
  391. return false;
  392. }
  393. $('.changeBthShouhuo').click(function(){
  394. var id_str = '';
  395. var shdh = $('input[name="shdh"]').val();
  396. $('.datagrid-row-checked').each(function (i, item) {
  397. id_str += $(this).children('td:nth-child(8)').children().text() + ',';
  398. });
  399. $.ajax({
  400. url: "/index.php?s=/Admin/Export/changeShouhuo",
  401. type: "post",
  402. dataType: "json",
  403. data: {id: id_str, shdh: shdh},
  404. success: function (data) {
  405. // console.log(data);
  406. if (data != null) {
  407. $('.body').loadend();
  408. if (data.status == 0) {
  409. $.messager.alert('系统提示', data.msg, 'warning',function(){
  410. });
  411. $('#shdh_qrcode').focus();
  412. return false;
  413. } else {
  414. $.messager.alert('系统提示', data.msg, 'success',function(){
  415. setTimeout(500);
  416. });
  417. window.location.href = data.url;
  418. supBthGrid.datagrid('load', $('#searchBthForm').serializeObject());
  419. $('#shdh_qrcode').focus();
  420. }
  421. }
  422. },
  423. error: function (error) {
  424. }
  425. });
  426. });
  427. //初始化日期输入框
  428. function initDateBox() {
  429. var nowDate = new Date;
  430. $('#endDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  431. nowDate.setMonth(nowDate.getMonth() - 1);
  432. nowDate.setDate(nowDate.getDay() +1);
  433. $('#startDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  434. }
  435. function searchBthFun() {
  436. if ($('#searchBthForm').form('validate')) {
  437. //var obj = $('#searchBthForm').serializeObject();
  438. fahuoList.datagrid('load', $('#searchBthForm').serializeObject());
  439. }
  440. }
  441. function UnixToDate(unixTime, isFull, timeZone) {
  442. if (typeof (timeZone) == 'number') {
  443. unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
  444. }
  445. var time = new Date(unixTime * 1000);
  446. var ymdhis = "";
  447. ymdhis += time.getUTCFullYear() + "-";
  448. ymdhis += (time.getUTCMonth() + 1) + "-";
  449. ymdhis += time.getUTCDate();
  450. if (isFull === true) {
  451. ymdhis += " " + time.getUTCHours() + ":";
  452. ymdhis += time.getUTCMinutes() + ":";
  453. ymdhis += time.getUTCSeconds();
  454. }
  455. return ymdhis;
  456. }
  457. </script>
  458. </body>
  459. </html>