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
e87d70d7
Commit
e87d70d7
authored
Jul 11, 2025
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、多音字强制选择
2、身份证启用强制认证 3、自动填充出生日期 4、护照号2+8 5、 护照过期日期必须剩余6个月(出团日期)
parent
b377f14b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
302 additions
and
20 deletions
+302
-20
addPassenger.vue
src/components/SalesModule/addPassenger.vue
+302
-20
No files found.
src/components/SalesModule/addPassenger.vue
View file @
e87d70d7
...
...
@@ -158,15 +158,51 @@
</el-form-item>
</li>
<li
v-if=
"addMsg.Nationality==2"
>
<el-form-item
:label=
"$t('visaT.Chinesesurname')"
prop=
"SurName"
>
<el-input
v-model=
'addMsg.SurName'
class=
"w230"
@
input=
"Transformation(addMsg.SurName,'SurName')"
:placeholder=
"$t('rule.qsrzwm')"
></el-input>
<el-form-item
:label=
"$t('visaT.Chinesesurname')"
prop=
"SurNameID"
>
<el-select
class=
"w230"
ref=
"options"
v-model=
"addMsg.SurNameID"
filterable
remote
reserve-keyword
placeholder=
"请输入关键词"
:remote-method=
"(query)=>remoteMethod(query,1)"
@
change=
"(e)=>getName(e,1)"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"`$
{item.name}`"
:value="item.value">
<span
style=
"float: left"
>
{{
item
.
label
}}
</span>
<span
style=
"float: right; color: #8492a6; font-size: 13px"
>
{{
item
.
name
}}
</span>
</el-option>
</el-select>
</el-form-item>
</li>
<li
v-if=
"addMsg.Nationality==2"
>
<el-form-item
:label=
"$t('admin.admin_Surname')"
prop=
"Name"
>
<el-input
v-model=
'addMsg.Name'
class=
"w230"
@
input=
"Transformation(addMsg.Name,'Name')"
:placeholder=
"$t('rule.qsrzwm')"
></el-input>
<el-form-item
:label=
"$t('admin.admin_Surname')"
prop=
"NameID"
>
<el-select
class=
"w230"
ref=
"optionsNames"
v-model=
"addMsg.NameID"
filterable
remote
reserve-keyword
:placeholder=
"$t('rule.qsrzwm')"
:remote-method=
"(query)=>remoteMethod(query)"
@
change=
"(e)=>getName(e)"
>
<el-option
v-for=
"item in optionsNames"
:key=
"item.value"
:label=
"`$
{item.name}`"
:value="item.value">
<span
style=
"float: left"
>
{{
item
.
label
}}
</span>
<span
style=
"float: right; color: #8492a6; font-size: 13px"
>
{{
item
.
name
}}
</span>
</el-option>
</el-select>
</el-form-item>
</li>
<li>
...
...
@@ -192,9 +228,10 @@
</el-input>
</el-form-item>
</li>
<li
v-if=
"addMsg.Nationality==2"
>
<el-form-item
:label=
"$t('admin.admin_IDcard')"
prop=
"IdCard"
v-if=
"LineId === 14 || LineId === 2"
>
<el-input
v-model=
"addMsg.IdCard"
type=
"text"
size=
mini
class=
"w230"
<li
>
<!-- v-if="LineId === 14 || LineId === 2" -->
<el-form-item
:label=
"$t('admin.admin_IDcard')"
prop=
"IdCard"
v-if=
"addMsg.Nationality==2"
>
<el-input
v-model=
"addMsg.IdCard"
type=
"text"
:class=
" IdCardSure ? '' : 'colorRed'"
size=
mini
class=
"w230"
:placeholder=
"$t('visaT.Pleasefillin')"
@
blur
.
prevent=
"authentication()"
>
</el-input>
</el-form-item>
...
...
@@ -228,8 +265,8 @@
:placeholder=
"$t('visaT.ptxPassportNo')"
></el-input>
</el-form-item>
<el-form-item
:label=
"$t('system.table_Passport')"
prop=
"PassportNo"
v-else
>
<el-input
v-model=
'addMsg.PassportNo'
type=
"text"
size=
mini
class=
"w230"
:placeholder=
"$t('visaT.ptxPassportNo')"
></el-input>
<el-input
v-model=
'addMsg.PassportNo'
:class=
" PassportNoSure ? '' : 'colorRed'"
type=
"text"
size=
mini
class=
"w230"
@
change=
"isValidPassport"
:placeholder=
"$t('visaT.ptxPassportNo')"
></el-input>
</el-form-item>
</li>
<li>
...
...
@@ -666,6 +703,8 @@
DutyTypeList
:
[],
ppAge
:
0
,
loading
:
false
,
PassportNoSure
:
true
,
IdCardSure
:
true
,
templateType
:
1
,
templateSign
:
""
,
imgBase64String
:
""
,
...
...
@@ -675,6 +714,8 @@
OrderId
:
0
,
SurName
:
""
,
Name
:
""
,
SurNameID
:
""
,
NameID
:
""
,
Sex
:
""
,
EName
:
""
,
ESurName
:
""
,
...
...
@@ -765,11 +806,21 @@
message
:
this
.
$t
(
'visaT.qtxzwx'
),
trigger
:
"blur"
}],
SurNameID
:
[{
required
:
true
,
message
:
this
.
$t
(
'visaT.qtxzwx'
),
trigger
:
"change"
}],
Name
:
[{
required
:
true
,
message
:
this
.
$t
(
'visaT.qtxzwm'
),
trigger
:
"blur"
}],
NameID
:
[{
required
:
true
,
message
:
this
.
$t
(
'visaT.qtxzwm'
),
trigger
:
"change"
}],
Sex
:
[{
required
:
true
,
message
:
this
.
$t
(
'visaT.qtxzxb'
),
...
...
@@ -806,7 +857,7 @@
trigger
:
"blur"
},
{
pattern
:
/^
[
0-9a-zA-Z
]
+$/
,
pattern
:
/^
[
0-9a-zA-Z
]
+$/
,
//this.isValidPassport(),
message
:
this
.
$t
(
'visaT.zqdhzh'
)
}
],
...
...
@@ -865,12 +916,44 @@
roomlist
:
[],
isOneDay
:
0
,
LineId
:
0
,
GroupStartDateStr
:
''
,
//出发团期
EndDateStr
:
''
,
guoqi
:
false
,
JingDianList
:
[]
JingDianList
:
[],
options
:
[],
optionsNames
:
[],
};
},
methods
:
{
getName
(
e
,
type
){
let
findIndex
if
(
type
)
{
findIndex
=
this
.
options
.
findIndex
(
x
=>
x
.
value
==
e
)
let
obj
=
this
.
options
[
findIndex
]
this
.
addMsg
.
SurName
=
obj
.
name
this
.
addMsg
.
ESurName
=
obj
.
label
}
else
{
findIndex
=
this
.
optionsNames
.
findIndex
(
x
=>
x
.
value
==
e
)
let
obj
=
this
.
optionsNames
[
findIndex
]
this
.
addMsg
.
Name
=
obj
.
name
this
.
addMsg
.
EName
=
obj
.
label
}
},
remoteMethod
(
query
,
type
)
{
if
(
query
!==
''
)
{
if
(
type
==
1
)
{
if
(
query
!=
this
.
addMsg
.
SurName
)
this
.
addMsg
.
SurName
=
query
this
.
Transformation
(
query
,
'SurName'
)
}
else
{
if
(
query
!=
this
.
addMsg
.
Name
)
this
.
addMsg
.
Name
=
query
this
.
Transformation
(
query
,
'Name'
)
}
}
else
{
if
(
type
==
1
)
this
.
options
=
[];
else
this
.
optionsNames
=
[]
}
},
getDutyType
()
{
this
.
apipost
(
"dict_get_GetDictValueCommonList"
,
{
...
...
@@ -1103,6 +1186,10 @@
},
submitForm
(
addMsg
,
type
)
{
if
(
this
.
btnState
===
true
)
{
// if(this.LineId!=90&&this.addMsg.Nationality===2&& !this.isValidPassport(this.addMsg.PassportNo)){
// this.Error(this.$t('visaT.Pleasefillin')+this.$t('visaT.zqdhzh'));
// return false;
// }
//提交创建、修改表单
this
.
$refs
[
addMsg
].
validate
(
valid
=>
{
this
.
btnState
=
false
...
...
@@ -1169,6 +1256,15 @@
},
savePassenger
(
type
)
{
this
.
timeOver
()
var
result
=
this
.
isValidPassport
()
if
(
!
result
)
{
return
;
}
if
(
this
.
addMsg
.
Nationality
===
2
&&
!
this
.
isValidIdCardFormat
(
this
.
addMsg
.
IdCard
)){
this
.
$message
.
error
(
"无效的身份证号码"
);
return
;
}
if
((
this
.
LineId
===
14
||
this
.
LineId
===
2
)
&&
this
.
addMsg
.
IdCard
===
''
&&
this
.
addMsg
.
Nationality
==
2
)
{
return
this
.
$message
.
error
(
this
.
$t
(
'objFill.qingtxsfzhm'
));
}
...
...
@@ -1234,18 +1330,120 @@
});
this
.
$forceUpdate
();
},
Transformation
(
val
,
type
)
{
combinePinyinDPs
(
pinyinArrays
)
{
let
combinations
=
[
""
];
for
(
const
pinyinGroup
of
pinyinArrays
)
{
const
newCombinations
=
[];
for
(
const
prefix
of
combinations
)
{
for
(
const
pinyin
of
pinyinGroup
)
{
newCombinations
.
push
(
prefix
+
pinyin
);
}
}
combinations
=
newCombinations
;
}
return
combinations
.
join
(
","
);
},
combinePinyinDP
(
pinyinArrays
)
{
const
result
=
[];
const
dfs
=
(
index
,
currentStr
)
=>
{
if
(
index
===
pinyinArrays
.
length
)
{
result
.
push
(
currentStr
);
return
;
}
for
(
const
pinyin
of
pinyinArrays
[
index
])
{
dfs
(
index
+
1
,
currentStr
+
pinyin
);
}
};
dfs
(
0
,
""
);
return
result
.
join
(
","
);
},
Transformation
(
val
,
type
,
input
)
{
let
text
=
this
.
pinyin
(
val
,
{
style
:
this
.
pinyin
.
STYLE_NORMAL
heteronym
:
true
,
// 启用多音字模式
style
:
this
.
pinyin
.
STYLE_NORMAL
,
segment
:
true
});
// 如果当前字是 "茜",则替换为自定义拼音
if
(
val
.
includes
(
'茜'
)){
text
=
text
.
map
(
pinyinArr
=>
{
if
(
pinyinArr
[
0
]
===
'qian'
)
{
// 默认返回的是 qian
return
[
'qiàn'
,
'xī'
];
// 替换成自定义多音字
}
return
pinyinArr
;
});
}
console
.
log
(
"text"
,
text
);
const
pinyinArray
=
text
const
result
=
this
.
combinePinyinDP
(
pinyinArray
);
if
(
type
==
"SurName"
)
{
let
upText
=
text
.
join
(
""
).
toLocaleUpperCase
()
this
.
addMsg
.
ESurName
=
upText
;
let
upText
=
result
// this.addMsg.ESurName = upText;
this
.
options
=
[]
let
names
=
upText
.
split
(
','
)
names
.
forEach
((
x
,
index
)
=>
{
this
.
options
.
push
({
label
:
x
.
toUpperCase
(),
value
:
index
+
1
,
name
:
this
.
addMsg
.
SurName
,
})
})
if
(
names
!=
null
&&
names
.
length
==
1
){
if
(
input
){
this
.
addMsg
.
SurNameID
=
this
.
options
[
0
].
value
;
this
.
addMsg
.
ESurName
=
this
.
options
[
0
].
label
;
}
else
{
setTimeout
(()
=>
{
this
.
addMsg
.
SurNameID
=
this
.
options
[
0
].
value
;
this
.
addMsg
.
ESurName
=
this
.
options
[
0
].
label
;
},
500
);
}
}
else
{
let
findIndex
=
this
.
options
.
findIndex
(
x
=>
x
.
label
==
this
.
addMsg
.
ESurName
)
if
(
findIndex
!=-
1
){
this
.
addMsg
.
SurNameID
=
this
.
options
[
findIndex
].
value
;
}
else
{
this
.
addMsg
.
SurNameID
=
''
;
this
.
addMsg
.
ESurName
=
''
;
}
}
this
.
$forceUpdate
()
}
if
(
type
==
"Name"
)
{
let
upText
=
text
.
join
(
""
).
toLocaleUpperCase
()
this
.
addMsg
.
EName
=
upText
;
let
upText
=
result
// this.addMsg.EName = upText;
this
.
optionsNames
=
[]
let
names
=
upText
.
split
(
','
)
names
.
forEach
((
x
,
index
)
=>
{
this
.
optionsNames
.
push
({
label
:
x
.
toUpperCase
(),
value
:
index
+
1
,
name
:
this
.
addMsg
.
Name
,
})
})
if
(
names
!=
null
&&
names
.
length
==
1
){
setTimeout
(()
=>
{
if
(
this
.
optionsNames
.
length
>
0
){
this
.
addMsg
.
NameID
=
this
.
optionsNames
[
0
].
value
;
this
.
addMsg
.
EName
=
this
.
optionsNames
[
0
].
label
;
}
},
500
);
}
else
{
let
findIndex
=
this
.
optionsNames
.
findIndex
(
x
=>
x
.
label
==
this
.
addMsg
.
EName
)
if
(
findIndex
!=-
1
){
this
.
addMsg
.
NameID
=
this
.
optionsNames
[
findIndex
].
value
;
return
}
this
.
addMsg
.
NameID
=
''
;
this
.
addMsg
.
EName
=
''
;
}
}
this
.
$forceUpdate
()
},
getVisaIdentityTypeEnum
()
{
//获取身份证明
...
...
@@ -1327,6 +1525,30 @@
err
=>
{}
);
},
// 中国护照验证逻辑
isValidPassport
:
function
()
{
var
isCheck
=
true
;
if
(
this
.
addMsg
.
PassportNo
.
length
!==
9
)
{
this
.
$message
.
error
(
"请输入9位护照号"
)
isCheck
=
false
;
return
;
}
if
(
this
.
addMsg
.
Nationality
===
2
){
// 单个字母开头(E或G)后跟8位数字
const
pattern1
=
/^
[
EG
][
0-9
]{8}
$/
;
// 两个字母开头(E开头,第二个字母不能是I或O)后跟7位数字
const
pattern2
=
/^E
[
A-HJ-NP-Z
][
0-9
]{7}
$/
;
this
.
PassportNoSure
=
pattern1
.
test
(
this
.
addMsg
.
PassportNo
)
||
pattern2
.
test
(
this
.
addMsg
.
PassportNo
);
if
(
!
this
.
PassportNoSure
){
this
.
$message
.
error
(
"护照格式不正确"
)
isCheck
=
false
;
return
;
}
}
return
isCheck
;
},
getVisaApplyForTypeEnum
()
{
// 获取申请类型
this
.
apipost
(
...
...
@@ -1424,6 +1646,8 @@
if
(
this
.
$route
.
query
.
isOneDay
===
1
)
{
this
.
addMsg
.
IsBed
=
0
}
this
.
Transformation
(
this
.
addMsg
.
SurName
,
'SurName'
,
1
)
this
.
Transformation
(
this
.
addMsg
.
Name
,
'Name'
,
2
)
}
else
{
this
.
$message
.
error
();
}
...
...
@@ -1631,14 +1855,71 @@
this
.
addMsg
.
Id
=
this
.
$route
.
query
.
guestId
;
this
.
addMsg
.
TCID
=
this
.
$route
.
query
.
TCID
;
this
.
addMsg
.
OrderId
=
this
.
$route
.
query
.
orderId
;
this
.
Roominformation
()
//调取下房间信息
}
},
err
=>
{}
);
}
}
}
this
.
addMsg
.
Birthday
=
this
.
getBirthdayFromIdCard
(
IdCard
);
},
isValidIdCardFormat
(
idCard
)
{
const
reg
=
/^
[
1-9
]\d{5}(
18|19|20
)\d{2}(
0
[
1-9
]
|1
[
0-2
])(
0
[
1-9
]
|
[
12
]\d
|3
[
01
])\d{3}[\d
Xx
]
$/
;
return
reg
.
test
(
idCard
);
},
getBirthdayFromIdCard
(
idCard
)
{
// 去除空格并转换为大写(处理末尾可能的小写x)
idCard
=
(
idCard
||
''
).
trim
().
toUpperCase
();
const
len
=
idCard
.
length
;
// 验证身份证长度
if
(
len
!==
15
&&
len
!==
18
)
{
this
.
$message
.
error
(
"无效的身份证号码"
);
this
.
IdCardSure
=
false
;
return
""
;
}
let
year
,
month
,
day
;
if
(
len
===
15
)
{
// 15位身份证
year
=
'19'
+
idCard
.
substring
(
6
,
8
);
// 年份补19前缀
month
=
idCard
.
substring
(
8
,
10
);
day
=
idCard
.
substring
(
10
,
12
);
}
else
{
// 18位身份证
year
=
idCard
.
substring
(
6
,
10
);
month
=
idCard
.
substring
(
10
,
12
);
day
=
idCard
.
substring
(
12
,
14
);
}
// 日期有效性验证
const
date
=
new
Date
(
`
${
year
}
-
${
month
}
-
${
day
}
`
);
if
(
isNaN
(
date
.
getTime
()))
{
this
.
$message
.
error
(
"身份证中的出生日期无效"
);
this
.
IdCardSure
=
false
;
return
""
;
}
this
.
IdCardSure
=
true
;
// 返回格式化的出生日期(YYYY-MM-DD)
return
`
${
year
}
-
${
month
.
padStart
(
2
,
'0'
)}
-
${
day
.
padStart
(
2
,
'0'
)}
`
;
},
getData
:
function
()
{
this
.
loading
=
true
this
.
apipost
(
"sellorder_get_GetTravelGuestList"
,
{
OrderId
:
this
.
$route
.
query
.
orderId
},
res
=>
{
if
(
res
.
data
.
resultCode
==
1
)
{
this
.
GroupStartDateStr
=
res
.
data
.
data
.
GroupStartDateStr
;
}
else
{
this
.
$message
.
error
(
res
.
data
.
message
)
}
this
.
loading
=
false
});
},
},
mounted
()
{
this
.
getTravelType
();
...
...
@@ -1651,6 +1932,7 @@
this
.
getVisaIdentityTypeEnum
();
this
.
getEconomicCapability
();
this
.
GetGuestMustVisaAir
();
// this.getData();
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