Browse Source

1、韵达速递对接

huangmp 2 years ago
parent
commit
44d5fc24a2

+ 1 - 0
package.json

@@ -31,6 +31,7 @@
     "vue-canvas-draw": "^1.0.1",
     "vue-cookie": "1.1.4",
     "vue-i18n": "8.24.5",
+    "vue-plugin-hiprint": "0.0.56",
     "vue-router": "3.5.2",
     "vue-slicksort": "^1.1.3",
     "vuedraggable": "2.23.2",

+ 2 - 0
public/index.html

@@ -4,8 +4,10 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+    <link rel="stylesheet" type="text/css" media="print" href="./print-lock.css">
     <title></title>
     <script>
+
       var webConfigData = JSON.parse(localStorage.getItem('webConfigData'))
       if (webConfigData) {
         let lang = localStorage.getItem('lang')

+ 349 - 0
public/print-lock.css

@@ -0,0 +1,349 @@
+@media print {
+  body {
+    margin: 0px;
+    padding: 0px;
+  }
+}
+
+@page {
+  margin: 0;
+}
+
+.hiprint-printPaper * {
+  box-sizing: border-box;
+  -moz-box-sizing: border-box; /* Firefox */
+  -webkit-box-sizing: border-box; /* Safari */
+}
+
+.hiprint-printPaper *:focus {
+  outline: -webkit-focus-ring-color auto 0px;
+}
+
+.hiprint-printPaper {
+  position: relative;
+  padding: 0 0 0 0;
+  page-break-after: always;
+  -webkit-user-select: none; /* Chrome/Safari/Opera */
+  -moz-user-select: none; /* Firefox */
+  user-select: none;
+  overflow-x: hidden;
+  overflow: hidden;
+}
+
+.hiprint-printPaper .hiprint-printPaper-content {
+  position: relative;
+}
+
+/* 火狐浏览器打印 第一页过后 重叠问题 */
+@-moz-document url-prefix() {
+  .hiprint-printPaper .hiprint-printPaper-content {
+    position: relative;
+    margin-top: 20px;
+    top: -20px
+  }
+}
+
+.hiprint-printPaper.design {
+  overflow: visible;
+}
+
+
+.hiprint-printTemplate .hiprint-printPanel {
+  page-break-after: always;
+}
+
+.hiprint-printPaper, hiprint-printPanel {
+  box-sizing: border-box;
+  border: 0px;
+}
+
+.hiprint-printPanel .hiprint-printPaper:last-child {
+  page-break-after: avoid;
+}
+
+.hiprint-printTemplate .hiprint-printPanel:last-child {
+  page-break-after: avoid;
+}
+
+.hiprint-printPaper .hideheaderLinetarget {
+  border-top: 0px dashed rgb(201, 190, 190) !important;
+}
+
+.hiprint-printPaper .hidefooterLinetarget {
+  border-top: 0px dashed rgb(201, 190, 190) !important;
+}
+
+.hiprint-printPaper.design {
+  border: 1px dashed rgba(170, 170, 170, 0.7);
+}
+
+.design .hiprint-printElement-table-content, .design .hiprint-printElement-longText-content {
+  overflow: hidden;
+  box-sizing: border-box;
+}
+
+.design .resize-panel {
+  box-sizing: border-box;
+  border: 1px dotted;
+}
+
+.hiprint-printElement-text {
+  background-color: transparent;
+  background-repeat: repeat;
+  padding: 0 0 0 0;
+  border: 0.75pt none rgb(0, 0, 0);
+  direction: ltr;
+  font-family: 'SimSun';
+  font-size: 9pt;
+  font-style: normal;
+  font-weight: normal;
+  padding-bottom: 0pt;
+  padding-left: 0pt;
+  padding-right: 0pt;
+  padding-top: 0pt;
+  text-align: left;
+  text-decoration: none;
+  line-height: 9.75pt;
+  box-sizing: border-box;
+  word-wrap: break-word;
+  word-break: break-all;
+}
+
+.design .hiprint-printElement-text-content {
+  border: 1px dashed rgb(206, 188, 188);
+  box-sizing: border-box;
+}
+
+.hiprint-printElement-longText {
+  background-color: transparent;
+  background-repeat: repeat;
+  border: 0.75pt none rgb(0, 0, 0);
+  direction: ltr;
+  font-family: 'SimSun';
+  font-size: 9pt;
+  font-style: normal;
+  font-weight: normal;
+  padding-bottom: 0pt;
+  padding-left: 0pt;
+  padding-right: 0pt;
+  padding-top: 0pt;
+  text-align: left;
+  text-decoration: none;
+  line-height: 9.75pt;
+  box-sizing: border-box;
+  word-wrap: break-word;
+  word-break: break-all;
+  /*white-space: pre-wrap*/
+}
+
+
+.hiprint-printElement-table {
+  background-color: transparent;
+  background-repeat: repeat;
+  color: rgb(0, 0, 0);
+  border-color: rgb(0, 0, 0);
+  border-style: none;
+  direction: ltr;
+  font-family: 'SimSun';
+  font-size: 9pt;
+  font-style: normal;
+  font-weight: normal;
+  padding-bottom: 0pt;
+  padding-left: 0pt;
+  padding-right: 0pt;
+  padding-top: 0pt;
+  text-align: left;
+  text-decoration: none;
+  padding: 0 0 0 0;
+  box-sizing: border-box;
+  line-height: 9.75pt;
+}
+
+.hiprint-printElement-table thead {
+  background: #e8e8e8;
+  font-weight: 700;
+}
+
+table.hiprint-printElement-tableTarget {
+  width: 100%;
+}
+
+.hiprint-printElement-tableTarget, .hiprint-printElement-tableTarget tr, .hiprint-printElement-tableTarget td {
+  border-color: rgb(0, 0, 0);
+  /*border-style: none;*/
+  /*border: 1px solid rgb(0, 0, 0);*/
+  font-weight: normal;
+  direction: ltr;
+  padding-bottom: 0pt;
+  padding-left: 4pt;
+  padding-right: 4pt;
+  padding-top: 0pt;
+  text-decoration: none;
+  vertical-align: middle;
+  box-sizing: border-box;
+  word-wrap: break-word;
+  word-break: break-all;
+  /*line-height: 9.75pt;
+  font-size: 9pt;*/
+}
+
+.hiprint-printElement-tableTarget-border-all {
+  border: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-none {
+  border: 0px solid;
+}
+.hiprint-printElement-tableTarget-border-lr {
+  border-left: 1px solid;
+  border-right: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-left {
+  border-left: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-right {
+  border-right: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-tb {
+  border-top: 1px solid;
+  border-bottom: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-top {
+  border-top: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-bottom {
+  border-bottom: 1px solid;
+}
+
+.hiprint-printElement-tableTarget-border-td-none td {
+  border: 0px solid;
+}
+.hiprint-printElement-tableTarget-border-td-all td:not(:nth-last-child(-n+2)) {
+  border-right: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-td-all td:last-child {
+  border-left: 1px solid;
+}
+.hiprint-printElement-tableTarget-border-td-all td:last-child:first-child {
+  border-left: none;
+}
+
+/*.hiprint-printElement-tableTarget tr,*/
+.hiprint-printElement-tableTarget td {
+  height: 18pt;
+}
+
+.hiprint-printPaper .hiprint-paperNumber {
+  font-size: 9pt;
+}
+
+.design .hiprint-printElement-table-handle {
+  position: absolute;
+  height: 21pt;
+  width: 21pt;
+  background: red;
+  z-index: 1;
+}
+
+.hiprint-printPaper .hiprint-paperNumber-disabled {
+  float: right !important;
+  right: 0 !important;
+  color: gainsboro !important;
+}
+
+.hiprint-printElement-vline, .hiprint-printElement-hline {
+  border: 0px none rgb(0, 0, 0);
+
+}
+
+.hiprint-printElement-vline {
+  border-left: 0.75pt solid #000;
+  border-right: 0px none rgb(0, 0, 0) !important;
+  border-bottom: 0px none rgb(0, 0, 0) !important;
+  border-top: 0px none rgb(0, 0, 0) !important;
+}
+
+.hiprint-printElement-hline {
+  border-top: 0.75pt solid #000;
+  border-right: 0px none rgb(0, 0, 0) !important;
+  border-bottom: 0px none rgb(0, 0, 0) !important;
+  border-left: 0px none rgb(0, 0, 0) !important;
+}
+
+.hiprint-printElement-oval, .hiprint-printElement-rect {
+  border: 0.75pt solid #000;
+}
+
+.hiprint-text-content-middle {
+}
+
+.hiprint-text-content-middle > div {
+  display: grid;
+  align-items: center;
+}
+
+.hiprint-text-content-bottom {
+}
+
+.hiprint-text-content-bottom > div {
+  display: grid;
+  align-items: flex-end;
+}
+
+.hiprint-text-content-wrap {
+}
+
+.hiprint-text-content-wrap .hiprint-text-content-wrap-nowrap {
+  white-space: nowrap;
+}
+
+.hiprint-text-content-wrap .hiprint-text-content-wrap-clip {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: clip;
+}
+
+.hiprint-text-content-wrap .hiprint-text-content-wrap-ellipsis {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+/*hi-grid-row */
+.hi-grid-row {
+  position: relative;
+  height: auto;
+  margin-right: 0;
+  margin-left: 0;
+  zoom: 1;
+  display: block;
+  box-sizing: border-box;
+}
+
+.hi-grid-row::after, .hi-grid-row::before {
+  display: table;
+  content: '';
+  box-sizing: border-box;
+}
+
+.hi-grid-col {
+  display: block;
+  box-sizing: border-box;
+  position: relative;
+  float: left;
+  flex: 0 0 auto;
+}
+
+.table-grid-row {
+  margin-left: -0pt;
+  margin-right: -0pt;
+}
+
+.tableGridColumnsGutterRow {
+  padding-left: 0pt;
+  padding-right: 0pt;
+}
+
+.hiprint-gridColumnsFooter {
+  text-align: left;
+  clear: both;
+}

+ 190 - 0
src/utils/LodopFuncs.js

@@ -0,0 +1,190 @@
+//==本JS是加载Lodop插件或Web打印服务CLodop/Lodop7的综合示例,可直接使用,建议理解后融入自己程序==
+
+//用双端口加载主JS文件Lodop.js(或CLodopfuncs.js兼容老版本)以防其中某端口被占:
+var MainJS ="CLodopfuncs.js",
+    URL_WS1   = "ws://localhost:8000/"+MainJS,                //ws用8000/18000
+    URL_WS2   = "ws://localhost:18000/"+MainJS,
+    URL_HTTP1 = "http://localhost:8000/"+MainJS,              //http用8000/18000
+    URL_HTTP2 = "http://localhost:18000/"+MainJS,
+    URL_HTTP3 = "https://localhost.lodop.net:8443/"+MainJS;   //https用8000/8443
+
+var CreatedOKLodopObject, CLodopIsLocal, LoadJsState;
+
+//==判断是否需要CLodop(那些不支持插件的浏览器):==
+function needCLodop() {
+    try {
+        var ua = navigator.userAgent;
+        if (ua.match(/Windows\sPhone/i) ||
+            ua.match(/iPhone|iPod|iPad/i) ||
+            ua.match(/Android/i) ||
+            ua.match(/Edge\D?\d+/i))
+            return true;
+        var verTrident = ua.match(/Trident\D?\d+/i);
+        var verIE = ua.match(/MSIE\D?\d+/i);
+        var verOPR = ua.match(/OPR\D?\d+/i);
+        var verFF = ua.match(/Firefox\D?\d+/i);
+        var x64 = ua.match(/x64/i);
+        if ((!verTrident) && (!verIE) && (x64)) return true;
+        else if (verFF) {
+            verFF = verFF[0].match(/\d+/);
+            if ((verFF[0] >= 41) || (x64)) return true;
+        } else if (verOPR) {
+            verOPR = verOPR[0].match(/\d+/);
+            if (verOPR[0] >= 32) return true;
+        } else if ((!verTrident) && (!verIE)) {
+            var verChrome = ua.match(/Chrome\D?\d+/i);
+            if (verChrome) {
+                verChrome = verChrome[0].match(/\d+/);
+                if (verChrome[0] >= 41) return true;
+            }
+        }
+        return false;
+    } catch (err) {
+        return true;
+    }
+}
+
+//==检查加载成功与否,如没成功则用http(s)再试==
+//==低版本CLODOP6.561/Lodop7.043及前)用本方法==
+function checkOrTryHttp() {
+  if (window.getCLodop) {
+     LoadJsState = "complete";
+     return true;
+  }
+  if (LoadJsState == "loadingB" || LoadJsState == "complete") return;
+  LoadJsState = "loadingB";
+  var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
+  var JS1 = document.createElement("script")
+     ,JS2 = document.createElement("script")
+     ,JS3 = document.createElement("script");
+  JS1.src = URL_HTTP1;
+  JS2.src = URL_HTTP2;
+  JS3.src = URL_HTTP3;
+  JS1.onload = JS2.onload = JS3.onload = JS2.onerror = JS3.onerror=function(){LoadJsState = "complete";}
+  JS1.onerror = function(e) {
+      if (window.location.protocol !== 'https:')
+          head.insertBefore(JS2, head.firstChild); else
+          head.insertBefore(JS3, head.firstChild);
+  }
+  head.insertBefore(JS1,head.firstChild);
+}
+
+//==加载Lodop对象的主过程:==
+(function loadCLodop(){
+  if (!needCLodop()) return;
+  CLodopIsLocal = !!((URL_WS1 + URL_WS2).match(/\/\/localho|\/\/127.0.0./i));
+  LoadJsState = "loadingA";
+  if (!window.WebSocket && window.MozWebSocket) window.WebSocket=window.MozWebSocket;
+  //ws方式速度快(小于200ms)且可避免CORS错误,但要求Lodop版本足够新:
+  try {
+    var WSK1=new WebSocket(URL_WS1);
+    WSK1.onopen = function(e) { setTimeout("checkOrTryHttp()",200); }
+    WSK1.onmessage = function(e) {if (!window.getCLodop) eval(e.data);}
+    WSK1.onerror = function(e) {
+         var WSK2=new WebSocket(URL_WS2);
+         WSK2.onopen = function(e) {setTimeout("checkOrTryHttp()",200);}
+         WSK2.onmessage = function(e) {if (!window.getCLodop) eval(e.data);}
+         WSK2.onerror= function(e) {checkOrTryHttp();}
+    }
+  } catch(e){
+    checkOrTryHttp();
+  }
+})();
+
+//==获取LODOP对象主过程,判断是否安装、需否升级:==
+function getLodop(oOBJECT, oEMBED) {
+    var strFontTag = "<br><font color='#FF00FF'>打印控件";
+    var strLodopInstall = strFontTag + "未安装!点击这里<a href='install_lodop32.exe' target='_self'>执行安装</a>";
+    var strLodopUpdate = strFontTag + "需要升级!点击这里<a href='install_lodop32.exe' target='_self'>执行升级</a>";
+    var strLodop64Install = strFontTag + "未安装!点击这里<a href='install_lodop64.exe' target='_self'>执行安装</a>";
+    var strLodop64Update = strFontTag + "需要升级!点击这里<a href='install_lodop64.exe' target='_self'>执行升级</a>";
+    var strCLodopInstallA = "<br><font color='#FF00FF'>Web打印服务CLodop未安装启动,点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
+    var strCLodopInstallB = "<br>(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>)";
+    var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>";
+    var strLodop7FontTag = "<br><font color='#FF00FF'>Web打印服务Lodop7";
+    var strLodop7HrefX86 = "点击这里<a href='Lodop7_Linux_X86_64.tar.gz' target='_self'>下载安装</a>(下载后解压,点击lodop文件开始执行)";
+    var strLodop7HrefARM = "点击这里<a href='Lodop7_Linux_ARM64.tar.gz'  target='_self'>下载安装</a>(下载后解压,点击lodop文件开始执行)";
+    var strLodop7Install_X86 = strLodop7FontTag + "未安装启动," + strLodop7HrefX86;
+    var strLodop7Install_ARM = strLodop7FontTag + "未安装启动," + strLodop7HrefARM;
+    var strLodop7Update_X86 = strLodop7FontTag + "需升级," + strLodop7HrefX86;
+    var strLodop7Update_ARM = strLodop7FontTag + "需升级," + strLodop7HrefARM;
+    var strInstallOK = ",成功后请刷新本页面或重启浏览器。</font>";
+    var LODOP;
+    try {
+        var isWinIE = (/MSIE/i.test(navigator.userAgent)) || (/Trident/i.test(navigator.userAgent));
+        var isWinIE64 = isWinIE && (/x64/i.test(navigator.userAgent));
+        var isLinuxX86 = (/Linux/i.test(navigator.platform)) && (/x86/i.test(navigator.platform));
+        var isLinuxARM = (/Linux/i.test(navigator.platform)) && (/aarch/i.test(navigator.platform));
+
+        if (needCLodop() || isLinuxX86 || isLinuxARM) {
+            try {
+                LODOP = window.getCLodop();
+            } catch (err) {}
+            if (!LODOP && LoadJsState !== "complete") {
+                if (!LoadJsState)
+                    alert("未曾加载Lodop主JS文件,请先调用loadCLodop过程."); else
+                    alert("网页还没下载完毕,请稍等一下再操作.");
+                return;
+            }
+            var strAlertMessage;
+            if (!LODOP) {
+                if (isLinuxX86)
+                    strAlertMessage = strLodop7Install_X86;
+                else if (isLinuxARM)
+                    strAlertMessage = strLodop7Install_ARM;
+                else
+                    strAlertMessage = strCLodopInstallA + (CLodopIsLocal ? strCLodopInstallB : "");
+                document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
+                return;
+            } else {
+                if (isLinuxX86 && LODOP.CVERSION < "7.0.7.5")
+                    strAlertMessage = strLodop7Update_X86;
+                else if (isLinuxARM && LODOP.CVERSION < "7.0.7.5")
+                    strAlertMessage = strLodop7Update_ARM;
+                else if (CLODOP.CVERSION < "6.5.9.3")
+                    strAlertMessage = strCLodopUpdate;
+
+                if (strAlertMessage)
+                    document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
+            }
+        } else {
+            //==如果页面有Lodop插件就直接使用,否则新建:==
+            if (oOBJECT || oEMBED) {
+                if (isWinIE)
+                    LODOP = oOBJECT;
+                else
+                    LODOP = oEMBED;
+            } else if (!CreatedOKLodopObject) {
+                LODOP = document.createElement("object");
+                LODOP.setAttribute("width", 0);
+                LODOP.setAttribute("height", 0);
+                LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
+                if (isWinIE)
+                    LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
+                else
+                    LODOP.setAttribute("type", "application/x-print-lodop");
+                document.documentElement.appendChild(LODOP);
+                CreatedOKLodopObject = LODOP;
+            } else
+                LODOP = CreatedOKLodopObject;
+            //==Lodop插件未安装时提示下载地址:==
+            if ((!LODOP) || (!LODOP.VERSION)) {
+                document.body.innerHTML = (isWinIE64 ? strLodop64Install : strLodopInstall) + strInstallOK + document.body.innerHTML;
+                return LODOP;
+            }
+            if (LODOP.VERSION < "6.2.2.6") {
+                document.body.innerHTML = (isWinIE64 ? strLodop64Update : strLodopUpdate) + strInstallOK + document.body.innerHTML;
+            }
+        }
+        //===如下空白位置适合调用统一功能(如注册语句、语言选择等):=======================
+
+
+        //===============================================================================
+        return LODOP;
+    } catch (err) {
+        alert("getLodop出错:" + err);
+    }
+}
+
+export {getLodop}
+

+ 63 - 16
src/views/modules/print/print-scan-delivery.vue

@@ -2,6 +2,15 @@
   <div style="margin: 20px">
     <h1 align="center">电子面单</h1>
     <el-row>
+      <el-col :span="3">
+        <el-select v-model="logistics" placeholder="请选择快递">
+          <el-option v-for="(item,index) in logisticsList"
+                     :key="index"
+                     :label="item.logisticsName"
+                     :value="item.logisticsValue">
+          </el-option>
+        </el-select>
+      </el-col>
       <el-col :span="3">
         <el-select v-model="deviceNo" placeholder="请选择打印设备">
           <el-option
@@ -12,7 +21,7 @@
           </el-option>
         </el-select>
       </el-col>
-      <el-col :span="20">
+      <el-col :span="18">
         <el-input id="scanInput" @change="scanMatchPrintOrder" type="text" v-model="scanOrderNo" placeholder="请扫码二维码"></el-input>
       </el-col>
     </el-row>
@@ -73,14 +82,25 @@
         </el-row>
       </div>
     </div>
+
+    <div class="flex-5 center">
+      <!-- 设计器的 容器 -->
+      <div id="hiprint-printTemplate" hidden></div>
+    </div>
   </div>
 </template>
 
 <script>
 // import AddOrUpdate from './orderLogistics-add-or-update'
+import {autoConnect, disAutoConnect, hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
+import template from './yunda-template-data'
+import printData from './yunda-print-data'
+autoConnect();
+hiprint.init();
 export default {
   data () {
     return {
+      hiprintTemplate : null,
       dataList: [],
       page: {
         total: 0, // 总页数
@@ -90,6 +110,9 @@ export default {
       printOrder:{
         orderLogistics:{}
       },
+      logisticsList:[{logisticsName: "申通快递", logisticsValue: "STO"}, {logisticsName: "韵达速递", logisticsValue: "YUNDA"}],
+      // logisticsList:[{logisticsName: "申通快递", logisticsValue: "STO"}],
+      logistics: "STO",
       deviceList: [],
       deviceNo: null,
       infoVisible:false,
@@ -107,8 +130,19 @@ export default {
     this.getDeviceList();
   },
   mounted () {
+    this.buildDesigner();
   },
   methods: {
+    buildDesigner(){
+      $("#hiprint-printTemplate").empty(); // 先清空, 避免重复构建
+      this.hiprintTemplate = new hiprint.PrintTemplate({
+        // 如果使用 vue ref 创建的模板json, 需要使用 .value 获取 (确保内部能够使用 object.key 拿到对应数据就行)
+        template: template, // 模板json(object)
+        settingContainer: "#PrintElementOptionSetting", // 元素参数容器
+      });
+      // 构建 并填充到 容器中
+      this.hiprintTemplate.design("#hiprint-printTemplate");
+    },
     getDeviceList(){
       this.$http({
         url: this.$http.adornUrl('/print/printDevice/getDeviceList'),
@@ -134,7 +168,7 @@ export default {
       }
       if(substr){
         this.scanOrderNo = substr;
-        let dataBody = {orderNo: substr, deviceNo: this.deviceNo};
+        let dataBody = {orderNo: substr, deviceNo: this.deviceNo, logistics: this.logistics};
         this.$http({
           url: this.$http.adornUrl('/logistics/scanDelivery'),
           method: 'POST',
@@ -142,6 +176,11 @@ export default {
         }).then(({data}) => {
           if(data){
             this.getLogisticsInfo(this.scanOrderNo);
+            if(this.logistics === 'YUNDA'){
+              //打印韵达面单
+              this.printOrder = data;
+              this.printWallbill(this.printOrder.orderLogistics)
+            }
         }
           this.lastInputStr = substr;
         }).catch((error) => {
@@ -165,21 +204,29 @@ export default {
       })
     },
     handlePrintOrder(){
-      if(!this.deviceNo){
-        this.$message.error("请选择打印设备");
-      }
-      this.$http({
-        url: this.$http.adornUrl('/logistics/printOrder'),
-        method: 'POST',
-        data: this.$http.adornData({orderNo: this.scanOrderNo, logistics: this.printOrder.orderLogistics.logistics, deviceNo: this.deviceNo}),
-      }).then(({data}) => {
-        if(data){
-          this.getLogisticsInfo(this.scanOrderNo);
+      if(this.logistics === 'YUNDA'){
+        this.printWallbill(this.printOrder.orderLogistics)
+      }else{
+        if(!this.deviceNo){
+          this.$message.error("请选择打印设备");
         }
-      }).catch((error) => {
-        this.$message.error("打印失败")
-      })
-    }
+        this.$http({
+          url: this.$http.adornUrl('/logistics/printOrder'),
+          method: 'POST',
+          data: this.$http.adornData({orderNo: this.scanOrderNo, logistics: this.printOrder.orderLogistics.logistics, deviceNo: this.deviceNo}),
+        }).then(({data}) => {
+          if(data){
+            this.getLogisticsInfo(this.scanOrderNo);
+          }
+        }).catch((error) => {
+          this.$message.error("打印失败")
+        })
+      }
+    },
+
+    printWallbill(logistics){
+      this.hiprintTemplate.print2(printData.value(logistics));
+    },
   }
 }
 </script>

+ 1 - 1
src/views/modules/print/wave-print-order.vue

@@ -890,7 +890,7 @@
             let pdfList = printOrder.pdfList;
             pdfList.forEach((pdf, j) => {
               let randomStr = Math.floor(Math.random()*100000).toString();
-              const promise = this.getPdfFile(this.resourcesUrl + pdf.pdfUrl + "?a="+randomStr).then(data => {
+              const promise = this.getPdfFile2(this.resourcesUrl + pdf.pdfUrl + "?a="+randomStr).then(data => {
                 // 下载文件, 并存成blob对象
                 const fileName = pdf.pdfFolderName + "/" + pdf.pdfName; // 获取文件名,一定要包含文件的后缀名(因为重复的文件名只会下载一个,故需要加入下标 不同名)
                 // zip.folder(pdf.pdfFolderName).file(pdf.pdfName, data);

+ 18 - 0
src/views/modules/print/yunda-print-data.js

@@ -0,0 +1,18 @@
+export default {
+ value(logistics){
+   return {
+     "createTime": logistics.createTime,
+     "threeSegmentCode": logistics.threeSegmentCode,
+     "barcode": logistics.deliveryNo,
+     "packagePlace": logistics.packagePlace,
+     "receiverName": logistics.receiverName,
+     "receiverMobile": logistics.receiverMobile,
+     "receiverAddr": logistics.receiverAddr,
+     "senderName": logistics.senderName,
+     "senderMobile": logistics.senderMobile,
+     "senderAddr": logistics.senderAddr,
+     "prodName": logistics.prodName,
+     "prodNums": logistics.prodNums
+   }
+ }
+};

File diff suppressed because it is too large
+ 2 - 0
src/views/modules/print/yunda-template-data.js


Some files were not shown because too many files changed in this diff