Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨炀
/
ztx_wx_gzt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
8f77dd9a
authored
2026-06-12 11:12:10 +0800
by
lttnew
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
单位缴费校验营业执照
1 parent
4e1f81c6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
332 additions
and
259 deletions
common/utils.js
myCenter/auth.vue
myCenter/perfect.vue
common/utils.js
View file @
8f77dd9
...
...
@@ -89,7 +89,7 @@ export function fillMemberPhoto(item = {}, fallback = '') {
return
photo
?
fillImgUrl
(
photo
)
:
fallback
}
export
function
previewAttachment
(
file
,
options
=
{})
{
export
async
function
previewAttachment
(
file
,
options
=
{})
{
const
item
=
normalizeAttachment
(
file
)
const
rawUrl
=
item
.
rawUrl
||
item
.
url
const
previewUrl
=
getAttachmentPreviewUrl
(
rawUrl
,
0
)
...
...
@@ -101,6 +101,14 @@ export function previewAttachment(file, options = {}) {
return
}
if
(
isAttachmentImage
(
item
)
||
isImageUrl
(
rawUrl
)
||
isImageUrl
(
previewUrl
))
{
const
errorMsg
=
await
checkAttachmentError
(
previewUrl
)
if
(
errorMsg
)
{
uni
.
showToast
({
title
:
errorMsg
,
icon
:
'none'
})
return
}
uni
.
previewImage
({
urls
:
[
previewUrl
],
current
:
previewUrl
,
...
...
@@ -120,11 +128,7 @@ export function previewAttachment(file, options = {}) {
})
return
}
if
(
getAttachmentExt
(
item
)
===
'pdf'
&&
options
.
preferWebView
!==
false
)
{
openAttachmentWebView
(
previewUrl
,
options
.
title
||
'附件预览'
)
return
}
openDocumentAttachment
(
item
,
getAttachmentPreviewUrl
(
rawUrl
,
1
),
false
,
options
)
openDocumentAttachment
(
item
,
getAttachmentPreviewUrl
(
rawUrl
,
0
),
false
,
options
)
}
export
function
normalizeAttachment
(
file
)
{
...
...
@@ -163,7 +167,7 @@ export function getAttachmentPreviewUrl(url, downFlag = 0) {
const
value
=
String
(
url
).
trim
()
if
(
!
value
||
value
===
'null'
||
value
===
'undefined'
)
return
''
if
(
value
.
startsWith
(
'msr:'
))
{
return
`
${
trimBaseUrl
(
config
.
baseUrl_api
)}
/fileServer/download?file=
${
value
}
&downFlag=
${
downFlag
}
`
return
`
${
trimBaseUrl
(
config
.
baseUrl_api
)}
/fileServer/download?file=
${
encodeURIComponent
(
value
)
}
&downFlag=
${
downFlag
}
`
}
return
fillImgUrl
(
value
)
}
...
...
@@ -192,8 +196,6 @@ function openDocumentAttachment(item, url, retried = false, options = {}) {
uni
.
hideLoading
()
if
(
redirectUrl
)
{
openDocumentAttachment
(
item
,
redirectUrl
,
true
,
options
)
}
else
if
(
getAttachmentExt
(
item
)
===
'pdf'
)
{
openAttachmentWebView
(
getAttachmentPreviewUrl
(
item
.
rawUrl
||
item
.
url
,
0
),
options
.
title
||
'附件预览'
)
}
else
{
uni
.
showToast
({
title
:
'文件下载失败'
,
...
...
@@ -202,10 +204,7 @@ function openDocumentAttachment(item, url, retried = false, options = {}) {
}
return
}
uni
.
showToast
({
title
:
'文件下载失败'
,
icon
:
'none'
})
showAttachmentFailToast
(
url
,
'文件下载失败'
)
return
}
uni
.
openDocument
({
...
...
@@ -213,10 +212,6 @@ function openDocumentAttachment(item, url, retried = false, options = {}) {
fileType
:
getDocumentFileType
(
item
),
showMenu
:
true
,
fail
:
()
=>
{
if
(
getAttachmentExt
(
item
)
===
'pdf'
)
{
openAttachmentWebView
(
getAttachmentPreviewUrl
(
item
.
rawUrl
||
item
.
url
,
0
),
options
.
title
||
'附件预览'
)
return
}
uni
.
showToast
({
title
:
'文件暂不支持预览'
,
icon
:
'none'
...
...
@@ -225,14 +220,7 @@ function openDocumentAttachment(item, url, retried = false, options = {}) {
})
},
fail
:
()
=>
{
if
(
getAttachmentExt
(
item
)
===
'pdf'
)
{
openAttachmentWebView
(
getAttachmentPreviewUrl
(
item
.
rawUrl
||
item
.
url
,
0
),
options
.
title
||
'附件预览'
)
return
}
uni
.
showToast
({
title
:
'文件下载失败'
,
icon
:
'none'
})
showAttachmentFailToast
(
url
,
'文件下载失败'
)
},
complete
:
()
=>
{
uni
.
hideLoading
()
...
...
@@ -260,9 +248,64 @@ function openAttachmentWebView(url, title = '附件预览') {
}
function
getAttachmentExt
(
file
)
{
const
name
=
`
${
file
?.
extname
||
file
?.
name
||
file
?.
rawUrl
||
file
?.
url
||
''
}
`
const ext = name.includes('.') ? name.split('.').pop() : name
return ext.split('?')[0].toLowerCase()
const
name
=
`
${
file
?.
extname
||
file
?.
name
||
file
?.
rawUrl
||
file
?.
url
||
file
||
''
}
`
const fileParam = getQueryParam(name, 'file')
const cleanName = safeDecodeURIComponent(fileParam || name).split('?')[0].split('#')[0]
const fileName = cleanName.split('/').pop() || cleanName
const ext = fileName.includes('.') ? fileName.split('.').pop() : fileName
return ext.toLowerCase()
}
function checkAttachmentError(url) {
if (!isFileDownloadUrl(url)) return Promise.resolve('')
return new Promise(resolve => {
uni.request({
url,
method: 'GET',
header: {
Authorization: uni.getStorageSync('token') || ''
},
success: res => {
const data = parseAttachmentResponse(res.data)
if (res.statusCode >= 400 || (data && data.code && data.code !== 200)) {
resolve(getAttachmentErrorMsg(data))
return
}
resolve('')
},
fail: () => resolve('')
})
})
}
async function showAttachmentFailToast(url, fallback) {
const errorMsg = await checkAttachmentError(url)
uni.showToast({
title: errorMsg || fallback,
icon: 'none'
})
}
function parseAttachmentResponse(data) {
if (!data) return null
if (typeof data === 'object') return data
if (typeof data === 'string') {
try {
return JSON.parse(data)
} catch (e) {
return null
}
}
return null
}
function getAttachmentErrorMsg(data) {
const msg = data?.msg || data?.message || ''
if (!msg) return '附件预览失败'
if (msg.includes('Hostname') || msg.includes('certificate')) {
return '附件服务证书异常,请稍后再试'
}
return msg.length > 40 ? msg.slice(0, 40) : msg
}
function isAttachmentImage(file) {
...
...
@@ -282,6 +325,16 @@ function getRedirectUrl(header = {}) {
return `
$
{
trimBaseUrl
(
config
.
baseUrl_api
)}
/${String
(
location
)
.replace
(
/
^
\
/+
/, ''
)
}
`
}
function
isFileDownloadUrl
(
url
)
{
const
value
=
String
(
url
||
''
)
return
value
.
includes
(
'/fileServer/download'
)
||
value
.
startsWith
(
'fileServer/download'
)
}
function
getQueryParam
(
url
,
key
)
{
const
match
=
String
(
url
||
''
).
match
(
new
RegExp
(
`[?&]
${
key
}
=([^&#]+)`
))
return
match
?
safeDecodeURIComponent
(
match
[
1
])
:
''
}
function
isValidUrlValue
(
value
)
{
if
(
value
===
undefined
||
value
===
null
)
return
false
const
url
=
String
(
value
).
trim
()
...
...
myCenter/auth.vue
View file @
8f77dd9
...
...
@@ -56,20 +56,20 @@
<view
class=
"mainbox"
>
<uni-list>
<view
class=
"auth-row"
>
<view
class=
"auth-label"
>
营业执照
</view>
<view
class=
"auth-value"
>
<view
v-if=
"form.businessLicenseArr&&form.businessLicenseArr?.length>0"
class=
"frrr license-footer"
@
click=
"download(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)"
>
<image
v-if=
"isImageUrl(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)"
:src=
"form.businessLicenseArr[0]?.url"
class=
"ylImage"
mode=
"aspectFit"
></image>
<text
v-else
class=
"text-primary"
>
{{
form
.
businessLicenseArr
[
0
]?.
name
}}
</text>
</view>
</view>
</view>
<uni-list-item
:rightText=
"form.companyName||'--'"
title=
"营业执照名称"
/>
<uni-list-item
:rightText=
"form.creditCode||'--'"
title=
"社会信用代码"
/>
<uni-list-item
v-if=
"form.menCode"
:rightText=
"form.menCode"
title=
"会员编号"
/>
<uni-list-item
:rightText=
"form.name"
title=
"机构名称"
/>
<view
class=
"auth-row"
>
<view
class=
"auth-label"
>
营业执照
</view>
<view
class=
"auth-value"
>
<view
v-if=
"form.businessLicenseArr&&form.businessLicenseArr?.length>0"
class=
"frrr license-footer"
@
click=
"download(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)"
>
<image
v-if=
"isImageUrl(form.businessLicenseArr[0]?.rawUrl || form.businessLicenseArr[0]?.url)"
:src=
"form.businessLicenseArr[0]?.url"
class=
"ylImage"
mode=
"aspectFit"
></image>
<text
v-else
class=
"text-primary"
>
{{
form
.
businessLicenseArr
[
0
]?.
name
}}
</text>
</view>
</view>
</view>
<uni-list-item
:rightText=
"form.companyName||'--'"
title=
"营业执照名称"
/>
<uni-list-item
:rightText=
"form.creditCode||'--'"
title=
"社会信用代码"
/>
<uni-list-item
v-if=
"form.menCode"
:rightText=
"form.menCode"
title=
"会员编号"
/>
<uni-list-item
:rightText=
"form.name"
title=
"机构名称"
/>
<!--
<uni-list-item
title=
"所属省份"
>
<template
v-slot:footer
>
<view
class=
"frrr"
>
...
...
@@ -79,9 +79,9 @@
</view>
</
template
>
</uni-list-item>
-->
<uni-list-item
title=
"认证地址"
>
<
template
v-slot:footer
>
<view
class=
"frrr"
>
<uni-list-item
title=
"认证地址"
>
<
template
v-slot:footer
>
<view
class=
"frrr"
>
<uni-data-picker
v-if=
"form.certRegionId"
v-model=
"form.certRegionId"
:clear-icon=
"false"
:localdata=
"options"
readonly
>
</uni-data-picker>
...
...
@@ -93,31 +93,31 @@
</uni-data-picker>
</view>
</
template
>
</uni-list-item>
<uni-list-item
:rightText=
"form.certAddress"
title=
"认证详细地址"
/>
<uni-list-item
v-if=
"authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3"
:rightText=
"form.aname"
title=
"所属协会"
>
</uni-list-item>
<uni-list-item
clickable
title=
"法人身份证"
>
<
template
v-slot:footer
>
<view
v-if=
"form.legalIdcPhotoArr&&form.legalIdcPhotoArr?.length>0"
class=
"frrr"
>
<image
v-for=
"(item,index) in form.legalIdcPhotoArr"
:key=
"item"
:src=
"item"
class=
"ylImage"
mode=
"aspectFit"
@
click=
"showImage(form.legalIdcPhotoArr,index)"
>
</image>
</view>
</
template
>
</uni-list-item>
<uni-list-item
:rightText=
"form.certLegal||'--'"
title=
"法人姓名"
/>
<uni-list-item
:rightText=
"form.certLegalIdcCode||form.legalIdcCode||'--'"
title=
"法人证件号"
/>
<uni-list-item
v-if=
"form.certSiteContact"
:rightText=
"form.certSiteContact"
title=
"联系人"
/>
<uni-list-item
v-else
:rightText=
"form.contact"
title=
"联系人"
/>
<uni-list-item
v-if=
"form.certSiteTel"
:rightText=
"form.certSiteTel"
title=
"联系方式"
/>
<uni-list-item
v-else
:rightText=
"form.phone"
title=
"联系方式"
/>
<uni-list-item
v-if=
"form.deptType==6"
:rightText=
"form.isPoints==0?'是':'否'"
title=
"是否为考点"
/>
<uni-list-item
clickable
title=
"机构照片"
>
<
template
v-slot:footer
>
<view
class=
"frrr"
>
</uni-list-item>
<uni-list-item
:rightText=
"form.certAddress"
title=
"认证详细地址"
/>
<uni-list-item
v-if=
"authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3"
:rightText=
"form.aname"
title=
"所属协会"
>
</uni-list-item>
<uni-list-item
clickable
title=
"法人身份证"
>
<
template
v-slot:footer
>
<view
v-if=
"form.legalIdcPhotoArr&&form.legalIdcPhotoArr?.length>0"
class=
"frrr"
>
<image
v-for=
"(item,index) in form.legalIdcPhotoArr"
:key=
"item"
:src=
"item"
class=
"ylImage"
mode=
"aspectFit"
@
click=
"showImage(form.legalIdcPhotoArr,index)"
>
</image>
</view>
</
template
>
</uni-list-item>
<uni-list-item
:rightText=
"form.certLegal||'--'"
title=
"法人姓名"
/>
<uni-list-item
:rightText=
"form.certLegalIdcCode||form.legalIdcCode||'--'"
title=
"法人证件号"
/>
<uni-list-item
v-if=
"form.certSiteContact"
:rightText=
"form.certSiteContact"
title=
"联系人"
/>
<uni-list-item
v-else
:rightText=
"form.contact"
title=
"联系人"
/>
<uni-list-item
v-if=
"form.certSiteTel"
:rightText=
"form.certSiteTel"
title=
"联系方式"
/>
<uni-list-item
v-else
:rightText=
"form.phone"
title=
"联系方式"
/>
<uni-list-item
v-if=
"form.deptType==6"
:rightText=
"form.isPoints==0?'是':'否'"
title=
"是否为考点"
/>
<uni-list-item
clickable
title=
"机构照片"
>
<
template
v-slot:footer
>
<view
class=
"frrr"
>
<view
v-if=
"form.picturesArr&&form.picturesArr?.length>0"
class=
"photoBook"
@
click=
"showImage(form.picturesArr,0)"
>
<image
:src=
"form.picturesArr[0]"
class=
"ylImage"
mode=
"aspectFit"
>
...
...
@@ -149,8 +149,8 @@
</template>
<
script
setup
>
import
*
as
api
from
'@/common/api.js'
import
{
fillImgUrl
,
isImageUrl
,
previewAttachment
}
from
'@/common/utils.js'
import
*
as
api
from
'@/common/api.js'
import
{
fillImgUrl
,
isImageUrl
,
previewAttachment
}
from
'@/common/utils.js'
import
_
from
'underscore'
import
{
...
...
@@ -209,23 +209,23 @@ function init() {
api
.
regionsList
().
then
(
res
=>
{
options
.
value
=
res
.
data
})
api
.
getMyOwnMemberInfo
().
then
(
res
=>
{
console
.
log
(
res
)
if
(
!
res
.
data
.
memberInfo
)
{
res
.
data
.
memberInfo
=
{}
}
if
(
!
res
.
data
.
dept
)
{
res
.
data
.
dept
=
{}
}
userType
.
value
=
app
.
globalData
.
userType
newResult
.
value
=
res
.
data
.
newResult
result
.
value
=
res
.
data
.
result
api
.
getMyOwnMemberInfo
().
then
(
res
=>
{
console
.
log
(
res
)
if
(
!
res
.
data
.
memberInfo
)
{
res
.
data
.
memberInfo
=
{}
}
if
(
!
res
.
data
.
dept
)
{
res
.
data
.
dept
=
{}
}
userType
.
value
=
app
.
globalData
.
userType
newResult
.
value
=
res
.
data
.
newResult
result
.
value
=
res
.
data
.
result
resultNoProvince
.
value
=
res
.
data
.
resultNoProvince2
authenticationStatusa
.
value
=
res
.
data
.
authenticationStatus
showDirectly
.
value
=
!
res
.
data
.
memberInfo
.
associateId
associateId
.
value
=
res
.
data
.
memberInfo
.
associateId
activeStatus
.
value
=
res
.
data
.
memberInfo
.
activeStatus
pr
.
value
=
res
.
data
.
pr
||
{}
pr
.
value
=
res
.
data
.
pr
||
{}
directUnderFlag
.
value
=
res
.
data
.
memberInfo
.
directUnderFlag
if
(
authenticationStatusa
.
value
==
0
)
{
btn
.
value
=
false
...
...
@@ -246,7 +246,7 @@ function init() {
flag
.
value
=
true
}
}
form
.
value
=
{
form
.
value
=
{
...
res
.
data
.
dept
,
...
res
.
data
.
memberInfo
}
...
...
@@ -261,19 +261,19 @@ function init() {
applicationForMembership1
.
value
=
form
.
value
.
applicationForMembership
||
[]
form
.
value
.
deptType
=
res
.
data
.
dept
.
deptType
const
imageSource
=
{
...
res
.
data
.
dept
,
...
res
.
data
.
memberInfo
,
...
pr
.
value
}
form
.
value
.
businessLicenseArr
=
parseFileList
(
imageSource
.
certBusinessLicense
||
imageSource
.
businessLicense
,
'营业执照'
)
form
.
value
.
legalIdcPhotoArr
=
parseImageList
(
imageSource
.
certLegalIdcPhoto
||
imageSource
.
legalIdcPhoto
)
form
.
value
.
picturesArr
=
parseImageList
(
imageSource
.
certPictures
||
imageSource
.
pictures
)
console
.
log
(
'营业执照'
,
form
.
value
.
businessLicenseArr
)
console
.
log
(
'法人身份证'
,
form
.
value
.
legalIdcPhotoArr
)
console
.
log
(
'机构照片'
,
form
.
value
.
picturesArr
)
})
}
const
imageSource
=
{
...
res
.
data
.
dept
,
...
res
.
data
.
memberInfo
,
...
pr
.
value
}
form
.
value
.
businessLicenseArr
=
parseFileList
(
imageSource
.
businessLicense
,
'营业执照'
)
form
.
value
.
legalIdcPhotoArr
=
parseImageList
(
imageSource
.
certLegalIdcPhoto
||
imageSource
.
legalIdcPhoto
)
form
.
value
.
picturesArr
=
parseImageList
(
imageSource
.
certPictures
||
imageSource
.
pictures
)
console
.
log
(
'营业执照'
,
form
.
value
.
businessLicenseArr
)
console
.
log
(
'法人身份证'
,
form
.
value
.
legalIdcPhotoArr
)
console
.
log
(
'机构照片'
,
form
.
value
.
picturesArr
)
})
}
async
function
getMyStatusAPI
()
{
const
{
...
...
@@ -338,52 +338,52 @@ function auditEditFN(type) {
})
}
function
showImage
(
arr
,
index
)
{
uni
.
previewImage
({
function
showImage
(
arr
,
index
)
{
uni
.
previewImage
({
urls
:
arr
,
current
:
index
,
success
:
function
(
res
)
{
}
})
}
function
parseFileList
(
value
,
name
)
{
if
(
!
value
)
return
[]
try
{
const
parsed
=
JSON
.
parse
(
value
)
const
list
=
Array
.
isArray
(
parsed
)
?
parsed
:
[
parsed
]
return
list
.
filter
(
item
=>
item
?.
url
||
item
).
map
(
item
=>
{
const
rawUrl
=
item
.
url
||
item
return
{
...
item
,
name
:
item
.
name
||
name
,
rawUrl
,
url
:
fillImgUrl
(
rawUrl
)
}
})
}
catch
(
e
)
{
return
[{
name
,
rawUrl
:
value
,
url
:
fillImgUrl
(
value
)
}]
}
}
function
parseImageList
(
value
)
{
if
(
!
value
)
return
[]
return
String
(
value
)
.
split
(
','
)
.
map
(
item
=>
item
.
trim
())
.
filter
(
Boolean
)
.
map
(
item
=>
fillImgUrl
(
item
))
}
function
download
(
url
)
{
previewAttachment
(
url
,
{
title
:
'查看附件'
})
}
function
payTheFees
()
{
})
}
function
parseFileList
(
value
,
name
)
{
if
(
!
value
)
return
[]
try
{
const
parsed
=
JSON
.
parse
(
value
)
const
list
=
Array
.
isArray
(
parsed
)
?
parsed
:
[
parsed
]
return
list
.
filter
(
item
=>
item
?.
url
||
item
).
map
(
item
=>
{
const
rawUrl
=
item
.
url
||
item
return
{
...
item
,
name
:
item
.
name
||
name
,
rawUrl
,
url
:
fillImgUrl
(
rawUrl
)
}
})
}
catch
(
e
)
{
return
[{
name
,
rawUrl
:
value
,
url
:
fillImgUrl
(
value
)
}]
}
}
function
parseImageList
(
value
)
{
if
(
!
value
)
return
[]
return
String
(
value
)
.
split
(
','
)
.
map
(
item
=>
item
.
trim
())
.
filter
(
Boolean
)
.
map
(
item
=>
fillImgUrl
(
item
))
}
function
download
(
url
)
{
previewAttachment
(
url
,
{
title
:
'查看附件'
})
}
function
payTheFees
()
{
if
(
!
form
.
value
.
name
)
{
uni
.
showToast
({
title
:
`请先完善单位信息`
,
...
...
@@ -434,9 +434,9 @@ function payTheFees() {
border-radius
:
8
rpx
;
}
.photoBook
{
position
:
relative
;
border-radius
:
10
rpx
;
.photoBook
{
position
:
relative
;
border-radius
:
10
rpx
;
overflow
:
hidden
;
&::after
{
...
...
@@ -456,49 +456,49 @@ function payTheFees() {
color
:
#fff
;
bottom
:
4
rpx
;
right
:
8
rpx
;
}
}
.auth-row
{
display
:
flex
;
align-items
:
flex-start
;
min-height
:
96
rpx
;
padding
:
24
rpx
30
rpx
;
border-bottom
:
1
rpx
solid
#eee
;
box-sizing
:
border-box
;
}
.auth-label
{
flex
:
0
0
auto
;
color
:
#999
;
font-size
:
28
rpx
;
line-height
:
40
rpx
;
}
.auth-value
{
flex
:
1
;
min-width
:
0
;
display
:
flex
;
justify-content
:
flex-end
;
}
.frrr
{
width
:
100%
;
text-align
:
right
;
display
:
flex
;
flex-wrap
:
wrap
;
justify-content
:
flex-end
;
}
.license-footer
{
min-width
:
300
rpx
;
margin-left
:
auto
;
}
:deep
(
.selected-list
)
{
font-size
:
32
rpx
;
padding
:
0
;
}
}
}
.auth-row
{
display
:
flex
;
align-items
:
flex-start
;
min-height
:
96
rpx
;
padding
:
24
rpx
30
rpx
;
border-bottom
:
1
rpx
solid
#eee
;
box-sizing
:
border-box
;
}
.auth-label
{
flex
:
0
0
auto
;
color
:
#999
;
font-size
:
28
rpx
;
line-height
:
40
rpx
;
}
.auth-value
{
flex
:
1
;
min-width
:
0
;
display
:
flex
;
justify-content
:
flex-end
;
}
.frrr
{
width
:
100%
;
text-align
:
right
;
display
:
flex
;
flex-wrap
:
wrap
;
justify-content
:
flex-end
;
}
.license-footer
{
min-width
:
300
rpx
;
margin-left
:
auto
;
}
:deep
(
.selected-list
)
{
font-size
:
32
rpx
;
padding
:
0
;
}
:deep
(
.input-value
)
{
padding
:
0
;
...
...
@@ -509,10 +509,10 @@ function payTheFees() {
color
:
#000
;
}
:deep
(
.uni-list-item__extra
)
{
flex
:
1
1
auto
;
min-width
:
0
;
}
:deep
(
.uni-list-item__extra
)
{
flex
:
1
1
auto
;
min-width
:
0
;
}
:deep
(
.uni-list-item__content
)
{
flex
:
0
0
auto
;
...
...
myCenter/perfect.vue
View file @
8f77dd9
...
...
@@ -251,6 +251,7 @@
const
coordinates1
=
ref
([])
const
pictures
=
ref
()
const
legalIdcPhoto
=
ref
([])
const
currentBusinessLicenseAddress
=
ref
(
''
)
const
carriedReadonlyFields
=
[
'companyName'
,
'creditCode'
,
'name'
,
'address'
,
'adress'
,
'parentId'
,
'legal'
,
'legalIdcCode'
]
function
isFieldDisabled
(
field
)
{
...
...
@@ -281,9 +282,21 @@
}
}
function
unlockOcrFields
()
{
ocrLockedFields
.
value
=
{}
}
function
unlockOcrFields
()
{
ocrLockedFields
.
value
=
{}
}
function
clearBusinessLicenseUpload
()
{
selectFileValue
=
{}
form
.
value
.
businessLicense
=
''
currentBusinessLicenseAddress
.
value
=
''
}
function
lockParentIdField
()
{
if
(
hasValue
(
form
.
value
.
parentId
))
{
ocrLockedFields
.
value
.
parentId
=
true
}
}
onLoad
(
option
=>
{
if
(
app
.
globalData
.
isLogin
)
{
...
...
@@ -295,11 +308,14 @@
}
});
async
function
init
()
{
getRegionsList
()
await
getForm
()
await
canUseDiscountApi
()
await
getZtxDiscountPolicyApi
()
async
function
init
()
{
await
Promise
.
all
([
getRegionsList
(),
getTree
()
])
await
getForm
()
await
canUseDiscountApi
()
await
getZtxDiscountPolicyApi
()
handelGetMyRecent
()
}
...
...
@@ -340,11 +356,10 @@
flag
.
value
=
newResult
.
value
}
form
.
value
=
{
...
res
.
data
.
dept
,
...
res
.
data
.
memberInfo
}
getTree
()
form
.
value
=
{
...
res
.
data
.
dept
,
...
res
.
data
.
memberInfo
}
form
.
value
.
deptType
=
res
.
data
.
dept
.
deptType
form
.
value
.
parentId
=
form
.
value
.
parentId
??
''
// creditCode.value = form.value.creditCode
...
...
@@ -383,6 +398,8 @@
creditCode
.
value
=
form
.
value
.
creditCode
parentId
.
value
=
form
.
value
.
parentId
restoreAssoFullName
()
lockParentIdField
()
companyName
.
value
=
form
.
value
.
companyName
legal
.
value
=
form
.
value
.
legal
legalIdcCode
.
value
=
form
.
value
.
legalIdcCode
...
...
@@ -408,7 +425,7 @@
}
function
getRegionsList
()
{
api
.
regionsList
().
then
(
res
=>
{
return
api
.
regionsList
().
then
(
res
=>
{
regionsList
.
value
=
res
.
data
;
});
}
...
...
@@ -465,16 +482,24 @@
})
return
}
if
(
form
.
value
.
parentId
==
-
1
||
form
.
value
.
parentId
==
0
)
{
uni
.
showToast
({
title
:
'请选择所属协会'
,
icon
:
'none'
})
return
}
if
(
legalIdcPhoto1
.
value
==
''
||
legalIdcPhoto2
.
value
==
''
)
{
uni
.
showToast
({
title
:
'请上传法人身份证'
,
if
(
form
.
value
.
parentId
==
-
1
||
form
.
value
.
parentId
==
0
)
{
uni
.
showToast
({
title
:
'请选择所属协会'
,
icon
:
'none'
})
return
}
if
(
currentBusinessLicenseAddress
.
value
&&
!
validateBusinessLicenseProvince
(
currentBusinessLicenseAddress
.
value
))
{
uni
.
showToast
({
title
:
'请上传省内的营业执照'
,
icon
:
'none'
,
duration
:
3000
})
return
}
if
(
legalIdcPhoto1
.
value
==
''
||
legalIdcPhoto2
.
value
==
''
)
{
uni
.
showToast
({
title
:
'请上传法人身份证'
,
icon
:
'none'
})
return
...
...
@@ -895,55 +920,39 @@
return
true
}
function
findAssoPathByRegionNames
(
regionPath
)
{
if
(
!
regionPath
?.
length
||
!
tree
.
value
?.
length
)
return
null
const
names
=
regionPath
.
map
(
node
=>
normalizeAddressText
(
getNodeText
(
node
))).
filter
(
Boolean
)
const
candidates
=
[]
function
walk
(
listData
,
path
)
{
for
(
const
item
of
listData
||
[])
{
const
itemName
=
normalizeAddressText
(
getNodeText
(
item
))
const
nextPath
=
[...
path
,
item
]
const
score
=
names
.
reduce
((
total
,
name
,
index
)
=>
{
const
shortName
=
name
.
replace
(
/省|市|区|县|自治区|壮族自治区|回族自治区|维吾尔自治区|地区|自治州|盟|旗/g
,
''
)
return
total
+
(
itemName
.
includes
(
name
)
||
(
shortName
.
length
>
1
&&
itemName
.
includes
(
shortName
))
?
index
+
1
:
0
)
},
0
)
if
(
score
>
0
)
candidates
.
push
({
path
:
nextPath
,
score
})
if
(
item
.
children
?.
length
)
walk
(
item
.
children
,
nextPath
)
}
}
walk
(
tree
.
value
,
[])
candidates
.
sort
((
a
,
b
)
=>
b
.
score
-
a
.
score
||
b
.
path
.
length
-
a
.
path
.
length
)
return
candidates
[
0
]?.
path
||
null
}
function
applyAssoPath
(
path
)
{
if
(
!
path
?.
length
)
return
false
const
lastNode
=
path
[
path
.
length
-
1
]
form
.
value
.
parentId
=
getNodeValue
(
lastNode
)
||
''
assoFullName
.
value
=
getAssoFullName
(
path
.
map
(
node
=>
({
value
:
getNodeValue
(
node
)
})))
lockOcrField
(
'parentId'
,
form
.
value
.
parentId
)
return
!!
form
.
value
.
parentId
}
async
function
applyBusinessAddress
(
address
)
{
const
businessAddress
=
String
(
address
||
''
).
trim
()
if
(
!
businessAddress
)
return
if
(
!
businessAddress
)
return
false
form
.
value
.
adress
=
businessAddress
lockOcrField
(
'adress'
,
businessAddress
)
if
(
!
regionsList
.
value
?.
length
)
{
await
getRegionsList
().
catch
(()
=>
{})
}
if
(
!
tree
.
value
?.
length
)
{
await
getTree
().
catch
(()
=>
{})
}
const
regionPath
=
findRegionPathByAddress
(
businessAddress
)
if
(
applyRegionPath
(
regionPath
))
{
const
assoPath
=
findAssoPathByRegionNames
(
regionPath
)
applyAssoPath
(
assoPath
)
}
return
applyRegionPath
(
regionPath
)
}
function
validateBusinessLicenseProvince
(
address
)
{
const
businessAddress
=
String
(
address
||
''
).
trim
()
if
(
!
businessAddress
)
return
true
const
regionPath
=
findRegionPathByAddress
(
businessAddress
)
const
currentAssoName
=
assoFullName
.
value
||
getAssoName
(
form
.
value
.
parentId
)
return
isSameProvince
(
regionPath
,
currentAssoName
)
}
function
isSameProvince
(
regionPath
,
assoName
)
{
const
regionProvince
=
normalizeProvinceName
(
getNodeText
(
regionPath
?.[
0
]))
if
(
!
regionProvince
)
return
false
const
normalizedAssoName
=
normalizeProvinceName
(
assoName
)
return
normalizedAssoName
&&
(
normalizedAssoName
.
includes
(
regionProvince
)
||
regionProvince
.
includes
(
normalizedAssoName
)
)
}
function
normalizeProvinceName
(
name
)
{
return
normalizeAddressText
(
name
).
replace
(
/省|市|自治区|壮族自治区|回族自治区|维吾尔自治区/g
,
''
)
}
// 恢复协会完整路径名称
...
...
@@ -1102,7 +1111,18 @@
lockOcrField
(
'companyName'
,
form
.
value
.
companyName
)
lockOcrField
(
'creditCode'
,
form
.
value
.
creditCode
)
lockOcrField
(
'legal'
,
form
.
value
.
legal
)
currentBusinessLicenseAddress
.
value
=
ocrData
.
businessAddress
||
''
await
applyBusinessAddress
(
ocrData
.
businessAddress
)
if
(
!
validateBusinessLicenseProvince
(
ocrData
.
businessAddress
))
{
clearBusinessLicenseUpload
()
uni
.
hideLoading
()
uni
.
showToast
({
title
:
'请上传省内的营业执照'
,
icon
:
'none'
,
duration
:
3000
})
return
}
await
onCreditCodeBlur
(
false
)
}
selectFileValue
=
{
...
...
@@ -1120,12 +1140,12 @@
})
}
}
function
delSupplementFile
()
{
selectFileValue
=
{}
form
.
value
.
businessLicense
=
''
unlockOcrFields
()
}
clearBusinessLicenseUpload
()
unlockOcrFields
()
lockParentIdField
()
}
function
getBusinessLicenseOcr
(
filePath
)
{
if
(
!
filePath
)
return
Promise
.
resolve
(
null
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment