addVip.vue
11.7 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<template>
<view>
<uni-segmented-control class="whitebg" :current="current" :values="items" @clickItem="onClickItem"
styleType="text" activeColor="#C40F18"></uni-segmented-control>
<view class="hasfixedbottom">
<view>
<uni-forms ref="baseForm" :border="true" :modelValue="baseFormData" label-width="80">
<view class="nolineform">
<uni-forms-item label="姓名" required name="name" v-show="current === 0">
<uni-easyinput :styles="inputstyle" :clearable='false' :placeholderStyle="placeholderStyle"
v-model="baseFormData.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="证件类型" required name="idcType">
<uni-data-select v-model="baseFormData.idcType" :localdata="idcTypeList"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="证件照" required name="picUrl" v-show="current === 1">
<view class="upCard">
<uni-file-picker :class="baseFormData.card?'':'op0'" v-model="baseFormData.cardObj"
@delete="delimgFont" return-type="object" limit="1" @select="upIdCardImgFront"
:image-styles="imageStylesZJ"></uni-file-picker>
<image v-if="!baseFormData.card" class="sfz" src="@/static/login/sfz.png">
</image>
</view>
</uni-forms-item>
<uni-forms-item label="姓名" required name="name" v-show="current === 1">
<uni-easyinput :styles="inputstyle" :clearable='false' :placeholderStyle="placeholderStyle"
v-model="baseFormData.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="证件号码" required name="idcCode">
<uni-easyinput :styles="inputstyle" :clearable='false' :placeholderStyle="placeholderStyle"
v-model="baseFormData.idcCode" @blur="giveBirthDay" placeholder="请输入证件号码" />
</uni-forms-item>
<uni-forms-item label="性别" required name="sex">
<uni-data-checkbox v-model="baseFormData.sex" @change="changeSex" :localdata="sexs" />
</uni-forms-item>
<uni-forms-item label="出生日期" required name="birth">
<uni-datetime-picker type="date" placeholder="YYYY-MM-DD" :border='false'
:clear-icon="false" v-model="baseFormData.birth" />
</uni-forms-item>
<uni-forms-item label="联系方式" name="phone">
<uni-easyinput :styles="inputstyle" :placeholderStyle="placeholderStyle"
v-model="baseFormData.phone" placeholder="请输入联系方式" />
</uni-forms-item>
<uni-forms-item label="所在地区">
<uni-data-picker class="fixUniFormItemStyle" v-model="baseFormData.cityId"
:localdata="regionsList" popup-title="请选择所在地区"></uni-data-picker>
</uni-forms-item>
<uni-forms-item label="详细地址"><uni-easyinput :styles="inputstyle"
:placeholderStyle="placeholderStyle" v-model="baseFormData.address"
placeholder="请输入详细地址" /></uni-forms-item>
<uni-forms-item label="头像" required name="photo">
<uni-file-picker v-model="baseFormData.photoObj" @delete="delPhoto" return-type="object"
limit="1" @select="upPhoto" :image-styles="imageStylesTx"></uni-file-picker>
</uni-forms-item>
</view>
</uni-forms>
</view>
<view class="agreeline">
<image @click="changeAgree(agree)" v-if="agree" src="@/static/login/xz_dwn@2x.png"></image>
<image @click="changeAgree(agree)" v-else src="@/static/login/xz@2x.png"></image>
<view>我已阅读<text @click="openpopup">《入会须知》</text></view>
</view>
</view>
<view class="fixedBottom"><button class="btn-red" @click="goSubmit">确 定</button></view>
<!-- 会员须知 -->
<uni-popup ref="popup" type="bottom" background-color="#fff" animation>
<view class="tt">入会须知</view>
<view class="popBody">
______欢迎您申请成为中国跆拳道协会(以下简称中国跆协)会员,请确保本次申请是经过您本人或监护人授权同意后的自愿行为,请您务必仔细阅读本入会须知。
<br />
一、中国跆协会员分为个人会员和单位会员。
<br />
二、成为本协会会员条件:遵守中国跆协章程和协会各项规章制度及相关决议,按期交纳会费,积极支持和参与中国跆拳道事业发展的社会各届人士或地方跆拳道协会、俱乐部、培训机构等,均可自愿申请成为中国跆协会员。
<br />
三、个人会员为在中国工作和生活的跆拳道爱好者,16 周岁以下应有监护人协助申请,会员须为中国公民。
<br />
四、会员入会需向所在区域内中国跆协单位会员提出入会申请,并按程序报中国跆协批准,按规定交纳会费。
<br />
五、会员享有《中国跆拳道协会会员管理办法》规定的会员权利。
<br />
六、会员应履行《中国跆拳道协会会员管理办法》规定的会员义务。
<br />
七、凡中国跆协会员,须按照《中国跆拳道协会会员会费标准(2021 版)》按时交纳年度会费。
<br />
八、会员行为违反《中国跆拳道协会会员管理办法》中规定的,按照相关处罚规定进行处理。
<br />
九、会员有退会的自由。会员自愿退会应至少提前 3 个月以书面形式通知本协会,并在此之前,妥善解决与本协会及其他会员之间的财务等问题,方可退会。
<br />
十、其它会员相关内容请查看《中国跆拳道协会会员管理办法》。
<button @click="closepopup" class="btn-red">我已阅读</button>
</view>
</uni-popup>
</view>
</template>
<script setup>
import {
onMounted,
ref
} from 'vue'
import * as api from '@/common/api.js'
const current = ref(0)
const popup = ref(null)
const agree = ref(false)
const perId = ref()
const regionsList = ref([])
const baseFormData = ref({
sex: '0',
idcType: '0',
perType: '1', // (1:个人会员;2:教练;3:考官;4:裁判;5:临时会员;)
})
const items = ref(['手动录入', '自动录入'])
const idcTypeList = ref([{
value: '0',
text: "身份证"
},
{
value: '1',
text: "港澳台通信身份证"
},
{
value: '2',
text: "中国护照"
},
{
value: '3',
text: "外国护照"
}
])
const sexs = ref([{
text: '女',
value: '0'
}, {
text: '男',
value: '1'
}])
const placeholderStyle = ref('text-align: right;font-size:30rpx')
const inputstyle = ref({
borderColor: '#fff',
fontSize: '30rpx'
})
const imageStylesTx = ref({
width: '210rpx',
height: '280rpx',
background: {
color: '#F4F6FA'
},
border: {
radius: '2px'
}
});
const imageStylesZJ = ref({
width: '500rpx',
height: '316rpx'
});
onMounted(() => {
getRegionsList()
})
function getRegionsList() {
api.regionsList().then(res => {
regionsList.value = res.data
})
}
function onClickItem(e) {
if (current.value != e.currentIndex) {
current.value = e.currentIndex
}
}
function changeAgree(item) {
agree.value = !item
}
//身份证识别
function upIdCardImgFront(e) {
baseFormData.value.card = e.tempFiles;
// console.log(e)
// const formData = new FormData()
// formData.append('pic', e.tempFiles[0].file)
api.carUrl(e.tempFilePaths[0], baseFormData.value.idcType).then(res => {
baseFormData.value.idcUrl = res.data.url
baseFormData.value.sex = res.data.sex
baseFormData.value.birth = res.data.birth
baseFormData.value.idcCode = res.data.code
baseFormData.value.cityId = res.data.cityId
baseFormData.value.address = res.data.address
baseFormData.value.photo = res.data.photo
baseFormData.value.name = res.data.name
baseFormData.value.picUUid = res.data.picUUid
})
// api.uploadImg(e).then(data => {
// baseFormData.value.card = data.data;
// });
}
function upPhoto(e) {
api.uploadImg(e).then(data => {
baseFormData.value.photo = data.data;
});
}
function delimgFont(n) {
baseFormData.value.card = '';
}
function delPhoto(n) {
baseFormData.value.photo = '';
}
function giveBirthDay() {
// 判断身份证正确性/赋值生日
if (baseFormData.value.idcType == 0) {
if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(baseFormData.value.idcCode))) {
uni.showToast({
title: '请输入正确的身份证号码',
duration: 2000,
icon: 'none'
})
} else {
let tmpStr = "";
if (baseFormData.value.idcCode.length == 15) {
tmpStr = baseFormData.value.idcCode.substring(6, 12);
tmpStr = "19" + tmpStr;
tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6)
} else {
tmpStr = baseFormData.value.idcCode.substring(6, 14);
tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6)
}
baseFormData.value.birth = tmpStr
const res = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/
if (baseFormData.value.idcCode && res.test(baseFormData.value.idcCode)) {
const genderCode = baseFormData.value.idcCode.charAt(16)
if (parseInt(genderCode) % 2 == 0) {
baseFormData.value.sex = '0'
} else {
baseFormData.value.sex = '1'
}
}
}
}
}
function changeSex(e) {
console.log("性别:", e.detail.value)
}
function openpopup() {
popup.value.open()
}
function closepopup() {
agree.value = true
popup.value.close()
}
function goSubmit() {
if (!agree.value) {
uni.showToast({
icon: 'none',
title: '请阅知入会须知',
duration: 2000
});
return
}
// 验证必填项
//信息确认弹出
uni.showModal({
content: '确认信息正确',
success: function(res) {
if (res.confirm) {
delete baseFormData.value
api.addPersonToMyDept(baseFormData.value).then(res => {
if (res.data == 0) {
let msg = '该成员,实名认证未通过,注册失败!'
resultDialog.value = true
return
}
if (res.data * 1 < 0) {
// 会员调入弹出
perId.value = res.data.slice(1)
getUserInfo()
return
}
let msg = '操作成功,您可以去列表中查看'
form.value = { perType: 1, idcType: '0' }
}).catch(() => {
let msg = '您已注册该会员,请不要重复注册!'
})
}
}
});
}
function getUserInfo() {
api.getInfo(perId.value).then(res=>{
forms.value = res.data
if (forms.areaAssName)forms.ancestorNameList = forms.value.ancestorNameList.join(',').replaceAll(',', '/')
})
}
</script>
<style lang="scss" scoped>
:deep(.segmented-control) {
height: 100rpx;
}
:deep(.segmented-control__text) {
line-height: 2;
font-size: 30rpx;
}
.tt {
text-align: center;
font-size: 30rpx;
padding: 40rpx 0 0;
}
.popBody {
font-size: 28rpx;
line-height: 1.5;
font-family: 华文仿宋;
height: 80vh;
overflow: auto;
padding: 30rpx;
.btn-red {
margin: 50rpx 0 30rpx;
}
}
.agreeline {
padding: 20rpx 40rpx;
box-sizing: border-box;
display: flex;
font-size: 30rpx;
text {
color: #014A9F;
}
image {
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
}
}
.upCard {
position: relative;
width: 500rpx;
height: 316rpx;
.uni-file-picker {
position: absolute;
z-index: 1;
}
.sfz {
width: 500rpx;
height: 316rpx;
}
}
.op0 {
opacity: 0;
}
:deep(.item-text-overflow) {
text-align: left;
}
:deep(.selected-list) {
justify-content: flex-end;
}
</style>