guoyujia 1 vuosi sitten
vanhempi
commit
da2a4181a1
1 muutettua tiedostoa jossa 16 lisäystä ja 0 poistoa
  1. 16 0
      components/dialog-end-work/dialog-end-work.vue

+ 16 - 0
components/dialog-end-work/dialog-end-work.vue

@@ -238,6 +238,7 @@
 	function handleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		if (mpaasScanModule) {
 		//调用插件的 mpaasScan 方法
 		mpaasScanModule.mpaasScan({
 				// 扫码识别类型,参数可多选,qrCode、barCode,
@@ -248,16 +249,31 @@
 			},
 			(ret) => {
 				let vehicleObj = JSON.parse(ret.resp_result);
+				let hasInFlag = false
 				for (let i = 0; i < bindList.value.length; i++) {
 					if (vehicleObj.carrierCode == bindList.value[i].carrierCode) {
+						hasInFlag = true
 						if (!bindList.value[i].flag) {
 							endFlag.value += 1;
 						}
 						bindList.value[i].flag = true;
 					}
 				}
+				if(!hasInFlag) {
+					uni.showToast({
+						icon: 'none',
+						title: '该批次没有绑定此箱',
+						duration: 2000
+					})
+				}
+				if (endFlag.value < bindList.value.length && hasInFlag) {
+						 setTimeout(() => {
+						    handleScanCode();
+						  }, 700);
+				}
 			}
 		);
+		}
 	}
 
 	function handlePreFinishReporting() {