傅豪杰 7 月之前
父节点
当前提交
da2964f435
共有 2 个文件被更改,包括 45 次插入15 次删除
  1. 8 3
      src/api/index.js
  2. 37 12
      src/pages/new/storage.vue

+ 8 - 3
src/api/index.js

@@ -199,6 +199,11 @@ export function storagePrintSmallTab(data) {
 }
 
 
-
-
-
+export function appFindInsideInfoByExpressNo(data){
+    return request({
+        url: '/tianzong/express/appFindInsideInfoByExpressNo',
+        method: 'post',
+        data: data,
+        emulateJSON: true
+    })
+}

+ 37 - 12
src/pages/new/storage.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <div class="container">
-            <van-form class="formStyle" @submit="onSubmit" ref="formRef">
+            <van-form class="formStyle" ref="formRef">
                 <div class="formStyle-top">
                     <van-field style="width: 100%;" v-model="object.expressNo" name="expressNo" label="快递单号"
                         placeholder="快递单号" :rules="[{ required: true }]" />
@@ -61,10 +61,10 @@
                 <div
                     style=" display: flex; justify-content: space-between; background-color: #fff;  padding: 10px 20px;">
                     <van-button size="small" style="border-radius: 5px; width: 50vw; " block type="info"
-                        @click="printerGo" native-type="button">保存/打印小标签并添加下一个</van-button>
+                        @click="handleSubmit(true)" native-type="button">保存并打印</van-button>
 
                     <van-button size="small" style="border-radius: 5px; width: 35vw;" block type="info"
-                        native-type="submit">保存并添加下一个</van-button>
+                    @click="handleSubmit(false)"  native-type="button">仅保存</van-button>
                 </div>
             </van-form>
         </div>
@@ -106,12 +106,14 @@
 </template>
 
 <script>
-import { appGetEmployeeInfoByPhone, appGeLogisticsList, appSaveExpressRecord, getSysUserInfoByUserIdAPI, getListOfPrinters, storagePrintSmallTab } from '@/api/index'
+import { appGetEmployeeInfoByPhone, appGeLogisticsList, appSaveExpressRecord, getSysUserInfoByUserIdAPI, getListOfPrinters, storagePrintSmallTab ,appFindInsideInfoByExpressNo} from '@/api/index'
 import { Toast } from 'vant';
 import wx from "weixin-jsapi";
 export default {
     data() {
         return {
+            isPrint:false,//是否需要打印
+            expressInfo:{},// 快件信息
             gfg: {},
             isCompany: '否',
             inputValue: '',//输入手机号后四位聚焦
@@ -145,9 +147,11 @@ export default {
             value14: '',
         };
     },
-    mounted() {
+    async mounted() {
         this.getUser()
         this.floorId = this.$store.state.user.expressScope
+        const expressData = await appFindInsideInfoByExpressNo({insideNum:'S6000000363245086'})
+        this.handleAppFindInsideInfoByExpressNoCallback(expressData)
     },
     methods: {
 
@@ -156,20 +160,26 @@ export default {
             wx.scanQRCode({
                 needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
                 scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
-                success: (res) => {
+                success: async (res) => {
                     var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
                     if (result.indexOf(",") != -1) {
                         let result1 = res.resultStr.split(",");
                         result = result1[result1.length - 1];
                     }
                     this.object.expressNo = result
+                    const expressData = await appFindInsideInfoByExpressNo({insideNum})
+                    handleAppFindInsideInfoByExpressNoCallback(expressData)
+                    console.log(expressData)
                 },
                 error: function (res) {
                     console.log(res, 'error++++++++++');
                 }
             });
+        },
 
-
+        // 查询快递单号回调
+        handleAppFindInsideInfoByExpressNoCallback(data){
+            this.expressInfo
         },
         // 手机号点击聚焦
         onFocus() {
@@ -217,6 +227,10 @@ export default {
             this.shelf = false;
         },
 
+        handleSubmit(isPrint){
+            this.isPrint = isPrint;
+            this.$refs.formRef.submit()
+        },
 
         // 提交
         async onSubmit(values) {
@@ -242,9 +256,13 @@ export default {
             }
             const res = await appSaveExpressRecord({ ...params, ...value, departmentId: this.onGroupObject.departmentName }, { emulateJSON: true })
             this.value14 = this.object.value4
-            console.log(res[0], 'res===')
             if (res.msg == 'success') {
-                this.$toast('打印成功')
+                this.$toast('入库成功')
+                if(this.isPrint){
+                    this.printerGo();
+                }
+                this.isPrint = false;
+                this.expressInfo = {};
                 this.object = {
                     remark: '',
                     radio: '文件',
@@ -261,7 +279,7 @@ export default {
                     mailFloor: '',
                     seat_no: '',
                 },
-                    this.checkbox = false
+                this.checkbox = false
 
             } else if (res.msg == 'already') {
                 this.$toast('该账号已添加过')
@@ -278,6 +296,15 @@ export default {
         // 保存/打印小标签并添加下一个
         async printerGo() {
             const getPrinters = await getListOfPrinters({})
+            console.log(getPrinters)
+            if(getPrinters.data.length === 0){
+                Toast('该用户未绑定打印机')
+                return;
+            }
+            if(getPrinters.data.length === 1){
+                this.onPrinter(getPrinters.data[0])
+                return;
+            }
             if (getPrinters.code == 0) {
                 // const qwe = {
                 //     IMEI: "8672970676795912",
@@ -315,13 +342,11 @@ export default {
             // 开始走打印机面单
             const formData = this.$refs.formRef.getValues();
             try {
-                await this.onSubmit(formData)
                 const res = await storagePrintSmallTab({ expressNo: formData.expressNo, id: e.id })
                 if (res.msg == 'success') {
                     Toast('打印成功')
 
                 }
-                console.log(res, '最后')
                 this.printerShow = false;
             } catch (error) {