|
|
@@ -18,6 +18,15 @@
|
|
|
<span autocomplete="off">{{waitScan.waitScanNum}}/</span>
|
|
|
<span autocomplete="off">{{waitScan.orderNum}}</span>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="快递公司" label-width="100px">
|
|
|
+ <el-select v-model="logistics">
|
|
|
+ <el-option v-for="(item,index) in logisticsList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.logisticsName"
|
|
|
+ :value="item.logisticsValue">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="扫描订单号" label-width="100px">
|
|
|
<el-input id="scanInput" @change="scanMatchPrintOrder" type="text" v-model="scanDeliveryNo" placeholder="请扫描条形码"></el-input>
|
|
|
</el-form-item>
|
|
|
@@ -48,6 +57,10 @@
|
|
|
<span autocomplete="off">手机号:</span>
|
|
|
<span autocomplete="off">{{matchPrintOrder.receiverMobile}}</span>
|
|
|
</div>
|
|
|
+ <div class="text item">
|
|
|
+ <span autocomplete="off">收件地址:</span>
|
|
|
+ <span autocomplete="off">{{matchPrintOrder.userAddrOrder.province + matchPrintOrder.userAddrOrder.city + matchPrintOrder.userAddrOrder.area + matchPrintOrder.userAddrOrder.addr}}</span>
|
|
|
+ </div>
|
|
|
<div class="text item">
|
|
|
<span autocomplete="off">产品信息:</span>
|
|
|
<span autocomplete="off">{{matchPrintOrder.prodName}}</span>
|
|
|
@@ -57,11 +70,17 @@
|
|
|
</el-card>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="handleDelivery" :disabled="!matchPrintOrder.match">发 货</el-button>
|
|
|
+ <el-button type="info" @click="handlePrintOrder" :disabled="!matchPrintOrder.match">打 印</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import printData from "../../views/modules/print/yunda-print-data";
|
|
|
+import {autoConnect, hiprint} from "vue-plugin-hiprint";
|
|
|
+import template from "../../views/modules/print/yunda-template-data";
|
|
|
+autoConnect();
|
|
|
+hiprint.init();
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -70,8 +89,14 @@ export default {
|
|
|
waitScanNum: 0,
|
|
|
orderNum: 0
|
|
|
},
|
|
|
+ logisticsList:[],
|
|
|
scanDeliveryNo: null,
|
|
|
+ logistics: null,
|
|
|
+ printOrder:{
|
|
|
+ orderLogistics:{}
|
|
|
+ },
|
|
|
matchPrintOrder: {
|
|
|
+ userAddrOrder:{},
|
|
|
orderNumber: null,
|
|
|
deliveryNo: null,
|
|
|
prodName: null,
|
|
|
@@ -86,7 +111,43 @@ export default {
|
|
|
lastInputStr: null
|
|
|
}
|
|
|
},
|
|
|
+ mounted () {
|
|
|
+ this.buildDesigner();
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ handlePrintOrder(){
|
|
|
+ if(this.logistics === 'YUNDA' || this.logistics === 'ZTO'){
|
|
|
+ this.printWallbill(this.printOrder.orderLogistics)
|
|
|
+ }else {
|
|
|
+ if (!this.deviceNo) {
|
|
|
+ this.$message.error("请选择打印设备");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('/logistics/printOrder'),
|
|
|
+ method: 'POST',
|
|
|
+ data: this.$http.adornData({orderNo: this.lastInputStr, logistics: this.logistics, deviceNo: this.deviceNo}),
|
|
|
+ }).then(({data}) => {
|
|
|
+ if(data){
|
|
|
+
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ this.$message.error("打印失败")
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getLogisticsList(){
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('/logistics/getLogisticsList'),
|
|
|
+ method: 'GET',
|
|
|
+ params: this.$http.adornParams(),
|
|
|
+ }).then(({data}) => {
|
|
|
+ if(data){
|
|
|
+ this.logisticsList = data;
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取数据列表
|
|
|
init (wave) {
|
|
|
this.wave = wave;
|
|
|
@@ -96,6 +157,7 @@ export default {
|
|
|
let $input = document.getElementById("scanInput");
|
|
|
$input.focus();
|
|
|
this.waitScanNumCheck();
|
|
|
+ this.getLogisticsList()
|
|
|
})
|
|
|
},
|
|
|
initEnterListener(){
|
|
|
@@ -108,6 +170,16 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ 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");
|
|
|
+ },
|
|
|
waitScanNumCheck(){
|
|
|
let dataBody = {printChannel: this.wave.printChannel, waveId: this.wave.waveId};
|
|
|
this.$http({
|
|
|
@@ -121,6 +193,10 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
scanMatchPrintOrder(value){
|
|
|
+ if(!this.logistics){
|
|
|
+ this.$message.error("快递公司必选")
|
|
|
+ return;
|
|
|
+ }
|
|
|
// let substr = value.substring(value.length - 19, value.length)
|
|
|
let substr;
|
|
|
if(this.lastInputStr != null){
|
|
|
@@ -140,7 +216,6 @@ export default {
|
|
|
if(data){
|
|
|
this.handleDelivery();
|
|
|
this.lastInputStr = substr;
|
|
|
-
|
|
|
}
|
|
|
}).catch((error) => {
|
|
|
this.matchPrintOrder = {};
|
|
|
@@ -149,24 +224,32 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleDelivery(){
|
|
|
- if(this.waitScan.waitScanNum == 0){
|
|
|
- this.$message({
|
|
|
- message: "订单已发货",
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- return;
|
|
|
- }
|
|
|
- let dataBody = {waveId: this.wave.waveId, orderNumber: this.scanDeliveryNo.trim(), printChannel: this.wave.printChannel};
|
|
|
+ // if(this.waitScan.waitScanNum == 0){
|
|
|
+ // this.$message({
|
|
|
+ // message: "订单已全部发货",
|
|
|
+ // type: 'error'
|
|
|
+ // })
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ let dataBody = {waveId: this.wave.waveId, orderNumber: this.scanDeliveryNo.trim(), printChannel: this.wave.printChannel, logistics: this.logistics};
|
|
|
this.$http({
|
|
|
url: this.$http.adornUrl(`/printOrder/printOrder/confirmDelivery`),
|
|
|
method: 'POST',
|
|
|
data: this.$http.adornData(dataBody)
|
|
|
}).then(({data}) => {
|
|
|
if(data){
|
|
|
+ this.printOrder = data;
|
|
|
this.$message({
|
|
|
message: "发货成功",
|
|
|
type: 'success'
|
|
|
})
|
|
|
+ if(this.logistics === 'YUNDA' || this.logistics === 'ZTO'){
|
|
|
+ if(!data.hadPrint){
|
|
|
+ //打印韵达或者中通面单
|
|
|
+ this.printOrder = data;
|
|
|
+ this.printWallbill(this.printOrder.orderLogistics)
|
|
|
+ }
|
|
|
+ }
|
|
|
this.waitScanNumCheck();
|
|
|
}else{
|
|
|
this.$message({
|
|
|
@@ -176,11 +259,16 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ printWallbill(logistics){
|
|
|
+ this.hiprintTemplate.print2(printData.value(logistics));
|
|
|
+ },
|
|
|
closeDialog(){
|
|
|
this.visible = false;
|
|
|
this.scanDeliveryNo = null;
|
|
|
this.waitScan = {};
|
|
|
- this.matchPrintOrder = {};
|
|
|
+ this.matchPrintOrder = {userAddrOrder:{}};
|
|
|
+ this.logistics = null;
|
|
|
+ this.printOrder = {orderLogistics:{}},
|
|
|
this.$emit("refreshDataList", null);
|
|
|
this.lastInputStr = null;
|
|
|
},
|