perfect.vue 48.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 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 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968
<template>
	<view class="perfect-page">
		<!-- 顶部步骤条 -->
		<view class="steps-bar">
			<view class="step-item" :class="{ active: activeStep >= 1, current: activeStep == 1 }" @click="switchStep(1)">
				<view class="step-circle">1</view>
				<view class="step-text">完善信息</view>
			</view>
			<view class="step-line" :class="{ active: activeStep >= 2 }"></view>
			<view class="step-item" :class="{ active: activeStep >= 2, current: activeStep == 2 }" @click="switchStep(2)">
				<view class="step-circle">2</view>
				<view class="step-text">会员认证</view>
			</view>
			<view class="step-line" :class="{ active: activeStep >= 3 }"></view>
			<view class="step-item" :class="{ active: activeStep >= 3, current: activeStep == 3 }" @click="switchStep(3)">
				<view class="step-circle">3</view>
				<view class="step-text">审核详情</view>
			</view>
		</view>
		<!-- <view class="tips-box">
			<view class="tips-title">注意</view>
			<view class="tips-content">
				<view class="tips-line">尊敬的用户,您好!</view>
				<view class="tips-line">在开始注册团体会员前,请您提前准备好以下材料,以便顺利完成申请:</view>
				<view class="tips-item">1. 单位营业执照</view>
				<view class="tips-desc">请提供清晰的营业执照原件照片或扫描件(加盖公章更佳)</view>
				<view class="tips-item">2. 法人身份证正反面照片</view>
				<view class="tips-desc">请分别上传身份证正面及反面清晰照片</view>
				<view class="tips-desc">确保信息完整、无遮挡、无模糊</view>
				<view class="tips-item">3. 机构照片</view>
				<view class="tips-desc">请提供体现单位实际经营或办公环境的照片1-2张</view>
				<view class="tips-desc">如门头、办公场所、活动场地等(能展示机构真实存在即可)</view>
			</view>
		</view> -->

		<view class="page-content" style="padding: 0rpx 30rpx 30rpx;">
			<!-- 退出按钮 - 悬浮右侧 -->
			<view class="logout-btn-top" @click="handleLogout">
				<text class="logout-icon"></text>
				<!-- <text class="logout-text">退出账号</text> -->
			</view>
			<!-- 步骤1:完善信息 -->
			<view class="wBox" v-if="activeStep == 1">
				<uni-forms ref="baseForm" :modelValue="form" label-width="70">
					<uni-forms-item label="单位名称" required>
						<uni-easyinput class="input-with-border" v-model="form.baseName" :disabled="!editIng" placeholder="单位名称" />
					</uni-forms-item>
					<uni-forms-item label="单位类型" required>
						<view style="width: 100%;">
							<uni-data-select v-model="form.type" :localdata="typeList" placeholder="请选择单位类型"></uni-data-select>
						</view>
					</uni-forms-item>
					<uni-forms-item label="联系人" required>
						<uni-easyinput class="input-with-border" v-model="form.contact" :disabled="!editIng" placeholder="请输入联系人姓名" />
					</uni-forms-item>
					<uni-forms-item label="联系方式" required>
						<uni-easyinput class="input-with-border" v-model="form.phone" :disabled="!editIng" placeholder="请输入联系方式" />
					</uni-forms-item>
					<uni-forms-item label="机构介绍" required>
						<uni-easyinput class="input-with-border" v-model="form.introduce" placeholder="请输入机构介绍" :disabled="!editIng" type='textarea' />
					</uni-forms-item>
				</uni-forms>
				<view class="fixedBottom">
					<button class="btn-red" @click="submitStep1()">下一步</button>
				</view>
			</view>

			<!-- 步骤2:会员认证 -->
			<view class="wBox" v-if="activeStep == 2">
				<view class="status-box">
					<view class="status-row">
						<text class="status-label">认证状态:</text>
						<text v-if="authenticationStatus == 0 || !authenticationStatus" class="text-danger">未认证</text>
						<text v-if="authenticationStatus == 1" class="text-warning">认证中</text>
						<text v-if="authenticationStatus == 2" class="text-success">已认证</text>
						<text v-if="authenticationStatus == 3" class="text-danger">认证未通过</text>
						<text v-if="authenticationStatus == 4" class="text-warning">即将过期</text>
						<text v-if="authenticationStatus == 5" class="text-danger">已过期</text>
					</view>
					<!-- <view class="logout-btn" @click="handleLogout">
						<text class="logout-icon"></text>
						<text class="logout-text">退出</text>
					</view> -->
				</view>

				<uni-forms ref="certForm" :modelValue="form" label-width="90">
					<uni-forms-item label="选择所属协会" required>
						<view class="picker-wrapper">
							<uni-data-picker 
								class="custom-picker"
								:disabled="!editIng" 
								v-model="form.parentId" 
								:localdata="assoList" 
								:level="3"
								popup-title="请选择所属协会"
								@change="changCase"
							></uni-data-picker>
						</view>
					</uni-forms-item>
					<uni-forms-item label="机构名称" required>
						<uni-easyinput class="input-with-border" v-model="form.name" :disabled="!editIng" placeholder="请输入机构名称" />
					</uni-forms-item>
					<uni-forms-item label="认证地址" required>
						<view class="picker-wrapper">
							<uni-data-picker 
								class="custom-picker"
								v-model="coordinates1"
								:localdata="regionOptions" 
								popup-title="请选择所在地区"
								@change="changeAddress"
							></uni-data-picker>
						</view>
					</uni-forms-item>
					<uni-forms-item label="认证详细地址" required>
						<uni-easyinput class="input-with-border" v-model="form.adress" :disabled="!editIng" placeholder="请输入详细地址" />
					</uni-forms-item>
					<uni-forms-item label="联系人" required>
						<uni-easyinput class="input-with-border" v-model="form.siteContact" :disabled="!editIng" placeholder="请输入联系人" />
					</uni-forms-item>
					<uni-forms-item label="联系方式" required>
						<uni-easyinput class="input-with-border" v-model="form.siteTel" :disabled="!editIng" placeholder="请输入联系方式" />
					</uni-forms-item>
					<uni-forms-item label="营业执照" required>
						<view class="upload-box">
							<view v-if="!form.businessLicense" class="upload-placeholder" @click="onBusinessLicenseSelect">
								<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" v-if="editIng" @click="removeBusinessLicense">×</view>
						</view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="营业执照名称" required>
						<uni-easyinput class="input-with-border" v-model="form.companyName" :disabled="!editIng" placeholder="请输入营业执照名称" />
					</uni-forms-item>
					<uni-forms-item label="社会信用代码" required>
						<uni-easyinput class="input-with-border" v-model="form.creditCode" :disabled="!editIng" placeholder="请输入社会信用代码" @blur="onCreditCodeBlur" />
					</uni-forms-item>
					<uni-forms-item label="法人身份证" required>
						<view class="idcard-box">
							<view class="idcard-item">
								<view v-if="!form.legalIdcPhoto1" class="idcard-placeholder" @click="onIdCardFrontSelect">
									<image :src="config.baseUrl_api + '/fs/static/sfz_zm@2x.png'" class="placeholder-img"/>
								</view>
								<view v-else class="idcard-preview">
									<image :src="getImageUrl(form.legalIdcPhoto1)" class="idcard-img" @click="previewImage(getImageUrl(form.legalIdcPhoto1))"></image>
									<view class="delete-btn" v-if="editIng" @click="removeIdCardFront">×</view>
								</view>
							</view>
						</view>
						<view class="idcard-box">
							<view class="idcard-item">
								<view v-if="!form.legalIdcPhoto2" class="idcard-placeholder" @click="onIdCardBackSelect">
									<image :src="config.baseUrl_api + '/fs/static/sfz_fm@2x.png'" class="placeholder-img"/>
								</view>
								<view v-else class="idcard-preview">
									<image :src="getImageUrl(form.legalIdcPhoto2)" class="idcard-img" @click="previewImage(getImageUrl(form.legalIdcPhoto2))"></image>
									<view class="delete-btn" v-if="editIng" @click="removeIdCardBack">×</view>
								</view>
							</view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="法人姓名" required>
						<uni-easyinput class="input-with-border" v-model="form.legal" :disabled="!editIng" placeholder="请输入法人姓名" />
					</uni-forms-item>
					<uni-forms-item label="法人证件号" required>
						<uni-easyinput class="input-with-border" v-model="form.legalIdcCode" :disabled="!editIng" placeholder="请输入法人证件号" />
					</uni-forms-item>
					<uni-forms-item label="上传机构照片" required>
					<view class="pictures-box">
						<view v-if="!form.pictures" class="picture-placeholder" @click="onPicturesSelect">
							<image :src="config.baseUrl_api + '/fs/static/jgzp@2x.png'" class="placeholder-img"/>
						</view>
						<view v-else class="pictures-preview">
							<image :src="getImageUrl(form.pictures.split(',')[0])" class="picture-img" @click="previewImage(form.pictures.split(',').map(url => getImageUrl(url)))"></image>
							<view class="delete-btn" v-if="editIng" @click="removePictures">×</view>
						</view>
					</view>
				</uni-forms-item>
				<!-- <uni-forms-item label=""> -->
					<view class="notice-box">
						<checkbox-group @change="onNoticeChange">
							<label class="notice-label">
								<checkbox :checked="form.notice" value="1" color="#e64329" />
								<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-item> -->
				</uni-forms>

				<view class="fixedBottom">
					<button class="btn-gray" @click="activeStep = 1">上一步</button>
					<button class="btn-red" :disabled="btn" @click="submitStep2()">下一步</button>
				</view>
			</view>

			<!-- 步骤3:审核详情(只展示,无提交按钮) -->
			<view class="wBox" v-if="activeStep == 3">
				<view class="audit-detail">
					<view class="audit-title">审核详情</view>
					<view v-if="auditLoading" class="loading-box">
						<text>加载中...</text>
					</view>
					<view v-else-if="auditList.length === 0" class="empty-box">
						<text>暂无审核记录</text>
					</view>
					<view class="audit-list" v-else>
						<view class="audit-item" v-for="(item, index) in auditList" :key="index">
							<view class="audit-item-header">
								<text class="audit-dept">{{ item.auditDeptName || '待审核' }}</text>
								<text class="audit-status" :class="getAuditStatusClass(item.auditResult)">{{ getAuditStatusText(item.auditResult) }}</text>
							</view>
							<view class="audit-item-body">
								<view class="audit-row" >
									<text class="audit-label">审核日期:</text>
									<text class="audit-value">{{ formatDate(item.auditTime) }}</text>
								</view>
								<view class="audit-row">
									<text class="audit-label">理由:</text>
									<text class="audit-value">{{ item.auditMsg || '/' }}</text>
								</view>
							</view>
						</view>
					</view>
				</view>

				<!-- <view class="fixedBottom">
					<button class="btn-gray" @click="activeStep = 2">上一步</button>
				</view> -->
			</view>
		</view>
	</view>

	<!-- 自定义弹框 -->
	<custom-modal
		ref="customModalRef"
		:title="modalConfig.title"
		:content="modalConfig.content"
		:isHtml="modalConfig.isHtml"
		:showCancel="modalConfig.showCancel"
		:showConfirm="modalConfig.showConfirm"
		:cancelText="modalConfig.cancelText"
		:confirmText="modalConfig.confirmText"
		@confirm="onModalConfirm"
		@cancel="onModalCancel"
	></custom-modal>
</template>

<script setup>
	import {
		ref,
		reactive,
		computed,
		watch
	} from 'vue';
	import * as api from '@/common/api.js';
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app';
	import config from '@/config.js'
	import customModal from '@/components/custom-modal.vue'
	// import uniDataSelect from '@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue'
	const app = getApp();

	// 自定义弹框 ref
	const customModalRef = ref(null)

	// 弹框配置
	const modalConfig = ref({
		title: '',
		content: '',
		isHtml: false,
		showCancel: true,
		showConfirm: true,
		cancelText: '取消',
		confirmText: '确定'
	})

	// 弹框确认回调
	function onModalConfirm() {
		if (modalConfig.value.onConfirm) {
			modalConfig.value.onConfirm()
		}
	}

	// 弹框取消回调
	function onModalCancel() {
		if (modalConfig.value.onCancel) {
			modalConfig.value.onCancel()
		}
	}

	// 显示自定义弹框方法
	function showModal(options) {
		modalConfig.value = {
			title: options.title || '',
			content: options.content || '',
			isHtml: options.isHtml || false,
			showCancel: options.showCancel !== false,
			showConfirm: options.showConfirm !== false,
			cancelText: options.cancelText || '取消',
			confirmText: options.confirmText || '确定',
			onConfirm: options.onConfirm,
			onCancel: options.onCancel
		}
		customModalRef.value?.open()
	}

	const form = ref({
		type: '1',
		notice: false
	});

	// 类型列表
	const typeList = ref([{
		value: '1',
		text: '企业'
	}, {
		value: '2',
		text: '国家组织'
	}, {
		value: '3',
		text: '社会组织'
	}, {
		value: '4',
		text: '其他'
	}])

	// 类型索引
	const typeIndex = computed(() => {
		return typeList.value.findIndex(item => String(item.value) === String(form.value.type))
	})

	// 类型选择
	function typeChange(e) {
		const index = e.detail.value
		form.value.type = typeList.value[index].value
	}

	// 地址选项
	const options = ref([])
	const regionOptions = ref([])

	// 协会树
	const assoList = ref([])
	const assoFullName = ref('') // 协会完整路径名称

	// 步骤相关
	const activeStep = ref(1)
	const list1 = ref([{
		title: '完善信息'
	}, {
		title: '会员认证'
	}])
	const creditCode = ref('')
	// 编辑状态
	const editIng = ref(true);

	// 认证状态
	const authenticationStatus = ref()
	const result = ref(false)

	// 地址级联
	const coordinates1 = ref([])

	// 按钮状态
	const btn = ref(false)

	// 费用相关
	const memberFee = ref('')
	const preferentialPolicy = ref(false)
	const preferentialData = ref({})

	// 考点审核状态
	const auditStatus = ref('0')

	// 审核详情
	const auditList = ref([])
	const auditLoading = ref(false)

	// 社会信用代码校验状态(true=校验通过,false=校验失败/已存在)
	const creditCodeValid = ref(true)

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

	// 社会信用代码失焦校验
	function onCreditCodeBlur() {
		const creditCode = form.value.creditCode
		if (!creditCode) return
		api.creditCodeExist(creditCode).then(res => {
			if (res.data) {
				creditCodeValid.value = false
				uni.showToast({ title: '社会信用代码已存在,请联系中跆协修改', icon: 'none', duration: 3000 })
			} else {
				creditCodeValid.value = true
			}
		}).catch(() => {
			creditCodeValid.value = true
		})
	}

	// 查看须知 - 跳转到须知页面
	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 })
		}
	}

	// 切换步骤(参考PC端handelActive逻辑)
	function switchStep(step) {
		// 如果没有认证状态,不允许切换
		if (!authenticationStatus.value) return
		// 根据认证状态判断可以切换到哪些步骤
		const status = authenticationStatus.value
		// 已认证(2)或认证中(1)可以到步骤3,其他只能到步骤2
		if (status == 1 || status == 2) {
			// 可以切换到任意步骤
			activeStep.value = step
		} else {
			// 未认证(0)、认证未通过(3)只能切换到步骤1或2
			if (step <= 2) {
				activeStep.value = step
			}
		}
	}

	// 获取审核详情
	function getMyCertStageFN() {
		auditLoading.value = true
		api.getMyRecent().then(res => {
			auditLoading.value = false
			if (res.data && res.data.auditLogs) {
				try {
					auditList.value = JSON.parse(res.data.auditLogs)
				} catch (e) {
					auditList.value = []
				}
			} else {
				auditList.value = []
			}
		}).catch(() => {
			auditLoading.value = false
			auditList.value = []
		})
	}

	// 审核状态文字
	function getAuditStatusText(status) {
		const map = {
			0: '待审核',
			1: '审核通过',
			2: '审核拒绝'
		}
		return map[status] || '待审核'
	}

	// 审核状态样式
	function getAuditStatusClass(status) {
		if (status == 1) return 'status-pass'
		if (status == 2) return 'status-reject'
		return 'status-pending'
	}

	// 日期格式化
	function formatDate(time) {
		if (!time) return ''
		const date = new Date(time)
		const year = date.getFullYear()
		const month = String(date.getMonth() + 1).padStart(2, '0')
		const day = String(date.getDate()).padStart(2, '0')
		return `${year}-${month}-${day}`
	}

	// 图片URL处理:如果不是http开头,拼接baseUrl_api
	function getImageUrl(url) {
		if (!url) return ''
		if (url.indexOf('http') === 0) return url
		return config.baseUrl_api + url
	}

	// 解析营业执照URL
	function getBusinessLicenseUrl() {
		if (!form.value.businessLicense) return ''
		try {
			const arr = JSON.parse(form.value.businessLicense)
			if (Array.isArray(arr) && arr.length > 0) {
				return arr[0].url || ''
			}
		} catch (e) {
			// 如果不是JSON格式,可能是直接返回的URL
			return form.value.businessLicense
		}
		return ''
	}

	onLoad(option => {
			getTree()
		if (app.globalData.isLogin) {
			init()
		} else {
			app.firstLoadCallback = () => {
				init()
			};
		}
		// 如果初始就是步骤3,需要立即调用
		if (activeStep.value === 3) {
			getMyCertStageFN()
		}
	});

	function init() {
		getDetail()
		getRegionsList()
	
		// getMyMemberCertUnitFeeApi()
		canUseDiscountApi()
		getZtxDiscountPolicyApi()
		getMyStatusAPI()
	}

	// 获取详情
	function getDetail() {
		api.getMyOwnMemberInfo().then(res => {
			// if (res.data.memberInfo) {
			// 	Object.assign(form.value, res.data.memberInfo)
			// }
			form.value = { ...res.data.dept, ...res.data.memberInfo }
			if (form.value.type) {
				form.value.type = String(form.value.type)
			}
			authenticationStatus.value = res.data.authenticationStatus
			  switch (res.data.authenticationStatus) {
				case '0' :
				activeStep.value = 2
				break
				case '1':
				activeStep.value = 3
				break
				case '2':
				activeStep.value = 3
				break
				case '3':
				activeStep.value = 2
				break
				default:
				activeStep.value = 1
				break
			}
			result.value = res.data.result

			// 处理地址 - 需要用对象数组格式
			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)

			// 处理协会 - 设置完整路径名称
			if (form.value.parentId) {
				// 尝试从协会树中查找完整路径
				const result = findAssoNodeWithPath(assoList.value, form.value.parentId, [])
				if (result) {
					assoFullName.value = getAssoFullName(result.path.map(id => ({ value: id })))
				} else {
					// 如果树还没加载完,延迟设置
					setTimeout(() => {
						const res = findAssoNodeWithPath(assoList.value, form.value.parentId, [])
						if (res) {
							assoFullName.value = getAssoFullName(res.path.map(id => ({ value: id })))
						}
					}, 500)
				}
			}

			// 处理身份证
			if (form.value.legalIdcPhoto) {
				const photos = form.value.legalIdcPhoto.split(',')
				form.value.legalIdcPhoto1 = photos[0] || ''
				form.value.legalIdcPhoto2 = photos[1] || ''
			}

			// 处理营业执照
			if (form.value.businessLicense) {
				try {
					const license = JSON.parse(form.value.businessLicense)
					form.value.businessLicense = license.url || license
					form.value.businessLicenseName = license.name
				} catch (e) {}
			}

			// 设置认证状态对应的按钮状态
			if (authenticationStatus.value == 0) {
				btn.value = false
			} else if (authenticationStatus.value == 1) {
				btn.value = true
			} else {
				btn.value = !result.value
			}

			// 参考PC端:根据认证状态设置字段是否可编辑
			// 认证中(1)、已认证(2)、已过期(5)时,字段不可编辑
			if (authenticationStatus.value == 1 || authenticationStatus.value == 2 || authenticationStatus.value == 5) {
				editIng.value = false
			} else {
				editIng.value = true
			}

			// creditCode.value = form.value.creditCode
			// legal.value = form.value.legal
			// legalIdcCode.value = form.value.legalIdcCode
			// coordinates1.value = form.value.provinceId
			// adress.value = form.value.adress
			form.value.name = form.value.baseName
		})
	}

	// 格式化地区树(修复:对齐PC端接口返回的id/name结构)
	function formatRegionTree(node) {
		const result = {
			value: node.id,
			text: node.name
		}
		if (node.children && node.children.length > 0) {
			result.children = node.children.map(child => formatRegionTree(child))
		}
		return result
	}

	// 获取地区列表
	function getRegionsList() {
		api.regionsList().then(res => {
			options.value = res.data
			// 转换为级联选择器格式
			regionOptions.value = res.data
			// map(item => formatRegionTree(item))
		});
	}

	// 获取协会树
	function getTree() {
		console.log('获取协会树')
		api.certifiedDeptTreeRegister({
			selfDeptId: -1, // 修复:传数字类型,避免后端类型转换错误
			webSiteShow: 1,
			showDisabled: 1,
			isBlack: 0
		}).then(res => {
			assoList.value = res.data.map(item => formatTree(item))
			// 树加载完成后,如果有parentId,设置完整路径名称
			if (form.value.parentId) {
				setTimeout(() => {
					restoreAssoFullName()
				}, 100)
			}
		})
	}

	// 格式化协会树
	function formatTree(node) {
		const result = {
			value: node.id,
			text: node.label || node.text
		}
		if (node.children && node.children.length > 0) {
			result.children = node.children.map(child => formatTree(child))
		}
		return result
	}

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

	// 查找协会节点及其父路径
	function findAssoNodeWithPath(list, targetId, currentPath) {
		for (const item of list) {
			const newPath = [...currentPath, item.value]
			if (item.value === targetId) {
				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
	}

	// 协会选择(修复:100%对齐PC端el-cascader emitPath: false逻辑,只取最后一级ID)
	function changCase(e) {
		const valueArr = e.detail?.value || e;
		// 取最后一级的value(纯ID)
		const lastNode = valueArr[valueArr.length - 1];
		form.value.parentId = lastNode?.value || '';
		console.log('最终提交的parentId:', form.value.parentId);
		assoFullName.value = getAssoFullName(valueArr)
		console.log('协会完整路径:', assoFullName.value);
	}

	// 地址选择(核心修复:从对象中提取纯value,对齐PC端格式)
// 地址选择(还原成你之前能用的版本:纯ID数组赋值)
	function changeAddress(e) {
		const selectedValue = e.detail?.value ?? e;
		console.log("选择的地址:", selectedValue);
		
		// 直接赋值纯ID,不要再取 .value
		form.value.provinceId = selectedValue[0] || '';
		form.value.cityId = selectedValue[1] || '';
		form.value.regionId = selectedValue[2] || '';
		
		// 同步更新选择器显示
		coordinates1.value = selectedValue;
		
		console.log('最终地址ID:', form.value.provinceId, form.value.cityId, form.value.regionId);
	}

	// 获取会员认证费用
	function getMyMemberCertUnitFeeApi() {
		api.getMyMemberCertUnitFee().then(res => {
			memberFee.value = res.data
		})
	}

	// 检查是否可用优惠政策
	function canUseDiscountApi() {
		api.canUseDiscount().then(res => {
			preferentialPolicy.value = res.data
		})
	}

	// 获取优惠政策详情
	function getZtxDiscountPolicyApi() {
		api.getZtxDiscountPolicy().then(res => {
			preferentialData.value = res.data
		})
	}

	// 获取考点申请状态
	function getMyStatusAPI() {
		api.getMyStatus().then(res => {
			if (res.data && res.data.auditStatus) {
				auditStatus.value = res.data.auditStatus
			} else {
				auditStatus.value = '0'
			}
		})
	}

	// 步骤1提交
	function submitStep1() {
		// 验证必填项
		if (!form.value.baseName) {
			uni.showToast({ title: '请填写单位名称', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.type) {
			uni.showToast({ title: '请选择单位类型', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.contact) {
			uni.showToast({ title: '请填写联系人', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.phone) {
			uni.showToast({ title: '请填写联系电话', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.introduce) {
			uni.showToast({ title: '请填写机构介绍', duration: 2000, icon: 'none' })
			return
		}

		api.createMyMember(form.value).then(res => {
			if (res.code === 200) {
				if (res.data.token) {
					uni.setStorageSync('token', 'Bearer ' + res.data.token)
				}
				uni.showToast({ title: '操作成功', duration: 1500, icon: 'success' })
				setTimeout(() => {
					activeStep.value = 2
					getDetail()
				}, 1500)
			} else {
				uni.showToast({ title: res.msg || '操作失败', duration: 2000, icon: 'none' })
			}
		})
	}

	// 步骤2提交
	function submitStep2() {
		// 验证必填项
		if (!form.value.parentId || form.value.parentId == 0 || form.value.parentId == -1) {
			uni.showToast({ title: '请选择所属协会', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.name) {
			uni.showToast({ title: '请输入机构名称', duration: 2000, icon: 'none' })
			return
		}
		if (coordinates1.value.length === 0) {
			uni.showToast({ title: '请选择认证地址', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.adress) {
			uni.showToast({ title: '请输入认证详细地址', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.siteContact) {
			uni.showToast({ title: '请输入联系人', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.siteTel) {
			uni.showToast({ title: '请输入联系方式', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.businessLicense) {
			uni.showToast({ title: '请上传营业执照', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.companyName) {
			uni.showToast({ title: '请输入营业执照名称', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.creditCode) {
			uni.showToast({ title: '请输入社会信用代码', duration: 2000, icon: 'none' })
			return
		}
		if (!creditCodeValid.value) {
			uni.showToast({ title: '社会信用代码已存在,请联系中跆协修改', icon: 'none', duration: 3000 })
			return
		}
		if (!form.value.legalIdcPhoto1 || !form.value.legalIdcPhoto2) {
			uni.showToast({ title: '请上传身份证正反面', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.legal) {
			uni.showToast({ title: '请输入法人姓名', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.legalIdcCode) {
			uni.showToast({ title: '请输入法人证件号', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.pictures) {
			uni.showToast({ title: '请上传机构照片', duration: 2000, icon: 'none' })
			return
		}
		if (!form.value.notice) {
			uni.showToast({ title: '请阅读并同意注册须知、入会须知、免责声明', duration: 2000, icon: 'none' })
			return
		}

		// 验证营业执照和法人信息
		uni.showLoading({ title: '验证中...' })
		api.checkBusinessLicense({
			creditCode: form.value.creditCode,
			companyName: form.value.companyName,
			legalIdcCode: form.value.legalIdcCode,
			legal: form.value.legal
		}).then(checkRes => {
			uni.hideLoading()
			if (checkRes.code !== 200) {
				showModal({
					title: '系统提示',
					content: checkRes.msg || '企业信息异常请检查相关资料信息,确认无误后再次提交!',
					cancelText: '返回修改',
					confirmText: '确认无误',
					onConfirm: () => submitCertification()
				})
			} else {
				// 校验通过,提交认证(PC端逻辑)
				submitCertification()
			}
		}).catch(() => {
			uni.hideLoading()
			showModal({
				title: '系统提示',
				content: '企业信息异常请检查相关资料信息,确认无误后再次提交!',
				cancelText: '返回修改',
				confirmText: '确认无误',
				onConfirm: () => submitCertification()
			})
		})
	}

	// 提交认证信息(100%对齐PC端入参格式)
	function submitCertification() {
		let params = {
			parentId: form.value.parentId,
			creditCode: form.value.creditCode,
			legal: form.value.legal,
			businessLicense: form.value.businessLicense,
			pictures: form.value.pictures,
			memId: form.value.memId,
			id: form.value.deptId,
			name: form.value.name,
			regionId: form.value.regionId?.value,
			cityId: form.value.cityId.value.toString(),
			provinceId: form.value.provinceId.value.toString(),
			adress: form.value.adress,
			deptType: app.globalData.deptType,
			legalIdcPhoto: [form.value.legalIdcPhoto1, form.value.legalIdcPhoto2].join(','),
			applyPoints: '0',
			siteContact: form.value.siteContact,
			siteTel: form.value.siteTel,
			companyName: form.value.companyName,
			legalIdcCode: form.value.legalIdcCode
		}
		console.log(666,params)
		// return
		uni.showLoading({ title: '提交中...' })
		api.editMyMemberCertifiedInfo(params).then(res => {
			uni.hideLoading()
			if (res.code === 200) {
				uni.showToast({ title: '提交成功', duration: 1500, icon: 'success' })
				// 跳转缴费页面
				setTimeout(() => {
					const assoName = assoFullName.value
					console.log(888,assoName)
					// 跳转到缴费页面
					uni.navigateTo({
						url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}`
					})
				}, 1500)
			} else {
				uni.showToast({ title: res.msg || '提交失败', duration: 2000, icon: 'none' })
			}
		}).catch(() => {
			uni.hideLoading()
		})
	}

	// 营业执照上传
	function onBusinessLicenseSelect() {
		uni.chooseImage({
			count: 1,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => {
				if (res.tempFilePaths && res.tempFilePaths.length > 0) {
					uni.showLoading({ title: '上传中...' })
					// 先上传文件
					api.uploadFile(res).then(uploadRes => {
						if (uploadRes.code !== 200) {
							throw new Error('上传失败')
						}
						const url = uploadRes.msg
						// 上传成功后调用OCR识别
						return uni.uploadFile({
							url: config.baseUrl_api + '/member/info/getBusinessLicense',
							filePath: res.tempFilePaths[0],
							name: 'pic',
							header: {
								'Authorization': uni.getStorageSync('token')
							}
						}).then(ocrRes => {
							return { url, ocrRes }
						})
					}).then(({ url, ocrRes }) => {
						uni.hideLoading()
						const data = JSON.parse(ocrRes.data)
						let name = '营业执照'
						if (data.code === 200 && data.data) {
							form.value.creditCode = data.data.creditCode
							form.value.companyName = data.data.companyName
							name = data.data.name || '营业执照'
						}
						// 存储为数组格式的JSON字符串
						form.value.businessLicense = JSON.stringify([{
							url: url,
							name: name
						}])
					}).catch(() => {
						uni.hideLoading()
						uni.showToast({ title: '上传失败', icon: 'none' })
					})
				}
			}
		})
	}

	function removeBusinessLicense() {
		form.value.businessLicense = ''
		form.value.businessLicenseName = ''
	}

	// 删除身份证正面
	function removeIdCardFront() {
		form.value.legalIdcPhoto1 = ''
	}

	// 删除身份证反面
	function removeIdCardBack() {
		form.value.legalIdcPhoto2 = ''
	}

	// 身份证上传
	function onIdCardFrontSelect() {
		uni.chooseImage({
			count: 1,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => {
				if (res.tempFilePaths && res.tempFilePaths.length > 0) {
					uni.showLoading({ title: '上传中...' })
					api.uploadImg(res).then(data => {
						if (data.code === 200) {
							form.value.legalIdcPhoto1 = data.msg
						}
						uni.hideLoading()
					}).catch(() => {
						uni.hideLoading()
						uni.showToast({ title: '上传失败', icon: 'none' })
					})
				}
			}
		})
	}

	function onIdCardBackSelect() {
		uni.chooseImage({
			count: 1,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => {
				if (res.tempFilePaths && res.tempFilePaths.length > 0) {
					const tempPath = res.tempFilePaths[0]
					uni.showLoading({ title: '上传中...' })
					api.uploadImg(res).then(data => {
						if (data.code === 200) {
							form.value.legalIdcPhoto2 = data.msg
							// 用临时文件路径调用OCR
							extractIdCardInfo(tempPath)
						}
						uni.hideLoading()
					}).catch(() => {
						uni.hideLoading()
						uni.showToast({ title: '上传失败', icon: 'none' })
					})
				}
			}
		})
	}

	// 提取身份证信息
	function extractIdCardInfo(tempPath) {
		if (tempPath) {
			uni.uploadFile({
				url: config.baseUrl_api + '/person/info/getPersonInfoFromCert/0',
				filePath: tempPath,
				name: 'pic',
				header: {
					'Authorization': uni.getStorageSync('token')
				},
				success: (res) => {
					const data = JSON.parse(res.data)
					if (data.code === 200 && data.data) {
						form.value.legal = data.data.name
						form.value.legalIdcCode = data.data.code
					}
				}
			})
		}
	}

	// 机构照片上传
	function onPicturesSelect() {
		uni.chooseImage({
			count: 3,
			sizeType: ['compressed'],
			sourceType: ['album', 'camera'],
			success: (res) => {
				if (res.tempFilePaths && res.tempFilePaths.length > 0) {
					uni.showLoading({ title: '上传中...' })
					// 循环上传多张图片
					const promises = res.tempFilePaths.map(path => {
						return api.uploadImg({ tempFilePaths: [path] })
					})
					Promise.all(promises).then(results => {
						uni.hideLoading()
						const urls = results.filter(r => r.code === 200).map(r => r.msg)
						form.value.pictures = urls.join(',')
					}).catch(() => {
						uni.hideLoading()
						uni.showToast({ title: '上传失败', icon: 'none' })
					})
				}
			}
		})
	}

	// 预览图片
	function previewImage(url) {
		if (Array.isArray(url)) {
			uni.previewImage({
				urls: url
			})
		} else {
			uni.previewImage({
				urls: [url]
			})
		}
	}

	// 删除机构照片
	function removePictures() {
		form.value.pictures = ''
	}

	// 去缴费 - 参考PC payTheFees逻辑,先校验基础信息
	function goPay() {
		// 检查基础信息是否完善
		if (!form.value.siteContact) {
			uni.showToast({
				title: '请完善基础信息!',
				icon: 'none'
			})
			return
		}
		// 使用完整的协会路径名称
		const assoName = assoFullName.value || getAssoName(form.value.parentId)
		// 跳转到缴费页面
		uni.navigateTo({
			url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}`
		})
	}

	// 根据协会ID获取协会名称(只获取最后一级)
	function getAssoName(parentId) {
		if (!parentId || !assoList.value || assoList.value.length === 0) {
			return ''
		}
		// 递归查找协会名称
		function findInTree(list) {
			for (const item of list) {
				if (item.value === parentId) {
					return item.text || ''
				}
				if (item.children && item.children.length > 0) {
					const found = findInTree(item.children)
					if (found) return found
				}
			}
			return null
		}
		return findInTree(assoList.value) || ''
	}

	// 根据选择的值数组获取完整的协会路径名称
	function getAssoFullName(valueArr) {
		if (!valueArr || valueArr.length === 0 || !assoList.value || assoList.value.length === 0) {
			return ''
		}
		const pathNames = []
		let currentList = assoList.value
		for (let i = 0; i < valueArr.length; i++) {
			const node = valueArr[i]
			const found = currentList.find(item => item.value === node?.value || item.value === node)
			if (found) {
				pathNames.push(found.text || found.label || '')
				if (found.children) {
					currentList = found.children
				}
			} else {
				break
			}
		}
		return pathNames.join('/')
	}

	// 去认证 - 提交认证信息
	function doCertification() {
		submitStep2()
	}

	// 审核详情 - 跳转到审核详情页面
	function goAuditDetail() {
		uni.navigateTo({
			url: '/myCenter/certAuditDetail'
		})
	}

	// 退出登录
	function handleLogout() {
		uni.showModal({
			title: '提示',
			content: '确定要退出当前账号吗?',
			success: (res) => {
				if (res.confirm) {
					// 清除登录信息
					uni.clearStorageSync();
					// 跳转到登录页
					uni.reLaunch({
						url: '/login/login'
					});
				}
			}
		});
	}

	// 监听步骤变化,加载审核详情
	watch(activeStep, (newVal) => {
		console.log('activeStep changed:', newVal)
		if (newVal === 3) {
			getMyCertStageFN()
		}
	})
</script>

<style lang="scss" scoped>
.perfect-page {
	min-height: 100vh;
	background: #f5f5f5;
	padding-bottom: 120rpx;
}

/* 顶部步骤条 */
.steps-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 30rpx 40rpx;
	background: linear-gradient(135deg, #fff9f9 0%, #ffffff 100%);
	margin-top: 20rpx;
	position: relative;
}

.step-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	z-index: 2;

	.step-circle {
		width: 56rpx;
		height: 56rpx;
		border-radius: 50%;
		background: #fff;
		border: 4rpx solid #ddd;
		color: #999;
		font-size: 26rpx;
		font-weight: 600;
		display: flex;
		align-items: center;
		justify-content: center;
		transition: all 0.4s ease;
		box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
	}

	.step-text {
		font-size: 24rpx;
		color: #999;
		margin-top: 12rpx;
		transition: all 0.3s;
		white-space: nowrap;
	}

	&.active {
		.step-circle {
			border-color: #AD181F;
			color: #AD181F;
			background: #fff;
		}

		.step-text {
			color: #AD181F;
			font-weight: 600;
		}
	}

	&.current {
		.step-circle {
			background: linear-gradient(135deg, #AD181F 0%, #c42030 100%);
			border-color: #AD181F;
			color: #fff;
			box-shadow: 0 4rpx 16rpx rgba(173, 24, 31, 0.35);
			transform: scale(1.1);
		}

		.step-text {
			color: #AD181F;
			font-weight: 700;
		}
	}
}

.step-line {
	flex: 1;
	height: 6rpx;
	background: #e8e8e8;
	margin: 0 10rpx;
	margin-bottom: 30rpx;
	border-radius: 3rpx;
	transition: all 0.4s ease;
	position: relative;
	z-index: 1;

	&.active {
		background: linear-gradient(90deg, #AD181F 0%, #e84040 100%);
	}
}

/* 提示框样式 */
.tips-box {
	margin: 20rpx 30rpx 0;
	padding: 24rpx;
	background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%);
	border-radius: 12rpx;
	border: 1rpx solid #f0d5b8;
}

.tips-title {
	display: inline-block;
	background: #e64329;
	color: #fff;
	font-size: 22rpx;
	padding: 4rpx 16rpx;
	border-radius: 20rpx;
	margin-bottom: 16rpx;
	font-weight: 600;
}

.tips-content {
	font-size: 26rpx;
	color: #666;
	line-height: 1.7;
}

.tips-line {
	margin-bottom: 12rpx;
}

.tips-item {
	color: #333;
	font-weight: 600;
	margin-top: 16rpx;
	margin-bottom: 8rpx;
}

.tips-desc {
	color: #888;
	font-size: 24rpx;
	padding-left: 20rpx;
	line-height: 1.6;
}

.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;
}

.logout-btn-top {
	position: fixed;
	top: 0rpx;
	right: 0rpx;
	display: flex;
	align-items: center;
	gap: 8rpx;
	padding: 20rpx 20rpx;
	background: #AD181F;
	border-radius: 30rpx;
	z-index: 100;
	box-shadow: -4rpx 4rpx 16rpx rgba(173, 24, 31, 0.3);
	transition: all 0.3s ease;
	transform: scale(0.8);

	.logout-icon {
		font-size: 32rpx;
		color: #fff;
	}

	.logout-text {
		font-size: 24rpx;
		color: #fff;
		font-weight: 500;
	}

	&:active {
		transform: scale(0.95);
		box-shadow: -2rpx 2rpx 8rpx rgba(173, 24, 31, 0.3);
	}
}

	.logout-icon {
		font-size: 28rpx;
		color: #e64329;
	}

	.logout-text {
		font-size: 24rpx;
		color: #e64329;
	}


.status-box {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20rpx 0;
	margin-bottom: 20rpx;
}

.status-row {
	display: flex;
	align-items: center;
	font-size: 24rpx;
}

.status-label {
	font-size: 24rpx;
	color: #333;
	margin-right: 10rpx;
	width: 100px;
}

.logout-btn {
	display: flex;
	align-items: center;
	gap: 6rpx;
	padding: 8rpx 20rpx;
	background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
	border-radius: 30rpx;

	.logout-icon {
		font-size: 28rpx;
		color: #e64329;
	}

	.logout-text {
		font-size: 22rpx;
		color: #e64329;
	}
}

.btn-row {
	display: flex;
	gap: 10rpx;
}

.btn-row button {
	padding: 0 20rpx;
	height: 50rpx;
	line-height: 50rpx;
	border-radius: 25rpx;
	font-size: 22rpx;
}

.btn-row button:first-child {
	background: #e64329;
	color: #fff;
}

.btn-row button:last-child {
	background: #f5f5f5;
	color: #666;
}

.upload-box {
	width: 100%;
}

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

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

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

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

.license-name {
	flex: 1;
	font-size: 26rpx;
	color: #666;
}

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

.idcard-item {
	width: 100%;
}

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

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

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

.delete-btn {
	position: absolute;
	top: 10rpx;
	right: 10rpx;
	background: #e64329;
	color: #fff;
	width: 40rpx;
	height: 40rpx;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28rpx;
	font-weight: bold;
	z-index: 10;
	box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
}

.pictures-box {
	width: 100%;
}

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

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

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

.fee-box {
	font-size: 32rpx;
	color: #ff6600;
	font-weight: bold;
}

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

.btn-red {
	width: 300rpx;
	height: 80rpx;
	line-height: 80rpx;
	background: #e64329;
	color: #fff;
	border-radius: 40rpx;
	font-size: 28rpx;
}

.btn-gray {
	width: 300rpx;
	height: 80rpx;
	line-height: 80rpx;
	background: #f5f5f5;
	color: #666;
	border-radius: 40rpx;
	font-size: 28rpx;
}

.text-danger {
	color: #e64329;
}

.text-success {
	color: #07c07e;
}

.text-warning {
	color: #ff9800;
}

/* 输入框边框样式 */
.input-with-border {
	border: 1rpx solid #e0e0e0;
	border-radius: 8rpx;
	padding: 0 20rpx;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	overflow: hidden;

	:deep(.uni-easyinput__input) {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		width: 100%;
	}

	:deep(.uni-easyinput__wrapper) {
		width: 100%;
		overflow: hidden;
	}

	:deep(.uni-input-wrapper) {
		width: 100%;
	}
}

/* 限制 uni-easyinput 组件宽度 */
:deep(.uni-easyinput) {
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

:deep(.uni-easyinput__container) {
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

/* 限制 uni-forms-item 内容区域 */
:deep(.uni-forms-item__content) {
	width: 100% !important;
	max-width: 100% !important;
	// overflow: hidden;
	box-sizing: border-box;
}

:deep(.uni-forms-item) {
	width: 100%;
	max-width: 100%;
	// overflow: hidden;
}

:deep(.uni-forms) {
	width: 100%;
	max-width: 100%;
}

/* uni-data-picker input-value padding 调整 */
:deep(.input-value) {
	padding: 0 5rpx !important;
}

/* 强制限制所有输入框宽度 */
// :deep(input) {
// 	max-width: 100% !important;
// 	width: 100% !important;
// }

/* 限制 uni-data-select 下拉框 */
// :deep(.uni-data-select) {
// 	max-width: 100% !important;
// 	width: 100% !important;
// 	overflow: hidden;
// }

// :deep(.uni-data-select .uni-select) {
// 	max-width: 100% !important;
// 	width: 100% !important;
// }

/* picker 样式 */
.picker-view {
	height: 70rpx;
	line-height: 70rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 20rpx;
	box-sizing: border-box;
}

.picker-text {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.arrow-icon {
	font-size: 20rpx;
	color: #999;
}

.placeholder {
	color: #999;
}


/* 级联选择器容器 - 修复边框和宽度问题(删除重复定义) */
.picker-wrapper {
	border: 1rpx solid #e0e0e0;
	border-radius: 8rpx;
	width: 244px !important;
	// max-width: 100%;
	box-sizing: border-box;
	// overflow: hidden;
}

/* 修复uni-data-picker 文字靠左 + 样式统一(合并重复样式) */
:deep(.uni-data-picker) {
    width: 100%;
    display: block;
    // overflow: hidden;
}
:deep(.uni-data-picker .selected-area) {
     width: 100%;
  padding: 0 20rpx;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
:deep(.uni-data-picker .selected-text) {
    font-size: 28rpx;
    color: #333;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    flex: 1;
}
:deep(.uni-data-picker .uni-data-picker__input) {
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
:deep(.selected-list) {
		justify-content: start;
		overflow: hidden;
		max-width: 100%;
}
:deep(.selected-item) {
		max-width: 200rpx;
		overflow: hidden;
}
:deep(.uni-data-picker__view) {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
}

/* 修复高度统一 */
.custom-picker {
	width: 100% !important;
	min-height: 70rpx;
}

/* uni-data-picker 弹窗样式 - 列表文字大小 */
:deep(.item) {
	font-size: 32rpx !important;
	padding: 24rpx 30rpx !important;
}
:deep(.item-text) {
	font-size: 32rpx !important;
}
:deep(.selected-item-text) {
	font-size: 32rpx !important;
}



/* 修复选择器容器宽度问题 */
.picker-wrapper {
	width: 100%;
	box-sizing: border-box;
	overflow: hidden;
}

/* 须知勾选样式 */
.notice-box {
	padding: 20rpx 0;
}

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

.notice-text {
	margin-left: 10rpx;
	color: #666;
}

.notice-link {
	color: #007AFF;
	// margin-left: 3rpx;
}

/* 审核详情样式 */
.audit-detail {
	padding: 20rpx 0;
}

.audit-title {
	font-size: 32rpx;
	font-weight: 600;
	color: #333;
	margin-bottom: 30rpx;
	text-align: center;
}

.loading-box,
.empty-box {
	text-align: center;
	padding: 60rpx 0;
	color: #999;
	font-size: 28rpx;
}

.audit-list {
	padding: 0;
}

.audit-item {
	background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
	border-radius: 16rpx;
	padding: 30rpx;
	margin-bottom: 24rpx;
	box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
	border: 1rpx solid #f0f0f0;
}

.audit-item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20rpx;
	padding-bottom: 20rpx;
	border-bottom: 1rpx dashed #e8e8e8;
}

.audit-dept {
	font-size: 30rpx;
	color: #333;
	font-weight: 600;
}

.audit-status {
	font-size: 24rpx;
	padding: 6rpx 20rpx;
	border-radius: 24rpx;
	font-weight: 500;
}

.status-pass {
	background: linear-gradient(135deg, #e8f8f0 0%, #d4f5e9 100%);
	color: #07c07e;
}

.status-reject {
	background: linear-gradient(135deg, #fef0f0 0%, #fde8e8 100%);
	color: #e64329;
}

.status-pending {
	background: linear-gradient(135deg, #fff7e6 0%, #fff3d9 100%);
	color: #ff9800;
}

.audit-item-body {
	padding: 0;
}

.audit-row {
	display: flex;
	font-size: 28rpx;
	line-height: 1.8;
	margin-bottom: 12rpx;
	justify-content: space-between;
	align-items: flex-start;
}

.audit-row:last-child {
	margin-bottom: 0;
}

.audit-label {
	color: #888;
	min-width: 140rpx;
	font-size: 28rpx;
}

.audit-value {
	color: #555;
	flex: 1;
	text-align: right;
	font-size: 28rpx;
}
radio-group label, checkbox-group label{
	padding-right:0rpx;
}
</style>