Ver código fonte

fix:微信接口

sunChengjie 11 meses atrás
pai
commit
320336d9b6

+ 9 - 4
src/pages/components/HomePage.vue

@@ -290,12 +290,17 @@ export default {
 
 		async wxScanCodeA(result) {
 			const res = await appFindYourShipment({ expressNo: result }, { emulateJSON: true })
-			if (res.msg == 'success') {
-				this.$store.state.shipment = res
-				this.$router.push('ScannerResult')
+			if (res.data !== '') {
+				if (res.msg == 'success') {
+					this.$store.state.shipment = res
+					this.$router.push('ScannerResult')
+				} else {
+					Toast('找不到此单号')
+				}
 			} else {
-				Toast('找不到此单号')
+				Toast('没查到此订单号')
 			}
+
 			console.log(res, '+++++++++==')
 		},
 

+ 0 - 1
src/pages/new/deliveryInquiry.vue

@@ -1,6 +1,5 @@
 <template>
     <div style="width: 100vw;">
-        <back :title="titlename"></back>
         <van-tabs v-model="active" @click="onClick">
             <van-tab title="待派件">
                 <waitsent></waitsent>

+ 19 - 5
src/pages/new/removal.vue

@@ -1,7 +1,6 @@
 <template>
     <div>
         <div class="container" v-if="isRemoval">
-            <back :title="titlename"></back>
             <van-search v-model="keyWorld" placeholder="请输入快递单号" />
             <img @click="onImg" src="@/assets/user/u4.png" alt="">
             <div style="padding: 12px;" v-if="show">
@@ -27,6 +26,7 @@ import { appDeliveryPersonDeliveries } from '../../api';
 import { Toast } from 'vant'
 import Batched from './batched.vue'
 import { getCompanyExpressNo } from "@/utils/utils"
+import wx from "weixin-jsapi";
 export default {
     name: 'Removal',
     components: {
@@ -39,7 +39,8 @@ export default {
     data() {
         return {
             titlename: "快件出库",
-            codes: ['SF676444932923', 'SF23123123123', 'SF202303221917'],
+            // codes: ['SF676444932923', 'SF23123123123', 'SF202303221917'],
+            codes: [],
             keyWorld: "",
             isRemoval: true,
             BatDispatchBatchNo: '',//传过去的生成的快递单号
@@ -47,8 +48,21 @@ export default {
     },
     methods: {
         onImg() {
-            // 调用
-            this.callback(Math.random())
+            wx.scanQRCode({
+                needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+                scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
+                success: (res) => {
+                    var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
+                    if (result.indexOf(",") != -1) {
+                        let result1 = res.resultStr.split(",");
+                        result = result1[result1.length - 1];
+                    }
+                    this.callback(result)
+                },
+                error: function (res) {
+                    console.log(res, 'error++++++++++');
+                }
+            });
         },
         callback(code) {
             if (this.codes.length < 15) {
@@ -105,7 +119,7 @@ export default {
         height: 20px;
         width: 20px;
         right: 22px;
-        top: 62px;
+        top: 20px;
     }
 }
 

+ 17 - 2
src/pages/new/sign.vue

@@ -1,6 +1,5 @@
 <template>
     <div>
-        <back :title="titlename"></back>
         <div class="container" v-if="isSign">
             <van-search v-model="value" placeholder="请输入快件单号或手机单号" />
             <img @click="onImg" src="@/assets/user/u4.png" alt="">
@@ -18,6 +17,7 @@
 import { appFindYourShipmentList, appFindYourShipment } from '@/api/index'
 import Combine from './combine.vue'
 import { Toast } from 'vant'
+import wx from "weixin-jsapi";
 export default {
     name: 'Sign',
     components: {
@@ -33,7 +33,22 @@ export default {
     },
     methods: {
         onImg() {
-            this.value = 'SF202303221917'
+            wx.scanQRCode({
+                needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+                scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
+                success: (res) => {
+                    var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
+                    if (result.indexOf(",") != -1) {
+                        let result1 = res.resultStr.split(",");
+                        result = result1[result1.length - 1];
+                    }
+                    this.value = result
+                },
+                error: function (res) {
+                    console.log(res, 'error++++++++++');
+                }
+            });
+
         },
         // 查询
         async check() {

+ 18 - 2
src/pages/new/storage.vue

@@ -1,7 +1,6 @@
 <template>
     <div>
         <div class="container">
-            <back :title="titlename"></back>
             <van-form @submit="onSubmit">
                 <div style="display: flex; justify-content: space-between; background-color: #fff;">
                     <van-field style="width: 100%;" v-model="object.expressNo" name="expressNo" label="快递单号"
@@ -106,6 +105,7 @@
 <script>
 import { appGetEmployeeInfoByPhone, appGeLogisticsList, appSaveExpressRecord, getSysUserInfoByUserIdAPI } from '@/api/index'
 import { Toast } from 'vant';
+import wx from "weixin-jsapi";
 export default {
     data() {
         return {
@@ -143,7 +143,23 @@ export default {
     methods: {
         // 快递单号
         wxScanCodeB() {
-            this.object.expressNo = 'QW132456789'
+            wx.scanQRCode({
+                needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+                scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
+                success: (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
+                },
+                error: function (res) {
+                    console.log(res, 'error++++++++++');
+                }
+            });
+
+
         },
         // 手机号点击聚焦
         onFocus() {