认证
Showing
3 changed files
with
82 additions
and
40 deletions
| ... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
| 11 | <view v-else class="license-preview"> | 11 | <view v-else class="license-preview"> |
| 12 | <image :src="getImageUrl(getBusinessLicenseUrl())" class="license-img" | 12 | <image :src="getImageUrl(getBusinessLicenseUrl())" class="license-img" |
| 13 | @click="previewImage(getImageUrl(getBusinessLicenseUrl()))"></image> | 13 | @click="previewImage(getImageUrl(getBusinessLicenseUrl()))"></image> |
| 14 | <view v-if="!isFieldDisabled('businessLicense')" class="delete-btn" @click.stop="delSupplementFile">×</view> | 14 | <view class="delete-btn" @click.stop="delSupplementFile">×</view> |
| 15 | </view> | 15 | </view> |
| 16 | </view> | 16 | </view> |
| 17 | </uni-forms-item> | 17 | </uni-forms-item> |
| ... | @@ -48,7 +48,7 @@ | ... | @@ -48,7 +48,7 @@ |
| 48 | <view v-else class="idcard-preview"> | 48 | <view v-else class="idcard-preview"> |
| 49 | <image :src="getImageUrl(legalIdcPhoto1)" class="idcard-img" | 49 | <image :src="getImageUrl(legalIdcPhoto1)" class="idcard-img" |
| 50 | @click="previewImage(getImageUrl(legalIdcPhoto1))"></image> | 50 | @click="previewImage(getImageUrl(legalIdcPhoto1))"></image> |
| 51 | <view v-if="!isFieldDisabled('legalIdcPhoto1')" class="delete-btn" @click.stop="delimgFont">×</view> | 51 | <view class="delete-btn" @click.stop="delimgFont">×</view> |
| 52 | </view> | 52 | </view> |
| 53 | </view> | 53 | </view> |
| 54 | </view> | 54 | </view> |
| ... | @@ -60,7 +60,7 @@ | ... | @@ -60,7 +60,7 @@ |
| 60 | <view v-else class="idcard-preview"> | 60 | <view v-else class="idcard-preview"> |
| 61 | <image :src="getImageUrl(legalIdcPhoto2)" class="idcard-img" | 61 | <image :src="getImageUrl(legalIdcPhoto2)" class="idcard-img" |
| 62 | @click="previewImage(getImageUrl(legalIdcPhoto2))"></image> | 62 | @click="previewImage(getImageUrl(legalIdcPhoto2))"></image> |
| 63 | <view v-if="!isFieldDisabled('legalIdcPhoto2')" class="delete-btn" @click.stop="delimgBack">×</view> | 63 | <view class="delete-btn" @click.stop="delimgBack">×</view> |
| 64 | </view> | 64 | </view> |
| 65 | </view> | 65 | </view> |
| 66 | </view> | 66 | </view> |
| ... | @@ -72,10 +72,10 @@ | ... | @@ -72,10 +72,10 @@ |
| 72 | <uni-easyinput v-model="form.legalIdcCode" :disabled="isFieldDisabled('legalIdcCode')" /> | 72 | <uni-easyinput v-model="form.legalIdcCode" :disabled="isFieldDisabled('legalIdcCode')" /> |
| 73 | </uni-forms-item> | 73 | </uni-forms-item> |
| 74 | <uni-forms-item label="联系人" required> | 74 | <uni-forms-item label="联系人" required> |
| 75 | <uni-easyinput v-model="form.siteContact" :disabled="isFieldDisabled('siteContact')" /> | 75 | <uni-easyinput v-model="form.siteContact" :disabled="false" /> |
| 76 | </uni-forms-item> | 76 | </uni-forms-item> |
| 77 | <uni-forms-item label="联系方式" required> | 77 | <uni-forms-item label="联系方式" required> |
| 78 | <uni-easyinput v-model="form.siteTel" :disabled="isFieldDisabled('siteTel')" /> | 78 | <uni-easyinput v-model="form.siteTel" :disabled="false" /> |
| 79 | </uni-forms-item> | 79 | </uni-forms-item> |
| 80 | <uni-forms-item label="上传机构照片" required> | 80 | <uni-forms-item label="上传机构照片" required> |
| 81 | <view class="pictures-box"> | 81 | <view class="pictures-box"> |
| ... | @@ -85,7 +85,7 @@ | ... | @@ -85,7 +85,7 @@ |
| 85 | <view v-else class="pictures-preview"> | 85 | <view v-else class="pictures-preview"> |
| 86 | <image :src="getImageUrl(picArr[0])" class="picture-img" | 86 | <image :src="getImageUrl(picArr[0])" class="picture-img" |
| 87 | @click="previewImage(picArr.map(item => getImageUrl(item)))"></image> | 87 | @click="previewImage(picArr.map(item => getImageUrl(item)))"></image> |
| 88 | <view v-if="!isFieldDisabled('pictures')" class="delete-btn" @click.stop="delpicArr">×</view> | 88 | <view class="delete-btn" @click.stop="delpicArr">×</view> |
| 89 | </view> | 89 | </view> |
| 90 | </view> | 90 | </view> |
| 91 | </uni-forms-item> | 91 | </uni-forms-item> |
| ... | @@ -251,25 +251,28 @@ | ... | @@ -251,25 +251,28 @@ |
| 251 | const coordinates1 = ref([]) | 251 | const coordinates1 = ref([]) |
| 252 | const pictures = ref() | 252 | const pictures = ref() |
| 253 | const legalIdcPhoto = ref([]) | 253 | const legalIdcPhoto = ref([]) |
| 254 | const carriedReadonlyFields = ['companyName', 'creditCode', 'name', 'address', 'adress', 'parentId', 'legal', 'legalIdcCode'] | ||
| 254 | 255 | ||
| 255 | function isFieldDisabled(field) { | 256 | function isFieldDisabled(field) { |
| 256 | const disabledMap = { | 257 | if (['businessLicense', 'legalIdcPhoto1', 'legalIdcPhoto2', 'pictures', 'siteContact', 'siteTel'].includes(field)) { |
| 257 | businessLicense: false, | 258 | return false |
| 258 | companyName: false, | 259 | } |
| 259 | creditCode: false, | 260 | return !!ocrLockedFields.value[field] || isCarriedFieldLocked(field) |
| 260 | name: type.value, | 261 | } |
| 261 | address: false, | 262 | |
| 262 | adress: false, | 263 | function isCarriedFieldLocked(field) { |
| 263 | parentId: type.value, | 264 | if (!carriedReadonlyFields.includes(field)) return false |
| 264 | legalIdcPhoto1: false, | 265 | if (field === 'address') { |
| 265 | legalIdcPhoto2: false, | 266 | return !!(form.value.provinceId || form.value.cityId || form.value.regionId || coordinates1.value?.length) |
| 266 | legal: false, | 267 | } |
| 267 | legalIdcCode: false, | 268 | if (field === 'name') { |
| 268 | siteContact: false, | 269 | return hasValue(form.value.name || form.value.baseName) |
| 269 | siteTel: false, | 270 | } |
| 270 | pictures: false | 271 | return hasValue(form.value[field]) |
| 271 | } | 272 | } |
| 272 | return !!disabledMap[field] | 273 | |
| 274 | function hasValue(value) { | ||
| 275 | return value !== undefined && value !== null && String(value).trim() !== '' | ||
| 273 | } | 276 | } |
| 274 | 277 | ||
| 275 | function lockOcrField(field, value) { | 278 | function lockOcrField(field, value) { |
| ... | @@ -968,7 +971,6 @@ | ... | @@ -968,7 +971,6 @@ |
| 968 | } | 971 | } |
| 969 | 972 | ||
| 970 | function chooseIdCardFront() { | 973 | function chooseIdCardFront() { |
| 971 | if (isFieldDisabled('legalIdcPhoto1')) return | ||
| 972 | uni.chooseImage({ | 974 | uni.chooseImage({ |
| 973 | count: 1, | 975 | count: 1, |
| 974 | sizeType: ['compressed'], | 976 | sizeType: ['compressed'], |
| ... | @@ -978,7 +980,6 @@ | ... | @@ -978,7 +980,6 @@ |
| 978 | } | 980 | } |
| 979 | 981 | ||
| 980 | function chooseIdCardBack() { | 982 | function chooseIdCardBack() { |
| 981 | if (isFieldDisabled('legalIdcPhoto2')) return | ||
| 982 | uni.chooseImage({ | 983 | uni.chooseImage({ |
| 983 | count: 1, | 984 | count: 1, |
| 984 | sizeType: ['compressed'], | 985 | sizeType: ['compressed'], |
| ... | @@ -988,7 +989,6 @@ | ... | @@ -988,7 +989,6 @@ |
| 988 | } | 989 | } |
| 989 | 990 | ||
| 990 | function upIdCardImgFront(e) { | 991 | function upIdCardImgFront(e) { |
| 991 | if (isFieldDisabled('legalIdcPhoto1')) return | ||
| 992 | const tempFilePaths = e.tempFilePaths; | 992 | const tempFilePaths = e.tempFilePaths; |
| 993 | const imgUrl = tempFilePaths[0] | 993 | const imgUrl = tempFilePaths[0] |
| 994 | if (!imgUrl) return | 994 | if (!imgUrl) return |
| ... | @@ -1008,7 +1008,6 @@ | ... | @@ -1008,7 +1008,6 @@ |
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
| 1010 | function upIdCardImgBack(e) { | 1010 | function upIdCardImgBack(e) { |
| 1011 | if (isFieldDisabled('legalIdcPhoto2')) return | ||
| 1012 | const tempFilePaths = e.tempFilePaths; | 1011 | const tempFilePaths = e.tempFilePaths; |
| 1013 | const imgUrl = tempFilePaths[0] | 1012 | const imgUrl = tempFilePaths[0] |
| 1014 | if (!imgUrl) return | 1013 | if (!imgUrl) return |
| ... | @@ -1029,13 +1028,11 @@ | ... | @@ -1029,13 +1028,11 @@ |
| 1029 | } | 1028 | } |
| 1030 | 1029 | ||
| 1031 | function delimgFont() { | 1030 | function delimgFont() { |
| 1032 | if (isFieldDisabled('legalIdcPhoto1')) return | ||
| 1033 | legalIdcPhoto1.value = '' | 1031 | legalIdcPhoto1.value = '' |
| 1034 | form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',') | 1032 | form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',') |
| 1035 | } | 1033 | } |
| 1036 | 1034 | ||
| 1037 | function delimgBack() { | 1035 | function delimgBack() { |
| 1038 | if (isFieldDisabled('legalIdcPhoto2')) return | ||
| 1039 | legalIdcPhoto2.value = '' | 1036 | legalIdcPhoto2.value = '' |
| 1040 | form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',') | 1037 | form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',') |
| 1041 | } | 1038 | } |
| ... | @@ -1067,7 +1064,6 @@ | ... | @@ -1067,7 +1064,6 @@ |
| 1067 | let selectFileValue = {} | 1064 | let selectFileValue = {} |
| 1068 | 1065 | ||
| 1069 | function chooseBusinessLicense() { | 1066 | function chooseBusinessLicense() { |
| 1070 | if (isFieldDisabled('businessLicense')) return | ||
| 1071 | uni.chooseImage({ | 1067 | uni.chooseImage({ |
| 1072 | count: 1, | 1068 | count: 1, |
| 1073 | sizeType: ['compressed'], | 1069 | sizeType: ['compressed'], |
| ... | @@ -1089,9 +1085,9 @@ | ... | @@ -1089,9 +1085,9 @@ |
| 1089 | } | 1085 | } |
| 1090 | 1086 | ||
| 1091 | async function selectFile(e) { | 1087 | async function selectFile(e) { |
| 1092 | if (isFieldDisabled('businessLicense')) return | ||
| 1093 | let file = e.tempFiles[0] | 1088 | let file = e.tempFiles[0] |
| 1094 | if (!file) return | 1089 | if (!file) return |
| 1090 | unlockOcrFields() | ||
| 1095 | const filePath = file.url || file.path || e.tempFilePaths?.[0] | 1091 | const filePath = file.url || file.path || e.tempFilePaths?.[0] |
| 1096 | uni.showLoading({ | 1092 | uni.showLoading({ |
| 1097 | title: '上传中' | 1093 | title: '上传中' |
| ... | @@ -1126,7 +1122,6 @@ | ... | @@ -1126,7 +1122,6 @@ |
| 1126 | } | 1122 | } |
| 1127 | 1123 | ||
| 1128 | function delSupplementFile() { | 1124 | function delSupplementFile() { |
| 1129 | if (isFieldDisabled('businessLicense')) return | ||
| 1130 | selectFileValue = {} | 1125 | selectFileValue = {} |
| 1131 | form.value.businessLicense = '' | 1126 | form.value.businessLicense = '' |
| 1132 | unlockOcrFields() | 1127 | unlockOcrFields() |
| ... | @@ -1180,7 +1175,6 @@ | ... | @@ -1180,7 +1175,6 @@ |
| 1180 | } | 1175 | } |
| 1181 | 1176 | ||
| 1182 | function choosePictures() { | 1177 | function choosePictures() { |
| 1183 | if (isFieldDisabled('pictures')) return | ||
| 1184 | uni.chooseImage({ | 1178 | uni.chooseImage({ |
| 1185 | count: 3, | 1179 | count: 3, |
| 1186 | sizeType: ['compressed'], | 1180 | sizeType: ['compressed'], |
| ... | @@ -1190,7 +1184,6 @@ | ... | @@ -1190,7 +1184,6 @@ |
| 1190 | } | 1184 | } |
| 1191 | 1185 | ||
| 1192 | function upPicArr(e) { | 1186 | function upPicArr(e) { |
| 1193 | if (isFieldDisabled('pictures')) return | ||
| 1194 | const tempFilePaths = e.tempFilePaths; | 1187 | const tempFilePaths = e.tempFilePaths; |
| 1195 | const imgUrl = tempFilePaths[0] | 1188 | const imgUrl = tempFilePaths[0] |
| 1196 | if (!imgUrl) return | 1189 | if (!imgUrl) return |
| ... | @@ -1211,7 +1204,6 @@ | ... | @@ -1211,7 +1204,6 @@ |
| 1211 | } | 1204 | } |
| 1212 | 1205 | ||
| 1213 | function delpicArr() { | 1206 | function delpicArr() { |
| 1214 | if (isFieldDisabled('pictures')) return | ||
| 1215 | picArr.value = [] | 1207 | picArr.value = [] |
| 1216 | form.value.pictures = '' | 1208 | form.value.pictures = '' |
| 1217 | } | 1209 | } |
| ... | @@ -1419,14 +1411,34 @@ | ... | @@ -1419,14 +1411,34 @@ |
| 1419 | display: flex; | 1411 | display: flex; |
| 1420 | align-items: center; | 1412 | align-items: center; |
| 1421 | justify-content: center; | 1413 | justify-content: center; |
| 1422 | font-size: 34rpx; | 1414 | font-size: 0; |
| 1423 | font-weight: bold; | 1415 | line-height: 1; |
| 1424 | line-height: 44rpx; | ||
| 1425 | z-index: 99; | 1416 | z-index: 99; |
| 1426 | border: 4rpx solid #fff; | 1417 | border: 4rpx solid #fff; |
| 1427 | box-shadow: 0 4rpx 14rpx rgba(173, 24, 31, 0.35); | 1418 | box-shadow: 0 4rpx 14rpx rgba(173, 24, 31, 0.35); |
| 1428 | } | 1419 | } |
| 1429 | 1420 | ||
| 1421 | .delete-btn::before, | ||
| 1422 | .delete-btn::after { | ||
| 1423 | content: ''; | ||
| 1424 | position: absolute; | ||
| 1425 | left: 50%; | ||
| 1426 | top: 50%; | ||
| 1427 | width: 24rpx; | ||
| 1428 | height: 4rpx; | ||
| 1429 | background: #fff; | ||
| 1430 | border-radius: 4rpx; | ||
| 1431 | transform-origin: center; | ||
| 1432 | } | ||
| 1433 | |||
| 1434 | .delete-btn::before { | ||
| 1435 | transform: translate(-50%, -50%) rotate(45deg); | ||
| 1436 | } | ||
| 1437 | |||
| 1438 | .delete-btn::after { | ||
| 1439 | transform: translate(-50%, -50%) rotate(-45deg); | ||
| 1440 | } | ||
| 1441 | |||
| 1430 | .btn-red { | 1442 | .btn-red { |
| 1431 | background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%); | 1443 | background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%); |
| 1432 | color: #fff; | 1444 | color: #fff; | ... | ... |
| ... | @@ -1943,12 +1943,33 @@ watch(activeStep, (newVal) => { | ... | @@ -1943,12 +1943,33 @@ watch(activeStep, (newVal) => { |
| 1943 | display: flex; | 1943 | display: flex; |
| 1944 | align-items: center; | 1944 | align-items: center; |
| 1945 | justify-content: center; | 1945 | justify-content: center; |
| 1946 | font-size: 28rpx; | 1946 | font-size: 0; |
| 1947 | font-weight: bold; | 1947 | line-height: 1; |
| 1948 | z-index: 10; | 1948 | z-index: 10; |
| 1949 | box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2); | 1949 | box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2); |
| 1950 | } | 1950 | } |
| 1951 | 1951 | ||
| 1952 | .delete-btn::before, | ||
| 1953 | .delete-btn::after { | ||
| 1954 | content: ''; | ||
| 1955 | position: absolute; | ||
| 1956 | left: 50%; | ||
| 1957 | top: 50%; | ||
| 1958 | width: 22rpx; | ||
| 1959 | height: 4rpx; | ||
| 1960 | background: #fff; | ||
| 1961 | border-radius: 4rpx; | ||
| 1962 | transform-origin: center; | ||
| 1963 | } | ||
| 1964 | |||
| 1965 | .delete-btn::before { | ||
| 1966 | transform: translate(-50%, -50%) rotate(45deg); | ||
| 1967 | } | ||
| 1968 | |||
| 1969 | .delete-btn::after { | ||
| 1970 | transform: translate(-50%, -50%) rotate(-45deg); | ||
| 1971 | } | ||
| 1972 | |||
| 1952 | .pictures-box { | 1973 | .pictures-box { |
| 1953 | width: 100%; | 1974 | width: 100%; |
| 1954 | } | 1975 | } | ... | ... |
| ... | @@ -258,10 +258,15 @@ | ... | @@ -258,10 +258,15 @@ |
| 258 | 258 | ||
| 259 | // 确认添加 | 259 | // 确认添加 |
| 260 | async function confirmAdd() { | 260 | async function confirmAdd() { |
| 261 | addForm.value.idcCode = String(addForm.value.idcCode || '').trim().toUpperCase() | ||
| 261 | if (!addForm.value.idcCode) { | 262 | if (!addForm.value.idcCode) { |
| 262 | uni.showToast({ title: '请输入证件号', icon: 'none' }) | 263 | uni.showToast({ title: '请输入证件号', icon: 'none' }) |
| 263 | return | 264 | return |
| 264 | } | 265 | } |
| 266 | if (addForm.value.idType === '0' && !isValidIdCard(addForm.value.idcCode)) { | ||
| 267 | uni.showToast({ title: '请输入正确的身份证号码', icon: 'none' }) | ||
| 268 | return | ||
| 269 | } | ||
| 265 | if (!queryParams.value.rangeId) { | 270 | if (!queryParams.value.rangeId) { |
| 266 | uni.showToast({ title: '缺少rangeId', icon: 'none' }) | 271 | uni.showToast({ title: '缺少rangeId', icon: 'none' }) |
| 267 | return | 272 | return |
| ... | @@ -281,6 +286,10 @@ | ... | @@ -281,6 +286,10 @@ |
| 281 | console.error(e) | 286 | console.error(e) |
| 282 | } | 287 | } |
| 283 | } | 288 | } |
| 289 | |||
| 290 | function isValidIdCard(idcCode) { | ||
| 291 | return /(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(idcCode) | ||
| 292 | } | ||
| 284 | </script> | 293 | </script> |
| 285 | 294 | ||
| 286 | <style scoped lang="scss"> | 295 | <style scoped lang="scss"> | ... | ... |
-
Please register or sign in to post a comment