fahuo.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  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:break-all;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="0">已发货</option>
  83. <option value="2">已收货</option>
  84. </select>
  85. </td>
  86. </tr>
  87. <tr>
  88. <td align="left">
  89. 发货开始时间:
  90. </td>
  91. <td>
  92. <input id ="startDate" name="startDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  93. </td>
  94. <td align="left">
  95. 发货结束时间:
  96. </td>
  97. <td>
  98. <input id ="endDate" name="endDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  99. </td>
  100. <td colspan="2" align="left">
  101. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchBthFun()">查询</a>
  102. </td>
  103. <tr/>
  104. <tr>
  105. <td colspan="10" class="export-tips"></td>
  106. </tr>
  107. </table>
  108. </form>
  109. </div>
  110. <table id="fahuoList">
  111. </table>
  112. <div class="body"></div>
  113. </div>
  114. <div data-options="region:'center',title:'所属发货单信息',split:true" >
  115. <div id="exportGridToolbar">
  116. <form id="searchTgForm">
  117. <input name="exportId" id='exportId' type="hidden"/><!-- 标签类型 -->
  118. </form>
  119. </div>
  120. <table id=exportGrid></table>
  121. </div>
  122. <div class="table" style="display: none;margin:0px 30px;">
  123. <div id="print">
  124. <div style="width: 1100px;height: 100px;position: relative;">
  125. <div style="float: left">
  126. <div style="width: 1000px;font-weight: 400;font-size: 28px;text-align: center;line-height: 50px;" class="company"></div>
  127. <div style="width: 1000px;font-weight: 400;font-size: 24px;text-align: center;line-height: 50px;">送货单</div>
  128. </div>
  129. <div id="qrcode" style="display:inline-block;width: 105px;height: 105px;position: absolute;right: 100px;top: -5px;">
  130. <img src="" style="width: 105px;height: 105px;" id="myImage" alt=""/>
  131. </div>
  132. </div>
  133. <table class="tg1" style="margin-top: 3px;">
  134. <!--<tr>-->
  135. <!--<td style="border: none"></td>-->
  136. <!--</tr>-->
  137. <tr class="info">
  138. <td colspan="6">客户名称:河南中烟工业有限责任公司黄金叶生产制造中心</td>
  139. <td colspan="4">送货单号:<span style="font-size: 16px;" id="shdh"></span></td>
  140. <!--<td rowspan="2" style="border: none" width="8%"></td>-->
  141. </tr>
  142. <tr class="info">
  143. <td colspan="6">送货地址:河南省郑州市经开区第三大街9号</td>
  144. <td colspan="4">送货日期:<span style="font-size: 16px;" id="shrq_date"></span></td>
  145. </tr>
  146. </table>
  147. <!--<div style=" width:1258px">-->
  148. <!--<hr />-->
  149. <!--</div>-->
  150. <!--<span>送货单备注:<span id=><span id='note'></span></span>-->
  151. <!--<br> -->
  152. <br>
  153. <table class="tg1" style="table-layout:fixed;width: 1020px" id="table"></table>
  154. <table class="tg2" style="margin-top: 3px;">
  155. <tr class="footer">
  156. <td colspan="3">发货单位:<span class="company"></span></td>
  157. <td colspan="3">司机/司机电话:<span id="deliveryman"></span></td>
  158. <td colspan="3">车牌号:<span id="carid"></span></td>
  159. </tr>
  160. <tr class="footer">
  161. <td colspan="7">发货单位地址:<span id="address"></span></td>
  162. <td colspan="3">收货单位(签名、盖章)</td>
  163. </tr>
  164. </table>
  165. </div>
  166. </div>
  167. <script>
  168. var fahuoList,exportGrid;
  169. bt_is_load=true;//定义防重复弹出小标签全局变量
  170. $(document).ready(function () {
  171. //初始化日期输入框
  172. initDateBox();
  173. fahuoList = $('#fahuoList').datagrid({
  174. url: '/index.php?s=/Admin/Export/getFahuoData',
  175. method: 'post',
  176. toolbar: '#fahuoListToolbar',
  177. striped : true,
  178. showFooter:false,
  179. rownumbers: false, // 如果为true,则显示一个行号列。
  180. singleSelect: false, // 如果为true,则只允许选择一行。
  181. nowrap: false, // 如果为true,则在同一行中显示数据。设置为true可以提高加载性能。
  182. fit: true, // datagrid自适应宽高
  183. fitColumns: true, // 使列自动展开/收缩到合适的数据表格宽度。
  184. autoRowHeight: false, // 定义设置行的高度,根据该行的内容。设置为false可以提高负载性能。
  185. sortName: 'id', // 排序字段
  186. sortOrder: 'desc', // 排序方式
  187. pagination: true, // 显示分页工具条
  188. pageSize: 100,//初始化页面大小
  189. pageList: [10, 20, 30, 50, 100, 500,1000,2000,5000,10000],// 初始化页面大小选择列表
  190. queryParams: $('#searchBthForm').serializeObject(),
  191. columns: [[
  192. {field: 'ck', checkbox: true},
  193. {field: 'shdh', title: '送货单号', sortable: true, width: 200},
  194. {field: 'order_number', title: '订单号', sortable: true, width: 200},
  195. {field: 'deliveryman', title: '司机', width: 200},
  196. {field: 'plate_number', title: '车牌号', align: 'center', sortable: true, width: 100},
  197. {field: 'supplier_name', title: '供应商名称', align: 'center', sortable: true, width: 100},
  198. {field: 'create_time', title: '送货日期', align: 'center', sortable: true, width: 150,
  199. formatter: function(value,row,index){
  200. return UnixToDate(value,true,8);
  201. }
  202. },
  203. {field:'id',title:'ID',align:'center',sortable:false,width:100,hidden:true},
  204. {field: 'file_dir', title: '发货单打印', align: 'center', sortable: true, width: 200,
  205. formatter: function(value,row,index){
  206. if(row.status==0 && row.user_type == 1){
  207. return "<a href='javascript:;' onclick='dayin("+row.id+")'>点击打印</a>";
  208. }else{
  209. return "<a href='javascript:;'>未开通权限</a>";
  210. }
  211. }
  212. },
  213. {field:'status',title:'状态',align:'center',sortable:false,width:100,
  214. formatter: function(value,row,index){
  215. if(value==0){
  216. return '已发货';
  217. }else if (value==2){
  218. return '已收货';
  219. }else {
  220. return '已删除';
  221. }
  222. }
  223. },
  224. {field:'option',title:'操作',align:'center',sortable:false,width:100,
  225. formatter: function(value,row,index){
  226. if(row.status==0){
  227. return '<a class="red" data-id='+row.id+' onclick="deal('+row.id+')">删除</a>';
  228. }else{
  229. //return '<a class="green" data-id='+value+' onclick="fa('+value+')">发货</a>';
  230. }
  231. }
  232. }
  233. ]],
  234. onClickRow: function (rowIndex, rowData) {
  235. $('#fahuoList').datagrid('unselectRow', rowIndex);
  236. },
  237. onClickCell:function(rowIndex, field, value){
  238. },
  239. onLoadError: function () {
  240. $.messager.alert('系统提示', '数据加载错误,请刷新重试!', 'error');
  241. return false;
  242. },
  243. onBeforeLoad: function (param,data) {
  244. if (fahuoList != null) {
  245. fahuoList.datagrid('loadData', {total: 0, rows: []});
  246. }
  247. },
  248. onLoadSuccess: function(data,options){
  249. },
  250. onClickRow: function (rowIndex, rowData) {
  251. $('#exportId').val(rowData.large_id);
  252. exportGrid.datagrid('load', $('#searchTgForm').serializeObject());
  253. },
  254. });
  255. });
  256. function dayin(id){
  257. $.ajax({
  258. method:"POST",
  259. url:"/index.php?s=/Admin/Export/print1",
  260. data:{id:id},
  261. dataType:'JSON',
  262. success:function(res){
  263. $(".company").html(res.supplier_name); //供应商
  264. $("#shdh").html(res.shdh); //送货单号
  265. $("#shrq_date").html(res.shrq_date); //送货日期
  266. $("#carid").html(res.plate_number); //车牌号
  267. $("#deliveryman").html(res.deliveryman+'&nbsp;&nbsp;'+res.shr_phone);//送货人
  268. $("#address").html(res.address); //发货单位地址
  269. var arr = res.arr;
  270. var note='';
  271. var html = '<tr><th class="tg-s6z2">物料名称</th>' +
  272. '<th class="tg-s6z2">生产批号</th>' +
  273. '<th class="tg-s6z2">大件</th>' +
  274. '<th class="tg-s6z2">小件</th>' +
  275. '<th class="tg-s6z2">单位</th>' +
  276. '<th class="tg-s6z2">实发数量</th>' +
  277. '<th class="tg-s6z2">备注</th>' +
  278. '<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;">' +
  279. '蓝联(回):业务 黄联(回):运输 '+'<br>'+'白联:存根 红联:财务 绿联:客户</span></th></tr>';
  280. for (var i=0;i < arr.length;i++){
  281. html+= '<tr><td class="tg-031e">'+arr[i].matter_name+'</td>';
  282. html+= '<td class="tg-031e" style="word-break:break-all;">'+(arr[i].bach_num?arr[i].bach_num:'')+'</td>';
  283. html+= '<td class="tg-031e">'+arr[i].large_num+'</td>';
  284. html+= '<td class="tg-031e">'+arr[i].small_num+'</td>';
  285. if(arr[i].mater_type==1){
  286. html+= '<td class="tg-031e">万张</td>';
  287. html+='<td class="tg-031e">'+arr[i].l_num+'</td>';
  288. html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseInt(arr[i].num)+'张'+'</td>';
  289. }else if (arr[i].mater_type==2){
  290. html+= '<td class="tg-031e">kg</td>';
  291. html+='<td class="tg-031e">'+parseFloat(arr[i].num)*parseFloat(arr[i].small_num)/1000+'</td>';
  292. html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseFloat(arr[i].num)/1000+'kg'+'</td>';
  293. }else if (arr[i].mater_type==3){
  294. html+= '<td class="tg-031e">万支</td>';
  295. html+='<td class="tg-031e">'+parseFloat(arr[i].num)*parseFloat(arr[i].small_num)/10000+'</td>';
  296. html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseInt(arr[i].num)+'支'+'</td>';
  297. }
  298. // note+=arr[i].note;
  299. // html+='<td class="tg-031e" >'+arr[i].small_num+'件*'+parseInt(arr[i].num)+(arr[i].mater_type==1?'张':"kg")+'</td>';
  300. }
  301. html+= '<tr><td class="tg-031e">送货单备注</td><td colspan="6" class="tg-031e">'+res.note+'</td></tr>';
  302. $("#table").html(html)
  303. // $("#note").html(note);
  304. $('#myImage').attr("src", res.qrcode_add);
  305. // createQrcode(res.shdh,110,110);
  306. // var img = document.getElementById("myImage"); /// get image element
  307. // var canvas = document.getElementsByTagName('canvas')[0];
  308. // img.src = canvas.toDataURL(); /// update image
  309. // if(!res.qrcode_add){
  310. // $.ajax({
  311. // method:"POST",
  312. // data:{
  313. // qrcode_add:img.src,
  314. // ids:id
  315. // },
  316. // dataType:'JSON',
  317. // url:"/index.php?s=/Admin/Export/qrcode_up",
  318. // success:function(rs){
  319. // console.log(rs);
  320. // }
  321. // });
  322. // }
  323. $.print('#print');
  324. return false;
  325. }
  326. })
  327. }
  328. // function createQrcode(txt,width,height) {
  329. // $("#qrcode").qrcode({
  330. // render: "canvas",//canvas和table两种渲染方式
  331. // width: width,
  332. // height: height,
  333. // correctLevel:3,//二维码纠错级别
  334. // background:"#ffffff",//背景颜色
  335. // foreground:"#000000", //二维码颜色
  336. // text:txt
  337. // });
  338. // }
  339. function deal(id){
  340. $.messager.confirm('再次确认', '温馨提示:删除后无法恢复,确定删除请选择“确定”', function(r){
  341. if (r){
  342. // exit action;
  343. $('.body').loading();
  344. $.ajax({
  345. url: "/index.php?s=/Admin/Export/changeFahuoData",
  346. type: "post",
  347. dataType: "json",
  348. data: {id:id},
  349. success: function (data) {
  350. $('.body').loadend();
  351. if (data != null) {
  352. if (data.status == 0) {
  353. $.messager.alert('系统提示', data.msg, 'error');
  354. fahuoList.datagrid('load', $('#searchBthForm').serializeObject());
  355. } else {
  356. $.messager.alert('系统提示', data.msg, 'info',function(){
  357. fahuoList.datagrid('load', $('#searchBthForm').serializeObject());
  358. });
  359. }
  360. }
  361. },
  362. error: function (error) {
  363. }
  364. })
  365. }
  366. });
  367. return false;
  368. }
  369. function fa(id){
  370. }
  371. //初始化日期输入框
  372. function initDateBox() {
  373. var nowDate = new Date;
  374. $('#endDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  375. nowDate.setMonth(nowDate.getMonth() - 1);
  376. nowDate.setDate(nowDate.getDay() +1);
  377. $('#startDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  378. }
  379. function searchBthFun() {
  380. if ($('#searchBthForm').form('validate')) {
  381. //var obj = $('#searchBthForm').serializeObject();
  382. fahuoList.datagrid('load', $('#searchBthForm').serializeObject());
  383. }
  384. }
  385. function UnixToDate(unixTime, isFull, timeZone) {
  386. if (typeof (timeZone) == 'number') {
  387. unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
  388. }
  389. var time = new Date(unixTime * 1000);
  390. var ymdhis = "";
  391. ymdhis += time.getUTCFullYear() + "-";
  392. ymdhis += (time.getUTCMonth() + 1) + "-";
  393. ymdhis += time.getUTCDate();
  394. if (isFull === true) {
  395. ymdhis += " " + time.getUTCHours() + ":";
  396. ymdhis += time.getUTCMinutes() + ":";
  397. ymdhis += time.getUTCSeconds();
  398. }
  399. return ymdhis;
  400. }
  401. </script>
  402. </body>
  403. </html>