feat(collectionSettings): 添加身份证信息上传和有效期选择功能
新增身份证人像面、国徽面上传功能,包含预览和删除操作 添加身份证有效期开始和结束日期选择器 增加身份证地址输入字段 更新表单验证逻辑以包含新增字段
Showing
2 changed files
with
480 additions
and
14 deletions
| ... | @@ -356,3 +356,121 @@ | ... | @@ -356,3 +356,121 @@ |
| 356 | } | 356 | } |
| 357 | } | 357 | } |
| 358 | } | 358 | } |
| 359 | + | ||
| 360 | +// 身份证图片上传样式 | ||
| 361 | +.idcard-img-container { | ||
| 362 | + margin-top: 20rpx; | ||
| 363 | +} | ||
| 364 | + | ||
| 365 | +.idcard-img-upload { | ||
| 366 | + width: 100%; | ||
| 367 | + height: 200rpx; | ||
| 368 | + border: 2rpx dashed #ddd; | ||
| 369 | + border-radius: 12rpx; | ||
| 370 | + display: flex; | ||
| 371 | + flex-direction: column; | ||
| 372 | + align-items: center; | ||
| 373 | + justify-content: center; | ||
| 374 | + background-color: #fafafa; | ||
| 375 | + transition: all 0.3s ease; | ||
| 376 | + | ||
| 377 | + &:active { | ||
| 378 | + background-color: #f0f0f0; | ||
| 379 | + border-color: #ccc; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + .upload-icon { | ||
| 383 | + font-size: 48rpx; | ||
| 384 | + color: #999; | ||
| 385 | + margin-bottom: 10rpx; | ||
| 386 | + } | ||
| 387 | + | ||
| 388 | + .upload-text { | ||
| 389 | + font-size: 28rpx; | ||
| 390 | + color: #999; | ||
| 391 | + } | ||
| 392 | +} | ||
| 393 | + | ||
| 394 | +.idcard-img-preview { | ||
| 395 | + width: 100%; | ||
| 396 | + position: relative; | ||
| 397 | + | ||
| 398 | + .idcard-img-image { | ||
| 399 | + width: 100%; | ||
| 400 | + height: 200rpx; | ||
| 401 | + border-radius: 12rpx; | ||
| 402 | + object-fit: cover; | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + .idcard-img-actions { | ||
| 406 | + display: flex; | ||
| 407 | + justify-content: space-between; | ||
| 408 | + margin-top: 20rpx; | ||
| 409 | + | ||
| 410 | + .change-img-btn { | ||
| 411 | + flex: 1; | ||
| 412 | + text-align: center; | ||
| 413 | + padding: 20rpx; | ||
| 414 | + background-color: #ffa500; | ||
| 415 | + color: white; | ||
| 416 | + border-radius: 8rpx; | ||
| 417 | + font-size: 28rpx; | ||
| 418 | + margin-right: 10rpx; | ||
| 419 | + | ||
| 420 | + &:active { | ||
| 421 | + background-color: #e6940a; | ||
| 422 | + } | ||
| 423 | + } | ||
| 424 | + | ||
| 425 | + .delete-img-btn { | ||
| 426 | + flex: 1; | ||
| 427 | + text-align: center; | ||
| 428 | + padding: 20rpx; | ||
| 429 | + background-color: #ff4757; | ||
| 430 | + color: white; | ||
| 431 | + border-radius: 8rpx; | ||
| 432 | + font-size: 28rpx; | ||
| 433 | + margin-left: 10rpx; | ||
| 434 | + | ||
| 435 | + &:active { | ||
| 436 | + background-color: #e63946; | ||
| 437 | + } | ||
| 438 | + } | ||
| 439 | + } | ||
| 440 | +} | ||
| 441 | + | ||
| 442 | +// 日期选择器样式 | ||
| 443 | +.date-selector { | ||
| 444 | + display: flex; | ||
| 445 | + align-items: center; | ||
| 446 | + justify-content: space-between; | ||
| 447 | + padding: 20rpx 0; | ||
| 448 | + border-bottom: 1rpx solid #eee; | ||
| 449 | + min-height: 80rpx; | ||
| 450 | + | ||
| 451 | + .date-text { | ||
| 452 | + font-size: 32rpx; | ||
| 453 | + color: #999; | ||
| 454 | + | ||
| 455 | + &.date-selected { | ||
| 456 | + color: #333; | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | + | ||
| 460 | + .arrow-down { | ||
| 461 | + font-size: 28rpx; | ||
| 462 | + color: #999; | ||
| 463 | + // transform: rotate(90deg); | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + &:active { | ||
| 467 | + background-color: #f5f5f5; | ||
| 468 | + } | ||
| 469 | +} | ||
| 470 | + | ||
| 471 | +// 必填项红色*号标记 | ||
| 472 | +.required-mark { | ||
| 473 | + color: #ff4757; | ||
| 474 | + font-size: 28rpx; | ||
| 475 | + margin-right: 8rpx; | ||
| 476 | +} | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-08-07 14:52:58 | 4 | + * @LastEditTime: 2025-08-07 15:12:29 |
| 5 | * @FilePath: /jgdl/src/pages/collectionSettings/index.vue | 5 | * @FilePath: /jgdl/src/pages/collectionSettings/index.vue |
| 6 | * @Description: 收款设置 | 6 | * @Description: 收款设置 |
| 7 | --> | 7 | --> |
| ... | @@ -55,7 +55,7 @@ | ... | @@ -55,7 +55,7 @@ |
| 55 | 55 | ||
| 56 | <view class="form-content"> | 56 | <view class="form-content"> |
| 57 | <view class="form-item"> | 57 | <view class="form-item"> |
| 58 | - <text class="form-label">银行名称</text> | 58 | + <text class="form-label"><text class="required-mark">*</text>银行名称</text> |
| 59 | <view class="bank-selector" @click="showBankPicker"> | 59 | <view class="bank-selector" @click="showBankPicker"> |
| 60 | <text class="bank-text" :class="{ 'bank-selected': tempAccountInfo.bankName }"> | 60 | <text class="bank-text" :class="{ 'bank-selected': tempAccountInfo.bankName }"> |
| 61 | {{ getBankNameById(tempAccountInfo.bankName) || '请选择银行' }} | 61 | {{ getBankNameById(tempAccountInfo.bankName) || '请选择银行' }} |
| ... | @@ -65,7 +65,7 @@ | ... | @@ -65,7 +65,7 @@ |
| 65 | </view> | 65 | </view> |
| 66 | 66 | ||
| 67 | <view class="form-item"> | 67 | <view class="form-item"> |
| 68 | - <text class="form-label">银行账号</text> | 68 | + <text class="form-label"><text class="required-mark">*</text>银行账号</text> |
| 69 | <input | 69 | <input |
| 70 | v-model="tempAccountInfo.bankAccount" | 70 | v-model="tempAccountInfo.bankAccount" |
| 71 | placeholder="请输入银行账号" | 71 | placeholder="请输入银行账号" |
| ... | @@ -77,7 +77,7 @@ | ... | @@ -77,7 +77,7 @@ |
| 77 | 77 | ||
| 78 | <!-- 银行卡正面照片上传 --> | 78 | <!-- 银行卡正面照片上传 --> |
| 79 | <view class="form-item"> | 79 | <view class="form-item"> |
| 80 | - <text class="form-label">银行卡正面照</text> | 80 | + <text class="form-label"><text class="required-mark">*</text>银行卡正面照</text> |
| 81 | <view class="bank-img-container"> | 81 | <view class="bank-img-container"> |
| 82 | <view v-if="tempAccountInfo.bankImg" class="bank-img-preview"> | 82 | <view v-if="tempAccountInfo.bankImg" class="bank-img-preview"> |
| 83 | <image | 83 | <image |
| ... | @@ -111,7 +111,7 @@ | ... | @@ -111,7 +111,7 @@ |
| 111 | type="primary" | 111 | type="primary" |
| 112 | @click="saveAccountInfo" | 112 | @click="saveAccountInfo" |
| 113 | color="#ffa500" | 113 | color="#ffa500" |
| 114 | - :disabled="!tempAccountInfo.bankName || !tempAccountInfo.bankAccount" | 114 | + :disabled="!tempAccountInfo.bankName || !tempAccountInfo.bankAccount || !tempAccountInfo.bankImg" |
| 115 | class="footer-btn footer-btn-save" | 115 | class="footer-btn footer-btn-save" |
| 116 | > | 116 | > |
| 117 | 保存 | 117 | 保存 |
| ... | @@ -152,7 +152,7 @@ | ... | @@ -152,7 +152,7 @@ |
| 152 | 152 | ||
| 153 | <view class="form-content"> | 153 | <view class="form-content"> |
| 154 | <view class="form-item"> | 154 | <view class="form-item"> |
| 155 | - <text class="form-label">用户名称</text> | 155 | + <text class="form-label"><text class="required-mark">*</text>用户名称</text> |
| 156 | <input | 156 | <input |
| 157 | v-model="tempIdentityInfo.userName" | 157 | v-model="tempIdentityInfo.userName" |
| 158 | placeholder="请输入真实姓名" | 158 | placeholder="请输入真实姓名" |
| ... | @@ -161,7 +161,7 @@ | ... | @@ -161,7 +161,7 @@ |
| 161 | </view> | 161 | </view> |
| 162 | 162 | ||
| 163 | <view class="form-item"> | 163 | <view class="form-item"> |
| 164 | - <text class="form-label">身份证号码</text> | 164 | + <text class="form-label"><text class="required-mark">*</text>身份证号码</text> |
| 165 | <input | 165 | <input |
| 166 | v-model="tempIdentityInfo.idCard" | 166 | v-model="tempIdentityInfo.idCard" |
| 167 | placeholder="请输入身份证号码" | 167 | placeholder="请输入身份证号码" |
| ... | @@ -172,6 +172,85 @@ | ... | @@ -172,6 +172,85 @@ |
| 172 | /> | 172 | /> |
| 173 | <text v-if="idCardError" class="error-text">{{ idCardError }}</text> | 173 | <text v-if="idCardError" class="error-text">{{ idCardError }}</text> |
| 174 | </view> | 174 | </view> |
| 175 | + | ||
| 176 | + <!-- 身份证人像面照片上传 --> | ||
| 177 | + <view class="form-item"> | ||
| 178 | + <text class="form-label"><text class="required-mark">*</text>身份证人像面</text> | ||
| 179 | + <view class="idcard-img-container"> | ||
| 180 | + <view v-if="tempIdentityInfo.idcard_1_img" class="idcard-img-preview"> | ||
| 181 | + <image | ||
| 182 | + :src="tempIdentityInfo.idcard_1_img" | ||
| 183 | + class="idcard-img-image" | ||
| 184 | + mode="aspectFill" | ||
| 185 | + @tap="previewIdcard1Img" | ||
| 186 | + /> | ||
| 187 | + <view class="idcard-img-actions"> | ||
| 188 | + <text class="change-img-btn" @click="changeIdcard1Img">重新上传</text> | ||
| 189 | + <text class="delete-img-btn" @click="deleteIdcard1Img">删除</text> | ||
| 190 | + </view> | ||
| 191 | + </view> | ||
| 192 | + <view v-else class="idcard-img-upload" @click="changeIdcard1Img"> | ||
| 193 | + <text class="upload-icon">+</text> | ||
| 194 | + <text class="upload-text">上传身份证人像面</text> | ||
| 195 | + </view> | ||
| 196 | + </view> | ||
| 197 | + </view> | ||
| 198 | + | ||
| 199 | + <!-- 身份证国徽面照片上传 --> | ||
| 200 | + <view class="form-item"> | ||
| 201 | + <text class="form-label"><text class="required-mark">*</text>身份证国徽面</text> | ||
| 202 | + <view class="idcard-img-container"> | ||
| 203 | + <view v-if="tempIdentityInfo.idcard_2_img" class="idcard-img-preview"> | ||
| 204 | + <image | ||
| 205 | + :src="tempIdentityInfo.idcard_2_img" | ||
| 206 | + class="idcard-img-image" | ||
| 207 | + mode="aspectFill" | ||
| 208 | + @tap="previewIdcard2Img" | ||
| 209 | + /> | ||
| 210 | + <view class="idcard-img-actions"> | ||
| 211 | + <text class="change-img-btn" @click="changeIdcard2Img">重新上传</text> | ||
| 212 | + <text class="delete-img-btn" @click="deleteIdcard2Img">删除</text> | ||
| 213 | + </view> | ||
| 214 | + </view> | ||
| 215 | + <view v-else class="idcard-img-upload" @click="changeIdcard2Img"> | ||
| 216 | + <text class="upload-icon">+</text> | ||
| 217 | + <text class="upload-text">上传身份证国徽面</text> | ||
| 218 | + </view> | ||
| 219 | + </view> | ||
| 220 | + </view> | ||
| 221 | + | ||
| 222 | + <!-- 证件有效期开始日期 --> | ||
| 223 | + <view class="form-item"> | ||
| 224 | + <text class="form-label"><text class="required-mark">*</text>证件有效期开始</text> | ||
| 225 | + <view class="date-selector" @click="showIdcardBeginDatePicker"> | ||
| 226 | + <text class="date-text" :class="{ 'date-selected': tempIdentityInfo.idcard_effect_begin }"> | ||
| 227 | + {{ tempIdentityInfo.idcard_effect_begin || '请选择开始日期' }} | ||
| 228 | + </text> | ||
| 229 | + <text class="arrow-down">></text> | ||
| 230 | + </view> | ||
| 231 | + </view> | ||
| 232 | + | ||
| 233 | + <!-- 证件有效期结束日期 --> | ||
| 234 | + <view class="form-item"> | ||
| 235 | + <text class="form-label"><text class="required-mark">*</text>证件有效期结束</text> | ||
| 236 | + <view class="date-selector" @click="showIdcardEndDatePicker"> | ||
| 237 | + <text class="date-text" :class="{ 'date-selected': tempIdentityInfo.idcard_effect_end }"> | ||
| 238 | + {{ tempIdentityInfo.idcard_effect_end || '请选择结束日期' }} | ||
| 239 | + </text> | ||
| 240 | + <text class="arrow-down">></text> | ||
| 241 | + </view> | ||
| 242 | + </view> | ||
| 243 | + | ||
| 244 | + <!-- 身份证地址 --> | ||
| 245 | + <view class="form-item"> | ||
| 246 | + <text class="form-label"><text class="required-mark">*</text>身份证地址</text> | ||
| 247 | + <textarea | ||
| 248 | + v-model="tempIdentityInfo.idcard_address" | ||
| 249 | + placeholder="请输入身份证地址" | ||
| 250 | + class="form-input native-input" | ||
| 251 | + :cursor-spacing="50" | ||
| 252 | + /> | ||
| 253 | + </view> | ||
| 175 | </view> | 254 | </view> |
| 176 | 255 | ||
| 177 | <view class="modal-footer"> | 256 | <view class="modal-footer"> |
| ... | @@ -186,7 +265,7 @@ | ... | @@ -186,7 +265,7 @@ |
| 186 | type="primary" | 265 | type="primary" |
| 187 | @click="saveIdentityInfo" | 266 | @click="saveIdentityInfo" |
| 188 | color="#ffa500" | 267 | color="#ffa500" |
| 189 | - :disabled="!tempIdentityInfo.userName || !tempIdentityInfo.idCard || !!idCardError" | 268 | + :disabled="!tempIdentityInfo.userName || !tempIdentityInfo.idCard || !tempIdentityInfo.idcard_1_img || !tempIdentityInfo.idcard_2_img || !tempIdentityInfo.idcard_effect_begin || !tempIdentityInfo.idcard_effect_end || !tempIdentityInfo.idcard_address || !!idCardError" |
| 190 | class="footer-btn footer-btn-save" | 269 | class="footer-btn footer-btn-save" |
| 191 | > | 270 | > |
| 192 | 保存 | 271 | 保存 |
| ... | @@ -195,6 +274,36 @@ | ... | @@ -195,6 +274,36 @@ |
| 195 | </view> | 274 | </view> |
| 196 | </nut-popup> | 275 | </nut-popup> |
| 197 | 276 | ||
| 277 | + <!-- 身份证有效期开始日期选择器 --> | ||
| 278 | + <nut-popup | ||
| 279 | + v-model:visible="showIdcardBeginDate" | ||
| 280 | + position="bottom" | ||
| 281 | + :style="{ height: '50%' }" | ||
| 282 | + > | ||
| 283 | + <nut-date-picker | ||
| 284 | + v-model="idcardBeginDate" | ||
| 285 | + type="date" | ||
| 286 | + title="选择证件有效期开始日期" | ||
| 287 | + @confirm="onIdcardBeginDateConfirm" | ||
| 288 | + @cancel="showIdcardBeginDate = false" | ||
| 289 | + /> | ||
| 290 | + </nut-popup> | ||
| 291 | + | ||
| 292 | + <!-- 身份证有效期结束日期选择器 --> | ||
| 293 | + <nut-popup | ||
| 294 | + v-model:visible="showIdcardEndDate" | ||
| 295 | + position="bottom" | ||
| 296 | + :style="{ height: '50%' }" | ||
| 297 | + > | ||
| 298 | + <nut-date-picker | ||
| 299 | + v-model="idcardEndDate" | ||
| 300 | + type="date" | ||
| 301 | + title="选择证件有效期结束日期" | ||
| 302 | + @confirm="onIdcardEndDateConfirm" | ||
| 303 | + @cancel="showIdcardEndDate = false" | ||
| 304 | + /> | ||
| 305 | + </nut-popup> | ||
| 306 | + | ||
| 198 | <!-- 固定返回按钮 - 只有当参数target=sell时才显示 --> | 307 | <!-- 固定返回按钮 - 只有当参数target=sell时才显示 --> |
| 199 | <view v-if="showBackButton" class="fixed-back-btn" @click="goBack"> | 308 | <view v-if="showBackButton" class="fixed-back-btn" @click="goBack"> |
| 200 | <text class="back-text">返回</text> | 309 | <text class="back-text">返回</text> |
| ... | @@ -244,7 +353,12 @@ const accountInfo = ref({ | ... | @@ -244,7 +353,12 @@ const accountInfo = ref({ |
| 244 | */ | 353 | */ |
| 245 | const identityInfo = ref({ | 354 | const identityInfo = ref({ |
| 246 | userName: '', | 355 | userName: '', |
| 247 | - idCard: '' | 356 | + idCard: '', |
| 357 | + idcard_1_img: '', | ||
| 358 | + idcard_2_img: '', | ||
| 359 | + idcard_effect_begin: '', | ||
| 360 | + idcard_effect_end: '', | ||
| 361 | + idcard_address: '' | ||
| 248 | }); | 362 | }); |
| 249 | 363 | ||
| 250 | /** | 364 | /** |
| ... | @@ -261,7 +375,12 @@ const tempAccountInfo = ref({ | ... | @@ -261,7 +375,12 @@ const tempAccountInfo = ref({ |
| 261 | */ | 375 | */ |
| 262 | const tempIdentityInfo = ref({ | 376 | const tempIdentityInfo = ref({ |
| 263 | userName: '', | 377 | userName: '', |
| 264 | - idCard: '' | 378 | + idCard: '', |
| 379 | + idcard_1_img: '', | ||
| 380 | + idcard_2_img: '', | ||
| 381 | + idcard_effect_begin: '', | ||
| 382 | + idcard_effect_end: '', | ||
| 383 | + idcard_address: '' | ||
| 265 | }); | 384 | }); |
| 266 | 385 | ||
| 267 | /** | 386 | /** |
| ... | @@ -270,12 +389,20 @@ const tempIdentityInfo = ref({ | ... | @@ -270,12 +389,20 @@ const tempIdentityInfo = ref({ |
| 270 | const showAccountModal = ref(false); | 389 | const showAccountModal = ref(false); |
| 271 | const showIdentityModal = ref(false); | 390 | const showIdentityModal = ref(false); |
| 272 | const showBankModal = ref(false); | 391 | const showBankModal = ref(false); |
| 392 | +const showIdcardBeginDate = ref(false); | ||
| 393 | +const showIdcardEndDate = ref(false); | ||
| 273 | 394 | ||
| 274 | /** | 395 | /** |
| 275 | * 身份证号码错误信息 | 396 | * 身份证号码错误信息 |
| 276 | */ | 397 | */ |
| 277 | const idCardError = ref(''); | 398 | const idCardError = ref(''); |
| 278 | 399 | ||
| 400 | +/** | ||
| 401 | + * 日期选择器相关状态 | ||
| 402 | + */ | ||
| 403 | +const idcardBeginDate = ref(new Date()); | ||
| 404 | +const idcardEndDate = ref(new Date()); | ||
| 405 | + | ||
| 279 | // 银行选择器当前选中的值 | 406 | // 银行选择器当前选中的值 |
| 280 | const bankPickerValue = ref([]); | 407 | const bankPickerValue = ref([]); |
| 281 | 408 | ||
| ... | @@ -324,7 +451,12 @@ const getUserInfo = async () => { | ... | @@ -324,7 +451,12 @@ const getUserInfo = async () => { |
| 324 | if (userInfo.name && userInfo.idcard) { | 451 | if (userInfo.name && userInfo.idcard) { |
| 325 | identityInfo.value = { | 452 | identityInfo.value = { |
| 326 | userName: userInfo.name, | 453 | userName: userInfo.name, |
| 327 | - idCard: userInfo.idcard | 454 | + idCard: userInfo.idcard, |
| 455 | + idcard_1_img: userInfo.idcard_1_img || '', | ||
| 456 | + idcard_2_img: userInfo.idcard_2_img || '', | ||
| 457 | + idcard_effect_begin: userInfo.idcard_effect_begin || '', | ||
| 458 | + idcard_effect_end: userInfo.idcard_effect_end || '', | ||
| 459 | + idcard_address: userInfo.idcard_address || '' | ||
| 328 | }; | 460 | }; |
| 329 | } | 461 | } |
| 330 | } | 462 | } |
| ... | @@ -500,7 +632,15 @@ const openIdentityModal = () => { | ... | @@ -500,7 +632,15 @@ const openIdentityModal = () => { |
| 500 | */ | 632 | */ |
| 501 | const closeIdentityModal = () => { | 633 | const closeIdentityModal = () => { |
| 502 | showIdentityModal.value = false; | 634 | showIdentityModal.value = false; |
| 503 | - tempIdentityInfo.value = { userName: '', idCard: '' }; | 635 | + tempIdentityInfo.value = { |
| 636 | + userName: '', | ||
| 637 | + idCard: '', | ||
| 638 | + idcard_1_img: '', | ||
| 639 | + idcard_2_img: '', | ||
| 640 | + idcard_effect_begin: '', | ||
| 641 | + idcard_effect_end: '', | ||
| 642 | + idcard_address: '' | ||
| 643 | + }; | ||
| 504 | idCardError.value = ''; | 644 | idCardError.value = ''; |
| 505 | }; | 645 | }; |
| 506 | 646 | ||
| ... | @@ -610,6 +750,204 @@ const deleteBankImg = () => { | ... | @@ -610,6 +750,204 @@ const deleteBankImg = () => { |
| 610 | } | 750 | } |
| 611 | 751 | ||
| 612 | /** | 752 | /** |
| 753 | + * 选择身份证人像面照片 | ||
| 754 | + */ | ||
| 755 | +const changeIdcard1Img = () => { | ||
| 756 | + Taro.chooseImage({ | ||
| 757 | + count: 1, | ||
| 758 | + sizeType: ['compressed'], | ||
| 759 | + sourceType: ['album', 'camera'], | ||
| 760 | + success: function (res) { | ||
| 761 | + const tempFilePath = res.tempFilePaths[0] | ||
| 762 | + uploadIdcardImage(tempFilePath, 'idcard_1_img') | ||
| 763 | + }, | ||
| 764 | + fail: function () { | ||
| 765 | + Taro.showToast({ | ||
| 766 | + title: '选择图片失败', | ||
| 767 | + icon: 'none' | ||
| 768 | + }) | ||
| 769 | + } | ||
| 770 | + }) | ||
| 771 | +} | ||
| 772 | + | ||
| 773 | +/** | ||
| 774 | + * 选择身份证国徽面照片 | ||
| 775 | + */ | ||
| 776 | +const changeIdcard2Img = () => { | ||
| 777 | + Taro.chooseImage({ | ||
| 778 | + count: 1, | ||
| 779 | + sizeType: ['compressed'], | ||
| 780 | + sourceType: ['album', 'camera'], | ||
| 781 | + success: function (res) { | ||
| 782 | + const tempFilePath = res.tempFilePaths[0] | ||
| 783 | + uploadIdcardImage(tempFilePath, 'idcard_2_img') | ||
| 784 | + }, | ||
| 785 | + fail: function () { | ||
| 786 | + Taro.showToast({ | ||
| 787 | + title: '选择图片失败', | ||
| 788 | + icon: 'none' | ||
| 789 | + }) | ||
| 790 | + } | ||
| 791 | + }) | ||
| 792 | +} | ||
| 793 | + | ||
| 794 | +/** | ||
| 795 | + * 上传身份证图片到服务器 | ||
| 796 | + * @param {String} filePath - 图片文件路径 | ||
| 797 | + * @param {String} fieldName - 字段名称 (idcard_1_img 或 idcard_2_img) | ||
| 798 | + */ | ||
| 799 | +const uploadIdcardImage = (filePath, fieldName) => { | ||
| 800 | + // 显示上传中提示 | ||
| 801 | + Taro.showLoading({ | ||
| 802 | + title: '上传中', | ||
| 803 | + mask: true | ||
| 804 | + }) | ||
| 805 | + | ||
| 806 | + // 上传图片 | ||
| 807 | + wx.uploadFile({ | ||
| 808 | + url: BASE_URL + '/admin/?m=srv&a=upload', | ||
| 809 | + filePath, | ||
| 810 | + name: 'file', | ||
| 811 | + header: { | ||
| 812 | + 'content-type': 'multipart/form-data', | ||
| 813 | + }, | ||
| 814 | + success: function (res) { | ||
| 815 | + let upload_data = JSON.parse(res.data); | ||
| 816 | + Taro.hideLoading({ | ||
| 817 | + success: () => { | ||
| 818 | + if (res.statusCode === 200) { | ||
| 819 | + tempIdentityInfo.value[fieldName] = upload_data.data.src; | ||
| 820 | + Taro.showToast({ | ||
| 821 | + title: '上传成功', | ||
| 822 | + icon: 'success' | ||
| 823 | + }) | ||
| 824 | + } else { | ||
| 825 | + Taro.showToast({ | ||
| 826 | + icon: 'error', | ||
| 827 | + title: '服务器错误,稍后重试!', | ||
| 828 | + mask: true | ||
| 829 | + }) | ||
| 830 | + } | ||
| 831 | + }, | ||
| 832 | + }); | ||
| 833 | + }, | ||
| 834 | + fail: function (res) { | ||
| 835 | + Taro.hideLoading({ | ||
| 836 | + success: () => { | ||
| 837 | + Taro.showToast({ | ||
| 838 | + icon: 'error', | ||
| 839 | + title: '上传失败,稍后重试!', | ||
| 840 | + mask: true | ||
| 841 | + }) | ||
| 842 | + }, | ||
| 843 | + }); | ||
| 844 | + } | ||
| 845 | + }) | ||
| 846 | +} | ||
| 847 | + | ||
| 848 | +/** | ||
| 849 | + * 预览身份证人像面图片 | ||
| 850 | + */ | ||
| 851 | +const previewIdcard1Img = () => { | ||
| 852 | + if (tempIdentityInfo.value.idcard_1_img) { | ||
| 853 | + Taro.previewImage({ | ||
| 854 | + urls: [tempIdentityInfo.value.idcard_1_img], | ||
| 855 | + current: tempIdentityInfo.value.idcard_1_img | ||
| 856 | + }) | ||
| 857 | + } | ||
| 858 | +} | ||
| 859 | + | ||
| 860 | +/** | ||
| 861 | + * 预览身份证国徽面图片 | ||
| 862 | + */ | ||
| 863 | +const previewIdcard2Img = () => { | ||
| 864 | + if (tempIdentityInfo.value.idcard_2_img) { | ||
| 865 | + Taro.previewImage({ | ||
| 866 | + urls: [tempIdentityInfo.value.idcard_2_img], | ||
| 867 | + current: tempIdentityInfo.value.idcard_2_img | ||
| 868 | + }) | ||
| 869 | + } | ||
| 870 | +} | ||
| 871 | + | ||
| 872 | +/** | ||
| 873 | + * 删除身份证人像面图片 | ||
| 874 | + */ | ||
| 875 | +const deleteIdcard1Img = () => { | ||
| 876 | + Taro.showModal({ | ||
| 877 | + title: '确认删除', | ||
| 878 | + content: '确定要删除身份证人像面照片吗?', | ||
| 879 | + success: function (res) { | ||
| 880 | + if (res.confirm) { | ||
| 881 | + tempIdentityInfo.value.idcard_1_img = '' | ||
| 882 | + Taro.showToast({ | ||
| 883 | + title: '删除成功', | ||
| 884 | + icon: 'success' | ||
| 885 | + }) | ||
| 886 | + } | ||
| 887 | + } | ||
| 888 | + }) | ||
| 889 | +} | ||
| 890 | + | ||
| 891 | +/** | ||
| 892 | + * 删除身份证国徽面图片 | ||
| 893 | + */ | ||
| 894 | +const deleteIdcard2Img = () => { | ||
| 895 | + Taro.showModal({ | ||
| 896 | + title: '确认删除', | ||
| 897 | + content: '确定要删除身份证国徽面照片吗?', | ||
| 898 | + success: function (res) { | ||
| 899 | + if (res.confirm) { | ||
| 900 | + tempIdentityInfo.value.idcard_2_img = '' | ||
| 901 | + Taro.showToast({ | ||
| 902 | + title: '删除成功', | ||
| 903 | + icon: 'success' | ||
| 904 | + }) | ||
| 905 | + } | ||
| 906 | + } | ||
| 907 | + }) | ||
| 908 | +} | ||
| 909 | + | ||
| 910 | +/** | ||
| 911 | + * 显示身份证有效期开始日期选择器 | ||
| 912 | + */ | ||
| 913 | +const showIdcardBeginDatePicker = () => { | ||
| 914 | + showIdcardBeginDate.value = true | ||
| 915 | +} | ||
| 916 | + | ||
| 917 | +/** | ||
| 918 | + * 显示身份证有效期结束日期选择器 | ||
| 919 | + */ | ||
| 920 | +const showIdcardEndDatePicker = () => { | ||
| 921 | + showIdcardEndDate.value = true | ||
| 922 | +} | ||
| 923 | + | ||
| 924 | +/** | ||
| 925 | + * 确认选择身份证有效期开始日期 | ||
| 926 | + * @param {Object} param - 日期选择器返回的参数 | ||
| 927 | + */ | ||
| 928 | +const onIdcardBeginDateConfirm = (param) => { | ||
| 929 | + const { selectedValue } = param | ||
| 930 | + const year = selectedValue[0] | ||
| 931 | + const month = selectedValue[1].toString().padStart(2, '0') | ||
| 932 | + const day = selectedValue[2].toString().padStart(2, '0') | ||
| 933 | + tempIdentityInfo.value.idcard_effect_begin = `${year}-${month}-${day}` | ||
| 934 | + showIdcardBeginDate.value = false | ||
| 935 | +} | ||
| 936 | + | ||
| 937 | +/** | ||
| 938 | + * 确认选择身份证有效期结束日期 | ||
| 939 | + * @param {Object} param - 日期选择器返回的参数 | ||
| 940 | + */ | ||
| 941 | +const onIdcardEndDateConfirm = (param) => { | ||
| 942 | + const { selectedValue } = param | ||
| 943 | + const year = selectedValue[0] | ||
| 944 | + const month = selectedValue[1].toString().padStart(2, '0') | ||
| 945 | + const day = selectedValue[2].toString().padStart(2, '0') | ||
| 946 | + tempIdentityInfo.value.idcard_effect_end = `${year}-${month}-${day}` | ||
| 947 | + showIdcardEndDate.value = false | ||
| 948 | +} | ||
| 949 | + | ||
| 950 | +/** | ||
| 613 | * 保存身份信息 | 951 | * 保存身份信息 |
| 614 | */ | 952 | */ |
| 615 | const saveIdentityInfo = async () => { | 953 | const saveIdentityInfo = async () => { |
| ... | @@ -634,7 +972,12 @@ const saveIdentityInfo = async () => { | ... | @@ -634,7 +972,12 @@ const saveIdentityInfo = async () => { |
| 634 | // 调用API保存身份信息 | 972 | // 调用API保存身份信息 |
| 635 | const result = await updateProfileAPI({ | 973 | const result = await updateProfileAPI({ |
| 636 | name: tempIdentityInfo.value.userName, | 974 | name: tempIdentityInfo.value.userName, |
| 637 | - idcard: tempIdentityInfo.value.idCard | 975 | + idcard: tempIdentityInfo.value.idCard, |
| 976 | + idcard_1_img: tempIdentityInfo.value.idcard_1_img, | ||
| 977 | + idcard_2_img: tempIdentityInfo.value.idcard_2_img, | ||
| 978 | + idcard_effect_begin: tempIdentityInfo.value.idcard_effect_begin, | ||
| 979 | + idcard_effect_end: tempIdentityInfo.value.idcard_effect_end, | ||
| 980 | + idcard_address: tempIdentityInfo.value.idcard_address | ||
| 638 | }); | 981 | }); |
| 639 | 982 | ||
| 640 | if (result.code) { | 983 | if (result.code) { |
| ... | @@ -643,7 +986,12 @@ const saveIdentityInfo = async () => { | ... | @@ -643,7 +986,12 @@ const saveIdentityInfo = async () => { |
| 643 | // 更新全局用户状态 | 986 | // 更新全局用户状态 |
| 644 | userStore.updateUserInfo({ | 987 | userStore.updateUserInfo({ |
| 645 | name: tempIdentityInfo.value.userName, | 988 | name: tempIdentityInfo.value.userName, |
| 646 | - idcard: tempIdentityInfo.value.idCard | 989 | + idcard: tempIdentityInfo.value.idCard, |
| 990 | + idcard_1_img: tempIdentityInfo.value.idcard_1_img, | ||
| 991 | + idcard_2_img: tempIdentityInfo.value.idcard_2_img, | ||
| 992 | + idcard_effect_begin: tempIdentityInfo.value.idcard_effect_begin, | ||
| 993 | + idcard_effect_end: tempIdentityInfo.value.idcard_effect_end, | ||
| 994 | + idcard_address: tempIdentityInfo.value.idcard_address | ||
| 647 | }); | 995 | }); |
| 648 | 996 | ||
| 649 | closeIdentityModal(); | 997 | closeIdentityModal(); | ... | ... |
-
Please register or login to post a comment