perfect.vue 40.6 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 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573
<template>
	<view>
		<view class="pd30" style="padding: 30rpx 30rpx 180rpx;">
			<view class="wBox">
					<uni-forms ref="baseForm" label-width="100">
					<uni-forms-item label="营业执照" required>
						<view class="upload-box">
							<view v-if="!form.businessLicense" class="upload-placeholder" @click="chooseBusinessLicense">
								<image :src="config.baseUrl_api + '/fs/static/yyzz@2x.png'" class="placeholder-img" />
							</view>
							<view v-else class="license-preview">
								<image :src="getImageUrl(getBusinessLicenseUrl())" class="license-img"
									@click="previewImage(getImageUrl(getBusinessLicenseUrl()))"></image>
								<view class="delete-btn" @click.stop="delSupplementFile">×</view>
							</view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="营业执照名称" required>
						<uni-easyinput v-model="form.companyName" :disabled="isFieldDisabled('companyName')" />
					</uni-forms-item>
					<uni-forms-item label="社会信用代码" required>
						<uni-easyinput v-model="form.creditCode" :disabled="isFieldDisabled('creditCode')" />
					</uni-forms-item>
					<uni-forms-item label="机构名称" required>
						<uni-easyinput v-model="form.name" :disabled="false" placeholder="机构名称" />
					</uni-forms-item>
					<uni-forms-item label="认证地址" required>
						<uni-data-picker v-model="coordinates1" @change="changeCoordinates1" placeholder="请选择认证地址"
							:localdata="regionsList" :readonly="isFieldDisabled('address')" :disabled="isFieldDisabled('address')"></uni-data-picker>
					</uni-forms-item>
					<uni-forms-item label="认证详细地址" required>
						<uni-easyinput v-model="form.adress" :disabled="isFieldDisabled('adress')" placeholder="请输入详细地址" type='textarea' />
					</uni-forms-item>
					<uni-forms-item label="所属协会" required>
						<view style="width: 60vw;overflow:auto;">
							<uni-data-picker v-model="form.parentId" :localdata="tree"
								:readonly="isFieldDisabled('parentId')" :disabled="isFieldDisabled('parentId')" :clear-icon="false" placeholder="请选择协会"
								:map="{text:'label',value:'id'}" popup-title="" @change="changCase">
							</uni-data-picker>
						</view>
					</uni-forms-item>
					<uni-forms-item label="法人身份证" required>
						<view class="idcard-box">
							<view class="idcard-item">
								<view v-if="!legalIdcPhoto1" class="idcard-placeholder" @click="chooseIdCardFront">
									<image :src="config.baseUrl_api + '/fs/static/sfz_zm@2x.png'" class="placeholder-img" />
								</view>
								<view v-else class="idcard-preview">
									<image :src="getImageUrl(legalIdcPhoto1)" class="idcard-img"
										@click="previewImage(getImageUrl(legalIdcPhoto1))"></image>
									<view class="delete-btn" @click.stop="delimgFont">×</view>
								</view>
							</view>
						</view>
						<view class="idcard-box">
							<view class="idcard-item">
								<view v-if="!legalIdcPhoto2" class="idcard-placeholder" @click="chooseIdCardBack">
									<image :src="config.baseUrl_api + '/fs/static/sfz_fm@2x.png'" class="placeholder-img" />
								</view>
								<view v-else class="idcard-preview">
									<image :src="getImageUrl(legalIdcPhoto2)" class="idcard-img"
										@click="previewImage(getImageUrl(legalIdcPhoto2))"></image>
									<view class="delete-btn" @click.stop="delimgBack">×</view>
								</view>
							</view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="法人姓名" required>
						<uni-easyinput v-model="form.legal" :disabled="isFieldDisabled('legal')" />
					</uni-forms-item>
					<uni-forms-item label="法人证件号" required>
						<uni-easyinput v-model="form.legalIdcCode" :disabled="isFieldDisabled('legalIdcCode')" />
					</uni-forms-item>
					<uni-forms-item label="联系人" required>
						<uni-easyinput v-model="form.siteContact" :disabled="false" />
					</uni-forms-item>
					<uni-forms-item label="联系方式" required>
						<uni-easyinput v-model="form.siteTel" :disabled="false" />
					</uni-forms-item>
					<uni-forms-item label="上传机构照片" required>
						<view class="pictures-box">
							<view v-if="picArr.length === 0" class="picture-placeholder" @click="choosePictures">
								<image :src="config.baseUrl_api + '/fs/static/jgzp@2x.png'" class="placeholder-img" />
							</view>
							<view v-else class="pictures-preview">
								<image :src="getImageUrl(picArr[0])" class="picture-img"
									@click="previewImage(picArr.map(item => getImageUrl(item)))"></image>
								<view class="delete-btn" @click.stop="delpicArr">×</view>
							</view>
						</view>
					</uni-forms-item>
					<!-- <uni-forms-item v-if="form.memCode" label="会员编号" required>
						<uni-easyinput v-model="form.memCode" disabled />
					</uni-forms-item> -->
					<view class="notice-box">
						<checkbox-group @change="onNoticeChange">
							<label class="notice-label">
								<checkbox :checked="form.notice" color="#e64329" value="1"/>
								<text class="notice-text">我已阅读并同意</text>
								<text class="notice-link" @click.stop="showNotice(1)">《注册须知》</text>
								<text class="notice-link" @click.stop="showNotice(2)">《入会须知》</text>
								<text class="notice-link" @click.stop="showNotice(3)">《免责声明》</text>
							</label>
						</checkbox-group>
					</view>
				</uni-forms>
				<view class="fixedBottom">
					<button class="btn-red" :disabled="btn" :class="{disabled: btn}" @click="submit()">确定</button>
				</view>
			</view>
		</view>

		<uni-popup ref="verifyPopup" type="center" background-color="rgba(0,0,0,0.5)">
			<view class="custom-modal">
				<view class="modal-title">提示</view>
				<view class="modal-content">
					暂未查询到相关企业信息
				</view>
				<view class=" modal-content" style="color:red">企业信息异常请检查相关资料信息,确认无误后再次提交!</view>
				<view class="modal-btns mt20">
					<button class="btn-cancel" @click="closeVerifyPopup()">返回修改</button>
					<button class="btn-confirm" @click="confirmSubmit()">确认无误</button>
				</view>
			</view>
		</uni-popup>

		<uni-popup ref="applyPopup" type="center" background-color="rgba(0,0,0,0.5)">
			<view class="custom-modal apply-modal">
				<view class="modal-title">考点申请</view>
				<view class="modal-btns apply-btns">
					<button class="btn-cancel" @click="closeApplyPopup()">暂不申请</button>
					<button class="btn-confirm" @click="confirmApply()">立即申请</button>
				</view>
				<view class="modal-tip">友情提示:非考点无法申请级位考试</view>
			</view>
		</uni-popup>

		<uni-popup ref="unpaidPopup" type="center" :mask-click="false">
			<view class="custom-modal">
				<view class="modal-title">系统提示</view>
				<view class="modal-content">您有一笔订单尚未支付,请及时支付或取消订单。</view>
				<view class="modal-btns">
					<button class="btn-cancel" @click="closeUnpaidPopup()">取消订单</button>
					<button class="btn-confirm" @click="goToPay()">去支付</button>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive,
		computed
	} from 'vue';
	import * as api from '@/common/api.js';
	import _ from 'underscore'
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app';
	import config from '@/config.js'
	import { fillImgUrl, reLaunchHomeByRole } from '@/common/utils.js'
	const app = getApp();

	const verifyPopup = ref(null)
	const applyPopup = ref(null)
	const unpaidPopup = ref(null)
	const verifyResult = ref({})
	const payForm = ref({})

	const form = ref({
		type: '1',
		applyPoints: '0',
		renewYear: 1,
		legalIdcCode: '',
		notice: false
	});
	const years = ref(['1', '2', '3', '4', '5'])
	const yesno = ref([{
		value: '0',
		text: '否'
	}, {
		value: '1',
		text: '是'
	}])
	const memberFee = ref('')
	const preferentialPolicy = ref(false)
	const preferentialData = ref({})
	const ocrLockedFields = ref({})
	const typeList = ref([{
			value: '1',
			text: '企业'
		},
		{
			value: '2',
			text: '国家组织'
		},
		{
			value: '3',
			text: '社会组织'
		},
		{
			value: '4',
			text: '其他'
		}
	])
	const regionArr = ref();
	const regionsList = ref([]);
	const tree = ref([]);
	const showDirectly = ref(true)
	const directUnderFlag = ref(0)
	const current = ref(0);
	const groupId = ref(0);
	const currIndex = ref(null);
	const signType = ref();
	const editIng = ref(true);
	const isSign = ref(false);
	const type = ref(false)
	const btn = ref(false)
	const flag = ref(false)
	const result = ref(false)
	const query = ref({
		type: 0
	});
	const activeStatus = ref(0)
	const active = ref(0)
	const memberInfo = ref({})
	const authenticationStatus = ref()
	const authenticationStatusa = ref()
	const newResult = ref(false)
	const belongProvinceId = ref()
	const picArr = ref([])
	const list1 = ref([{
		title: '完善信息'
	}, {
		title: '会员认证'
	}])
	const indicatorStyle = ref(`height: 50px;`)
	const creditCode = ref()
	const creditCodeValid = ref(true)
	const parentId = ref()
	const assoFullName = ref('') // 协会完整路径名称
	const legalIdcPhoto1 = ref('')
	const legalIdcPhoto2 = ref('')
	const companyName = ref('')
	const legal = ref()
	const legalIdcCode = ref()
	const adress = ref()
	const coordinates1 = ref([])
	const pictures = ref()
	const legalIdcPhoto = ref([])
	const currentBusinessLicenseAddress = ref('')
	const carriedReadonlyFields = ['companyName', 'creditCode', 'name', 'address', 'adress', 'parentId', 'legal', 'legalIdcCode']

	function isFieldDisabled(field) {
		if (['businessLicense', 'legalIdcPhoto1', 'legalIdcPhoto2', 'pictures', 'siteContact', 'siteTel'].includes(field)) {
			return false
		}
		return !!ocrLockedFields.value[field] || isCarriedFieldLocked(field)
	}

	function isCarriedFieldLocked(field) {
		if (!carriedReadonlyFields.includes(field)) return false
		if (field === 'address') {
			return !!(form.value.provinceId || form.value.cityId || form.value.regionId || coordinates1.value?.length)
		}
		if (field === 'name') {
			return hasValue(form.value.name || form.value.baseName)
		}
		return hasValue(form.value[field])
	}

	function hasValue(value) {
		return value !== undefined && value !== null && String(value).trim() !== ''
	}

	function lockOcrField(field, value) {
		if (value !== undefined && value !== null && String(value).trim() !== '') {
			ocrLockedFields.value[field] = true
		}
	}

	function unlockOcrFields() {
		ocrLockedFields.value = {}
	}

	function clearBusinessLicenseUpload() {
		selectFileValue = {}
		form.value.businessLicense = ''
		currentBusinessLicenseAddress.value = ''
	}

	function lockParentIdField() {
		if (hasValue(form.value.parentId)) {
			ocrLockedFields.value.parentId = true
		}
	}

	onLoad(option => {
		if (app.globalData.isLogin) {
			init()
		} else {
			app.firstLoadCallback = () => {
				init()
			};
		}
	});

	async function init() {
		await Promise.all([
			getRegionsList(),
			getTree()
		])
		await getForm()
		await canUseDiscountApi()
		await getZtxDiscountPolicyApi()
		handelGetMyRecent()
	}

	async function getMyMemberCertUnitFeeApi() {
		const res = await api.getMyMemberCertUnitFee()
		memberFee.value = res.data
	}

	async function canUseDiscountApi() {
		const res = await api.canUseDiscount()
		preferentialPolicy.value = res.data
	}

	async function getZtxDiscountPolicyApi() {
		const res = await api.getZtxDiscountPolicy()
		preferentialData.value = res.data
	}

	async function getForm() {
		const res = await api.getMyOwnMemberInfo()
		if (!res.data.memberInfo) res.data.memberInfo = {}
		if (!res.data.dept) res.data.dept = {}
		newResult.value = res.data.newResult
		result.value = res.data.result
		authenticationStatusa.value = res.data.authenticationStatus
		showDirectly.value = !res.data.memberInfo.associateId
		activeStatus.value = res.data.memberInfo.activeStatus
		directUnderFlag.value = res.data.memberInfo.directUnderFlag

		if (authenticationStatusa.value == 1 || authenticationStatusa.value == 2 || authenticationStatusa.value == 5) {
			type.value = true
		} else {
			type.value = false
		}
		btn.value = authenticationStatusa.value == 1

		if (authenticationStatusa.value != 0) {
			flag.value = newResult.value
		}

		form.value = {
			...res.data.dept,
			...res.data.memberInfo
		}
		form.value.deptType = res.data.dept.deptType
		form.value.parentId = form.value.parentId ?? ''
		// creditCode.value = form.value.creditCode
		// form.value.companyName = res.data.memberInfo.companyName
		// belongProvinceId.value = form.value.belongProvinceId
		// parentId.value = form.value.parentId

		coordinates1.value = []
		if (form.value.provinceId) coordinates1.value.push(form.value.provinceId)
		if (form.value.cityId) coordinates1.value.push(form.value.cityId)
		if (form.value.regionId) coordinates1.value.push(form.value.regionId)
		form.value.coordinates1 = coordinates1.value

		if (form.value.businessLicense) {
			form.value.businessLicense = form.value.businessLicense
		}

		if (form.value.legalIdcPhoto) {
			legalIdcPhoto1.value = form.value.legalIdcPhoto.split(',')?.[0] || ''
			legalIdcPhoto2.value = form.value.legalIdcPhoto.split(',')?.[1] || ''
		}

		if (form.value.pictures) {
			picArr.value = []
			var arr = form.value.pictures.split(',') || []
			if (arr.length > 0) {
				_.map(arr, (p) => {
					picArr.value.push(p)
				})
			}
		}

		if (!form.value.applyPoints || form.value.applyPoints == '') {
			form.value.applyPoints = '0'
		}

		creditCode.value = form.value.creditCode
		parentId.value = form.value.parentId
		restoreAssoFullName()
		lockParentIdField()
		companyName.value = form.value.companyName
		legal.value = form.value.legal
		legalIdcCode.value = form.value.legalIdcCode
		adress.value = form.value.adress
		coordinates1.value = [...coordinates1.value]
		pictures.value = form.value.pictures
		legalIdcPhoto.value = [legalIdcPhoto1.value, legalIdcPhoto2.value]
	}

	function getTree() {
		return api.certifiedDeptTreeRegister({
			selfDeptId: -1,
			webSiteShow: 1,
			showDisabled: 1,
			isBlack: 0
		}).then(res => {
			tree.value = res.data
			restoreAssoFullName()
			setTimeout(() => {
				restoreAssoFullName()
			}, 100)
		})
	}

	function getRegionsList() {
		return api.regionsList().then(res => {
			regionsList.value = res.data;
		});
	}

	// 核心:修改submit方法,改用自定义弹窗
	async function submit() {
		if (btn.value) {
			uni.showToast({
				title: '当前认证状态不可重复提交',
				icon: 'none'
			})
			return
		}
		// 基础表单验证
		if (!form.value.businessLicense) {
			uni.showToast({
				title: '请上传营业执照',
				icon: 'none'
			})
			return
		}
		if (form.value.companyName == '') {
			uni.showToast({
				title: '请填写营业执照名称',
				icon: 'none'
			})
			return
		}
		if (form.value.creditCode == '') {
			uni.showToast({
				title: '请填写社会信用代码',
				icon: 'none'
			})
			return
		}
		if (form.value.name == '') {
			uni.showToast({
				title: '请填写机构名称',
				icon: 'none'
			})
			return
		}
		if (!coordinates1.value.length) {
			uni.showToast({
				title: '请选择认证地址',
				icon: 'none'
			})
			return
		}
		if (form.value.adress == '') {
			uni.showToast({
				title: '请填写认证详细地址',
				icon: 'none'
			})
			return
		}
		if (form.value.parentId == -1 || form.value.parentId == 0) {
			uni.showToast({
				title: '请选择所属协会',
				icon: 'none'
			})
			return
		}
		if (currentBusinessLicenseAddress.value && !validateBusinessLicenseProvince(currentBusinessLicenseAddress.value)) {
			uni.showToast({
				title: '请上传省内的营业执照',
				icon: 'none',
				duration: 3000
			})
			return
		}
		if (legalIdcPhoto1.value == '' || legalIdcPhoto2.value == '') {
			uni.showToast({
				title: '请上传法人身份证',
				icon: 'none'
			})
			return
		}
		if (form.value.legal == '') {
			uni.showToast({
				title: '请填写法人姓名',
				icon: 'none'
			})
			return
		}
		if (form.value.legalIdcCode == '') {
			uni.showToast({
				title: '请填写法人证件号',
				icon: 'none'
			})
			return
		}
		if (!validateIdCardNo(form.value.legalIdcCode)) {
			uni.showToast({
				title: '请输入正确的法人证件号',
				icon: 'none'
			})
			return
		}
		if (form.value.siteContact == '') {
			uni.showToast({
				title: '请填写联系人',
				icon: 'none'
			})
			return
		}
		if (form.value.siteTel == '') {
			uni.showToast({
				title: '请填写联系方式',
				icon: 'none'
			})
			return
		}
		if (picArr.value.length == 0) {
			uni.showToast({
				title: '请上传机构照片',
				icon: 'none'
			})
			return
		}
		if (!form.value.notice) {
			uni.showToast({
				title: '请阅读并同意注册须知、入会须知、免责声明',
				icon: 'none'
			})
			return
		}
		const creditCodeOk = await onCreditCodeBlur(true)
		if (!creditCodeOk) return

		// 检查是否有未支付订单
		try {
			await handelGetMyRecent()
		} catch (e) {
			return
		}

		try {
			const res = await handelVerify()
			verifyResult.value = res

			if (!res.passFlag) {
				// 打开自定义弹窗(替代原有showModal)
				verifyPopup.value.open()
				return
			}

			submitData()

		} catch (error) {
			uni.showToast({
				title: error.message || '验证失败,请重试',
				icon: 'none'
			})
		}
	}

	// 新增:关闭验证弹窗
	function closeVerifyPopup() {
		verifyPopup.value.close()
	}

	// 新增:确认无误提交
	function confirmSubmit() {
		verifyPopup.value.close()
		submitData()
	}

	// 新增:关闭未支付订单弹窗
	function closeUnpaidPopup() {
		unpaidPopup.value.close()
		handelCancelOrder()
	}

	// 新增:去支付
	function goToPay() {
		unpaidPopup.value.close()
		uni.navigateTo({
			url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&orderId=${payForm.value.id}`
		})
	}

	// 新增:获取最近认证记录,判断是否有未支付订单
	function handelGetMyRecent() {
		return new Promise(async (resolve, reject) => {
			const res = await api.getMyRecent() ?? {}
			payForm.value = res.data?.comOrder ?? {}
			if (payForm.value.content) payForm.value.content = JSON.parse(payForm.value.content)
			if (payForm.value.payStatus === '0') {
				unpaidPopup.value.open()
				return reject(res)
			} else {
				return resolve(true)
			}
		})
	}

	// 新增:取消订单
	async function handelCancelOrder() {
		if (!payForm.value.id) return
		uni.showLoading({ title: '取消中...' })
		try {
			await api.cancelOrder(payForm.value.id)
			uni.showToast({ title: '取消成功', icon: 'success' })
			await init()
		} catch (e) {
			uni.showToast({ title: '取消失败', icon: 'none' })
		} finally {
			uni.hideLoading()
		}
	}

	// 新增:打开考点申请弹窗(备用,如需调用可加触发逻辑)
	function openApplyPopup() {
		applyPopup.value.open()
	}

	// 新增:关闭考点申请弹窗
	function closeApplyPopup() {
		applyPopup.value.close()
	}

	// 新增:确认考点申请
	function confirmApply() {
		applyPopup.value.close()
		// 此处添加考点申请逻辑
	}

	// 企业信息验证
	function handelVerify() {
		return new Promise(async (resolve, reject) => {
			if (!form.value.legalIdcCode || !form.value.legal) {
				return reject(new Error('请重新上传身份证并填写法人证件号'))
			}
			if (!form.value.companyName || !form.value.creditCode) {
				return reject(new Error('请重新上传营业执照并填写营业执照名称'))
			}

			try {
				const res = await api.checkBusinessLicense({
					creditCode: form.value.creditCode,
					companyName: form.value.companyName,
					legalIdcCode: form.value.legalIdcCode,
					legal: form.value.legal
				})
				if (res.code == 200) {
					resolve(res.data)
				} else {
					reject(new Error(res.msg || '企业信息验证失败'))
				}
			} catch (e) {
				reject(new Error('验证接口调用失败,请检查网络'))
			}
		})
	}

	async function onCreditCodeBlur(showErrorToast = true) {
		const currentCreditCode = (form.value.creditCode || '').trim()
		if (!currentCreditCode || currentCreditCode === creditCode.value) {
			creditCodeValid.value = true
			return true
		}
		try {
			const res = await api.creditCodeExist(currentCreditCode)
			if (res.data) {
				creditCodeValid.value = false
				if (showErrorToast) {
					uni.showToast({
						title: '社会信用代码已存在,请联系中跆协修改',
						icon: 'none',
						duration: 3000
					})
				}
				return false
			}
			creditCodeValid.value = true
			return true
		} catch (e) {
			creditCodeValid.value = false
			if (showErrorToast) {
				uni.showToast({
					title: '社会信用代码校验失败,请稍后重试',
					icon: 'none',
					duration: 3000
				})
			}
			return false
		}
	}

	function validateIdCardNo(value) {
		const code = String(value || '').trim()
		if (!code) return false
		const reg = /(^\d{15}$)|(^\d{17}[\dXx]$)/
		if (!reg.test(code)) return false
		if (code.length === 15) return true
		const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
		const checks = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
		const sum = code.slice(0, 17).split('').reduce((total, num, index) => total + Number(num) * weights[index], 0)
		return checks[sum % 11] === code[17].toUpperCase()
	}

	// 数据提交核心逻辑
	function submitData() {
		const dataInfo = {
			parentId: form.value.parentId,
			creditCode: form.value.creditCode,
			legal: form.value.legal,
			businessLicense: form.value.businessLicense,
			pictures: picArr.value.toString(),
			memId: form.value.memId,
			id: form.value.deptId,
			name: form.value.name,
			regionId: form.value.regionId,
			cityId: form.value.cityId,
			provinceId: form.value.provinceId,
			adress: form.value.adress,
			belongProvinceId: form.value.belongProvinceId,
			deptType: form.value.deptType,
			legalIdcPhoto: [legalIdcPhoto1.value, legalIdcPhoto2.value]?.join(','),
			legalIdcCode: form.value.legalIdcCode,
			companyName: form.value.companyName,
			applyPoints: form.value.applyPoints,
			siteContact: form.value.siteContact,
			siteTel: form.value.siteTel
		}

		if (activeStatus.value == 0) {
			api.active(dataInfo).then(res => {
				uni.showModal({
					content: '激活成功,返回首页',
					success: function(resp) {
						if (resp.confirm) {
							reLaunchHomeByRole()
						} else {
							uni.navigateBack()
						}
					}
				})
			}).catch(err => {
				uni.showToast({
					title: '激活失败,请重试',
					icon: 'none'
				})
			})
		} else {
			api.editMyMemberCertifiedInfo(dataInfo).then(res => {
				// 使用完整的协会路径名称
				uni.navigateTo({
					url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoFullName.value)}`
				})

			}).catch(err => {
				uni.showToast({
					title: '提交失败,请重试',
					icon: 'none'
				})
			})
		}
	}

	// 根据协会ID获取协会名称
	function getAssoName(parentId) {
		if (!parentId || !tree.value || tree.value.length === 0) {
			return ''
		}
		// 递归查找协会名称
		function findInTree(list) {
			for (const item of list) {
				if ((item.id ?? item.value)?.toString() === parentId?.toString()) {
					return item.label || ''
				}
				if (item.children && item.children.length > 0) {
					const found = findInTree(item.children)
					if (found) return found
				}
			}
			return null
		}
		return findInTree(tree.value) || ''
	}

	// 协会选择 - 获取完整路径名称
	function changCase(e) {
		if (isFieldDisabled('parentId')) return
		const valueArr = e.detail?.value || e;
		// 取最后一级的value(纯ID)
		const lastNode = valueArr[valueArr.length - 1];
		form.value.parentId = lastNode?.value ?? lastNode?.id ?? lastNode ?? '';
		console.log('最终提交的parentId:', form.value.parentId);
		assoFullName.value = getAssoFullName(valueArr)
		console.log('协会完整路径:', assoFullName.value);
	}

	// 获取协会完整路径名称
	function getAssoFullName(valueArr) {
		if (!valueArr || valueArr.length === 0) return ''
		// valueArr 是 {value: id} 数组
		const names = []
		let currentLevel = tree.value
		for (const item of valueArr) {
			const itemValue = (item?.value ?? item?.id ?? item)?.toString()
			const found = currentLevel?.find(v => (v.id ?? v.value)?.toString() === itemValue)
			if (found) {
				names.push(found.label)
				currentLevel = found.children
			} else {
				break
			}
		}
		return names.join('/')
	}

	// 查找协会节点及其父路径
	function findAssoNodeWithPath(list, targetId, currentPath) {
		for (const item of list) {
			const newPath = [...currentPath, item.value || item.id]
			if ((item.value || item.id)?.toString() === targetId?.toString()) {
				return { node: item, path: newPath }
			}
			if (item.children && item.children.length > 0) {
				const found = findAssoNodeWithPath(item.children, targetId, newPath)
				if (found) return found
			}
		}
		return null
	}

	function normalizeAddressText(text) {
		return String(text || '').replace(/\s/g, '')
	}

	function getAddressKeywords(name) {
		const fullName = normalizeAddressText(name)
		const shortName = fullName.replace(/省|市|区|县|自治区|壮族自治区|回族自治区|维吾尔自治区|地区|自治州|盟|旗/g, '')
		return [...new Set([fullName, shortName].filter(keyword => keyword && keyword.length > 1))]
	}

	function addressIncludes(target, name) {
		return getAddressKeywords(name).some(keyword => target.includes(keyword))
	}

	function getNodeText(node) {
		return node?.text ?? node?.label ?? node?.name ?? ''
	}

	function getNodeValue(node) {
		return node?.value ?? node?.id ?? ''
	}

	function findRegionPathByAddress(address) {
		const target = normalizeAddressText(address)
		if (!target || !regionsList.value?.length) return null
		const candidates = []

		for (const province of regionsList.value) {
			const provinceMatched = addressIncludes(target, getNodeText(province))
			const provincePath = [province]
			const cities = province.children || []
			for (const city of cities) {
				const cityMatched = addressIncludes(target, getNodeText(city))
				const cityPath = [province, city]
				const regions = city.children || []
				for (const region of regions) {
					const regionMatched = addressIncludes(target, getNodeText(region))
					if (provinceMatched || cityMatched || regionMatched) {
						const score = (provinceMatched ? 1 : 0) + (cityMatched ? 2 : 0) + (regionMatched ? 4 : 0)
						candidates.push({ path: [province, city, region], score })
					}
				}
				if (provinceMatched || cityMatched) {
					const score = (provinceMatched ? 1 : 0) + (cityMatched ? 2 : 0)
					candidates.push({ path: cityPath, score })
				}
			}
			if (provinceMatched) {
				candidates.push({ path: provincePath, score: 1 })
			}
		}
		candidates.sort((a, b) => b.score - a.score || b.path.length - a.path.length)
		return candidates[0]?.path || null
	}

	function applyRegionPath(path) {
		if (!path?.length) return false
		const valuePath = path.map(node => getNodeValue(node)).filter(Boolean)
		coordinates1.value = valuePath
		form.value.coordinates1 = valuePath
		form.value.provinceId = getNodeValue(path[0]) || ''
		form.value.cityId = getNodeValue(path[1]) || ''
		form.value.regionId = getNodeValue(path[2]) || ''
		return true
	}

	async function applyBusinessAddress(address) {
		const businessAddress = String(address || '').trim()
		if (!businessAddress) return false
		form.value.adress = businessAddress
		lockOcrField('adress', businessAddress)

		if (!regionsList.value?.length) {
			await getRegionsList().catch(() => {})
		}
		const regionPath = findRegionPathByAddress(businessAddress)
		return applyRegionPath(regionPath)
	}

	function validateBusinessLicenseProvince(address) {
		const businessAddress = String(address || '').trim()
		if (!businessAddress) return true
		const regionPath = findRegionPathByAddress(businessAddress)
		const currentAssoName = assoFullName.value || getAssoName(form.value.parentId)
		return isSameProvince(regionPath, currentAssoName)
	}

	function isSameProvince(regionPath, assoName) {
		const regionProvince = normalizeProvinceName(getNodeText(regionPath?.[0]))
		if (!regionProvince) return false
		const normalizedAssoName = normalizeProvinceName(assoName)
		return normalizedAssoName && (
			normalizedAssoName.includes(regionProvince) ||
			regionProvince.includes(normalizedAssoName)
		)
	}

	function normalizeProvinceName(name) {
		return normalizeAddressText(name).replace(/省|市|自治区|壮族自治区|回族自治区|维吾尔自治区/g, '')
	}

	// 恢复协会完整路径名称
	function restoreAssoFullName() {
		if (!form.value.parentId || !tree.value || tree.value.length === 0) {
			return
		}
		// 查找节点及其路径
		const result = findAssoNodeWithPath(tree.value, form.value.parentId, [])
		if (result) {
			// 使用路径数组重建完整名称
			assoFullName.value = getAssoFullName(result.path.map(id => ({ value: id })))
		}
	}

	function changeCoordinates1(e) {
		if (isFieldDisabled('address')) return
		const selectedValue = e?.detail?.value || e || []
		const getValue = (item) => item?.value ?? item?.id ?? item
		form.value.provinceId = getValue(selectedValue[0])?.toString() || ''
		form.value.cityId = getValue(selectedValue[1])?.toString() || ''
		form.value.regionId = getValue(selectedValue[2])?.toString() || ''
		coordinates1.value = selectedValue.map(item => getValue(item)).filter(Boolean)
		form.value.coordinates1 = coordinates1.value
	}

	function chooseIdCardFront() {
		uni.chooseImage({
			count: 1,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => upIdCardImgFront(res)
		})
	}

	function chooseIdCardBack() {
		uni.chooseImage({
			count: 1,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => upIdCardImgBack(res)
		})
	}

	function upIdCardImgFront(e) {
		const tempFilePaths = e.tempFilePaths;
		const imgUrl = tempFilePaths[0]
		if (!imgUrl) return
		uni.showLoading({
			title: '上传中'
		})
		uploadMinioImage(imgUrl).then(url => {
			legalIdcPhoto1.value = url
			uni.hideLoading()
		}).catch(err => {
			uni.hideLoading()
			uni.showToast({
				title: '上传失败',
				icon: 'none'
			})
		})
	}

	function upIdCardImgBack(e) {
		const tempFilePaths = e.tempFilePaths;
		const imgUrl = tempFilePaths[0]
		if (!imgUrl) return
		uni.showLoading({
			title: '上传中'
		})
		uploadMinioImage(imgUrl).then(url => {
			legalIdcPhoto2.value = url
			extractIdCardInfo(imgUrl)
			uni.hideLoading()
		}).catch(err => {
			uni.hideLoading()
			uni.showToast({
				title: '上传失败',
				icon: 'none'
			})
		})
	}

	function delimgFont() {
		legalIdcPhoto1.value = ''
		form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',')
	}

	function delimgBack() {
		legalIdcPhoto2.value = ''
		form.value.legalIdcPhoto = [legalIdcPhoto1.value, legalIdcPhoto2.value].filter(Boolean).join(',')
	}

	function extractIdCardInfo(tempPath) {
		if (!tempPath) return
		uni.uploadFile({
			url: config.baseUrl_api + '/person/info/getPersonInfoFromCert/0',
			filePath: tempPath,
			name: 'pic',
			header: {
				'Authorization': uni.getStorageSync('token')
			},
			success: (res) => {
				try {
					const data = JSON.parse(res.data || '{}')
					if (data.code === 200 && data.data) {
						form.value.legal = data.data.name || form.value.legal
						form.value.legalIdcCode = data.data.code || form.value.legalIdcCode
						lockOcrField('legal', form.value.legal)
					}
				} catch (e) {
					console.error('身份证OCR解析失败', e)
				}
			}
		})
	}

	let selectFileValue = {}

	function chooseBusinessLicense() {
		uni.chooseImage({
			count: 1,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => {
				const tempFiles = (res.tempFilePaths || []).map((path, index) => ({
					...(res.tempFiles?.[index] || {}),
					url: path,
					path,
					name: res.tempFiles?.[index]?.name || '营业执照',
					extname: res.tempFiles?.[index]?.extname || 'png'
				}))
				selectFile({
					tempFiles,
					tempFilePaths: res.tempFilePaths
				})
			}
		})
	}

	async function selectFile(e) {
		let file = e.tempFiles[0]
		if (!file) return
		unlockOcrFields()
		const filePath = file.url || file.path || e.tempFilePaths?.[0]
		uni.showLoading({
			title: '上传中'
		})
		try {
			const uploadUrl = await uploadMinioImage(filePath)
			const ocrData = await getBusinessLicenseOcr(filePath)
			if (ocrData) {
				form.value.companyName = ocrData.companyName || form.value.companyName
				form.value.creditCode = ocrData.creditCode || form.value.creditCode
				form.value.legal = ocrData.legalPerson || form.value.legal
				lockOcrField('companyName', form.value.companyName)
				lockOcrField('creditCode', form.value.creditCode)
				lockOcrField('legal', form.value.legal)
				currentBusinessLicenseAddress.value = ocrData.businessAddress || ''
				await applyBusinessAddress(ocrData.businessAddress)
				if (!validateBusinessLicenseProvince(ocrData.businessAddress)) {
					clearBusinessLicenseUpload()
					uni.hideLoading()
					uni.showToast({
						title: '请上传省内的营业执照',
						icon: 'none',
						duration: 3000
					})
					return
				}
				await onCreditCodeBlur(false)
			}
			selectFileValue = {
				url: uploadUrl,
				name: ocrData?.name || file.name || '营业执照',
				extname: file.extname
			}
			form.value.businessLicense = JSON.stringify([selectFileValue])
			uni.hideLoading()
		} catch (err) {
			uni.hideLoading()
			uni.showToast({
				title: '上传失败',
				icon: 'none'
			})
		}
	}

	function delSupplementFile() {
		clearBusinessLicenseUpload()
		unlockOcrFields()
		lockParentIdField()
	}

	function getBusinessLicenseOcr(filePath) {
		if (!filePath) return Promise.resolve(null)
		return new Promise((resolve) => {
			uni.uploadFile({
				url: config.baseUrl_api + '/member/info/getBusinessLicense',
				filePath,
				name: 'pic',
				header: {
					'Authorization': uni.getStorageSync('token')
				},
				success: (res) => {
					try {
						const data = JSON.parse(res.data || '{}')
						resolve(data.code === 200 ? data.data : null)
					} catch (e) {
						resolve(null)
					}
				},
				fail: () => resolve(null)
			})
		})
	}

	function getImageUrl(url) {
		return fillImgUrl(url)
	}

	function getBusinessLicenseUrl() {
		if (!form.value.businessLicense) return ''
		try {
			const license = JSON.parse(form.value.businessLicense)
			if (Array.isArray(license) && license.length > 0) return license[0].url || ''
			if (typeof license === 'object' && license.url) return license.url
		} catch (e) {
			return form.value.businessLicense
		}
		return ''
	}

	function previewImage(url) {
		if (Array.isArray(url)) {
			uni.previewImage({ urls: url })
		} else {
			uni.previewImage({ urls: [url] })
		}
	}

	function choosePictures() {
		uni.chooseImage({
			count: 3,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => upPicArr(res)
		})
	}

	function upPicArr(e) {
		const tempFilePaths = e.tempFilePaths;
		const imgUrl = tempFilePaths[0]
		if (!imgUrl) return
		uni.showLoading({
			title: '上传中'
		})
		Promise.all(tempFilePaths.slice(0, 3).map(path => uploadMinioImage(path))).then(urls => {
			picArr.value = urls.filter(Boolean)
			form.value.pictures = picArr.value.join(',')
			uni.hideLoading()
		}).catch(err => {
			uni.hideLoading()
			uni.showToast({
				title: '上传失败',
				icon: 'none'
			})
		})
	}

	function delpicArr() {
		picArr.value = []
		form.value.pictures = ''
	}

	function uploadMinioImage(filePath) {
		return new Promise((resolve, reject) => {
			if (!filePath) return reject(new Error('请选择图片'))
			uni.uploadFile({
				url: config.baseUrl_api + '/fileServer/uploadImg',
				filePath,
				name: 'image',
				header: {
					'Authorization': uni.getStorageSync('token')
				},
				success: (res) => {
					try {
						const data = JSON.parse(res.data || '{}')
						const url = getUploadUrl(data)
						if (!url) return reject(new Error('上传返回数据异常'))
						resolve(url)
					} catch (e) {
						reject(e)
					}
				},
				fail: reject
			})
		})
	}

	function getUploadUrl(res) {
		const data = res?.data
		if (typeof data === 'string') return data
		return data?.ms || data?.url || data?.fang || res?.msg || ''
	}

	// 须知勾选
	function onNoticeChange(e) {
		if (btn.value) return
		const values = e.detail.value
		form.value.notice = values.includes('1')
	}

	// 查看须知 - 跳转到须知页面
	function showNotice(type) {
		const pageMap = {
			1: '/pages/index/notice-registration',
			2: '/pages/index/notice-membership',
			3: '/pages/index/notice-disclaimer'
		}
		const url = pageMap[type]
		if (url) {
			uni.navigateTo({url})
		}
	}
</script>

<style lang="scss" scoped>
	:deep(.file-picker__progress) {
		opacity: 0;
	}

	:deep(.input-value) {
		padding: 0 5rpx;
	}

	.picker-view {
		width: 750rpx;
		height: 600rpx;
		margin-top: 20rpx;
	}

	.item {
		line-height: 100rpx;
		text-align: center;
	}

	:deep(.uni-data-tree) {
		border: 1px solid #dcdfe6;
		border-radius: 4px;

		.selected-list {
			justify-content: start;
		}
	}

	:deep(.uni-select__input-placeholder) {
		font-size: 30rpx;
	}

	:deep(.uni-easyinput__content-input) {
		font-size: 30rpx;
	}

	:deep(.uni-easyinput__placeholder-class) {
		font-size: 30rpx;
		color: grey;
	}

	.wBox {
		width: 700rpx;
		padding: 30rpx;
		margin: 20rpx auto 0;
		background: #FFFFFF;
		box-shadow: 0rpx 12rpx 116rpx 0rpx rgba(196, 203, 214, 0.1);
		border-radius: 15rpx;
	}

	.notice-box {
		padding: 20rpx 0;
	}

	.notice-label {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		font-size: 24rpx;
	}

	.notice-text {
		color: #666;
	}

	.notice-link {
		color: #007AFF;
	}

	.imgArea {
		padding: 1px;
		display: flex;
		flex-wrap: wrap;
		flex-direction: column;
	}

	.upload-box,
	.pictures-box {
		width: 100%;
	}

	.upload-placeholder,
	.idcard-placeholder {
		width: 100%;
		height: auto;
		aspect-ratio: 3/2;
		border-radius: 8rpx;
		overflow: hidden;
		vertical-align: middle;
	}

	.picture-placeholder {
		width: 100%;
		height: auto;
		aspect-ratio: 4/3;
		border-radius: 8rpx;
		overflow: hidden;
		vertical-align: middle;
	}

	.placeholder-img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.license-preview,
	.idcard-preview,
	.pictures-preview {
		position: relative;
		width: 100%;
	}

	.license-img,
	.idcard-img {
		width: 100%;
		height: auto;
		aspect-ratio: 3/2;
		border-radius: 8rpx;
		object-fit: cover;
	}

	.picture-img {
		width: 100%;
		height: auto;
		aspect-ratio: 4/3;
		border-radius: 8rpx;
		object-fit: cover;
	}

	.idcard-box {
		margin-bottom: 20rpx;
	}

	.idcard-item {
		width: 100%;
	}

	.delete-btn {
		position: absolute;
		top: 12rpx;
		right: 12rpx;
		background: #AD181F;
		color: #fff;
		width: 48rpx;
		height: 48rpx;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 0;
		line-height: 1;
		z-index: 99;
		border: 4rpx solid #fff;
		box-shadow: 0 4rpx 14rpx rgba(173, 24, 31, 0.35);
	}

	.delete-btn::before,
	.delete-btn::after {
		content: '';
		position: absolute;
		left: 50%;
		top: 50%;
		width: 24rpx;
		height: 4rpx;
		background: #fff;
		border-radius: 4rpx;
		transform-origin: center;
	}

	.delete-btn::before {
		transform: translate(-50%, -50%) rotate(45deg);
	}

	.delete-btn::after {
		transform: translate(-50%, -50%) rotate(-45deg);
	}

	.btn-red {
		background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%);
		color: #fff;
		border-radius: 44rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		width: 100%;
		border: none;
	}

	.btn-red.disabled,
	.btn-red[disabled] {
		opacity: 0.55;
		background: #c7c7c7;
		color: #fff;
	}

	.fixedBottom {
		display: flex;
		justify-content: center;
		padding: 30rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background: #fff;
		box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
		z-index: 99;
	}

	.text-warning {
		font-size: 28rpx;
		margin-top: 20rpx;
	}

	/* 新增:自定义弹窗样式(核心) */
	.custom-modal {
		width: 600rpx;
		background: #fff;
		border-radius: 20rpx;
		padding: 40rpx 30rpx;
		box-sizing: border-box;
		text-align: center;
	}

	.modal-title {
		font-size: 36rpx;
		font-weight: 600;
		color: #333;
		margin-bottom: 30rpx;
	}

	.modal-content {
		font-size: 30rpx;
		color: #666;
		line-height: 1.6;
		margin-bottom: 20rpx;
		text-align: left;
	}

	.modal-tip {
		font-size: 26rpx;
		color: #F56C6C;
		margin-top: 10rpx;
		margin-bottom: 30rpx;
	}

	.modal-btns {
		display: flex;
		justify-content: space-between;
		gap: 20rpx;
	}

	.btn-cancel {
		flex: 1;
		height: 80rpx;
		line-height: 80rpx;
		background: #f5f5f5;
		color: #666;
		border-radius: 40rpx;
		font-size: 32rpx;
		border: none;
	}

	.btn-confirm {
		flex: 1;
		height: 80rpx;
		line-height: 80rpx;
		background: #C4121B;
		/* 红色主色调,和图二一致 */
		color: #fff;
		border-radius: 40rpx;
		font-size: 32rpx;
		border: none;
	}

	/* 去掉按钮默认边框 */
	.btn-cancel::after,
	.btn-confirm::after {
		border: none;
	}

	/* 考点申请弹窗专属样式 */
	.apply-modal {
		padding: 40rpx 30rpx 20rpx;
	}

	.apply-btns {
		margin-bottom: 20rpx;
	}
</style>