Browse Source

1、更新中通快递

huangmp 1 năm trước cách đây
mục cha
commit
e0fc932773

+ 30 - 11
src/views/modules/print/print-scan-delivery.vue

@@ -93,14 +93,16 @@
 <script>
 // import AddOrUpdate from './orderLogistics-add-or-update'
 import {autoConnect, disAutoConnect, hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
-import template from './yunda-template-data'
+import ztoTemplate from './zto-template-data'
+import yundaTemplate from './yunda-template-data'
 import printData from './yunda-print-data'
 autoConnect();
 hiprint.init();
 export default {
   data () {
     return {
-      hiprintTemplate : null,
+      ztoHiprintTemplate : null,
+      yundaHiprintTemplate : null,
       dataList: [],
       page: {
         total: 0, // 总页数
@@ -130,18 +132,29 @@ export default {
     this.getDeviceList();
   },
   mounted () {
-    this.buildDesigner();
+    this.buildYundaDesigner();
+    this.buildZtoDesigner();
   },
   methods: {
-    buildDesigner(){
-      $("#hiprint-printTemplate").empty(); // 先清空, 避免重复构建
-      this.hiprintTemplate = new hiprint.PrintTemplate({
+    buildYundaDesigner(){
+      $("#yunda-hiprint-printTemplate").empty(); // 先清空, 避免重复构建
+      this.yundaHiprintTemplate = new hiprint.PrintTemplate({
         // 如果使用 vue ref 创建的模板json, 需要使用 .value 获取 (确保内部能够使用 object.key 拿到对应数据就行)
-        template: template, // 模板json(object)
+        template: yundaTemplate, // 模板json(object)
         settingContainer: "#PrintElementOptionSetting", // 元素参数容器
       });
       // 构建 并填充到 容器中
-      this.hiprintTemplate.design("#hiprint-printTemplate");
+      this.yundaHiprintTemplate.design("#yunda-hiprint-printTemplate");
+    },
+    buildZtoDesigner(){
+      $("#zto-hiprint-printTemplate").empty(); // 先清空, 避免重复构建
+      this.ztoHiprintTemplate = new hiprint.PrintTemplate({
+        // 如果使用 vue ref 创建的模板json, 需要使用 .value 获取 (确保内部能够使用 object.key 拿到对应数据就行)
+        template: ztoTemplate, // 模板json(object)
+        settingContainer: "#PrintElementOptionSetting", // 元素参数容器
+      });
+      // 构建 并填充到 容器中
+      this.ztoHiprintTemplate.design("#zto-hiprint-printTemplate");
     },
     getDeviceList(){
       this.$http({
@@ -176,7 +189,7 @@ export default {
         }).then(({data}) => {
           if(data){
             this.getLogisticsInfo(this.scanOrderNo);
-            if(this.logistics === 'YUNDA'){
+            if(this.logistics === 'YUNDA' || this.logistics === 'ZTO'){
               if(!data.hadPrint){
                 //打印韵达面单
                 this.printOrder = data;
@@ -195,7 +208,7 @@ export default {
       this.$http({
         url: this.$http.adornUrl('/logistics/getLogisticsInfo'),
         method: 'GET',
-        params: this.$http.adornParams({orderNo:orderNo}),
+        params: this.$http.adornParams({orderNo:orderNo, logistics:this.logistics}),
       }).then(({data}) => {
         if(data){
           this.printOrder = data;
@@ -208,6 +221,7 @@ export default {
     handlePrintOrder(){
       if(this.logistics === 'YUNDA' || this.logistics === 'ZTO'){
         this.printWallbill(this.printOrder.orderLogistics)
+        return
       }else{
         // if(!this.deviceNo){
         //   this.$message.error("请选择打印设备");
@@ -227,7 +241,12 @@ export default {
     },
 
     printWallbill(logistics){
-      this.hiprintTemplate.print2(printData.value(logistics));
+      if(logistics.logistics === 'ZTO'){
+        this.ztoHiprintTemplate.print2(printData.value(logistics));
+      }else if(logistics.logistics === 'YUNDA'){
+        this.yundaHiprintTemplate.print2(printData.value(logistics));
+      }
+
     },
   }
 }

+ 2 - 1
src/views/modules/print/yunda-print-data.js

@@ -12,7 +12,8 @@ export default {
      "senderMobile": logistics.senderMobile,
      "senderAddr": logistics.senderAddr,
      "prodName": logistics.prodName,
-     "prodNums": logistics.prodNums
+     "prodNums": logistics.prodNums,
+     "orderNumber": logistics.orderNo
    }
  }
 };

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
src/views/modules/print/yunda-template-data.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 0
src/views/modules/print/zto-template-data.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác