|
@@ -45,6 +45,7 @@
|
|
<button type="default" class="btn" @click="handleFinishReporting">结束报工</button>
|
|
<button type="default" class="btn" @click="handleFinishReporting">结束报工</button>
|
|
</view>
|
|
</view>
|
|
</dialog-base>
|
|
</dialog-base>
|
|
|
|
+ <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@@ -53,6 +54,7 @@
|
|
ref,
|
|
ref,
|
|
getCurrentInstance
|
|
getCurrentInstance
|
|
} from 'vue'
|
|
} from 'vue'
|
|
|
|
+ import QrScanner from '@/pages/vueQrCode/index.vue'
|
|
import {
|
|
import {
|
|
onLoad
|
|
onLoad
|
|
} from '@dcloudio/uni-app'
|
|
} from '@dcloudio/uni-app'
|
|
@@ -87,6 +89,7 @@
|
|
|
|
|
|
const baseDialog = ref(null)
|
|
const baseDialog = ref(null)
|
|
const workInfo = ref({})
|
|
const workInfo = ref({})
|
|
|
|
+ const showQrCodeReader = ref(false);
|
|
const wasteInfo = ref([])
|
|
const wasteInfo = ref([])
|
|
const reasonList = ref([])
|
|
const reasonList = ref([])
|
|
const emit = defineEmits(['resflushItem'])
|
|
const emit = defineEmits(['resflushItem'])
|
|
@@ -283,70 +286,104 @@
|
|
|
|
|
|
function handleScanCode() {
|
|
function handleScanCode() {
|
|
// 引入原生插件
|
|
// 引入原生插件
|
|
- const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
|
|
|
|
- if (mpaasScanModule) {
|
|
|
|
- //调用插件的 mpaasScan 方法
|
|
|
|
- mpaasScanModule.mpaasScan({
|
|
|
|
- // 扫码识别类型,参数可多选,qrCode、barCode,
|
|
|
|
- // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
|
|
|
|
- scanType: ["qrCode", "barCode"],
|
|
|
|
- // 是否隐藏相册,默认false不隐藏
|
|
|
|
- hideAlbum: false,
|
|
|
|
- },
|
|
|
|
- (ret) => {
|
|
|
|
- let vehicleObj = {
|
|
|
|
- carrierCode: 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);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
- } else {
|
|
|
|
- let vehicleObj = {
|
|
|
|
- carrierCode: bindList.value[0].carrierCode
|
|
|
|
- };
|
|
|
|
- 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;
|
|
|
|
|
|
+ // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
|
|
|
|
+ // if (mpaasScanModule) {
|
|
|
|
+ // //调用插件的 mpaasScan 方法
|
|
|
|
+ // mpaasScanModule.mpaasScan({
|
|
|
|
+ // // 扫码识别类型,参数可多选,qrCode、barCode,
|
|
|
|
+ // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
|
|
|
|
+ // scanType: ["qrCode", "barCode"],
|
|
|
|
+ // // 是否隐藏相册,默认false不隐藏
|
|
|
|
+ // hideAlbum: false,
|
|
|
|
+ // },
|
|
|
|
+ // (ret) => {
|
|
|
|
+ // let vehicleObj = {
|
|
|
|
+ // carrierCode: 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);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // );
|
|
|
|
+ // } else {
|
|
|
|
+ // let vehicleObj = {
|
|
|
|
+ // carrierCode: bindList.value[0].carrierCode
|
|
|
|
+ // };
|
|
|
|
+ // 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);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ showQrCodeReader.value = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function qrReaderClose() {
|
|
|
|
+ showQrCodeReader.value = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function onDecodeHandler(ret) {
|
|
|
|
+ showQrCodeReader.value = false;
|
|
|
|
+ let vehicleObj = {
|
|
|
|
+ carrierCode: ret
|
|
|
|
+ };
|
|
|
|
+ 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);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if (!hasInFlag) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: 'none',
|
|
|
|
+ title: '该批次没有绑定此箱',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (endFlag.value < bindList.value.length && hasInFlag) {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ handleScanCode();
|
|
|
|
+ }, 700);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|