| <!DOCTYPE HTML> | 
| <html xmlns:th="http://www.thymeleaf.org"> | 
| <head> | 
|     <meta charset="utf-8"> | 
|     <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> | 
|     <meta name="renderer" content="webkit|ie-comp|ie-stand"> | 
|     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|     <meta name="viewport" | 
|           content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> | 
|     <meta http-equiv="Cache-Control" content="no-siteapp" /> | 
|     <!-- 本框架基本脚本和样式 --> | 
|     <script type="text/javascript" | 
|             th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> | 
|     <script type="text/javascript" | 
|             th:src="@{/js/systools/MBase.js}"></script> | 
|     <script src="https://cdn.jsdelivr.net/gh/jquery-form/form@4.2.2/dist/jquery.form.min.js" integrity="sha384-FzT3vTVGXqf7wRfy8k4BiyzvbNfeYjK+frTVqZeNDFl8woCbF0CYG6g2fMEFFo/i" crossorigin="anonymous"></script> | 
| </head> | 
| <body> | 
| <div class="ibox-content"> | 
|     <form name="uploadExcel" | 
|           style="display: contents; margin-left: 20px;" | 
|           action="/admin/shopOrder/logisticsImport" method="post" | 
|           enctype="multipart/form-data" id="uploadForm"> | 
|   | 
|         <div class="form-group"> | 
|             <input onclick="importChances()" | 
|                    class="input-text upload-url radius form-control" type="text" | 
|                    id="showFileName" readonly | 
|                    style="width: 200px; display: inline; margin-left: 50px;"> | 
|             <a onclick="importChances()" class="btn btn-primary radius"> | 
|                 <i class="fa fa-cloud-upload"></i> 浏览文件 | 
|             </a> | 
|             <input type="file" name="file" accept=".xls,.xlsx" | 
|                    id="chanceUploadId" style="display: none"> | 
|             <button type="button" onclick="download()" | 
|                     class="btn btn-success radius">下载模板</button></div> | 
|         <div class="form-group "> | 
|             <div class="col-sm-12 text-center"> | 
|   | 
|                 <button type="submit" onclick="return submitFile()" | 
|                         class="btn btn-success radius">导入快递单</button> | 
|                 <a | 
|                         class="btn btn-danger radius" href="javascript:;" onclick="MTools.closeForm()" ><i class="fa fa-close"></i> 关闭</a> | 
|             </div> | 
|         </div> | 
|     </form> | 
| </div> | 
| </body> | 
| <script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script> | 
| <script th:inline="javascript"> | 
|     MTools.autoFullSelect(); | 
|     $(".select2").select2(); | 
|   | 
|     /*<![CDATA[*/ | 
|     var obj=/*[[${obj}]]*/ | 
|     /*]]>*/ | 
|   | 
|     var invokeUrl=basePath+"/admin/shopOrder/showList"; | 
|     var myForm=MForm.initForm({ | 
|         invokeUrl:invokeUrl, | 
|         afterSubmit:function(){ | 
|             parent.myGrid.serchData(); | 
|         }, | 
|     }); | 
|   | 
|   | 
|     //绑定文件的点击事件 | 
|     function importChances() { | 
|         var file = $("#chanceUploadId").click(); | 
|   | 
|         //选中文件,文件名字显示在文本框中 | 
|         $("#chanceUploadId").change( | 
|             function() { | 
|                 $("#showFileName").val(''); | 
|                 var fileName = $(this).val(); | 
|                 fileName = fileName.substring( | 
|                     fileName.lastIndexOf("\\") + 1, fileName | 
|                         .lastIndexOf(".")); | 
|                 $("#showFileName").val(fileName); | 
|             }) | 
|     } | 
|     //提交文件 | 
|     function submitFile() { | 
|         if ($("#showFileName").val() == '' | 
|             || $("#showFileName").val().length < 1) { | 
|             layer.msg("请选择上传文件!", { | 
|                 icon : 2 | 
|             }); | 
|             return false; | 
|         } | 
|   | 
|         layer.load(2, { | 
|             time : 100 * 1000, | 
|             shade : [ 0.4, '#aeaeae' ] | 
|         }); | 
|   | 
|         $("#uploadForm").ajaxForm(function (data) { | 
|             layer.closeAll('loading'); | 
|             console.log(data) | 
|             if (data.status == "200") { | 
|                 parent.layer.close(parent.layer.getFrameIndex(window.name)); | 
|                 parent.myGrid.serchData(); | 
|             } else { | 
|                 layer.open({ | 
|                     title: '导入快递单,部分失败', | 
|                     content: data.info | 
|                 }); | 
|                 var url = basePath + "/admin/shopOrder/exportLogisticsImportExcel"; | 
|                 window.open(url); | 
|                 parent.myGrid.serchData(); | 
|             } | 
|             $("#showFileName").val(''); | 
|             var file = $("#chanceUploadId"); | 
|             file.after(file.clone().val('')); | 
|             file.remove(); | 
|         }); | 
|     } | 
|   | 
|   | 
|     function download() { | 
|         window.location.href=basePath + "/uploadfile/image/logisticsImport.xls"; | 
|     } | 
| </script> | 
| </body> | 
| </html> |