单位缴费校验营业执照
Showing
3 changed files
with
332 additions
and
259 deletions
| ... | @@ -89,7 +89,7 @@ export function fillMemberPhoto(item = {}, fallback = '') { | ... | @@ -89,7 +89,7 @@ export function fillMemberPhoto(item = {}, fallback = '') { |
| 89 | return photo ? fillImgUrl(photo) : fallback | 89 | return photo ? fillImgUrl(photo) : fallback |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | export function previewAttachment(file, options = {}) { | 92 | export async function previewAttachment(file, options = {}) { |
| 93 | const item = normalizeAttachment(file) | 93 | const item = normalizeAttachment(file) |
| 94 | const rawUrl = item.rawUrl || item.url | 94 | const rawUrl = item.rawUrl || item.url |
| 95 | const previewUrl = getAttachmentPreviewUrl(rawUrl, 0) | 95 | const previewUrl = getAttachmentPreviewUrl(rawUrl, 0) |
| ... | @@ -101,6 +101,14 @@ export function previewAttachment(file, options = {}) { | ... | @@ -101,6 +101,14 @@ export function previewAttachment(file, options = {}) { |
| 101 | return | 101 | return |
| 102 | } | 102 | } |
| 103 | if (isAttachmentImage(item) || isImageUrl(rawUrl) || isImageUrl(previewUrl)) { | 103 | if (isAttachmentImage(item) || isImageUrl(rawUrl) || isImageUrl(previewUrl)) { |
| 104 | const errorMsg = await checkAttachmentError(previewUrl) | ||
| 105 | if (errorMsg) { | ||
| 106 | uni.showToast({ | ||
| 107 | title: errorMsg, | ||
| 108 | icon: 'none' | ||
| 109 | }) | ||
| 110 | return | ||
| 111 | } | ||
| 104 | uni.previewImage({ | 112 | uni.previewImage({ |
| 105 | urls: [previewUrl], | 113 | urls: [previewUrl], |
| 106 | current: previewUrl, | 114 | current: previewUrl, |
| ... | @@ -120,11 +128,7 @@ export function previewAttachment(file, options = {}) { | ... | @@ -120,11 +128,7 @@ export function previewAttachment(file, options = {}) { |
| 120 | }) | 128 | }) |
| 121 | return | 129 | return |
| 122 | } | 130 | } |
| 123 | if (getAttachmentExt(item) === 'pdf' && options.preferWebView !== false) { | 131 | openDocumentAttachment(item, getAttachmentPreviewUrl(rawUrl, 0), false, options) |
| 124 | openAttachmentWebView(previewUrl, options.title || '附件预览') | ||
| 125 | return | ||
| 126 | } | ||
| 127 | openDocumentAttachment(item, getAttachmentPreviewUrl(rawUrl, 1), false, options) | ||
| 128 | } | 132 | } |
| 129 | 133 | ||
| 130 | export function normalizeAttachment(file) { | 134 | export function normalizeAttachment(file) { |
| ... | @@ -163,7 +167,7 @@ export function getAttachmentPreviewUrl(url, downFlag = 0) { | ... | @@ -163,7 +167,7 @@ export function getAttachmentPreviewUrl(url, downFlag = 0) { |
| 163 | const value = String(url).trim() | 167 | const value = String(url).trim() |
| 164 | if (!value || value === 'null' || value === 'undefined') return '' | 168 | if (!value || value === 'null' || value === 'undefined') return '' |
| 165 | if (value.startsWith('msr:')) { | 169 | if (value.startsWith('msr:')) { |
| 166 | return `${trimBaseUrl(config.baseUrl_api)}/fileServer/download?file=${value}&downFlag=${downFlag}` | 170 | return `${trimBaseUrl(config.baseUrl_api)}/fileServer/download?file=${encodeURIComponent(value)}&downFlag=${downFlag}` |
| 167 | } | 171 | } |
| 168 | return fillImgUrl(value) | 172 | return fillImgUrl(value) |
| 169 | } | 173 | } |
| ... | @@ -192,8 +196,6 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { | ... | @@ -192,8 +196,6 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { |
| 192 | uni.hideLoading() | 196 | uni.hideLoading() |
| 193 | if (redirectUrl) { | 197 | if (redirectUrl) { |
| 194 | openDocumentAttachment(item, redirectUrl, true, options) | 198 | openDocumentAttachment(item, redirectUrl, true, options) |
| 195 | } else if (getAttachmentExt(item) === 'pdf') { | ||
| 196 | openAttachmentWebView(getAttachmentPreviewUrl(item.rawUrl || item.url, 0), options.title || '附件预览') | ||
| 197 | } else { | 199 | } else { |
| 198 | uni.showToast({ | 200 | uni.showToast({ |
| 199 | title: '文件下载失败', | 201 | title: '文件下载失败', |
| ... | @@ -202,10 +204,7 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { | ... | @@ -202,10 +204,7 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { |
| 202 | } | 204 | } |
| 203 | return | 205 | return |
| 204 | } | 206 | } |
| 205 | uni.showToast({ | 207 | showAttachmentFailToast(url, '文件下载失败') |
| 206 | title: '文件下载失败', | ||
| 207 | icon: 'none' | ||
| 208 | }) | ||
| 209 | return | 208 | return |
| 210 | } | 209 | } |
| 211 | uni.openDocument({ | 210 | uni.openDocument({ |
| ... | @@ -213,10 +212,6 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { | ... | @@ -213,10 +212,6 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { |
| 213 | fileType: getDocumentFileType(item), | 212 | fileType: getDocumentFileType(item), |
| 214 | showMenu: true, | 213 | showMenu: true, |
| 215 | fail: () => { | 214 | fail: () => { |
| 216 | if (getAttachmentExt(item) === 'pdf') { | ||
| 217 | openAttachmentWebView(getAttachmentPreviewUrl(item.rawUrl || item.url, 0), options.title || '附件预览') | ||
| 218 | return | ||
| 219 | } | ||
| 220 | uni.showToast({ | 215 | uni.showToast({ |
| 221 | title: '文件暂不支持预览', | 216 | title: '文件暂不支持预览', |
| 222 | icon: 'none' | 217 | icon: 'none' |
| ... | @@ -225,14 +220,7 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { | ... | @@ -225,14 +220,7 @@ function openDocumentAttachment(item, url, retried = false, options = {}) { |
| 225 | }) | 220 | }) |
| 226 | }, | 221 | }, |
| 227 | fail: () => { | 222 | fail: () => { |
| 228 | if (getAttachmentExt(item) === 'pdf') { | 223 | showAttachmentFailToast(url, '文件下载失败') |
| 229 | openAttachmentWebView(getAttachmentPreviewUrl(item.rawUrl || item.url, 0), options.title || '附件预览') | ||
| 230 | return | ||
| 231 | } | ||
| 232 | uni.showToast({ | ||
| 233 | title: '文件下载失败', | ||
| 234 | icon: 'none' | ||
| 235 | }) | ||
| 236 | }, | 224 | }, |
| 237 | complete: () => { | 225 | complete: () => { |
| 238 | uni.hideLoading() | 226 | uni.hideLoading() |
| ... | @@ -260,9 +248,64 @@ function openAttachmentWebView(url, title = '附件预览') { | ... | @@ -260,9 +248,64 @@ function openAttachmentWebView(url, title = '附件预览') { |
| 260 | } | 248 | } |
| 261 | 249 | ||
| 262 | function getAttachmentExt(file) { | 250 | function getAttachmentExt(file) { |
| 263 | const name = `${file?.extname || file?.name || file?.rawUrl || file?.url || ''}` | 251 | const name = `${file?.extname || file?.name || file?.rawUrl || file?.url || file || ''}` |
| 264 | const ext = name.includes('.') ? name.split('.').pop() : name | 252 | const fileParam = getQueryParam(name, 'file') |
| 265 | return ext.split('?')[0].toLowerCase() | 253 | const cleanName = safeDecodeURIComponent(fileParam || name).split('?')[0].split('#')[0] |
| 254 | const fileName = cleanName.split('/').pop() || cleanName | ||
| 255 | const ext = fileName.includes('.') ? fileName.split('.').pop() : fileName | ||
| 256 | return ext.toLowerCase() | ||
| 257 | } | ||
| 258 | |||
| 259 | function checkAttachmentError(url) { | ||
| 260 | if (!isFileDownloadUrl(url)) return Promise.resolve('') | ||
| 261 | return new Promise(resolve => { | ||
| 262 | uni.request({ | ||
| 263 | url, | ||
| 264 | method: 'GET', | ||
| 265 | header: { | ||
| 266 | Authorization: uni.getStorageSync('token') || '' | ||
| 267 | }, | ||
| 268 | success: res => { | ||
| 269 | const data = parseAttachmentResponse(res.data) | ||
| 270 | if (res.statusCode >= 400 || (data && data.code && data.code !== 200)) { | ||
| 271 | resolve(getAttachmentErrorMsg(data)) | ||
| 272 | return | ||
| 273 | } | ||
| 274 | resolve('') | ||
| 275 | }, | ||
| 276 | fail: () => resolve('') | ||
| 277 | }) | ||
| 278 | }) | ||
| 279 | } | ||
| 280 | |||
| 281 | async function showAttachmentFailToast(url, fallback) { | ||
| 282 | const errorMsg = await checkAttachmentError(url) | ||
| 283 | uni.showToast({ | ||
| 284 | title: errorMsg || fallback, | ||
| 285 | icon: 'none' | ||
| 286 | }) | ||
| 287 | } | ||
| 288 | |||
| 289 | function parseAttachmentResponse(data) { | ||
| 290 | if (!data) return null | ||
| 291 | if (typeof data === 'object') return data | ||
| 292 | if (typeof data === 'string') { | ||
| 293 | try { | ||
| 294 | return JSON.parse(data) | ||
| 295 | } catch (e) { | ||
| 296 | return null | ||
| 297 | } | ||
| 298 | } | ||
| 299 | return null | ||
| 300 | } | ||
| 301 | |||
| 302 | function getAttachmentErrorMsg(data) { | ||
| 303 | const msg = data?.msg || data?.message || '' | ||
| 304 | if (!msg) return '附件预览失败' | ||
| 305 | if (msg.includes('Hostname') || msg.includes('certificate')) { | ||
| 306 | return '附件服务证书异常,请稍后再试' | ||
| 307 | } | ||
| 308 | return msg.length > 40 ? msg.slice(0, 40) : msg | ||
| 266 | } | 309 | } |
| 267 | 310 | ||
| 268 | function isAttachmentImage(file) { | 311 | function isAttachmentImage(file) { |
| ... | @@ -282,6 +325,16 @@ function getRedirectUrl(header = {}) { | ... | @@ -282,6 +325,16 @@ function getRedirectUrl(header = {}) { |
| 282 | return `${trimBaseUrl(config.baseUrl_api)}/${String(location).replace(/^\/+/, '')}` | 325 | return `${trimBaseUrl(config.baseUrl_api)}/${String(location).replace(/^\/+/, '')}` |
| 283 | } | 326 | } |
| 284 | 327 | ||
| 328 | function isFileDownloadUrl(url) { | ||
| 329 | const value = String(url || '') | ||
| 330 | return value.includes('/fileServer/download') || value.startsWith('fileServer/download') | ||
| 331 | } | ||
| 332 | |||
| 333 | function getQueryParam(url, key) { | ||
| 334 | const match = String(url || '').match(new RegExp(`[?&]${key}=([^&#]+)`)) | ||
| 335 | return match ? safeDecodeURIComponent(match[1]) : '' | ||
| 336 | } | ||
| 337 | |||
| 285 | function isValidUrlValue(value) { | 338 | function isValidUrlValue(value) { |
| 286 | if (value === undefined || value === null) return false | 339 | if (value === undefined || value === null) return false |
| 287 | const url = String(value).trim() | 340 | const url = String(value).trim() | ... | ... |
| ... | @@ -56,20 +56,20 @@ | ... | @@ -56,20 +56,20 @@ |
| 56 | 56 | ||
| 57 | <view class="mainbox"> | 57 | <view class="mainbox"> |
| 58 | <uni-list> | 58 | <uni-list> |
| 59 | <view class="auth-row"> | 59 | <view class="auth-row"> |
| 60 | <view class="auth-label">营业执照</view> | 60 | <view class="auth-label">营业执照</view> |
| 61 | <view class="auth-value"> | 61 | <view class="auth-value"> |
| 62 | <view v-if="form.businessLicenseArr&&form.businessLicenseArr?.length>0" class="frrr license-footer" | 62 | <view v-if="form.businessLicenseArr&&form.businessLicenseArr?.length>0" class="frrr license-footer" |
| 63 | @click="download(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)"> | 63 | @click="download(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)"> |
| 64 | <image v-if="isImageUrl(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)" :src="form.businessLicenseArr[0]?.url" class="ylImage" mode="aspectFit"></image> | 64 | <image v-if="isImageUrl(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)" :src="form.businessLicenseArr[0]?.url" class="ylImage" mode="aspectFit"></image> |
| 65 | <text v-else class="text-primary">{{ form.businessLicenseArr[0]?.name }}</text> | 65 | <text v-else class="text-primary">{{ form.businessLicenseArr[0]?.name }}</text> |
| 66 | </view> | 66 | </view> |
| 67 | </view> | 67 | </view> |
| 68 | </view> | 68 | </view> |
| 69 | <uni-list-item :rightText="form.companyName||'--'" title="营业执照名称"/> | 69 | <uni-list-item :rightText="form.companyName||'--'" title="营业执照名称"/> |
| 70 | <uni-list-item :rightText="form.creditCode||'--'" title="社会信用代码"/> | 70 | <uni-list-item :rightText="form.creditCode||'--'" title="社会信用代码"/> |
| 71 | <uni-list-item v-if="form.menCode" :rightText="form.menCode" title="会员编号"/> | 71 | <uni-list-item v-if="form.menCode" :rightText="form.menCode" title="会员编号"/> |
| 72 | <uni-list-item :rightText="form.name" title="机构名称"/> | 72 | <uni-list-item :rightText="form.name" title="机构名称"/> |
| 73 | <!-- <uni-list-item title="所属省份"> | 73 | <!-- <uni-list-item title="所属省份"> |
| 74 | <template v-slot:footer> | 74 | <template v-slot:footer> |
| 75 | <view class="frrr"> | 75 | <view class="frrr"> |
| ... | @@ -79,9 +79,9 @@ | ... | @@ -79,9 +79,9 @@ |
| 79 | </view> | 79 | </view> |
| 80 | </template> | 80 | </template> |
| 81 | </uni-list-item> --> | 81 | </uni-list-item> --> |
| 82 | <uni-list-item title="认证地址"> | 82 | <uni-list-item title="认证地址"> |
| 83 | <template v-slot:footer> | 83 | <template v-slot:footer> |
| 84 | <view class="frrr"> | 84 | <view class="frrr"> |
| 85 | <uni-data-picker v-if="form.certRegionId" v-model="form.certRegionId" :clear-icon="false" | 85 | <uni-data-picker v-if="form.certRegionId" v-model="form.certRegionId" :clear-icon="false" |
| 86 | :localdata="options" readonly> | 86 | :localdata="options" readonly> |
| 87 | </uni-data-picker> | 87 | </uni-data-picker> |
| ... | @@ -93,31 +93,31 @@ | ... | @@ -93,31 +93,31 @@ |
| 93 | </uni-data-picker> | 93 | </uni-data-picker> |
| 94 | </view> | 94 | </view> |
| 95 | </template> | 95 | </template> |
| 96 | </uni-list-item> | 96 | </uni-list-item> |
| 97 | <uni-list-item :rightText="form.certAddress" title="认证详细地址"/> | 97 | <uni-list-item :rightText="form.certAddress" title="认证详细地址"/> |
| 98 | <uni-list-item v-if="authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3" | 98 | <uni-list-item v-if="authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3" |
| 99 | :rightText="form.aname" title="所属协会"> | 99 | :rightText="form.aname" title="所属协会"> |
| 100 | </uni-list-item> | 100 | </uni-list-item> |
| 101 | <uni-list-item clickable title="法人身份证"> | 101 | <uni-list-item clickable title="法人身份证"> |
| 102 | <template v-slot:footer> | 102 | <template v-slot:footer> |
| 103 | <view v-if="form.legalIdcPhotoArr&&form.legalIdcPhotoArr?.length>0" class="frrr"> | 103 | <view v-if="form.legalIdcPhotoArr&&form.legalIdcPhotoArr?.length>0" class="frrr"> |
| 104 | <image v-for="(item,index) in form.legalIdcPhotoArr" :key="item" :src="item" | 104 | <image v-for="(item,index) in form.legalIdcPhotoArr" :key="item" :src="item" |
| 105 | class="ylImage" mode="aspectFit" @click="showImage(form.legalIdcPhotoArr,index)"> | 105 | class="ylImage" mode="aspectFit" @click="showImage(form.legalIdcPhotoArr,index)"> |
| 106 | </image> | 106 | </image> |
| 107 | </view> | 107 | </view> |
| 108 | </template> | 108 | </template> |
| 109 | </uni-list-item> | 109 | </uni-list-item> |
| 110 | <uni-list-item :rightText="form.certLegal||'--'" title="法人姓名"/> | 110 | <uni-list-item :rightText="form.certLegal||'--'" title="法人姓名"/> |
| 111 | <uni-list-item :rightText="form.certLegalIdcCode||form.legalIdcCode||'--'" title="法人证件号"/> | 111 | <uni-list-item :rightText="form.certLegalIdcCode||form.legalIdcCode||'--'" title="法人证件号"/> |
| 112 | <uni-list-item v-if="form.certSiteContact" :rightText="form.certSiteContact" title="联系人"/> | 112 | <uni-list-item v-if="form.certSiteContact" :rightText="form.certSiteContact" title="联系人"/> |
| 113 | <uni-list-item v-else :rightText="form.contact" title="联系人"/> | 113 | <uni-list-item v-else :rightText="form.contact" title="联系人"/> |
| 114 | <uni-list-item v-if="form.certSiteTel" :rightText="form.certSiteTel" title="联系方式"/> | 114 | <uni-list-item v-if="form.certSiteTel" :rightText="form.certSiteTel" title="联系方式"/> |
| 115 | <uni-list-item v-else :rightText="form.phone" title="联系方式"/> | 115 | <uni-list-item v-else :rightText="form.phone" title="联系方式"/> |
| 116 | 116 | ||
| 117 | <uni-list-item v-if="form.deptType==6" :rightText="form.isPoints==0?'是':'否'" title="是否为考点"/> | 117 | <uni-list-item v-if="form.deptType==6" :rightText="form.isPoints==0?'是':'否'" title="是否为考点"/> |
| 118 | <uni-list-item clickable title="机构照片"> | 118 | <uni-list-item clickable title="机构照片"> |
| 119 | <template v-slot:footer> | 119 | <template v-slot:footer> |
| 120 | <view class="frrr"> | 120 | <view class="frrr"> |
| 121 | <view v-if="form.picturesArr&&form.picturesArr?.length>0" class="photoBook" | 121 | <view v-if="form.picturesArr&&form.picturesArr?.length>0" class="photoBook" |
| 122 | @click="showImage(form.picturesArr,0)"> | 122 | @click="showImage(form.picturesArr,0)"> |
| 123 | <image :src="form.picturesArr[0]" class="ylImage" mode="aspectFit"> | 123 | <image :src="form.picturesArr[0]" class="ylImage" mode="aspectFit"> |
| ... | @@ -149,8 +149,8 @@ | ... | @@ -149,8 +149,8 @@ |
| 149 | </template> | 149 | </template> |
| 150 | 150 | ||
| 151 | <script setup> | 151 | <script setup> |
| 152 | import * as api from '@/common/api.js' | 152 | import * as api from '@/common/api.js' |
| 153 | import { fillImgUrl, isImageUrl, previewAttachment } from '@/common/utils.js' | 153 | import { fillImgUrl, isImageUrl, previewAttachment } from '@/common/utils.js' |
| 154 | 154 | ||
| 155 | import _ from 'underscore' | 155 | import _ from 'underscore' |
| 156 | import { | 156 | import { |
| ... | @@ -209,23 +209,23 @@ function init() { | ... | @@ -209,23 +209,23 @@ function init() { |
| 209 | api.regionsList().then(res => { | 209 | api.regionsList().then(res => { |
| 210 | options.value = res.data | 210 | options.value = res.data |
| 211 | }) | 211 | }) |
| 212 | api.getMyOwnMemberInfo().then(res => { | 212 | api.getMyOwnMemberInfo().then(res => { |
| 213 | console.log(res) | 213 | console.log(res) |
| 214 | if (!res.data.memberInfo) { | 214 | if (!res.data.memberInfo) { |
| 215 | res.data.memberInfo = {} | 215 | res.data.memberInfo = {} |
| 216 | } | 216 | } |
| 217 | if (!res.data.dept) { | 217 | if (!res.data.dept) { |
| 218 | res.data.dept = {} | 218 | res.data.dept = {} |
| 219 | } | 219 | } |
| 220 | userType.value = app.globalData.userType | 220 | userType.value = app.globalData.userType |
| 221 | newResult.value = res.data.newResult | 221 | newResult.value = res.data.newResult |
| 222 | result.value = res.data.result | 222 | result.value = res.data.result |
| 223 | resultNoProvince.value = res.data.resultNoProvince2 | 223 | resultNoProvince.value = res.data.resultNoProvince2 |
| 224 | authenticationStatusa.value = res.data.authenticationStatus | 224 | authenticationStatusa.value = res.data.authenticationStatus |
| 225 | showDirectly.value = !res.data.memberInfo.associateId | 225 | showDirectly.value = !res.data.memberInfo.associateId |
| 226 | associateId.value = res.data.memberInfo.associateId | 226 | associateId.value = res.data.memberInfo.associateId |
| 227 | activeStatus.value = res.data.memberInfo.activeStatus | 227 | activeStatus.value = res.data.memberInfo.activeStatus |
| 228 | pr.value = res.data.pr || {} | 228 | pr.value = res.data.pr || {} |
| 229 | directUnderFlag.value = res.data.memberInfo.directUnderFlag | 229 | directUnderFlag.value = res.data.memberInfo.directUnderFlag |
| 230 | if (authenticationStatusa.value == 0) { | 230 | if (authenticationStatusa.value == 0) { |
| 231 | btn.value = false | 231 | btn.value = false |
| ... | @@ -246,7 +246,7 @@ function init() { | ... | @@ -246,7 +246,7 @@ function init() { |
| 246 | flag.value = true | 246 | flag.value = true |
| 247 | } | 247 | } |
| 248 | } | 248 | } |
| 249 | form.value = { | 249 | form.value = { |
| 250 | ...res.data.dept, | 250 | ...res.data.dept, |
| 251 | ...res.data.memberInfo | 251 | ...res.data.memberInfo |
| 252 | } | 252 | } |
| ... | @@ -261,19 +261,19 @@ function init() { | ... | @@ -261,19 +261,19 @@ function init() { |
| 261 | applicationForMembership1.value = form.value.applicationForMembership || [] | 261 | applicationForMembership1.value = form.value.applicationForMembership || [] |
| 262 | form.value.deptType = res.data.dept.deptType | 262 | form.value.deptType = res.data.dept.deptType |
| 263 | 263 | ||
| 264 | const imageSource = { | 264 | const imageSource = { |
| 265 | ...res.data.dept, | 265 | ...res.data.dept, |
| 266 | ...res.data.memberInfo, | 266 | ...res.data.memberInfo, |
| 267 | ...pr.value | 267 | ...pr.value |
| 268 | } | 268 | } |
| 269 | form.value.businessLicenseArr = parseFileList(imageSource.certBusinessLicense || imageSource.businessLicense, '营业执照') | 269 | form.value.businessLicenseArr = parseFileList(imageSource.businessLicense , '营业执照') |
| 270 | form.value.legalIdcPhotoArr = parseImageList(imageSource.certLegalIdcPhoto || imageSource.legalIdcPhoto) | 270 | form.value.legalIdcPhotoArr = parseImageList(imageSource.certLegalIdcPhoto || imageSource.legalIdcPhoto) |
| 271 | form.value.picturesArr = parseImageList(imageSource.certPictures || imageSource.pictures) | 271 | form.value.picturesArr = parseImageList(imageSource.certPictures || imageSource.pictures) |
| 272 | console.log('营业执照', form.value.businessLicenseArr) | 272 | console.log('营业执照', form.value.businessLicenseArr) |
| 273 | console.log('法人身份证', form.value.legalIdcPhotoArr) | 273 | console.log('法人身份证', form.value.legalIdcPhotoArr) |
| 274 | console.log('机构照片', form.value.picturesArr) | 274 | console.log('机构照片', form.value.picturesArr) |
| 275 | }) | 275 | }) |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | async function getMyStatusAPI() { | 278 | async function getMyStatusAPI() { |
| 279 | const { | 279 | const { |
| ... | @@ -338,52 +338,52 @@ function auditEditFN(type) { | ... | @@ -338,52 +338,52 @@ function auditEditFN(type) { |
| 338 | }) | 338 | }) |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | function showImage(arr, index) { | 341 | function showImage(arr, index) { |
| 342 | uni.previewImage({ | 342 | uni.previewImage({ |
| 343 | urls: arr, | 343 | urls: arr, |
| 344 | current: index, | 344 | current: index, |
| 345 | success: function (res) { | 345 | success: function (res) { |
| 346 | } | 346 | } |
| 347 | }) | 347 | }) |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | function parseFileList(value, name) { | 350 | function parseFileList(value, name) { |
| 351 | if (!value) return [] | 351 | if (!value) return [] |
| 352 | try { | 352 | try { |
| 353 | const parsed = JSON.parse(value) | 353 | const parsed = JSON.parse(value) |
| 354 | const list = Array.isArray(parsed) ? parsed : [parsed] | 354 | const list = Array.isArray(parsed) ? parsed : [parsed] |
| 355 | return list.filter(item => item?.url || item).map(item => { | 355 | return list.filter(item => item?.url || item).map(item => { |
| 356 | const rawUrl = item.url || item | 356 | const rawUrl = item.url || item |
| 357 | return { | 357 | return { |
| 358 | ...item, | 358 | ...item, |
| 359 | name: item.name || name, | 359 | name: item.name || name, |
| 360 | rawUrl, | 360 | rawUrl, |
| 361 | url: fillImgUrl(rawUrl) | 361 | url: fillImgUrl(rawUrl) |
| 362 | } | 362 | } |
| 363 | }) | 363 | }) |
| 364 | } catch (e) { | 364 | } catch (e) { |
| 365 | return [{ | 365 | return [{ |
| 366 | name, | 366 | name, |
| 367 | rawUrl: value, | 367 | rawUrl: value, |
| 368 | url: fillImgUrl(value) | 368 | url: fillImgUrl(value) |
| 369 | }] | 369 | }] |
| 370 | } | 370 | } |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | function parseImageList(value) { | 373 | function parseImageList(value) { |
| 374 | if (!value) return [] | 374 | if (!value) return [] |
| 375 | return String(value) | 375 | return String(value) |
| 376 | .split(',') | 376 | .split(',') |
| 377 | .map(item => item.trim()) | 377 | .map(item => item.trim()) |
| 378 | .filter(Boolean) | 378 | .filter(Boolean) |
| 379 | .map(item => fillImgUrl(item)) | 379 | .map(item => fillImgUrl(item)) |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | function download(url) { | 382 | function download(url) { |
| 383 | previewAttachment(url, { title: '查看附件' }) | 383 | previewAttachment(url, { title: '查看附件' }) |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | function payTheFees() { | 386 | function payTheFees() { |
| 387 | if (!form.value.name) { | 387 | if (!form.value.name) { |
| 388 | uni.showToast({ | 388 | uni.showToast({ |
| 389 | title: `请先完善单位信息`, | 389 | title: `请先完善单位信息`, |
| ... | @@ -434,9 +434,9 @@ function payTheFees() { | ... | @@ -434,9 +434,9 @@ function payTheFees() { |
| 434 | border-radius: 8rpx; | 434 | border-radius: 8rpx; |
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | .photoBook { | 437 | .photoBook { |
| 438 | position: relative; | 438 | position: relative; |
| 439 | border-radius: 10rpx; | 439 | border-radius: 10rpx; |
| 440 | overflow: hidden; | 440 | overflow: hidden; |
| 441 | 441 | ||
| 442 | &::after { | 442 | &::after { |
| ... | @@ -456,49 +456,49 @@ function payTheFees() { | ... | @@ -456,49 +456,49 @@ function payTheFees() { |
| 456 | color: #fff; | 456 | color: #fff; |
| 457 | bottom: 4rpx; | 457 | bottom: 4rpx; |
| 458 | right: 8rpx; | 458 | right: 8rpx; |
| 459 | } | 459 | } |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | .auth-row { | 462 | .auth-row { |
| 463 | display: flex; | 463 | display: flex; |
| 464 | align-items: flex-start; | 464 | align-items: flex-start; |
| 465 | min-height: 96rpx; | 465 | min-height: 96rpx; |
| 466 | padding: 24rpx 30rpx; | 466 | padding: 24rpx 30rpx; |
| 467 | border-bottom: 1rpx solid #eee; | 467 | border-bottom: 1rpx solid #eee; |
| 468 | box-sizing: border-box; | 468 | box-sizing: border-box; |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | .auth-label { | 471 | .auth-label { |
| 472 | flex: 0 0 auto; | 472 | flex: 0 0 auto; |
| 473 | color: #999; | 473 | color: #999; |
| 474 | font-size: 28rpx; | 474 | font-size: 28rpx; |
| 475 | line-height: 40rpx; | 475 | line-height: 40rpx; |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | .auth-value { | 478 | .auth-value { |
| 479 | flex: 1; | 479 | flex: 1; |
| 480 | min-width: 0; | 480 | min-width: 0; |
| 481 | display: flex; | 481 | display: flex; |
| 482 | justify-content: flex-end; | 482 | justify-content: flex-end; |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | .frrr { | 485 | .frrr { |
| 486 | width: 100%; | 486 | width: 100%; |
| 487 | text-align: right; | 487 | text-align: right; |
| 488 | display: flex; | 488 | display: flex; |
| 489 | flex-wrap: wrap; | 489 | flex-wrap: wrap; |
| 490 | justify-content: flex-end; | 490 | justify-content: flex-end; |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | .license-footer { | 493 | .license-footer { |
| 494 | min-width: 300rpx; | 494 | min-width: 300rpx; |
| 495 | margin-left: auto; | 495 | margin-left: auto; |
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | :deep(.selected-list) { | 498 | :deep(.selected-list) { |
| 499 | font-size: 32rpx; | 499 | font-size: 32rpx; |
| 500 | padding: 0; | 500 | padding: 0; |
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | :deep(.input-value) { | 503 | :deep(.input-value) { |
| 504 | padding: 0; | 504 | padding: 0; |
| ... | @@ -509,10 +509,10 @@ function payTheFees() { | ... | @@ -509,10 +509,10 @@ function payTheFees() { |
| 509 | color: #000; | 509 | color: #000; |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | :deep(.uni-list-item__extra) { | 512 | :deep(.uni-list-item__extra) { |
| 513 | flex: 1 1 auto; | 513 | flex: 1 1 auto; |
| 514 | min-width: 0; | 514 | min-width: 0; |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | :deep(.uni-list-item__content) { | 517 | :deep(.uni-list-item__content) { |
| 518 | flex: 0 0 auto; | 518 | flex: 0 0 auto; | ... | ... |
| ... | @@ -251,6 +251,7 @@ | ... | @@ -251,6 +251,7 @@ |
| 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 currentBusinessLicenseAddress = ref('') | ||
| 254 | const carriedReadonlyFields = ['companyName', 'creditCode', 'name', 'address', 'adress', 'parentId', 'legal', 'legalIdcCode'] | 255 | const carriedReadonlyFields = ['companyName', 'creditCode', 'name', 'address', 'adress', 'parentId', 'legal', 'legalIdcCode'] |
| 255 | 256 | ||
| 256 | function isFieldDisabled(field) { | 257 | function isFieldDisabled(field) { |
| ... | @@ -281,9 +282,21 @@ | ... | @@ -281,9 +282,21 @@ |
| 281 | } | 282 | } |
| 282 | } | 283 | } |
| 283 | 284 | ||
| 284 | function unlockOcrFields() { | 285 | function unlockOcrFields() { |
| 285 | ocrLockedFields.value = {} | 286 | ocrLockedFields.value = {} |
| 286 | } | 287 | } |
| 288 | |||
| 289 | function clearBusinessLicenseUpload() { | ||
| 290 | selectFileValue = {} | ||
| 291 | form.value.businessLicense = '' | ||
| 292 | currentBusinessLicenseAddress.value = '' | ||
| 293 | } | ||
| 294 | |||
| 295 | function lockParentIdField() { | ||
| 296 | if (hasValue(form.value.parentId)) { | ||
| 297 | ocrLockedFields.value.parentId = true | ||
| 298 | } | ||
| 299 | } | ||
| 287 | 300 | ||
| 288 | onLoad(option => { | 301 | onLoad(option => { |
| 289 | if (app.globalData.isLogin) { | 302 | if (app.globalData.isLogin) { |
| ... | @@ -295,11 +308,14 @@ | ... | @@ -295,11 +308,14 @@ |
| 295 | } | 308 | } |
| 296 | }); | 309 | }); |
| 297 | 310 | ||
| 298 | async function init() { | 311 | async function init() { |
| 299 | getRegionsList() | 312 | await Promise.all([ |
| 300 | await getForm() | 313 | getRegionsList(), |
| 301 | await canUseDiscountApi() | 314 | getTree() |
| 302 | await getZtxDiscountPolicyApi() | 315 | ]) |
| 316 | await getForm() | ||
| 317 | await canUseDiscountApi() | ||
| 318 | await getZtxDiscountPolicyApi() | ||
| 303 | handelGetMyRecent() | 319 | handelGetMyRecent() |
| 304 | } | 320 | } |
| 305 | 321 | ||
| ... | @@ -340,11 +356,10 @@ | ... | @@ -340,11 +356,10 @@ |
| 340 | flag.value = newResult.value | 356 | flag.value = newResult.value |
| 341 | } | 357 | } |
| 342 | 358 | ||
| 343 | form.value = { | 359 | form.value = { |
| 344 | ...res.data.dept, | 360 | ...res.data.dept, |
| 345 | ...res.data.memberInfo | 361 | ...res.data.memberInfo |
| 346 | } | 362 | } |
| 347 | getTree() | ||
| 348 | form.value.deptType = res.data.dept.deptType | 363 | form.value.deptType = res.data.dept.deptType |
| 349 | form.value.parentId = form.value.parentId ?? '' | 364 | form.value.parentId = form.value.parentId ?? '' |
| 350 | // creditCode.value = form.value.creditCode | 365 | // creditCode.value = form.value.creditCode |
| ... | @@ -383,6 +398,8 @@ | ... | @@ -383,6 +398,8 @@ |
| 383 | 398 | ||
| 384 | creditCode.value = form.value.creditCode | 399 | creditCode.value = form.value.creditCode |
| 385 | parentId.value = form.value.parentId | 400 | parentId.value = form.value.parentId |
| 401 | restoreAssoFullName() | ||
| 402 | lockParentIdField() | ||
| 386 | companyName.value = form.value.companyName | 403 | companyName.value = form.value.companyName |
| 387 | legal.value = form.value.legal | 404 | legal.value = form.value.legal |
| 388 | legalIdcCode.value = form.value.legalIdcCode | 405 | legalIdcCode.value = form.value.legalIdcCode |
| ... | @@ -408,7 +425,7 @@ | ... | @@ -408,7 +425,7 @@ |
| 408 | } | 425 | } |
| 409 | 426 | ||
| 410 | function getRegionsList() { | 427 | function getRegionsList() { |
| 411 | api.regionsList().then(res => { | 428 | return api.regionsList().then(res => { |
| 412 | regionsList.value = res.data; | 429 | regionsList.value = res.data; |
| 413 | }); | 430 | }); |
| 414 | } | 431 | } |
| ... | @@ -465,16 +482,24 @@ | ... | @@ -465,16 +482,24 @@ |
| 465 | }) | 482 | }) |
| 466 | return | 483 | return |
| 467 | } | 484 | } |
| 468 | if (form.value.parentId == -1 || form.value.parentId == 0) { | 485 | if (form.value.parentId == -1 || form.value.parentId == 0) { |
| 469 | uni.showToast({ | 486 | uni.showToast({ |
| 470 | title: '请选择所属协会', | 487 | title: '请选择所属协会', |
| 471 | icon: 'none' | 488 | icon: 'none' |
| 472 | }) | 489 | }) |
| 473 | return | 490 | return |
| 474 | } | 491 | } |
| 475 | if (legalIdcPhoto1.value == '' || legalIdcPhoto2.value == '') { | 492 | if (currentBusinessLicenseAddress.value && !validateBusinessLicenseProvince(currentBusinessLicenseAddress.value)) { |
| 476 | uni.showToast({ | 493 | uni.showToast({ |
| 477 | title: '请上传法人身份证', | 494 | title: '请上传省内的营业执照', |
| 495 | icon: 'none', | ||
| 496 | duration: 3000 | ||
| 497 | }) | ||
| 498 | return | ||
| 499 | } | ||
| 500 | if (legalIdcPhoto1.value == '' || legalIdcPhoto2.value == '') { | ||
| 501 | uni.showToast({ | ||
| 502 | title: '请上传法人身份证', | ||
| 478 | icon: 'none' | 503 | icon: 'none' |
| 479 | }) | 504 | }) |
| 480 | return | 505 | return |
| ... | @@ -895,55 +920,39 @@ | ... | @@ -895,55 +920,39 @@ |
| 895 | return true | 920 | return true |
| 896 | } | 921 | } |
| 897 | 922 | ||
| 898 | function findAssoPathByRegionNames(regionPath) { | ||
| 899 | if (!regionPath?.length || !tree.value?.length) return null | ||
| 900 | const names = regionPath.map(node => normalizeAddressText(getNodeText(node))).filter(Boolean) | ||
| 901 | const candidates = [] | ||
| 902 | |||
| 903 | function walk(listData, path) { | ||
| 904 | for (const item of listData || []) { | ||
| 905 | const itemName = normalizeAddressText(getNodeText(item)) | ||
| 906 | const nextPath = [...path, item] | ||
| 907 | const score = names.reduce((total, name, index) => { | ||
| 908 | const shortName = name.replace(/省|市|区|县|自治区|壮族自治区|回族自治区|维吾尔自治区|地区|自治州|盟|旗/g, '') | ||
| 909 | return total + (itemName.includes(name) || (shortName.length > 1 && itemName.includes(shortName)) ? index + 1 : 0) | ||
| 910 | }, 0) | ||
| 911 | if (score > 0) candidates.push({ path: nextPath, score }) | ||
| 912 | if (item.children?.length) walk(item.children, nextPath) | ||
| 913 | } | ||
| 914 | } | ||
| 915 | |||
| 916 | walk(tree.value, []) | ||
| 917 | candidates.sort((a, b) => b.score - a.score || b.path.length - a.path.length) | ||
| 918 | return candidates[0]?.path || null | ||
| 919 | } | ||
| 920 | |||
| 921 | function applyAssoPath(path) { | ||
| 922 | if (!path?.length) return false | ||
| 923 | const lastNode = path[path.length - 1] | ||
| 924 | form.value.parentId = getNodeValue(lastNode) || '' | ||
| 925 | assoFullName.value = getAssoFullName(path.map(node => ({ value: getNodeValue(node) }))) | ||
| 926 | lockOcrField('parentId', form.value.parentId) | ||
| 927 | return !!form.value.parentId | ||
| 928 | } | ||
| 929 | |||
| 930 | async function applyBusinessAddress(address) { | 923 | async function applyBusinessAddress(address) { |
| 931 | const businessAddress = String(address || '').trim() | 924 | const businessAddress = String(address || '').trim() |
| 932 | if (!businessAddress) return | 925 | if (!businessAddress) return false |
| 933 | form.value.adress = businessAddress | 926 | form.value.adress = businessAddress |
| 934 | lockOcrField('adress', businessAddress) | 927 | lockOcrField('adress', businessAddress) |
| 935 | 928 | ||
| 936 | if (!regionsList.value?.length) { | 929 | if (!regionsList.value?.length) { |
| 937 | await getRegionsList().catch(() => {}) | 930 | await getRegionsList().catch(() => {}) |
| 938 | } | 931 | } |
| 939 | if (!tree.value?.length) { | ||
| 940 | await getTree().catch(() => {}) | ||
| 941 | } | ||
| 942 | const regionPath = findRegionPathByAddress(businessAddress) | 932 | const regionPath = findRegionPathByAddress(businessAddress) |
| 943 | if (applyRegionPath(regionPath)) { | 933 | return applyRegionPath(regionPath) |
| 944 | const assoPath = findAssoPathByRegionNames(regionPath) | 934 | } |
| 945 | applyAssoPath(assoPath) | 935 | |
| 946 | } | 936 | function validateBusinessLicenseProvince(address) { |
| 937 | const businessAddress = String(address || '').trim() | ||
| 938 | if (!businessAddress) return true | ||
| 939 | const regionPath = findRegionPathByAddress(businessAddress) | ||
| 940 | const currentAssoName = assoFullName.value || getAssoName(form.value.parentId) | ||
| 941 | return isSameProvince(regionPath, currentAssoName) | ||
| 942 | } | ||
| 943 | |||
| 944 | function isSameProvince(regionPath, assoName) { | ||
| 945 | const regionProvince = normalizeProvinceName(getNodeText(regionPath?.[0])) | ||
| 946 | if (!regionProvince) return false | ||
| 947 | const normalizedAssoName = normalizeProvinceName(assoName) | ||
| 948 | return normalizedAssoName && ( | ||
| 949 | normalizedAssoName.includes(regionProvince) || | ||
| 950 | regionProvince.includes(normalizedAssoName) | ||
| 951 | ) | ||
| 952 | } | ||
| 953 | |||
| 954 | function normalizeProvinceName(name) { | ||
| 955 | return normalizeAddressText(name).replace(/省|市|自治区|壮族自治区|回族自治区|维吾尔自治区/g, '') | ||
| 947 | } | 956 | } |
| 948 | 957 | ||
| 949 | // 恢复协会完整路径名称 | 958 | // 恢复协会完整路径名称 |
| ... | @@ -1102,7 +1111,18 @@ | ... | @@ -1102,7 +1111,18 @@ |
| 1102 | lockOcrField('companyName', form.value.companyName) | 1111 | lockOcrField('companyName', form.value.companyName) |
| 1103 | lockOcrField('creditCode', form.value.creditCode) | 1112 | lockOcrField('creditCode', form.value.creditCode) |
| 1104 | lockOcrField('legal', form.value.legal) | 1113 | lockOcrField('legal', form.value.legal) |
| 1114 | currentBusinessLicenseAddress.value = ocrData.businessAddress || '' | ||
| 1105 | await applyBusinessAddress(ocrData.businessAddress) | 1115 | await applyBusinessAddress(ocrData.businessAddress) |
| 1116 | if (!validateBusinessLicenseProvince(ocrData.businessAddress)) { | ||
| 1117 | clearBusinessLicenseUpload() | ||
| 1118 | uni.hideLoading() | ||
| 1119 | uni.showToast({ | ||
| 1120 | title: '请上传省内的营业执照', | ||
| 1121 | icon: 'none', | ||
| 1122 | duration: 3000 | ||
| 1123 | }) | ||
| 1124 | return | ||
| 1125 | } | ||
| 1106 | await onCreditCodeBlur(false) | 1126 | await onCreditCodeBlur(false) |
| 1107 | } | 1127 | } |
| 1108 | selectFileValue = { | 1128 | selectFileValue = { |
| ... | @@ -1120,12 +1140,12 @@ | ... | @@ -1120,12 +1140,12 @@ |
| 1120 | }) | 1140 | }) |
| 1121 | } | 1141 | } |
| 1122 | } | 1142 | } |
| 1123 | 1143 | ||
| 1124 | function delSupplementFile() { | 1144 | function delSupplementFile() { |
| 1125 | selectFileValue = {} | 1145 | clearBusinessLicenseUpload() |
| 1126 | form.value.businessLicense = '' | 1146 | unlockOcrFields() |
| 1127 | unlockOcrFields() | 1147 | lockParentIdField() |
| 1128 | } | 1148 | } |
| 1129 | 1149 | ||
| 1130 | function getBusinessLicenseOcr(filePath) { | 1150 | function getBusinessLicenseOcr(filePath) { |
| 1131 | if (!filePath) return Promise.resolve(null) | 1151 | if (!filePath) return Promise.resolve(null) | ... | ... |
-
Please register or sign in to post a comment