fahuo.html 22 KB

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