Jelajahi Sumber

improve: 发货快递订单打印

From-wh 2 tahun lalu
induk
melakukan
11043bcb4d

+ 16 - 0
template/admin/src/pages/order/orderList/components/tableList.vue

@@ -147,6 +147,7 @@
               <!--                            <DropdownItem name="7"  v-show='row._status === 3'>不退款</DropdownItem>-->
               <DropdownItem name="8" v-show="row._status === 4">已收货</DropdownItem>
               <DropdownItem name="9">删除订单</DropdownItem>
+              <DropdownItem name="12" v-show="row.kuaidi_label">快递面单打印</DropdownItem>
             </DropdownMenu>
           </Dropdown>
         </template>
@@ -190,6 +191,7 @@
 
 <script>
 import expandRow from './tableExpand.vue';
+import printJS from 'print-js';
 import {
   orderList,
   getOrdeDatas,
@@ -417,6 +419,9 @@ export default {
               this.$Message.error(res.msg);
             });
           break;
+        case '12':
+          this.printImg(row.kuaidi_label);
+          break;
         default:
           this.delfromData = {
             title: '删除订单',
@@ -428,6 +433,17 @@ export default {
           this.delOrder(row, this.delfromData);
       }
     },
+    printImg(url) {
+      printJS({
+        printable: url,
+        type: 'image',
+        documentTitle: '快递信息',
+        style: `img{
+          width: 100%;
+          height: 476px;
+        }`,
+      });
+    },
     // 立即支付 /确认收货//删除单条订单
     submitModel() {
       this.getList();

+ 15 - 1
template/admin/src/pages/order/orderList/handle/orderSend.vue

@@ -154,6 +154,7 @@ import {
   orderSheetInfo,
   splitCartInfo,
 } from '@/api/order';
+import printJS from 'print-js';
 export default {
   name: 'orderSend',
   props: {
@@ -352,6 +353,18 @@ export default {
           this.$Message.error(res.msg);
         });
     },
+    printImg(url) {
+      printJS({
+        printable: url,
+        type: 'image',
+        documentTitle: '快递信息',
+        style: `img{
+          width: 100%;
+          height: 476px;
+        }`,
+      });
+    },
+
     // 提交
     putSend(name) {
       let data = {
@@ -385,7 +398,6 @@ export default {
           return this.$Message.error('送货人不能为空');
         }
       }
-
       if (this.splitSwitch) {
         data.datas.cart_ids = [];
         this.selectData.forEach((v) => {
@@ -401,6 +413,7 @@ export default {
             this.$emit('submitFail');
             this.reset();
             this.splitSwitch = false;
+            if (res.data.label) this.printImg(res.data.label);
           })
           .catch((res) => {
             this.$Message.error(res.msg);
@@ -413,6 +426,7 @@ export default {
             this.splitSwitch = false;
             this.$emit('submitFail');
             this.reset();
+            if (res.data.label) this.printImg(res.data.label);
           })
           .catch((res) => {
             this.$Message.error(res.msg);