|
|
@@ -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 yundaTemplate from './yunda-template-data'
|
|
|
+import ztoTemplate from './zto-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, // 总页数
|
|
|
@@ -131,7 +133,8 @@ export default {
|
|
|
this.getLogisticsList()
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.buildDesigner();
|
|
|
+ this.buildYundaDesigner();
|
|
|
+ this.buildZtoDesigner();
|
|
|
},
|
|
|
methods: {
|
|
|
getLogisticsList(){
|
|
|
@@ -147,15 +150,25 @@ export default {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
- 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({
|
|
|
@@ -177,9 +190,9 @@ export default {
|
|
|
}else{
|
|
|
substr = value;
|
|
|
}
|
|
|
- if(!this.deviceNo){
|
|
|
- this.$message.error("请选择打印设备");
|
|
|
- }
|
|
|
+ // if(!this.deviceNo){
|
|
|
+ // this.$message.error("请选择打印设备");
|
|
|
+ // }
|
|
|
if(substr){
|
|
|
this.scanOrderNo = substr;
|
|
|
let dataBody = {orderNo: substr, deviceNo: this.deviceNo, logistics: this.logistics};
|
|
|
@@ -241,7 +254,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));
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
}
|
|
|
}
|