Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SuperMan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
SuperMan
Commits
435cacf0
Commit
435cacf0
authored
Jun 14, 2023
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
42000259
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
645 deletions
+63
-645
addPassenger.vue
src/components/SalesModule/addPassenger.vue
+63
-645
No files found.
src/components/SalesModule/addPassenger.vue
View file @
435cacf0
...
...
@@ -449,10 +449,11 @@
</li>
<li
v-show=
"templateType==2"
>
<el-select
class=
'w200'
v-model=
'templateSign'
>
<el-option
label=
'台湾护照'
value=
'7224a048d0fcc94413c3a729e481a775'
></el-option>
<el-option
label=
'中国护照'
value=
'2625f80ec957a0c837ca14f8ce608a51'
></el-option>
<!--
<el-option
label=
'台湾护照'
value=
'7224a048d0fcc94413c3a729e481a775'
></el-option>
<el-option
label=
'中国护照旧版'
value=
'2dc78a37e516f18ebe56aeacc6d49203'
></el-option>
<el-option
label=
'台湾通行证'
value=
'2cd1d05f5efc5eec23ffad6358bdb70f'
></el-option>
<el-option
label=
'台湾通行证'
value=
'2cd1d05f5efc5eec23ffad6358bdb70f'
></el-option>
-->
</el-select>
</li>
</div>
...
...
@@ -646,16 +647,9 @@
DutyTypeList
:
[],
ppAge
:
0
,
loading
:
false
,
appkey_ocr
:
"OGAhU38ib8EweXMtPVqCbkpN"
,
secretKey_ocr
:
"OcqfFF5hlleWovzA6vLweykxPgwE8XF2"
,
BD_GET_ACCESS_TOKEN
:
"https://aip.baidubce.com/oauth/2.0/token"
,
BD_COMMON_TEXT_DISCERN_IDCARD
:
"https://aip.baidubce.com/rest/2.0/ocr/v1/idcard"
,
BD_COMMON_TEXT_DISCERN
:
"https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise"
,
access_token_ocr
:
""
,
templateType
:
1
,
templateSign
:
""
,
imgBase64String
:
""
,
imgBase64String1
:
""
,
addMsg
:
{
Id
:
0
,
TCID
:
0
,
...
...
@@ -803,7 +797,7 @@
}],
PassportExpiry
:
[{
required
:
true
,
message
:
"请选择护照过期日"
,
message
:
"请选择护照过期日
期
"
,
trigger
:
"blur"
}],
PassportAddress
:
[{
...
...
@@ -970,654 +964,78 @@
}
}
},
getAccessToken
()
{
let
url
=
this
.
BD_GET_ACCESS_TOKEN
+
"?grant_type=client_credentials&client_id="
+
this
.
appkey_ocr
+
"&client_secret="
+
this
.
secretKey_ocr
;
this
.
$http
.
get
(
"https://bird.ioliu.cn/v1?url="
+
url
).
then
(
res
=>
{
this
.
access_token_ocr
=
res
.
data
.
access_token
;
});
},
// 月份转换
getMonthWithEn
:
function
(
enMonth
)
{
enMonth
=
enMonth
.
toLowerCase
();
let
month
=
''
;
if
(
'jan'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'01'
;
}
else
if
(
'feb'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'02'
;
}
else
if
(
'mar'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'03'
;
}
else
if
(
'apr'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'04'
;
}
else
if
(
'may'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'05'
;
}
else
if
(
'june'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'06'
;
}
else
if
(
'july'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'07'
;
}
else
if
(
'aug'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'08'
;
}
else
if
(
'sept'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'09'
;
}
else
if
(
'oct'
.
indexOf
(
enMonth
)
!=
-
1
||
'0ct'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'10'
;
}
else
if
(
'nov'
.
indexOf
(
enMonth
)
!=
-
1
||
'n0v'
.
indexOf
(
enMonth
)
!=
-
1
||
'nv'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'11'
;
}
else
if
(
'dec'
.
indexOf
(
enMonth
)
!=
-
1
)
{
month
=
'12'
;
}
return
month
;
},
formatDateWithTaiwan
:
function
(
word
)
{
if
(
word
.
length
>
0
)
{
try
{
let
dateArr
=
word
.
match
(
/
(
^
\d
+
)
|
(\d
+$
)
/g
);
let
day
=
dateArr
[
0
];
day
=
day
.
length
>
2
?
(
parseInt
(
day
)
>
0
?
day
.
substring
(
0
,
2
)
:
'01'
)
:
day
;
let
year
=
dateArr
[
1
];
if
(
year
.
length
!=
4
)
{
if
(
year
.
length
==
3
)
{
year
=
year
+
'0'
;
}
else
if
(
year
.
length
==
2
)
{
year
=
year
+
'00'
}
else
if
(
year
.
length
==
1
)
{
year
=
'2020'
;
}
else
{
year
=
Tool
.
getCurrentYear
().
toString
();
}
}
let
month
=
this
.
getMonthWithEn
(
word
.
replace
(
/
[
0-9
]
/ig
,
""
));
day
=
day
.
length
==
0
?
'01'
:
day
;
month
=
month
.
length
==
0
?
'01'
:
month
;
return
year
+
'-'
+
month
+
'-'
+
day
;
}
catch
(
e
)
{
return
''
;
}
//OCR识别
commonTextDiscern
()
{
let
params
=
{
base64
:
""
,
Type
:
1
,
//1-中国大陆护照,2-身份证
};
params
.
base64
=
this
.
imgBase64String
;
let
url
=
this
.
domainManager
().
UploadUrl
;
if
(
this
.
templateType
==
1
)
{
params
.
Type
=
2
;
}
else
{
return
''
;
params
.
Type
=
1
;
}
},
formatDateWithChina
(
word
)
{
if
(
word
.
length
>
0
)
{
try
{
let
arr
=
word
.
match
(
/
(
^
\d
+
)
|
(\d
+$
)
/g
);
let
y
=
arr
[
1
];
let
d
=
''
;
let
mon
=
this
.
getMonthWithEn
(
word
.
replace
(
/
[^
a-zA-Z
]
/g
,
''
));
let
dayAndMonth
=
arr
[
0
];
if
(
dayAndMonth
.
length
==
1
)
{
d
=
'0'
+
dayAndMonth
;
if
(
mon
.
length
==
0
)
{
mon
=
'0'
+
dayAndMonth
;
}
}
else
if
(
dayAndMonth
.
length
==
2
)
{
if
(
parseInt
(
dayAndMonth
)
>
31
)
{
d
=
'0'
+
dayAndMonth
.
substring
(
0
,
1
);
if
(
mon
.
length
==
0
)
{
mon
=
'0'
+
dayAndMonth
.
substring
(
1
,
2
);
this
.
loading
=
true
;
this
.
UploadCard
(
params
.
Type
,
params
.
base64
,
res
=>
{
this
.
loading
=
false
;
if
(
res
.
data
.
StatusCode
==
1
)
{
var
tempObj
=
res
.
data
;
console
.
log
(
"tempObj"
,
tempObj
);
//大陆护照
if
(
params
.
Type
==
1
)
{
if
(
tempObj
)
{
//护照号
if
(
tempObj
.
PassportNumber
&&
tempObj
.
PassportNumber
!=
''
)
{
this
.
addMsg
.
PassportNo
=
tempObj
.
PassportNumber
;
}
}
else
{
if
(
parseInt
(
dayAndMonth
)
<
13
)
{
if
(
mon
.
length
==
0
)
{
mon
=
dayAndMonth
;
}
d
=
dayAndMonth
;
}
else
{
d
=
'0'
+
dayAndMonth
.
substring
(
0
,
1
)
;
if
(
mon
.
length
==
0
)
{
mon
=
'0'
+
dayAndMonth
.
substring
(
1
,
2
)
;
//出生地
if
(
tempObj
.
BirthAddress
&&
tempObj
.
BirthAddress
!=
''
)
{
this
.
addMsg
.
BirthdayAddress
=
tempObj
.
BirthAddress
;
}
//性别
if
(
tempObj
.
Gender
&&
tempObj
.
Gender
!=
''
)
{
if
(
tempObj
.
Gender
==
'男'
)
{
this
.
addMsg
.
Sex
=
"1"
;
}
else
{
this
.
addMsg
.
Sex
=
"2"
;
}
}
}
}
else
if
(
dayAndMonth
.
length
==
3
)
{
d
=
dayAndMonth
.
substring
(
0
,
2
);
if
(
mon
.
length
==
0
)
{
mon
=
'0'
+
dayAndMonth
.
substring
(
2
,
3
);
}
}
else
if
(
dayAndMonth
.
length
==
4
)
{
d
=
dayAndMonth
.
substring
(
0
,
2
);
if
(
mon
.
length
==
0
)
{
mon
=
dayAndMonth
.
substring
(
2
,
4
);
}
}
if
(
y
.
length
!=
4
)
{
if
(
y
.
length
==
3
)
{
y
=
y
+
'0'
;
}
else
if
(
y
.
length
==
2
)
{
y
=
y
+
'00'
}
else
if
(
y
.
length
==
1
)
{
y
=
'2020'
;
}
else
{
y
=
Tool
.
getCurrentYear
().
toString
();
}
}
d
=
d
.
length
==
0
?
'01'
:
d
;
mon
=
mon
.
length
==
0
?
'01'
:
mon
;
return
y
+
'-'
+
mon
+
'-'
+
d
;
}
catch
(
e
)
{
return
''
;
}
}
else
{
return
''
;
}
},
// 中国护照数据处理
formatDataWithChina
:
function
(
results
)
{
let
formatData
=
null
;
let
chinaFirstName
=
''
;
let
chinaLastName
=
''
;
let
sex
=
{
'Id'
:
1
,
'Name'
:
'男'
};
let
birthday
=
''
;
let
enFirstName
=
''
;
let
enLastName
=
''
;
let
passportNo
=
''
;
let
passportAddress
=
''
;
let
passportExpiry
=
''
;
let
nationality
=
{
'ID'
:
''
,
'Name'
:
''
};
let
birthplace
=
''
;
let
passportDate
=
''
;
for
(
let
i
=
0
;
i
<
results
.
length
;
i
++
)
{
let
item
=
results
[
i
];
let
word_name
=
item
.
word_name
;
let
word
=
item
.
word
!=
null
?
item
.
word
:
''
;
if
(
word_name
==
'姓名'
)
{
if
(
word
!=
null
&&
word
.
length
>
0
)
{
try
{
if
(
word
.
length
==
1
)
{
chinaFirstName
=
word
;
}
else
if
(
word
.
length
==
2
)
{
chinaFirstName
=
word
.
substring
(
0
,
1
);
chinaLastName
=
word
.
substring
(
1
,
2
);
}
else
if
(
word
.
length
==
3
)
{
chinaFirstName
=
word
.
substring
(
0
,
1
);
chinaLastName
=
word
.
substring
(
1
,
3
);
}
else
if
(
word
.
length
==
4
)
{
chinaFirstName
=
word
.
substring
(
0
,
2
);
chinaLastName
=
word
.
substring
(
2
,
4
);
}
else
{
chinaFirstName
=
word
.
substring
(
0
,
1
);
chinaLastName
=
word
.
substring
(
1
,
word
.
length
);
//护照签发日期
if
(
tempObj
.
IssueDate
&&
tempObj
.
IssueDate
!=
''
)
{
this
.
addMsg
.
PassportIssued
=
tempObj
.
IssueDate
;
}
}
catch
(
e
)
{}
}
}
else
if
(
word_name
==
'性别'
)
{
if
(
word
==
'女/F'
||
word
.
indexOf
(
'女'
)
!=
-
1
||
word
.
indexOf
(
'F'
)
!=
-
1
)
{
sex
=
{
'Id'
:
2
,
'Name'
:
'女'
};
}
else
{
sex
=
{
'Id'
:
1
,
'Name'
:
'男'
};
}
}
else
if
(
word_name
==
'出生日期'
)
{
birthday
=
this
.
formatDateWithTaiwan
(
word
)
}
else
if
(
word_name
==
'name'
)
{
if
(
word
.
length
>
0
)
{
try
{
if
(
word
.
indexOf
(
'.'
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
'.'
)[
0
];
enLastName
=
word
.
split
(
'.'
)[
1
];
}
else
if
(
word
.
indexOf
(
','
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
','
)[
0
];
enLastName
=
word
.
split
(
','
)[
1
];
}
else
if
(
word
.
indexOf
(
'。'
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
'。'
)[
0
];
enLastName
=
word
.
split
(
'。'
)[
1
];
}
else
if
(
word
.
indexOf
(
','
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
','
)[
0
];
enLastName
=
word
.
split
(
','
)[
1
];
//护照过期日期
if
(
tempObj
.
ExpiryDate
&&
tempObj
.
ExpiryDate
!=
''
)
{
this
.
addMsg
.
PassportExpiry
=
tempObj
.
ExpiryDate
;
}
}
catch
(
e
)
{}
}
}
else
if
(
word_name
==
'护照号码'
)
{
if
(
word
.
indexOf
(
'i'
)
!=
-
1
)
{
word
=
word
.
replace
(
/i/g
,
'1'
);
}
if
(
word
.
indexOf
(
'I'
)
!=
-
1
)
{
word
=
word
.
replace
(
/I/g
,
'1'
);
}
if
(
word
.
indexOf
(
'l'
)
!=
-
1
)
{
word
=
word
.
replace
(
/l/g
,
'1'
);
}
if
(
word
.
indexOf
(
'L'
)
!=
-
1
)
{
word
=
word
.
replace
(
/L/g
,
'1'
);
}
if
(
word
.
indexOf
(
'|'
)
!=
-
1
)
{
word
=
word
.
replace
(
/
\|
/g
,
'1'
);
}
passportNo
=
word
;
}
else
if
(
word_name
==
'签发地点'
)
{
passportAddress
=
word
;
if
(
word
.
indexOf
(
'/'
)
!=
-
1
)
{
passportAddress
=
word
.
split
(
'/'
)[
0
];
}
}
else
if
(
word_name
==
'有效期至'
)
{
passportExpiry
=
this
.
formatDateWithChina
(
word
);
}
else
if
(
word_name
==
'国籍'
)
{
nationality
=
{
'ID'
:
2
,
'Name'
:
'中国'
};
}
else
if
(
word_name
==
'出生地点'
)
{
birthplace
=
word
;
if
(
word
.
indexOf
(
'/'
)
!=
-
1
)
{
birthplace
=
word
.
split
(
'/'
)[
0
];
}
}
else
if
(
word_name
==
'签发日期'
)
{
passportDate
=
this
.
formatDateWithChina
(
word
);
}
}
formatData
=
{
'chinaFirstName'
:
chinaFirstName
,
'chinaLastName'
:
chinaLastName
,
'sex'
:
sex
,
'birthday'
:
birthday
,
'enFirstName'
:
enFirstName
,
'enLastName'
:
enLastName
,
'passportNo'
:
passportNo
,
'passportAddress'
:
passportAddress
,
'passportExpiry'
:
passportExpiry
,
'nationality'
:
nationality
,
'birthplace'
:
birthplace
,
'passportDate'
:
passportDate
}
return
formatData
;
},
// 中国护照旧版
formatDataWithChina_old
(
results
)
{
let
formatData
=
null
;
let
chinaFirstName
=
''
;
let
chinaLastName
=
''
;
let
sex
=
{
'Id'
:
1
,
'Name'
:
'男'
};
let
birthday
=
''
;
let
enFirstName
=
''
;
let
enLastName
=
''
;
let
passportNo
=
''
;
let
passportAddress
=
''
;
let
passportExpiry
=
''
;
let
nationality
=
{
'ID'
:
''
,
'Name'
:
''
};
let
birthplace
=
''
;
let
passportDate
=
''
;
for
(
let
i
=
0
;
i
<
results
.
length
;
i
++
)
{
let
item
=
results
[
i
];
let
word_name
=
item
.
word_name
;
let
word
=
item
.
word
!=
null
?
item
.
word
:
''
;
if
(
word_name
==
'姓'
)
{
try
{
chinaFirstName
=
word
;
enFirstName
=
word
;
if
(
word
.
indexOf
(
'/'
)
!=
-
1
)
{
chinaFirstName
=
word
.
split
(
'/'
)[
0
];
enFirstName
=
word
.
split
(
'/'
)[
1
];
}
}
catch
(
e
)
{}
}
else
if
(
word_name
==
'名'
)
{
try
{
chinaLastName
=
word
;
enLastName
=
word
;
if
(
word
.
indexOf
(
'/'
)
!=
-
1
)
{
chinaLastName
=
word
.
split
(
'/'
)[
0
];
enLastName
=
word
.
split
(
'/'
)[
1
];
}
}
catch
(
e
)
{}
}
else
if
(
word_name
==
'性别'
)
{
try
{
if
(
word
==
'M'
||
word
.
indexOf
(
'M'
)
!=
-
1
||
word
.
indexOf
(
'm'
)
==
-
1
||
word
.
indexOf
(
'男'
)
!=
-
1
)
{
sex
=
{
'Id'
:
1
,
'Name'
:
'男'
};
}
else
{
sex
=
{
'Id'
:
2
,
'Name'
:
'女'
};
}
}
catch
(
e
)
{}
}
else
if
(
word_name
==
'出生日期'
)
{
birthday
=
this
.
formatDateWithTaiwan
(
word
)
}
else
if
(
word_name
==
'护照号'
)
{
if
(
word
.
indexOf
(
'i'
)
!=
-
1
)
{
word
=
word
.
replace
(
/i/g
,
'1'
);
}
if
(
word
.
indexOf
(
'I'
)
!=
-
1
)
{
word
=
word
.
replace
(
/I/g
,
'1'
);
}
if
(
word
.
indexOf
(
'l'
)
!=
-
1
)
{
word
=
word
.
replace
(
/l/g
,
'1'
);
}
if
(
word
.
indexOf
(
'L'
)
!=
-
1
)
{
word
=
word
.
replace
(
/L/g
,
'1'
);
}
if
(
word
.
indexOf
(
'|'
)
!=
-
1
)
{
word
=
word
.
replace
(
/
\|
/g
,
'1'
);
}
passportNo
=
word
;
}
else
if
(
word_name
==
'签发机关'
)
{
passportAddress
=
word
;
}
else
if
(
word_name
==
'有效期至'
)
{
passportExpiry
=
this
.
formatDateWithTaiwan
(
word
);
}
else
if
(
word_name
==
'国家码'
)
{
nationality
=
{
'ID'
:
2
,
'Name'
:
'中国'
};
}
else
if
(
word_name
==
'出生地点'
)
{
birthplace
=
word
;
if
(
word
.
indexOf
(
'/'
)
!=
-
1
)
{
birthplace
=
word
.
split
(
'/'
)[
0
];
}
}
else
if
(
word_name
==
'签发日期'
)
{
passportDate
=
this
.
formatDateWithTaiwan
(
word
);
}
}
formatData
=
{
'chinaFirstName'
:
chinaFirstName
,
'chinaLastName'
:
chinaLastName
,
'sex'
:
sex
,
'birthday'
:
birthday
,
'enFirstName'
:
enFirstName
,
'enLastName'
:
enLastName
,
'passportNo'
:
passportNo
,
'passportAddress'
:
passportAddress
,
'passportExpiry'
:
passportExpiry
,
'nationality'
:
nationality
,
'birthplace'
:
birthplace
,
'passportDate'
:
passportDate
};
return
formatData
;
},
// 台湾护照数据处理
formatDataWithTaiwan
(
results
)
{
let
formatData
=
null
;
let
chinaFirstName
=
''
;
let
chinaLastName
=
''
;
let
sex
=
{
'Id'
:
1
,
'Name'
:
'男'
};
let
birthday
=
''
;
let
enFirstName
=
''
;
let
enLastName
=
''
;
let
passportNo
=
''
;
let
passportAddress
=
''
;
let
passportExpiry
=
''
;
let
nationality
=
{
'ID'
:
''
,
'Name'
:
''
};
let
birthplace
=
''
;
let
passportDate
=
''
;
for
(
let
i
=
0
;
i
<
results
.
length
;
i
++
)
{
let
item
=
results
[
i
];
let
word_name
=
item
.
word_name
;
let
word
=
item
.
word
!=
null
?
item
.
word
:
''
;
if
(
word_name
==
'姓名'
)
{
try
{
if
(
word
!=
null
&&
word
.
length
>
0
)
{
if
(
word
.
length
==
1
)
{
chinaFirstName
=
word
;
}
else
if
(
word
.
length
==
2
)
{
chinaFirstName
=
word
.
substring
(
0
,
1
);
chinaLastName
=
word
.
substring
(
1
,
2
);
}
else
if
(
word
.
length
==
3
)
{
chinaFirstName
=
word
.
substring
(
0
,
1
);
chinaLastName
=
word
.
substring
(
1
,
3
);
}
else
if
(
word
.
length
==
4
)
{
chinaFirstName
=
word
.
substring
(
0
,
2
);
chinaLastName
=
word
.
substring
(
2
,
4
);
}
else
{
chinaFirstName
=
word
.
substring
(
0
,
1
);
chinaLastName
=
word
.
substring
(
1
,
word
.
length
);
//护照签发地
if
(
tempObj
.
Placoofissue
&&
tempObj
.
Placoofissue
!=
''
)
{
this
.
addMsg
.
PassportAddress
=
tempObj
.
Placoofissue
;
}
}
}
catch
(
e
)
{
chinaFirstName
=
word
;
chinaLastName
=
word
;
}
}
else
if
(
word_name
==
'性别'
)
{
try
{
if
(
word
==
'M'
||
word
.
indexOf
(
'M'
)
!=
-
1
||
word
.
indexOf
(
'm'
)
==
-
1
)
{
sex
=
{
'Id'
:
1
,
'Name'
:
'男'
};
}
else
{
sex
=
{
'Id'
:
2
,
'Name'
:
'女'
};
}
}
catch
(
e
)
{}
}
else
if
(
word_name
==
'出生日期'
)
{
birthday
=
this
.
formatDateWithTaiwan
(
word
)
}
else
if
(
word_name
==
'name'
)
{
if
(
word
.
length
>
0
)
{
try
{
if
(
word
.
indexOf
(
'.'
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
'.'
)[
0
];
enLastName
=
word
.
split
(
'.'
)[
1
];
}
else
if
(
word
.
indexOf
(
','
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
','
)[
0
];
enLastName
=
word
.
split
(
','
)[
1
];
}
else
if
(
word
.
indexOf
(
'。'
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
'。'
)[
0
];
enLastName
=
word
.
split
(
'。'
)[
1
];
}
else
if
(
word
.
indexOf
(
','
)
!=
-
1
)
{
enFirstName
=
word
.
split
(
','
)[
0
];
enLastName
=
word
.
split
(
','
)[
1
];
}
else
{
enFirstName
=
word
;
enLastName
=
word
;
//出生日期
if
(
tempObj
.
BirthDate
&&
tempObj
.
BirthDate
!=
''
)
{
this
.
addMsg
.
Birthday
=
tempObj
.
BirthDate
;
}
}
catch
(
e
)
{}
}
}
else
if
(
word_name
==
'护照号码'
)
{
if
(
word
.
indexOf
(
'i'
)
!=
-
1
)
{
word
=
word
.
replace
(
/i/g
,
'1'
);
}
if
(
word
.
indexOf
(
'I'
)
!=
-
1
)
{
word
=
word
.
replace
(
/I/g
,
'1'
);
}
if
(
word
.
indexOf
(
'l'
)
!=
-
1
)
{
word
=
word
.
replace
(
/l/g
,
'1'
);
}
if
(
word
.
indexOf
(
'L'
)
!=
-
1
)
{
word
=
word
.
replace
(
/L/g
,
'1'
);
}
if
(
word
.
indexOf
(
'|'
)
!=
-
1
)
{
word
=
word
.
replace
(
/
\|
/g
,
'1'
);
}
passportNo
=
word
;
}
else
if
(
word_name
==
'发照机构'
)
{
passportAddress
=
word
;
}
else
if
(
word_name
==
'有效期截止'
)
{
passportExpiry
=
this
.
formatDateWithTaiwan
(
word
);
}
else
if
(
word_name
==
'国籍'
)
{
nationality
=
{
'ID'
:
2
,
'Name'
:
'中国'
};
}
else
if
(
word_name
==
'出生地'
)
{
birthplace
=
word
;
}
else
if
(
word_name
==
'发照日期'
)
{
passportDate
=
this
.
formatDateWithTaiwan
(
word
);
}
}
formatData
=
{
'chinaFirstName'
:
chinaFirstName
,
'chinaLastName'
:
chinaLastName
,
'sex'
:
sex
,
'birthday'
:
birthday
,
'enFirstName'
:
enFirstName
,
'enLastName'
:
enLastName
,
'passportNo'
:
passportNo
,
'passportAddress'
:
passportAddress
,
'passportExpiry'
:
passportExpiry
,
'nationality'
:
nationality
,
'birthplace'
:
birthplace
,
'passportDate'
:
passportDate
};
return
formatData
;
},
commonTextDiscern
()
{
let
params
=
""
;
let
url
=
""
;
if
(
this
.
templateType
==
1
)
{
//身份证
params
=
"detect_direction=true&id_card_side=front&image="
+
encodeURIComponent
(
this
.
imgBase64String
);
url
=
this
.
BD_COMMON_TEXT_DISCERN_IDCARD
+
"?access_token="
+
this
.
access_token_ocr
;
}
else
{
//自定义模板
if
(
this
.
templateSign
==
""
)
{
this
.
$message
.
error
(
"请选择护照类型!"
);
return
;
}
params
=
"templateSign="
+
this
.
templateSign
+
"&image="
+
encodeURIComponent
(
this
.
imgBase64String
);
url
=
this
.
BD_COMMON_TEXT_DISCERN
+
"?access_token="
+
this
.
access_token_ocr
;
}
this
.
loading
=
true
;
this
.
apipost
(
"admin_get_ApiLinkAgency"
,
{
Path
:
url
,
Image
:
params
},
res
=>
{
if
(
res
.
data
.
resultCode
==
1
)
{
this
.
loading
=
false
;
if
(
this
.
templateType
==
1
)
{
//身份证
let
obj
=
JSON
.
parse
(
res
.
data
.
data
).
words_result
;
this
.
addMsg
.
Nationality
=
2
;
for
(
let
key
in
obj
)
{
switch
(
key
)
{
case
"姓名"
:
this
.
addMsg
.
SurName
=
obj
[
key
].
words
.
substring
(
0
,
1
);
this
.
addMsg
.
Name
=
obj
[
key
].
words
.
substring
(
1
,
obj
[
key
].
words
.
length
);
this
.
Transformation
(
this
.
addMsg
.
SurName
,
"SurName"
);
this
.
Transformation
(
this
.
addMsg
.
Name
,
"Name"
);
break
;
case
"公民身份号码"
:
this
.
addMsg
.
IdCard
=
obj
[
key
].
words
;
break
;
case
"住址"
:
this
.
addMsg
.
AddressDetail
=
obj
[
key
].
words
;
break
;
case
"性别"
:
obj
[
key
].
words
==
"男"
?
(
this
.
addMsg
.
Sex
=
"1"
)
:
(
this
.
addMsg
.
Sex
=
"2"
);
break
;
case
"出生"
:
this
.
addMsg
.
Birthday
=
obj
[
key
].
words
.
substring
(
0
,
4
)
+
"-"
+
obj
[
key
].
words
.
substring
(
4
,
6
)
+
"-"
+
obj
[
key
].
words
.
substring
(
6
,
8
);
default
:
break
;
}
//英文姓
if
(
tempObj
.
ESName
&&
tempObj
.
ESName
!=
''
)
{
this
.
addMsg
.
ESurName
=
tempObj
.
ESName
;
}
}
else
{
//自定义模板
if
(
this
.
templateSign
==
"7224a048d0fcc94413c3a729e481a775"
)
{
//台湾护照
let
obj
=
JSON
.
parse
(
res
.
data
.
data
);
let
myObj
=
this
.
formatDataWithTaiwan
(
obj
.
data
.
ret
)
this
.
addMsg
.
Birthday
=
myObj
.
birthday
this
.
addMsg
.
SurName
=
myObj
.
chinaFirstName
.
trim
()
this
.
addMsg
.
Name
=
myObj
.
chinaLastName
.
trim
()
this
.
addMsg
.
ESurName
=
myObj
.
enFirstName
.
trim
()
this
.
addMsg
.
EName
=
myObj
.
enLastName
.
trim
()
this
.
addMsg
.
Nationality
=
myObj
.
nationality
.
ID
this
.
addMsg
.
PassportAddress
=
myObj
.
passportAddress
this
.
addMsg
.
PassportExpiry
=
myObj
.
passportExpiry
this
.
addMsg
.
PassportNo
=
myObj
.
passportNo
this
.
addMsg
.
Sex
=
myObj
.
sex
.
Id
.
toString
()
this
.
addMsg
.
PassportIssued
=
myObj
.
passportDate
this
.
addMsg
.
BirthdayAddress
=
myObj
.
birthplace
}
else
if
(
this
.
templateSign
==
"2625f80ec957a0c837ca14f8ce608a51"
)
{
//大陆护照
let
obj
=
JSON
.
parse
(
res
.
data
.
data
);
let
myObj
=
this
.
formatDataWithChina
(
obj
.
data
.
ret
)
this
.
addMsg
.
Birthday
=
myObj
.
birthday
this
.
addMsg
.
SurName
=
myObj
.
chinaFirstName
.
trim
()
this
.
addMsg
.
Name
=
myObj
.
chinaLastName
.
trim
()
this
.
addMsg
.
ESurName
=
myObj
.
enFirstName
.
trim
()
this
.
addMsg
.
EName
=
myObj
.
enLastName
.
trim
()
this
.
addMsg
.
Nationality
=
myObj
.
nationality
.
ID
this
.
addMsg
.
PassportAddress
=
myObj
.
passportAddress
this
.
addMsg
.
PassportExpiry
=
myObj
.
passportExpiry
this
.
addMsg
.
PassportNo
=
myObj
.
passportNo
this
.
addMsg
.
Sex
=
myObj
.
sex
.
Id
.
toString
()
this
.
addMsg
.
PassportIssued
=
myObj
.
passportDate
this
.
addMsg
.
BirthdayAddress
=
myObj
.
birthplace
}
else
if
(
this
.
templateSign
==
"2dc78a37e516f18ebe56aeacc6d49203"
)
{
//大陆护照旧版
let
obj
=
JSON
.
parse
(
res
.
data
.
data
);
let
myObj
=
this
.
formatDataWithChina_old
(
obj
.
data
.
ret
)
this
.
addMsg
.
Birthday
=
myObj
.
birthday
this
.
addMsg
.
SurName
=
myObj
.
chinaFirstName
.
trim
()
this
.
addMsg
.
Name
=
myObj
.
chinaLastName
.
trim
()
this
.
addMsg
.
ESurName
=
myObj
.
enFirstName
.
trim
()
this
.
addMsg
.
EName
=
myObj
.
enLastName
.
trim
()
this
.
addMsg
.
Nationality
=
myObj
.
nationality
.
ID
this
.
addMsg
.
PassportAddress
=
myObj
.
passportAddress
this
.
addMsg
.
PassportExpiry
=
myObj
.
passportExpiry
this
.
addMsg
.
PassportNo
=
myObj
.
passportNo
this
.
addMsg
.
Sex
=
myObj
.
sex
.
Id
.
toString
()
this
.
addMsg
.
PassportIssued
=
myObj
.
passportDate
this
.
addMsg
.
BirthdayAddress
=
myObj
.
birthplace
}
else
if
(
this
.
templateSign
==
"2cd1d05f5efc5eec23ffad6358bdb70f"
)
{
//台湾通行证
//英文名
if
(
tempObj
.
EName
&&
tempObj
.
EName
!=
''
)
{
this
.
addMsg
.
EName
=
tempObj
.
EName
;
}
}
}
else
{
this
.
loading
=
false
;
}
},
err
=>
{}
);
//大陆身份证
else
if
(
params
.
Type
==
2
)
{
}
}
});
},
onUpload
(
val
)
{
let
preview
=
document
.
getElementById
(
"img"
);
...
...
@@ -2234,7 +1652,7 @@
this
.
getVisaIdentityTypeEnum
();
this
.
getEconomicCapability
();
this
.
GetGuestMustVisaAir
();
this
.
getAccessToken
();
this
.
isOneDay
=
this
.
$route
.
query
.
isOneDay
;
this
.
LineId
=
this
.
$route
.
query
.
LineId
;
this
.
addMsg
.
TCID
=
this
.
$route
.
query
.
TCID
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment