|
|
@@ -11,7 +11,7 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-col>
|
|
|
- <el-col :span="3">
|
|
|
+ <!--<el-col :span="3">
|
|
|
<el-select v-model="deviceNo" placeholder="请选择打印设备">
|
|
|
<el-option
|
|
|
v-for="(item,index) in deviceList"
|
|
|
@@ -20,7 +20,7 @@
|
|
|
:value="item.deviceNo">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- </el-col>
|
|
|
+ </el-col>-->
|
|
|
<el-col :span="18">
|
|
|
<el-input id="scanInput" @change="scanMatchPrintOrder" type="text" v-model="scanOrderNo" placeholder="请扫码二维码"></el-input>
|
|
|
</el-col>
|
|
|
@@ -92,8 +92,9 @@
|
|
|
|
|
|
<script>
|
|
|
// import AddOrUpdate from './orderLogistics-add-or-update'
|
|
|
-import {autoConnect, disAutoConnect, hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
|
|
|
-import template from './yunda-template-data'
|
|
|
+import {autoConnect, disAutoConnect, hiprint} from 'vue-plugin-hiprint'
|
|
|
+import yundaTemplate from './yunda-template-data'
|
|
|
+import ztoTemplate from './zto-template-data'
|
|
|
import printData from './yunda-print-data'
|
|
|
autoConnect();
|
|
|
hiprint.init();
|
|
|
@@ -110,9 +111,9 @@ export default {
|
|
|
printOrder:{
|
|
|
orderLogistics:{}
|
|
|
},
|
|
|
- logisticsList:[{logisticsName: "韵达速递", logisticsValue: "YUNDA"},{logisticsName: "申通快递", logisticsValue: "STO"}],
|
|
|
+ logisticsList:[],
|
|
|
// logisticsList:[{logisticsName: "申通快递", logisticsValue: "STO"}],
|
|
|
- logistics: "YUNDA",
|
|
|
+ logistics: "",
|
|
|
deviceList: [],
|
|
|
deviceNo: null,
|
|
|
infoVisible:false,
|
|
|
@@ -127,21 +128,46 @@ export default {
|
|
|
// AddOrUpdate
|
|
|
},
|
|
|
created () {
|
|
|
- this.getDeviceList();
|
|
|
+ // this.getDeviceList();
|
|
|
+ this.getLogisticsList()
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.buildDesigner();
|
|
|
+ this.buildYundaDesigner();
|
|
|
+ this.buildZtoDesigner();
|
|
|
},
|
|
|
methods: {
|
|
|
- buildDesigner(){
|
|
|
- $("#hiprint-printTemplate").empty(); // 先清空, 避免重复构建
|
|
|
- this.hiprintTemplate = new hiprint.PrintTemplate({
|
|
|
+ getLogisticsList(){
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('/platform/logistics/getLogisticsList'),
|
|
|
+ method: 'GET',
|
|
|
+ params: this.$http.adornParams(),
|
|
|
+ }).then(({data}) => {
|
|
|
+ if(data){
|
|
|
+ this.logisticsList = data;
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ buildYundaDesigner(){
|
|
|
+ $("#yunda-hiprint-printTemplate").empty(); // 先清空, 避免重复构建
|
|
|
+ this.yundaHiprintTemplate = new hiprint.PrintTemplate({
|
|
|
+ // 如果使用 vue ref 创建的模板json, 需要使用 .value 获取 (确保内部能够使用 object.key 拿到对应数据就行)
|
|
|
+ template: yundaTemplate, // 模板json(object)
|
|
|
+ settingContainer: "#PrintElementOptionSetting", // 元素参数容器
|
|
|
+ });
|
|
|
+ // 构建 并填充到 容器中
|
|
|
+ this.yundaHiprintTemplate.design("#yunda-hiprint-printTemplate");
|
|
|
+ },
|
|
|
+ buildZtoDesigner(){
|
|
|
+ $("#zto-hiprint-printTemplate").empty(); // 先清空, 避免重复构建
|
|
|
+ this.ztoHiprintTemplate = new hiprint.PrintTemplate({
|
|
|
// 如果使用 vue ref 创建的模板json, 需要使用 .value 获取 (确保内部能够使用 object.key 拿到对应数据就行)
|
|
|
- template: template, // 模板json(object)
|
|
|
+ template: ztoTemplate, // 模板json(object)
|
|
|
settingContainer: "#PrintElementOptionSetting", // 元素参数容器
|
|
|
});
|
|
|
// 构建 并填充到 容器中
|
|
|
- this.hiprintTemplate.design("#hiprint-printTemplate");
|
|
|
+ this.ztoHiprintTemplate.design("#zto-hiprint-printTemplate");
|
|
|
},
|
|
|
getDeviceList(){
|
|
|
this.$http({
|
|
|
@@ -163,9 +189,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 = {orderNumber: substr, deviceNo: this.deviceNo, logistics: this.logistics};
|
|
|
@@ -176,7 +202,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.printWallbill(data.orderLogistics)
|
|
|
@@ -208,12 +234,16 @@ 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));
|
|
|
+ }
|
|
|
},
|
|
|
handlePrintOrder(){
|
|
|
- if(!this.deviceNo){
|
|
|
- this.$message.error("请选择打印设备");
|
|
|
- }
|
|
|
+ // if(!this.deviceNo){
|
|
|
+ // this.$message.error("请选择打印设备");
|
|
|
+ // }
|
|
|
this.$http({
|
|
|
url: this.$http.adornUrl('/platform/logistics/printOrder'),
|
|
|
method: 'POST',
|
|
|
@@ -221,7 +251,7 @@ export default {
|
|
|
}).then(({data}) => {
|
|
|
if(data){
|
|
|
this.getLogisticsInfo(this.scanOrderNo);
|
|
|
- if(this.logistics === 'YUNDA'){
|
|
|
+ if(this.logistics === 'YUNDA' || this.logistics === 'ZTO'){
|
|
|
//打印韵达面单
|
|
|
this.printWallbill(this.printOrder.orderLogistics)
|
|
|
}
|