67a6778f by lttnew

认证

1 parent ab789555
......@@ -11,7 +11,7 @@
<view v-else class="license-preview">
<image :src="getImageUrl(getBusinessLicenseUrl())" class="license-img"
@click="previewImage(getImageUrl(getBusinessLicenseUrl()))"></image>
<view v-if="!isFieldDisabled('businessLicense')" class="delete-btn" @click.stop="delSupplementFile">×</view>
<view class="delete-btn" @click.stop="delSupplementFile">×</view>
</view>
</view>
</uni-forms-item>
......@@ -48,7 +48,7 @@
<view v-else class="idcard-preview">
<image :src="getImageUrl(legalIdcPhoto1)" class="idcard-img"
@click="previewImage(getImageUrl(legalIdcPhoto1))"></image>
<view v-if="!isFieldDisabled('legalIdcPhoto1')" class="delete-btn" @click.stop="delimgFont">×</view>
<view class="delete-btn" @click.stop="delimgFont">×</view>
</view>
</view>
</view>
......@@ -60,7 +60,7 @@
<view v-else class="idcard-preview">
<image :src="getImageUrl(legalIdcPhoto2)" class="idcard-img"
@click="previewImage(getImageUrl(legalIdcPhoto2))"></image>
<view v-if="!isFieldDisabled('legalIdcPhoto2')" class="delete-btn" @click.stop="delimgBack">×</view>
<view class="delete-btn" @click.stop="delimgBack">×</view>
</view>
</view>
</view>
......@@ -72,10 +72,10 @@
<uni-easyinput v-model="form.legalIdcCode" :disabled="isFieldDisabled('legalIdcCode')" />
</uni-forms-item>
<uni-forms-item label="联系人" required>
<uni-easyinput v-model="form.siteContact" :disabled="isFieldDisabled('siteContact')" />
<uni-easyinput v-model="form.siteContact" :disabled="false" />
</uni-forms-item>
<uni-forms-item label="联系方式" required>
<uni-easyinput v-model="form.siteTel" :disabled="isFieldDisabled('siteTel')" />
<uni-easyinput v-model="form.siteTel" :disabled="false" />
</uni-forms-item>
<uni-forms-item label="上传机构照片" required>
<view class="pictures-box">
......@@ -85,7 +85,7 @@
<view v-else class="pictures-preview">
<image :src="getImageUrl(picArr[0])" class="picture-img"
@click="previewImage(picArr.map(item => getImageUrl(item)))"></image>
<view v-if="!isFieldDisabled('pictures')" class="delete-btn" @click.stop="delpicArr">×</view>
<view class="delete-btn" @click.stop="delpicArr">×</view>
</view>
</view>
</uni-forms-item>
......@@ -251,25 +251,28 @@
const coordinates1 = ref([])
const pictures = ref()
const legalIdcPhoto = ref([])
const carriedReadonlyFields = ['companyName', 'creditCode', 'name', 'address', 'adress', 'parentId', 'legal', 'legalIdcCode']
function isFieldDisabled(field) {
const disabledMap = {
businessLicense: false,
companyName: false,
creditCode: false,
name: type.value,
address: false,
adress: false,
parentId: type.value,
legalIdcPhoto1: false,
legalIdcPhoto2: false,
legal: false,
legalIdcCode: false,
siteContact: false,
siteTel: false,
pictures: false
if (['businessLicense', 'legalIdcPhoto1', 'legalIdcPhoto2', 'pictures', 'siteContact', 'siteTel'].includes(field)) {
return false
}
return !!ocrLockedFields.value[field] || isCarriedFieldLocked(field)
}
function isCarriedFieldLocked(field) {
if (!carriedReadonlyFields.includes(field)) return false
if (field === 'address') {
return !!(form.value.provinceId || form.value.cityId || form.value.regionId || coordinates1.value?.length)
}
return !!disabledMap[field]
if (field === 'name') {
return hasValue(form.value.name || form.value.baseName)
}
return hasValue(form.value[field])
}
function hasValue(value) {
return value !== undefined && value !== null && String(value).trim() !== ''
}
function lockOcrField(field, value) {
......@@ -968,7 +971,6 @@
}
function chooseIdCardFront() {
if (isFieldDisabled('legalIdcPhoto1')) return
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
......@@ -978,7 +980,6 @@
}
function chooseIdCardBack() {
if (isFieldDisabled('legalIdcPhoto2')) return
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
......@@ -988,7 +989,6 @@
}
function upIdCardImgFront(e) {
if (isFieldDisabled('legalIdcPhoto1')) return
const tempFilePaths = e.tempFilePaths;
const imgUrl = tempFilePaths[0]
if (!imgUrl) return
......@@ -1008,7 +1008,6 @@
}
function upIdCardImgBack(e) {
if (isFieldDisabled('legalIdcPhoto2')) return
const tempFilePaths = e.tempFilePaths;
const imgUrl = tempFilePaths[0]
if (!imgUrl) return
......@@ -1029,13 +1028,11 @@
}
function delimgFont() {
if (isFieldDisabled('legalIdcPhoto1')) return
legalIdcPhoto1.value = ''
form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',')
}
function delimgBack() {
if (isFieldDisabled('legalIdcPhoto2')) return
legalIdcPhoto2.value = ''
form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',')
}
......@@ -1067,7 +1064,6 @@
let selectFileValue = {}
function chooseBusinessLicense() {
if (isFieldDisabled('businessLicense')) return
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
......@@ -1089,9 +1085,9 @@
}
async function selectFile(e) {
if (isFieldDisabled('businessLicense')) return
let file = e.tempFiles[0]
if (!file) return
unlockOcrFields()
const filePath = file.url || file.path || e.tempFilePaths?.[0]
uni.showLoading({
title: '上传中'
......@@ -1126,7 +1122,6 @@
}
function delSupplementFile() {
if (isFieldDisabled('businessLicense')) return
selectFileValue = {}
form.value.businessLicense = ''
unlockOcrFields()
......@@ -1180,7 +1175,6 @@
}
function choosePictures() {
if (isFieldDisabled('pictures')) return
uni.chooseImage({
count: 3,
sizeType: ['compressed'],
......@@ -1190,7 +1184,6 @@
}
function upPicArr(e) {
if (isFieldDisabled('pictures')) return
const tempFilePaths = e.tempFilePaths;
const imgUrl = tempFilePaths[0]
if (!imgUrl) return
......@@ -1211,7 +1204,6 @@
}
function delpicArr() {
if (isFieldDisabled('pictures')) return
picArr.value = []
form.value.pictures = ''
}
......@@ -1419,14 +1411,34 @@
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
font-weight: bold;
line-height: 44rpx;
font-size: 0;
line-height: 1;
z-index: 99;
border: 4rpx solid #fff;
box-shadow: 0 4rpx 14rpx rgba(173, 24, 31, 0.35);
}
.delete-btn::before,
.delete-btn::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 24rpx;
height: 4rpx;
background: #fff;
border-radius: 4rpx;
transform-origin: center;
}
.delete-btn::before {
transform: translate(-50%, -50%) rotate(45deg);
}
.delete-btn::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
.btn-red {
background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%);
color: #fff;
......
......@@ -1943,12 +1943,33 @@ watch(activeStep, (newVal) => {
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
font-weight: bold;
font-size: 0;
line-height: 1;
z-index: 10;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
}
.delete-btn::before,
.delete-btn::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 22rpx;
height: 4rpx;
background: #fff;
border-radius: 4rpx;
transform-origin: center;
}
.delete-btn::before {
transform: translate(-50%, -50%) rotate(45deg);
}
.delete-btn::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
.pictures-box {
width: 100%;
}
......
......@@ -256,15 +256,20 @@
addForm.value.idType = idcList.value[idcListIndex.value].value
}
// 确认添加
async function confirmAdd() {
if (!addForm.value.idcCode) {
uni.showToast({ title: '请输入证件号', icon: 'none' })
return
}
if (!queryParams.value.rangeId) {
uni.showToast({ title: '缺少rangeId', icon: 'none' })
return
// 确认添加
async function confirmAdd() {
addForm.value.idcCode = String(addForm.value.idcCode || '').trim().toUpperCase()
if (!addForm.value.idcCode) {
uni.showToast({ title: '请输入证件号', icon: 'none' })
return
}
if (addForm.value.idType === '0' && !isValidIdCard(addForm.value.idcCode)) {
uni.showToast({ title: '请输入正确的身份证号码', icon: 'none' })
return
}
if (!queryParams.value.rangeId) {
uni.showToast({ title: '缺少rangeId', icon: 'none' })
return
}
try {
......@@ -278,10 +283,14 @@
getList()
getCount()
} catch (e) {
console.error(e)
}
}
</script>
console.error(e)
}
}
function isValidIdCard(idcCode) {
return /(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(idcCode)
}
</script>
<style scoped lang="scss">
.pickViewBox {
......@@ -467,4 +476,4 @@
color: #E60012;
font-weight: 500;
}
</style>
\ No newline at end of file
</style>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!