add-watch-people.vue
3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<script setup>
import { ElMessage } from "element-plus";
import { addViewPeople } from "./api/index.js";
const router = useRouter();
const people = reactive({
form: {
name: "",
idCard: "",
},
type: "身份证",
onConfirm() {
if (!people.form.name)
return ElMessage({ type: "warning", message: "请输入姓名" });
if (!people.form.idCard)
return ElMessage({ type: "warning", message: "请输入证件号" });
// 使用正则验证身份证号码格式
const idCardRegex =
/^[1-9]\d{5}(19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[\dXx]$/;
if (!idCardRegex.test(people.form.idCard))
return ElMessage({ type: "warning", message: "身份证号格式不正确" });
addViewPeople(people.form).then((res) => {
ElMessage({ type: "success", message: "操作成功" });
router.go(-2);
});
},
});
</script>
<template>
<div class="container">
<div class="title">新增观影人</div>
<div class="content">
<div class="form-item">
<div>
<div class="label">姓名</div>
<el-input
v-model="people.form.name"
style="width: 570px"
placeholder="请输入姓名"
/>
</div>
<div>
<div class="label">证件类型</div>
<el-input
v-model="people.type"
style="width: 570px"
placeholder="Please input"
readonly
/>
</div>
</div>
<div class="form-item">
<div>
<div class="label">身份证号</div>
<el-input
v-model="people.form.idCard"
style="width: 570px"
placeholder="请输入身份证号"
/>
</div>
</div>
</div>
<div class="footer">
<div class="can_pay">取消</div>
<div class="pay" @click="people.onConfirm()">确认</div>
</div>
</div>
</template>
<style scoped lang="scss">
div {
box-sizing: border-box;
}
.container {
padding: 20px 0;
width: 1200px;
margin: 0 auto;
.title {
padding: 11px;
text-align: center;
background: linear-gradient(270deg, #493ceb 0%, #8623fc 100%);
font-size: 18px;
color: #ffffff;
}
.content {
padding: 46px 20px 24px;
background-color: #fff;
:deep(.el-input) {
height: 48px;
border-radius: 24px !important;
}
.form-item {
display: flex;
gap: 20px;
margin-bottom: 36px;
&:last-child {
margin: 0;
}
.label {
font-size: 18px;
color: #333333;
margin-bottom: 16px;
}
}
}
.footer {
display: flex;
justify-content: center;
align-items: center;
gap: 20px;
height: 70px;
background-color: #fff;
margin-top: 12px;
.pay {
width: 200px;
height: 40px;
background: linear-gradient(270deg, #493ceb 0%, #8623fc 100%);
border-radius: 20px;
font-weight: 500;
font-size: 16px;
color: #ffffff;
line-height: 40px;
text-align: center;
cursor: pointer;
}
.can_pay {
width: 200px;
height: 40px;
background: #f6f6f6;
border-radius: 20px;
font-weight: 500;
font-size: 16px;
color: #999;
line-height: 40px;
text-align: center;
box-sizing: border-box;
cursor: pointer;
}
}
}
</style>