|
|
|
@ -45,7 +45,7 @@ |
|
|
|
<div class="reason-tags"> |
|
|
|
<div v-for="(reason, index) in reasonOptions" :key="index" class="reason-tag" |
|
|
|
:class="{ active: selectedReason === index }" @click="selectedReason = index"> |
|
|
|
{{ reason }} |
|
|
|
{{ reason.text }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -96,6 +96,7 @@ import { useRouter, useRoute } from 'vue-router'; |
|
|
|
import { showFailToast, showSuccessToast, showToast, showConfirmDialog } from 'vant'; |
|
|
|
import { baseUrl, appEnv } from '@/config/env.js'; |
|
|
|
import { getEntInfoByQRCode, queryEnterpriseListAndQrInfo, szyptGetToken } from '@/api/enforcement/index'; |
|
|
|
import { loadDict } from '@/util/dictUtil'; |
|
|
|
import wx from 'weixin-js-sdk'; |
|
|
|
|
|
|
|
const router = useRouter(); |
|
|
|
@ -326,19 +327,14 @@ const isHttpLink = (url) => { |
|
|
|
|
|
|
|
// ========== 手动搜索企业弹窗 ========== |
|
|
|
const showSearchModal = ref(false); |
|
|
|
const selectedReason = ref(3); // 默认选中"其他" |
|
|
|
const selectedReason = ref(-1); // 默认未选中,字典加载后设置 |
|
|
|
const searchKeyword = ref(''); |
|
|
|
const enterpriseList = ref([]); |
|
|
|
const loading = ref(false); |
|
|
|
const finished = ref(false); |
|
|
|
const error = ref(false); |
|
|
|
|
|
|
|
const reasonOptions = [ |
|
|
|
'企业原因', |
|
|
|
'系统原因', |
|
|
|
'扫码未能显示企业信息', |
|
|
|
'其他' |
|
|
|
]; |
|
|
|
const reasonOptions = ref([]); |
|
|
|
|
|
|
|
const showSearchPopup = () => { |
|
|
|
showSearchModal.value = true; |
|
|
|
@ -346,9 +342,25 @@ const showSearchPopup = () => { |
|
|
|
enterpriseList.value = []; |
|
|
|
finished.value = false; |
|
|
|
error.value = false; |
|
|
|
nextTick(() => { |
|
|
|
loadEnterprises(); |
|
|
|
}); |
|
|
|
|
|
|
|
if (reasonOptions.value.length === 0) { |
|
|
|
loadDict('no-scan-reason', (columns) => { |
|
|
|
reasonOptions.value = columns; |
|
|
|
const otherIndex = columns.findIndex(item => item.text === '其他' || item.value === '其他'); |
|
|
|
selectedReason.value = otherIndex !== -1 ? otherIndex : 0; |
|
|
|
nextTick(() => { |
|
|
|
loadEnterprises(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
if (selectedReason.value === -1) { |
|
|
|
const otherIndex = reasonOptions.value.findIndex(item => item.text === '其他' || item.value === '其他'); |
|
|
|
selectedReason.value = otherIndex !== -1 ? otherIndex : 0; |
|
|
|
} |
|
|
|
nextTick(() => { |
|
|
|
loadEnterprises(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const closeSearchModal = () => { |
|
|
|
@ -415,7 +427,7 @@ const onLoad = () => { |
|
|
|
const selectEnterprise = (item) => { |
|
|
|
console.log('选中企业:', item); |
|
|
|
// 保存无法扫码原因到 sessionStorage |
|
|
|
const selectedReasonText = reasonOptions[selectedReason.value]; |
|
|
|
const selectedReasonText = reasonOptions.value[selectedReason.value]?.text || ''; |
|
|
|
sessionStorage.setItem('scanReason', selectedReasonText); |
|
|
|
showSearchModal.value = false; |
|
|
|
router.push({ |
|
|
|
@ -430,7 +442,7 @@ const selectEnterprise = (item) => { |
|
|
|
|
|
|
|
// 市外注册企业信息录入 |
|
|
|
const handleOutOfCityEnterprise = () => { |
|
|
|
const selectedReasonText = reasonOptions[selectedReason.value]; |
|
|
|
const selectedReasonText = reasonOptions[selectedReason.value]?.text || ''; |
|
|
|
sessionStorage.setItem('scanReason', selectedReasonText); |
|
|
|
showSearchModal.value = false; |
|
|
|
router.push({ |
|
|
|
@ -459,6 +471,18 @@ const toSign = () => { |
|
|
|
|
|
|
|
// ========== 生命周期 ========== |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
loadDict('no-scan-reason', (columns) => { |
|
|
|
reasonOptions.value = columns; |
|
|
|
const otherIndex = columns.findIndex(item => item.text === '其他' || item.value === '其他'); |
|
|
|
if (otherIndex !== -1) { |
|
|
|
selectedReason.value = otherIndex; |
|
|
|
} else if (columns.length > 0) { |
|
|
|
selectedReason.value = 0; |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
onBeforeUnmount(() => { |
|
|
|
// 页面销毁时确保关闭摄像头 |
|
|
|
if (html5QrCode) { |
|
|
|
|