addEvaluationFrom.vue 72.2 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 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046
<template>
  <view class="add-evaluation-from">
    <view class="nav-bar">
      <view class="back" @click.stop="backPage">
        <uni-icons type="left" :size="20" color="#000"></uni-icons>
      </view>
      <view class="title">{{ title }}</view>
    </view>
    <view class="detail-content">
      <view class="flex align-center">
        <view class="stepper-container flex flex-1">
          <view class="flex items-center">
            <view class="step-number-circle" :class="{ active: currentStep >= 1 }">
              <view class="step-number">1</view>
            </view>
            <view class="step-name" :class="{ active: currentStep >= 1 }">车辆信息</view>
          </view>
          <view class="dash-line" :class="{ active: currentStep >= 2 }"></view>
          <view class="flex items-center">
            <view class="step-number-circle" :class="{ active: currentStep >= 2 }">
              <view class="step-number">2</view>
            </view>
            <view class="step-name" :class="{ active: currentStep >= 2 }">牌证信息</view>
          </view>
          <view class="dash-line" :class="{ active: currentStep >= 3 }"></view>
          <view class="flex items-center">
            <view class="step-number-circle" :class="{ active: currentStep >= 3 }">
              <view class="step-number">3</view>
            </view>
            <view class="step-name" :class="{ active: currentStep >= 3 }">图像信息</view>
          </view>
        </view>
        <view v-if="currentStep === 1" class="flex align-center scanBtn justify-center" @click.stop="scan('carLicenseOcr')">
          <view class="sprite-icon icon-scanIcon"></view>
          行驶证
        </view>
      </view>

      <view class="fromBox">
        <!-- 车辆信息表单 -->

        <FormCell v-if="currentStep === 1" :formFields="formFields" :formData="formData" @handleCell="handleCell" @pickerChange="pickerChange" @radioChange="radioChange" @blurChange="blurChange" @scan="scan" />

        <!-- 牌证信息表单 -->
        <FormCell v-else-if="currentStep === 2" :formFields="licenseFormFields" :formData="formData" @handleCell="handleCell" />

        <!-- 图像信息表单 -->
        <view v-else-if="currentStep === 3" class="form-container-upload">
          <view class="upload-section">
            <view class="section-title">车辆图片</view>
            <UploadMedia :upload-fields="uploadFields" :mediaData.sync="formImagesData" :grid-columns="3" />
          </view>
          <view class="upload-section">
            <view class="section-title">证件资料</view>
            <UploadMedia :upload-fields="uploadCertificateFields" :mediaData.sync="certificateImagesData" :grid-columns="3" />
          </view>
          <view class="upload-section">
            <view class="section-title">车辆视频</view>
            <UploadMedia :upload-fields="uploadVideoFields" :mediaData.sync="carVideoData" :grid-columns="3" />
          </view>
          <view class="upload-section">
            <view class="section-title">车辆检测报告</view>
            <UploadMedia :upload-fields="uploadReportFields" :mediaData.sync="reportImageData" :grid-columns="3" />
          </view>
          <view class="upload-section">
            <view class="section-title">其他图片</view>
            <UploadMedia :upload-fields="uploadOtherFields" :mediaData.sync="otherImagesData" :grid-columns="1" class="other-upload" />
          </view>
        </view>
      </view>

      <view class="button-module flex justify-center align-center">
        <view class="button-container flex justify-between">
          <view class="cancel-btn" @click.stop="currentStep > 1 ? prevStep() : backPage()">
            {{ currentStep > 1 ? '上一步' : '取消' }}
          </view>
          <view class="next-btn" @click.stop="currentStep < 3 ? nextStep() : submitForm()">
            {{ currentStep < 3 ? '下一步' : '提交' }}
          </view>
        </view>
      </view>
    </view>

    <!-- 弹窗 -->
    <OrderPopup ref="orderPopup" :data="displayData" :isDefeatOrder="true" :externalData="[]" @onConfirm="onConfirm" :popupType="0" />
    <SelectCar ref="selectCar" title="选择车型" :car-brand-data="carBrandData" @car-selected="handleCarSelected" :on-load-year-data="loadYearDataForModel" :car-tips="carTips" />
    <SelectCity
      ref="selectCity"
      title="选择城市"
      @city-selected="handleCitySelected"
      :defaultProvince="{
        code: formData.carBaseReqDTO.registrationProvinceId,
        name: formData.carBaseReqDTO.registrationProvinceName
      }"
      :defaultCity="{
        code: formData.carBaseReqDTO.registrationCityId,
        name: formData.carBaseReqDTO.registrationCityName
      }"
    />
    <SelectCity
      ref="selectCarCity"
      title="选择城市"
      @city-selected="handleCarCitySelected"
      :defaultProvince="{
        code: formData.carBaseReqDTO.carProvinceId,
        name: formData.carBaseReqDTO.carProvinceName
      }"
      :defaultCity="{
        code: formData.carBaseReqDTO.carCityId,
        name: formData.carBaseReqDTO.carCityName
      }"
    />
    <GeneralPopup ref="calendarGeneralPopup" popupClass="calendarGeneralPopup" :showClose="false" :showTitle="false" @confirm="confirmCalendar">
      <template #content>
        <uni-calendar class="calendar" :showMonth="false" :date="defaultDate" :startDate="startDate" :endDate="endDate" @change="calendarChange" />
      </template>
    </GeneralPopup>
    <GeneralPopup ref="tipsPopup" popupClass="tipsPopup" type="center" :showClose="true" :showTitle="false" :noTitle="true">
      <template #content>
        <view>
          <image class="tipsPopupBg" :src="bg" />
          <view class="title">提示</view>
          <view class="tipsConent">
            <view>{{ isExistSamePlate ? '已存在相同车牌号的评估单,是否进入编辑流程?' : '已存在一个30天内有效评估,是否进入详情查看?' }}</view>
          </view>
        </view>
      </template>
    </GeneralPopup>
    <NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
    <GeneralPopup ref="editTipsPopup" popupClass="tipsPopup" type="center" :showClose="true" :showTitle="false" :noTitle="true">
      <template #content>
        <view>
          <image class="tipsPopupBg" :src="bg" />
          <view class="title">提示</view>
          <view class="tipsConent">
            <view>您未对表单内容进行任何修改, 请修改后重新提交。</view>
          </view>
        </view>
      </template>
    </GeneralPopup>
  </view>
</template>
<script>
import GeneralPopup from './components/GeneralPopup.vue'
import { popupTypeEnum } from '../boutique/tool/contant'
import OrderPopup from '@/components/OrderPopup/index.vue'
import SelectCar from './components/SelectCar.vue'
import FormCell from './components/FormCell.vue'
import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import SelectCity from './components/SelectCity.vue'
import UploadMedia from './components/uploadMedia.vue'
import NoticePopup from '@/components/NoticePopup.vue'
import { throttle } from 'lodash'
import dayjs from 'dayjs'
import permision from '@/js_sdk/wa-permission/permission.js'
import { sign, md532, md516 } from 'utils/common'
import { signSecretKey } from '@/env.js'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
import { getPlateLocation } from '@/utils/licensePlateParser'
export default {
  name: 'AddEvaluationFrom',
  components: {
    OrderPopup,
    SelectCar,
    FormCell,
    SelectCity,
    GeneralPopup,
    UploadMedia,
    NoticePopup
  },
  computed: {
    displayData() {
      console.log('currentField', this.currentField)
      if (this.currentField && this.currentField.targetObj === 'evalOrderBasicReqDTO' && this.currentField.targetKey === 'sellerUserId') {
        const tempData = { ...this.formData }
        tempData.userId = this.formData.evalOrderBasicReqDTO?.sellerUserId || ''
        console.log('tempData', tempData)
        return tempData
      }
      return this.formData
    }
  },
  data() {
    return {
      bg: require('@/assets/images/boutique/tipsPopupBg.png'),
      carBrandData: [],
      loadingCarData: false,
      // 缓存数据
      dataCache: null,
      cacheTimestamp: null,
      // 缓存有效期(10分钟)
      CACHE_EXPIRE_TIME: 10 * 60 * 1000,
      pickerArray: [],
      index: 0,
      carList: [],
      selectDate: '',
      currentIdentifiedBrandName: null,
      popupTypeEnum,
      title: '新增评估单',
      selectedCarInfo: null,
      startDate: '1999-01-01',
      endDate: dayjs().format('YYYY-MM-DD'),
      defaultDate: dayjs().format('YYYY-MM-DD'),
      isExistSamePlate: false,
      formData: {
        evalOrderBasicReqDTO: {
          sellerUserId: '',
          sellerName: '',
          sellerMerchantId: '',
          sellerMerchantName: ''
        },
        carBaseReqDTO: {
          carBrandId: '',
          carBrand: '',
          carChildsBrandId: '',
          carChildsBrandName: '',
          carSeriesId: '',
          carSeriesName: '',
          carTypeId: '',
          carTypeName: '',
          vin: '',
          licensePlate: '',
          engineNumber: '',
          registrationDate: '',
          registrationProvinceId: '',
          registrationProvinceName: '',
          registrationCityId: '',
          registrationCityName: '',
          carProvinceId: '',
          carProvinceName: '',
          carCityId: '',
          carCityName: '',
          mileage: '',
          usageType: '1',
          ownerType: '1',
          sunroof: '2',
          vehicleCategory: '1',
          emissionStandard: '6',
          interiorColor: '',
          exteriorColor: '',
          productionDate: '',
          guidePrice: '',
          buyNewCar: 1,
          hasAccident: 0,
          overallRating: 1,
          conditionDescription: '',
          ownerTypeName: '个人',
          usageTypeName: '非营运',
          sunroofName: '普通天窗',
          vehicleCategoryName: '置换车',
          emissionStandardName: '国6',
          overallRatingName: '优'
        },
        carLicenseReqDTO: {
          keyCount: 2,
          transferCount: 1,
          compulsoryInsuranceExpiry: '',
          annualInspectionExpiry: '',
          commercialInsuranceExpiry: '',
          previousOwnerName: '',
          previousOwnerAddress: '',
          previousOwnerPhone: ''
        },
        imageList: []
      },
      formImagesData: {},
      certificateImagesData: {},
      carVideoData: {},
      reportImageData: {},
      otherImagesData: {},
      currentStep: 1, // 当前步骤,默认为1
      formFields: [
        { key: 'sellerUserId', label: '销售顾问', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'sellerUserId', targetObj: 'evalOrderBasicReqDTO', type: 'select', showText: 'shopMerchantName' },
        { key: 'brandModel', label: '品牌车型', required: true, fullWidth: false, targetNameKey: 'carBrand', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'carBrandId', targetObj: 'carBaseReqDTO', type: 'select', isCar: true },
        { key: 'vin', label: '车架号', required: true, maxlength: 17, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'vin', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName', isScan: true, pattern: '^[A-Z0-9]{17}$' },
        { key: 'licensePlate', label: '车牌号', required: true, maxlength: 10, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'licensePlate', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName' },
        { key: 'engineNumber', label: '发动机号', required: true, maxlength: 20, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'engineNumber', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName' },
        { key: 'registrationCity', label: '上牌城市', required: true, fullWidth: false, targetNameKey: 'cityName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'registrationCityName', targetObj: 'carBaseReqDTO', type: 'select', showText: 'shopMerchantName', isCity: true },
        { key: 'registrationDate', label: '上牌时间', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'registrationDate', targetObj: 'carBaseReqDTO', type: 'calendar', showText: 'shopMerchantName', endDate: true },
        { key: 'carCity', label: '车辆所在地', required: true, fullWidth: false, targetNameKey: 'carCityName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'carCityName', targetObj: 'carBaseReqDTO', type: 'select', isCarCity: true },
        { key: 'mileage', label: '表显里程', inputType: 'number', min: 0, max: 999999, maxlength: 6, required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'mileage', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName', pattern: '^[0-9]{0,6}$', cell: '公里', isCell: true },
        {
          key: 'usageType',
          label: '使用性质',
          required: true,
          fullWidth: false,
          targetNameKey: 'usageTypeName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'usageType',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '非营运', value: '1' },
            { name: '营运', value: '2' },
            { name: '营转非', value: '3' }
          ]
        },
        {
          key: 'ownerType',
          label: '所有人性质',
          required: true,
          fullWidth: false,
          targetNameKey: 'ownerTypeName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'ownerType',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '个人', value: '1' },
            { name: '单位', value: '2' }
          ]
        },
        {
          key: 'sunroof',
          label: '天窗',
          required: true,
          fullWidth: false,
          targetNameKey: 'sunroofName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'sunroof',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '无天窗', value: '1' },
            { name: '普通天窗', value: '2' },
            { name: '全景天窗', value: '3' }
          ]
        },
        {
          key: 'vehicleCategory',
          label: '车辆类别',
          required: true,
          fullWidth: false,
          targetNameKey: 'vehicleCategoryName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'vehicleCategory',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '置换车', value: '1' },
            { name: '报废车', value: '2' }
          ]
        },
        {
          key: 'emissionStandard',
          label: '排放标准',
          required: true,
          fullWidth: false,
          targetNameKey: 'emissionStandardName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'emissionStandard',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '国3', value: '3' },
            { name: '国4', value: '4' },
            { name: '国5', value: '5' },
            { name: '国6', value: '6' }
          ]
        },
        {
          key: 'exteriorColor',
          label: '外观颜色',
          required: true,
          fullWidth: false,
          targetNameKey: 'exteriorColorName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'exteriorColor',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '黑色', value: '1' },
            { name: '白色', value: '2' },
            { name: '银色', value: '3' },
            { name: '灰色', value: '4' },
            { name: '红色', value: '5' },
            { name: '蓝色', value: '6' },
            { name: '绿色', value: '7' },
            { name: '棕色', value: '8' },
            { name: '金色', value: '9' },
            { name: '橙色', value: '10' },
            { name: '紫色', value: '11' },
            { name: '黄色', value: '12' },
            { name: '香槟色', value: '13' },
            { name: '其他', value: '14' }
          ]
        },
        {
          key: 'interiorColor',
          label: '内饰颜色',
          required: true,
          fullWidth: false,
          targetNameKey: 'interiorColorName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'interiorColor',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '黑色', value: '1' },
            { name: '白色', value: '2' },
            { name: '银色', value: '3' },
            { name: '灰色', value: '4' },
            { name: '红色', value: '5' },
            { name: '蓝色', value: '6' },
            { name: '绿色', value: '7' },
            { name: '棕色', value: '8' },
            { name: '金色', value: '9' },
            { name: '橙色', value: '10' },
            { name: '紫色', value: '11' },
            { name: '黄色', value: '12' },
            { name: '香槟色', value: '13' },
            { name: '其他', value: '14' }
          ]
        },
        { key: 'productionDate', label: '生产日期', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'productionDate', targetObj: 'carBaseReqDTO', type: 'calendar', endDate: true },
        { key: 'guidePrice', label: '指导价', inputType: 'number', min: 0, max: 9999999.99, maxlength: 10, required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'guidePrice', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName', pattern: '/^\d+(\.\d{1,2})?$/', cell: '元', isCell: true },
        {
          key: 'buyNewCar',
          label: '是否购买新车',
          required: true,
          fullWidth: false,
          targetNameKey: 'buyNewCarName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'buyNewCar',
          targetObj: 'carBaseReqDTO',
          type: 'radio',
          showText: 'shopMerchantName',
          radioList: [
            {
              value: 1,
              name: '是'
            },
            {
              value: 0,
              name: '否'
            }
          ]
        },
        {
          key: 'hasAccident',
          label: '是否事故',
          required: true,
          fullWidth: false,
          targetNameKey: 'hasAccidentName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'hasAccident',
          targetObj: 'carBaseReqDTO',
          type: 'radio',
          showText: 'shopMerchantName',
          radioList: [
            {
              value: 1,
              name: '是'
            },
            {
              value: 0,
              name: '否'
            }
          ]
        },
        {
          key: 'overallRating',
          label: '综合评价',
          required: true,
          fullWidth: true,
          targetNameKey: 'overallRatingName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'overallRating',
          targetObj: 'carBaseReqDTO',
          type: 'pricek',
          showText: 'shopMerchantName',
          fieldPickerArray: [
            { name: '优', value: 1 },
            { name: '良', value: 2 },
            { name: '中', value: 3 },
            { name: '差', value: 4 }
          ]
        },
        {
          key: 'conditionDescription',
          label: '车况描述',
          required: false,
          fullWidth: true,
          targetNameKey: 'sellerName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'conditionDescription',
          targetObj: 'carBaseReqDTO',
          type: 'textarea',
          maxlength: 200
        }
      ],
      licenseFormFields: [
        { key: 'keyCount', label: '钥匙数', required: true, fullWidth: false, targetKey: 'keyCount', targetObj: 'carLicenseReqDTO', type: 'input', inputType: 'number', min: 0, max: 9, pattern: '^[0-9]{1}$', maxlength: 1 },
        { key: 'transferCount', label: '过户次数', required: true, fullWidth: false, targetKey: 'transferCount', targetObj: 'carLicenseReqDTO', type: 'input', inputType: 'number', min: 0, max: 9, pattern: '^[0-9]{1}$', maxlength: 1 },
        { key: 'compulsoryInsuranceExpiry', label: '交强险到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'compulsoryInsuranceExpiry', targetObj: 'carLicenseReqDTO', endDate: false },
        { key: 'annualInspectionExpiry', label: '年审到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'annualInspectionExpiry', targetObj: 'carLicenseReqDTO', endDate: false },
        { key: 'commercialInsuranceExpiry', label: '商业险到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'commercialInsuranceExpiry', targetObj: 'carLicenseReqDTO', endDate: false },
        { key: 'previousOwnerName', label: '原车主名称', required: true, fullWidth: false, targetKey: 'previousOwnerName', targetObj: 'carLicenseReqDTO', type: 'input', maxlength: 20 },
        { key: 'previousOwnerPhone', label: '原车主电话', required: true, fullWidth: true, targetKey: 'previousOwnerPhone', targetObj: 'carLicenseReqDTO', type: 'input', inputType: 'number', pattern: '^[0-9]{11}$', maxlength: 11 },
        {
          key: 'previousOwnerAddress',
          label: '原车主住址',
          required: true,
          fullWidth: true,
          targetNameKey: 'sellerName',
          sourceNameKey: 'staffName',
          sourceKey: 'uuid',
          targetKey: 'previousOwnerAddress',
          targetObj: 'carLicenseReqDTO',
          type: 'textarea',
          maxlength: 52
        }
      ],
      uploadFields: [
        {
          key: 11,
          label: '左前45度',
          required: true,
          maxCount: 1,
          accept: 'image'
        },
        { key: 12, label: '主驾驶全景', maxCount: 1, accept: 'image' },
        { key: 13, label: '仪表盘', maxCount: 1, accept: 'image' },
        { key: 14, label: '后排座椅', maxCount: 1, accept: 'image' },
        { key: 15, label: '中控台全景', maxCount: 1, accept: 'image' },

        { key: 16, label: '右后45度', maxCount: 1, accept: 'image' },
        { key: 17, label: '铭牌', maxCount: 1, accept: 'image' }
      ],
      uploadCertificateFields: [
        { key: 21, label: '行驶证', maxCount: 1, accept: 'image' },
        { key: 22, label: '登记证', maxCount: 3, accept: 'image' }
      ],
      uploadVideoFields: [
        { key: 31, label: '发动机工况', required: false, accept: 'video' },
        { key: 32, label: '车况解说', required: false, accept: 'video' }
      ],
      uploadReportFields: [{ key: 51, label: '车辆检测报告', required: false, accept: 'image', maxCount: 3, fullwidth: true }],
      uploadOtherFields: [{ key: 41, label: '其他图片', required: false, accept: 'image', maxCount: 30, fullwidth: true }],
      currentField: null,
      query: {},
      validateState: true,
      carTips: ''
    }
  },
  onLoad(options) {
    this.init(options)
  },
  onBackPress(options) {
    if (options.from === 'backbutton') {
      // 物理返回按钮触发
      // 阻止默认行为,即不执行页面返回
      this.backPage()
      return true
    }
    // 其他情况允许正常返回
    return false
  },
  mounted() {
    this.loadCarData()
    console.log(this.query)
    if (this.query.type == 'edit') {
      this.title = '编辑评估单'
      this.getDetail(this.query.evalOrderNo)
      uni.$track.add({ eventCode: 'app_edit_evaluation_from' })
    } else {
      uni.$track.add({ eventCode: 'app_add_evaluation_from' })
    }
    this.formData.carBaseReqDTO.ownerTypeName = '个人'
    this.formData.carBaseReqDTO.usageTypeName = '非营运'
    this.formData.carBaseReqDTO.sunroofName = '普通天窗'
    this.formData.carBaseReqDTO.vehicleCategoryName = '置换车'
    this.formData.carBaseReqDTO.emissionStandardName = '国6'
    this.formData.carBaseReqDTO.overallRatingName = '优'
    this.userInfo = uni.$storage.get('userInfo') || {}
  },
  methods: {
    loadCachedData() {
      try {
        const cachedData = uni.getStorageSync('carBrandData')
        const timestamp = uni.getStorageSync('carBrandDataTimestamp')

        if (cachedData && timestamp) {
          const now = Date.now()
          // 检查缓存是否过期
          if (now - timestamp < this.CACHE_EXPIRE_TIME) {
            this.carBrandData = JSON.parse(cachedData)
            this.dataCache = this.carBrandData
            this.cacheTimestamp = timestamp
            return true
          }
        }
        return false
      } catch (e) {
        console.error('加载缓存数据失败:', e)
        return false
      }
    },
    saveDataToCache(data) {
      try {
        const timestamp = Date.now()
        uni.setStorageSync('carBrandData', JSON.stringify(data))
        uni.setStorageSync('carBrandDataTimestamp', timestamp)
        this.dataCache = data
        this.cacheTimestamp = timestamp
      } catch (e) {
        console.error('保存数据到缓存失败:', e)
      }
    },
    loadCarData() {
      // 先尝试从缓存加载
      if (this.loadCachedData()) {
        return
      }

      this.loadingCarData = true
      // 异步加载数据,避免阻塞UI
      setTimeout(() => {
        const params = {
          app_key: '48e5e13229b82c1b4e6e8c96151f0637',
          v: '1.0.0',
          timestamp: '1234567890',
          source: 'dev_author',
          method: 'glsx.accounts.base.car.brand.complete',
          format: 'json'
        }
        const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
        const signature = sign(params, secret)

        uni.request({
          url: signSecretKey.carBasrUrl + '?method=glsx.accounts.base.car.brand.complete',
          method: 'GET',
          dataType: 'json',
          data: {
            sign: signature,
            ...params
          },
          success: result => {
            if (result.data && result.data.code === '0' && result.data.data && result.data.data.carinfos) {
              this.carBrandData = result.data.data.carinfos
              // 保存到缓存
              this.saveDataToCache(this.carBrandData)
            } else {
              console.error('Invalid car data format:', result)
            }
          },
          fail: error => {
            console.log(error, 'error')
          },
          complete: () => {
            this.loadingCarData = false
          }
        })
      }, 100)
    },
    loadYearDataForModel(modelId) {
      return new Promise((resolve, reject) => {
        const params = {
          app_key: '48e5e13229b82c1b4e6e8c96151f0637',
          v: '1.0.0',
          timestamp: '1234567890',
          source: 'dev_author',
          method: 'glsx.accounts.base.car.types',
          format: 'json',
          csId: modelId
        }
        const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
        const signature = sign(params, secret)

        // 优化请求方式,避免重复请求
        setTimeout(() => {
          uni.request({
            url: signSecretKey.carBasrUrl + '?method=glsx.accounts.base.car.types',
            method: 'GET',
            dataType: 'json',
            data: {
              sign: signature,
              csId: modelId,
              ...params
            },
            success: result => {
              if (result.data && result.data.code === '0' && result.data.data && result.data.data.carinfos) {
                resolve(result.data.data.carinfos || [])
              } else {
                console.error('无效的车型数据格式:', result)
                resolve([])
              }
            },
            fail: error => {
              console.log(error, 'error')
              resolve([])
            }
          })
        }, 10)
      })
    },
    openSelectCar(carInfo = null) {
      this.loadCarData()

      let openData = carInfo
      if (carInfo === null && this.currentIdentifiedBrandName) {
        openData = this.currentIdentifiedBrandName
        this.currentIdentifiedBrandName = null
      } else if (carInfo === null && !this.currentIdentifiedBrandName && this.selectedCarInfo) {
        openData = this.selectedCarInfo
      }

      // 即使数据正在加载中也打开弹窗,让用户看到加载状态
      this.$refs.selectCar.open(openData)
    },
    init(options) {
      console.log('options:', options)
      this.query = options
      console.log('query:', this.query)
    },
    backPage() {
      this.$refs.notice.buttonsList = [
        {
          text: '确认退出',
          type: 'default',
          callback: () => {
            this.$refs.notice.close()
            uni.navigateBack({
              delta: 1
            })
          }
        },
        {
          text: '继续编辑',
          type: 'primary',
          callback: () => {
            this.$refs.notice.close()
          }
        }
      ]
      this.$refs.notice.open()
    },

    getDetail(evalOrderNo) {
      const that = this
      uni.$api.evaluationApi
        .evalOrderDetail({
          evalOrderNo
        })
        .then(res => {
          console.log('res:', res)
          if (res.data.code == 0) {
            const { basic = {}, carInfo = {}, carLicense = {}, images = {} } = res.data.data
            that.formData.evalOrderBasicReqDTO = { ...basic }
            that.formData.carBaseReqDTO = { ...carInfo }
            that.formData.carLicenseReqDTO = { ...carLicense }
            that.formData.imageList = [...images]
            that.formData.evalOrderNo = evalOrderNo
            that.selectedCarInfo = {
              brand: {
                id: that.formData.carBaseReqDTO.carBrandId,
                name: that.formData.carBaseReqDTO.carBrand
              },
              series: {
                id: that.formData.carBaseReqDTO.carChildsBrandId,
                name: that.formData.carBaseReqDTO.carChildsBrandName
              },
              model: {
                id: that.formData.carBaseReqDTO.carSeriesId,
                name: that.formData.carBaseReqDTO.carSeriesName
              },
              year: {
                id: that.formData.carBaseReqDTO.carTypeId,
                name: that.formData.carBaseReqDTO.carTypeName
              }
            }
            that.formImagesData = {}
            that.certificateImagesData = {}
            that.carVideoData = {}
            that.reportImageData = {}
            that.otherImagesData = {}

            // 根据 fileType 和 fileSubtype 分类存放图片
            images.forEach(image => {
              const { fileType, fileSubtype, fileUrl } = image
              const imageItem = { url: fileUrl }

              // 根据 fileType 决定存放到哪个数据结构
              let targetData = null
              switch (fileType) {
                case 1: // 车辆图片
                  targetData = that.formImagesData
                  break
                case 2: // 证件资料
                  targetData = that.certificateImagesData
                  break
                case 3: // 车辆视频
                  targetData = that.carVideoData
                  break
                case 4: // 其他图片
                  targetData = that.otherImagesData
                  break
                case 5: // 车辆检测报告
                  targetData = that.reportImageData
                  break
                default:
                  return
              }

              // 根据 fileSubtype 组织数据
              if (!targetData[fileSubtype]) {
                targetData[fileSubtype] = []
              }
              targetData[fileSubtype].push(imageItem)
            })

            that.formFields.forEach(field => {
              if (field.fieldPickerArray && field.targetObj && field.targetKey && field.targetNameKey) {
                const targetValue = that.formData[field.targetObj][field.targetKey]
                if (targetValue !== undefined && targetValue !== null && targetValue !== '') {
                  let selectedItem
                  if (field.key === 'exteriorColor' || field.key === 'interiorColor') {
                    that.$set(that.formData[field.targetObj], field.targetNameKey, targetValue)
                    selectedItem = field.fieldPickerArray.find(item => item.name === targetValue)
                    if (selectedItem) {
                    }
                  } else {
                    selectedItem = field.fieldPickerArray.find(item => Number(item.value) === Number(targetValue))
                    if (selectedItem) {
                      that.$set(that.formData[field.targetObj], field.targetNameKey, selectedItem.name)
                      that.$set(that.formData[field.targetObj], field.targetKey, selectedItem.value)
                    }
                  }
                }
              }
            })
            const licensePlateField = that.formFields.find(field => field.key === 'licensePlate')
            if (licensePlateField) {
              that.$set(licensePlateField, 'disabled', true)
            }
          } else {
            uni.hideLoading()
            uni.showToast({
              title: res.data.msg || '请求失败',
              icon: 'none'
            })
          }
        })
    },

    // 下一步逻辑
    nextStep() {
      console.log('nextStep', this.formData)
      // 验证当前步骤的必填项
      if (this.currentStep === 1) {
        const requiredFields = this.formFields.filter(field => field.required)

        // 检查必填项是否为空
        const emptyFields = requiredFields.filter(field => {
          if (field.targetObj && this.formData[field.targetObj]) {
            return this.formData[field.targetObj][field.targetKey] === undefined || this.formData[field.targetObj][field.targetKey] === null || this.formData[field.targetObj][field.targetKey] === ''
          }
          return this.formData[field.key] === undefined || this.formData[field.key] === null || this.formData[field.key] === ''
        })

        if (emptyFields.length > 0) {
          const firstEmptyField = emptyFields[0]
          uni.showToast({
            title: `${firstEmptyField.label}为必填项`,
            icon: 'none'
          })
          return
        }

        // 车架号验证 - 长度17且只能包含数字和大写字母
        // const vin = this.formData.carBaseReqDTO.vin
        // const vinRegex = /^[A-Z0-9]+$/

        // if (!vinRegex.test(vin)) {
        //   uni.showToast({
        //     title: '车架号只能包含数字和大写字母',
        //     icon: 'none'
        //   })
        //   return
        // }
        // if (vin.length != 17) {
        //   uni.showToast({
        //     title: '车架号必须为17位',
        //     icon: 'none'
        //   })
        //   return
        // }

        // VIN车架号-动态校验
        const carVin = this.formData.carBaseReqDTO.vin
        console.log('validateState', this.validateState)
        if (carVin) {
          // 前置判断
          if (carVin.length !== 17) {
            uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
            return false
          }
          // 根据接口校验结果判断
          if (carVin.length === 17 && !this.validateState) {
            uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
            return false
          }
        }
        const engineNumber = this.formData.carBaseReqDTO.engineNumber
        const engineNumberRegex = /^[A-Za-z0-9]+$/
        if (!engineNumberRegex.test(engineNumber)) {
          uni.showToast({
            title: '发动机号只能包含数字和字母',
            icon: 'none'
          })
          return
        }

        // 表显里程验证 - 数字,0-999999
        const mileage = this.formData.carBaseReqDTO.mileage
        const mileageRegex = /^[0-9]{1,6}$/
        if (!mileageRegex.test(mileage) || mileage < 0 || mileage > 999999) {
          uni.showToast({
            title: '表显里程必须为0-999999之间的数字',
            icon: 'none'
          })
          return
        }

        // 指导价验证 - 数字,0-999999
        const guidePrice = this.formData.carBaseReqDTO.guidePrice
        const priceRegex = /^\d+(\.\d{1,2})?$/
        console.log('priceRegex', guidePrice)
        if (!priceRegex.test(guidePrice) || guidePrice < 0 || guidePrice > 9999999.99) {
          uni.showToast({
            title: '指导价必须为0-9999999.99之间的数字',
            icon: 'none'
          })
          return
        }
      } else if (this.currentStep === 2) {
        // 牌证信息步骤的验证逻辑
        const requiredFields = this.licenseFormFields.filter(field => field.required)
        const emptyFields = requiredFields.filter(field => {
          if (field.targetObj && this.formData[field.targetObj]) {
            return this.formData[field.targetObj][field.targetKey] === undefined || this.formData[field.targetObj][field.targetKey] === null || this.formData[field.targetObj][field.targetKey] === ''
          }
          return this.formData[field.key] === undefined || this.formData[field.key] === null || this.formData[field.key] === ''
        })

        if (emptyFields.length > 0) {
          const firstEmptyField = emptyFields[0]
          uni.showToast({
            title: `${firstEmptyField.label}为必填项`,
            icon: 'none'
          })
          return
        }
        const keyCount = this.formData.carLicenseReqDTO.keyCount
        const keyCountRegex = /^[0-9]{1}$/
        if (!keyCountRegex.test(keyCount) || keyCount < 0 || keyCount > 9) {
          uni.showToast({
            title: '钥匙数必须为0-9之间的整数',
            icon: 'none'
          })
          return
        }

        // 过户次数验证 - 数字,整数,0-9
        const transferCount = this.formData.carLicenseReqDTO.transferCount
        const transferCountRegex = /^[0-9]{1}$/
        if (!transferCountRegex.test(transferCount) || transferCount < 0 || transferCount > 9) {
          uni.showToast({
            title: '过户次数必须为0-9之间的整数',
            icon: 'none'
          })
          return
        }

        // 原车主电话验证 - 11位数字
        const previousOwnerPhone = this.formData.carLicenseReqDTO.previousOwnerPhone
        const phoneRegex = /^[0-9]{11}$/
        if (!phoneRegex.test(previousOwnerPhone)) {
          uni.showToast({
            title: '原车主电话必须为11位数字',
            icon: 'none'
          })
          return
        }
      } else if (this.currentStep === 3) {
        const leftFront45Image = this.formImagesData['11'] // key为11的是左前45度图片
        if (!leftFront45Image || !leftFront45Image.length) {
          uni.showToast({
            title: '左前45度图片为必填项',
            icon: 'none'
          })
          return
        }
      }

      // 验证通过,进入下一步
      if (this.currentStep < 3) {
        this.currentStep++
        // 滚动到顶部
        this.scrollToTop()
      }
    },
    handleCell(field) {
      const that = this
      console.log('handleCellAAAAA')
      if (field.isCar) {
        this.openSelectCar()
      } else if (field.isCity) {
        // 处理城市选择
        this.$refs.selectCity.open()
      } else if (field.isCarCity) {
        this.$refs.selectCarCity.open()
      } else if (field.type === 'calendar') {
        this.currentField = field
        this.defaultDate = that.formData[field.targetObj][field.targetKey] || dayjs().format('YYYY-MM-DD')
        if (field.endDate) {
          this.endDate = dayjs().format('YYYY-MM-DD')
        } else {
          this.endDate = '2039-5-20'
        }
        this.$refs.calendarGeneralPopup
          .open()
          .then(() => {
            console.log('that.selectDate', that.selectDate)
            that.$set(that.formData[field.targetObj], field.targetKey, that.selectDate || this.defaultDate)
          })
          .catch(() => {
            console.log('日期取消')
          })
      } else if (field.type === 'select' && field.targetObj === 'evalOrderBasicReqDTO' && field.targetKey === 'sellerUserId') {
        this.currentField = field
        this.$refs.orderPopup.open()
      }
    },
    handleCarSelected(carInfo) {
      console.log('handleCarSelected', carInfo)
      this.selectedCarInfo = carInfo
      this.$set(this.formData.carBaseReqDTO, 'carBrandId', carInfo.brand.id)
      this.$set(this.formData.carBaseReqDTO, 'carBrand', carInfo.brand.name)
      this.$set(this.formData.carBaseReqDTO, 'carChildsBrandId', carInfo.series.id)
      this.$set(this.formData.carBaseReqDTO, 'carChildsBrandName', carInfo.series.name)
      this.$set(this.formData.carBaseReqDTO, 'carSeriesId', carInfo.model.id)
      this.$set(this.formData.carBaseReqDTO, 'carSeriesName', carInfo.model.name)
      this.$set(this.formData.carBaseReqDTO, 'carTypeId', carInfo.year.id)
      this.$set(this.formData.carBaseReqDTO, 'carTypeName', carInfo.year.name)
    },
    handleCitySelected(date) {
      console.log('handleCitySelected', date)
      this.$set(this.formData.carBaseReqDTO, 'registrationProvinceId', date.province.code)
      this.$set(this.formData.carBaseReqDTO, 'registrationProvinceName', date.province.name)
      this.$set(this.formData.carBaseReqDTO, 'registrationCityId', date.city.code)
      this.$set(this.formData.carBaseReqDTO, 'registrationCityName', date.city.name)
    },
    handleCarCitySelected(date) {
      this.$set(this.formData.carBaseReqDTO, 'carProvinceId', date.province.code)
      this.$set(this.formData.carBaseReqDTO, 'carProvinceName', date.province.name)
      this.$set(this.formData.carBaseReqDTO, 'carCityId', date.city.code)
      this.$set(this.formData.carBaseReqDTO, 'carCityName', date.city.name)
      console.log('handleCarCitySelected', this.formData.carBaseReqDTO)
    },
    pickerChange(index, field) {
      console.log('pickerChange', index, field)
      this.$set(this.formData[field.targetObj], field.targetKey, field.key == 'exteriorColor' || field.key == 'interiorColor' ? field.fieldPickerArray[index].name : field.fieldPickerArray[index].value)
      this.$set(this.formData[field.targetObj], field.targetNameKey, field.fieldPickerArray[index].name)
      console.log('pickerChange', this.formData)
    },
    radioChange(value, field) {
      console.log('radioChange', value, field)
      this.$set(this.formData[field.targetObj], field.targetKey, value)
    },
    calendarChange(date) {
      this.selectDate = date.year + '-' + date.month + '-' + date.date
      console.log('this.selectDate', this.selectDate)
    },
    blurChange(value, field) {
      console.log('blurChange', value, field)
      if (field.key == 'licensePlate') {
        uni.$api.evaluationApi
          .checkRepeat({
            licensePlate: value
          })
          .then(res => {
            console.log('res:', res)
            if (res.data.code == 0) {
              if (res.data.data.result == 1) {
                this.isExistSamePlate = true
                this.$refs.tipsPopup
                  .open()
                  .then(() => {
                    uni.navigateTo({
                      url: '/pages/evaluationForm/addEvaluationFrom?type=edit' + '&evalOrderNo=' + res.data.data.evalOrderNo
                    })
                  })
                  .catch(() => {
                    console.log('用户点击了取消')
                  })
              } else if (res.data.data.result == 2) {
                this.isExistSamePlate = false
                this.$refs.tipsPopup
                  .open()
                  .then(() => {
                    uni.navigateTo({
                      url: '/pages/evaluationForm/evaluationFormDetails?evalOrderNo=' + res.data.data.evalOrderNo
                    })
                  })
                  .catch(() => {
                    console.log('用户点击了取消')
                  })
              }
            } else {
              uni.hideLoading()
              uni.showToast({
                title: res.data.msg || '请求失败',
                icon: 'none'
              })
            }
          })
      }
      // 车架号自动转大写
      if (field.key === 'vin') {
        const upperValue = value.toUpperCase()
        if (upperValue !== value) {
          this.$set(this.formData.carBaseReqDTO, 'vin', upperValue)
        }

        // VIN车架号动态校验:车架号字段,动态转换为大写
        validateVin(upperValue)
          .then(result => {
            console.log('validateVin', result)
            let { valid } = result.data
            this.validateState = valid
            // 校验成功,所有提示已在公共方法中处理
            console.log('车架号校验成功:', result)
          })
          .catch(err => {
            console.log('validateVinErr', result)
          })
      }
      if (field.key === 'mileage') {
        let numValue = Number(value)

        if (isNaN(numValue)) {
          numValue = 0
        }

        if (numValue < 0) numValue = 0
        if (numValue > 999999) numValue = 999999

        const limitedValue = String(numValue)
        if (limitedValue !== value) {
          this.$set(this.formData.carBaseReqDTO, field.key, limitedValue)

          if (Number(value) > 999999) {
            uni.showToast({
              title: `${field.label}不能超过999999`,
              icon: 'none'
            })
          }
        }
      }
      if (field.key === 'guidePrice') {
        let numValue = Number(value)

        if (isNaN(numValue)) {
          numValue = 0
        }

        if (numValue < 0) numValue = 0
        if (numValue > 9999999.99) numValue = 9999999.99

        const limitedValue = String(numValue)
        if (limitedValue !== value) {
          this.$set(this.formData.carBaseReqDTO, field.key, limitedValue)

          if (Number(value) > 9999999.99) {
            uni.showToast({
              title: `${field.label}不能超过9999999.99`,
              icon: 'none'
            })
          }
        }
      }

      if (field.key === 'keyCount' || field.key === 'transferCount') {
        let numValue = Number(value)

        if (isNaN(numValue)) {
          numValue = field.key === 'keyCount' ? 2 : 1
        }

        if (numValue < 0) numValue = 0
        if (numValue > 9) numValue = 9

        const limitedValue = String(Math.floor(numValue))
        if (limitedValue !== value) {
          this.$set(this.formData.carLicenseReqDTO, field.key, limitedValue)
          if (Number(value) > 9) {
            uni.showToast({
              title: `${field.label}不能超过9`,
              icon: 'none'
            })
          }
        }
      }
    },
    confirmCalendar() {
      // this.rangeSelect(this.selectDate)
    },
    // 拍照
    takePhoto(type) {
      uni.chooseImage({
        count: 1,
        sizeType: ['original'],
        sourceType: ['camera'],
        success: async res => {
          try {
            // 上传所有选择的图片
            for (const tempFilePath of res.tempFilePaths) {
              const url = await uploadFile(tempFilePath)
              console.log('上传图片成功', url)
              this[type](url)
            }
          } catch (error) {
            console.log('上传图片失败', error)
            uni.showToast({ title: '上传图片失败', icon: 'none' })
          }
        },
        fail: err => {
          console.log('拍照失败', err)
          if (err.errMsg.indexOf('cancel') === -1) {
            uni.showToast({ title: '拍照失败', icon: 'none' })
          }
        }
      })
    },

    // 从相册选择图片
    chooseImageFromAlbum(type) {
      uni.chooseImage({
        count: 1,
        sizeType: ['original'],
        sourceType: ['album'],
        success: async res => {
          try {
            // 上传所有选择的图片
            for (const tempFilePath of res.tempFilePaths) {
              const url = await uploadFile(tempFilePath)
              console.log('上传图片成功', url)
              this[type](url)
            }
          } catch (error) {
            console.log('上传图片失败', error)
            uni.showToast({ title: '上传图片失败', icon: 'none' })
          }
        },
        fail: err => {
          console.log('选择图片失败', err)
          if (err.errMsg.indexOf('cancel') === -1) {
            uni.showToast({ title: '选择图片失败', icon: 'none' })
          }
        }
      })
    },

    async scan(type) {
      // #ifdef APP-PLUS
      const photoLibrary = await permision.requestAndroidPermission('android.permission.READ_EXTERNAL_STORAGE')
      const camera = await permision.requestAndroidPermission('android.permission.CAMERA')
      const isOnline = await uni.$isNetWork()
      if (photoLibrary != 1) {
        uni.showToast({ title: '您的设备不支持相册功能或未授权访问,请前往设置中开启相册权限', icon: 'none' })
        return
      }
      if (camera != 1) {
        uni.showToast({ title: '您的设备不支持摄像头功能或未授权访问,请前往设置中开启摄像头权限', icon: 'none' })
        return
      }
      if (!isOnline) {
        uni.showToast({ title: '当前无网络连接,请连接网络后重试', icon: 'none' })
        return
      }
      // #endif
      uni.showActionSheet({
        itemList: ['拍照', '从相册选择'],
        success: res => {
          if (res.tapIndex === 0) {
            // 拍照
            this.takePhoto(type)
          } else if (res.tapIndex === 1) {
            // 从相册选择图片
            this.chooseImageFromAlbum(type)
          }
        },
        fail: err => {
          console.log('选择操作失败', err)
        }
      })
    },
    vinOcr(imageUrl) {
      uni.showLoading({
        title: '识别中',
        mask: true
      })
      uni.$api.evaluationApi
        .vinOcr({
          imageUrl
        })
        .then(res => {
          console.log('res:', res)
          if (res.data.code == 0) {
            if (res.data.data.status == 1) {
              this.formData.carBaseReqDTO.vin = res.data.data.vin
              // 只有有 VIN 时才做后续校验和 queryByVin
              if (this.formData.carBaseReqDTO.vin) {
                validateVin(this.formData.carBaseReqDTO.vin)
                  .then(result => {
                    console.log('validateVin', result)
                    let { valid } = result.data
                    this.validateState = valid
                    // 校验成功,所有提示已在公共方法中处理
                    console.log('车架号校验成功:', result)
                  })
                  .catch(err => {
                    console.log('validateVinErr', err)
                  })
                uni.$api.evaluationApi
                  .queryByVin({
                    vin: this.formData.carBaseReqDTO.vin
                  })
                  .then(res => {
                    console.log('res:queryByVin', res)
                    if (res.data.code == 0) {
                      this.carTips = res.data.data.base.commonName || ''
                    } else {
                      this.carTips = ''
                    }
                  })
              }
              uni.showToast({ title: '车架号识别完成并已自动填写到表单中', icon: 'none' })
              uni.hideLoading()
            } else {
              uni.showToast({ title: res.data.data.errorMessage, icon: 'none' })
              uni.hideLoading()
            }
          } else {
            uni.hideLoading()
            uni.showToast({
              title: res.data.msg || '请求失败',
              icon: 'none'
            })
          }
        })
    },
    carLicenseOcr(imageUrl) {
      uni.showLoading({
        title: '识别中',
        mask: true
      })
      uni.$api.evaluationApi
        .carLicenseOcr({
          imageUrl
        })
        .then(res => {
          console.log('res:', res)
          uni.hideLoading()
          if (res.data.code == 0) {
            uni.showToast({ title: '行驶证信息识别完成,已自动填写到表单中', icon: 'none' })
            if (res.data.data.status == 1) {
              this.formData.carBaseReqDTO.engineNumber = res.data.data.engineNumber

              // 识别车牌号并解析省市回显到上牌城市
              if (res.data.data.licensePlate) {
                const plateLocation = getPlateLocation(res.data.data.licensePlate)
                console.log('plateLocation', plateLocation)

                if (plateLocation.success && plateLocation.province && plateLocation.city) {
                  // 清空上牌城市的ID,只保留名称
                  this.formData.carBaseReqDTO.registrationProvinceId = null
                  this.formData.carBaseReqDTO.registrationCityId = null
                  this.formData.carBaseReqDTO.registrationProvinceName = plateLocation.province
                  this.formData.carBaseReqDTO.registrationCityName = plateLocation.city
                }
              }

              if (this.title == '新增评估单') {
                this.formData.carBaseReqDTO.licensePlate = res.data.data.licensePlate
                if (res.data.data.licensePlate) {
                  uni.$api.evaluationApi
                    .checkRepeat({
                      licensePlate: res.data.data.licensePlate
                    })
                    .then(res => {
                      console.log('res:', res)
                      if (res.data.code == 0) {
                        if (res.data.data.result == 1) {
                          this.isExistSamePlate = true
                          this.$refs.tipsPopup
                            .open()
                            .then(() => {
                              uni.navigateTo({
                                url: '/pages/evaluationForm/addEvaluationFrom?type=edit' + '&evalOrderNo=' + res.data.data.evalOrderNo
                              })
                            })
                            .catch(() => {
                              console.log('用户点击了取消')
                            })
                        } else if (res.data.data.result == 2) {
                          this.isExistSamePlate = false
                          this.$refs.tipsPopup
                            .open()
                            .then(() => {
                              uni.navigateTo({
                                url: '/pages/evaluationForm/evaluationFormDetails?evalOrderNo=' + res.data.data.evalOrderNo
                              })
                            })
                            .catch(() => {
                              console.log('用户点击了取消')
                            })
                        }
                      } else {
                        uni.hideLoading()
                        uni.showToast({
                          title: res.data.msg || '请求失败',
                          icon: 'none'
                        })
                      }
                    })
                }
              }

              this.formData.carBaseReqDTO.vin = res.data.data.vin
              this.formData.carBaseReqDTO.registrationDate = res.data.data.registrationDate

              // 处理 previousOwnerAddress,提取省市并回显到上牌城市
              const previousOwnerAddress = res.data.data.previousOwnerAddress
              this.formData.carLicenseReqDTO.previousOwnerAddress = previousOwnerAddress

              if (previousOwnerAddress) {
                // 解析地址,提取省和市(到市级)
                let provinceName = ''
                let cityName = ''

                // 处理直辖市(北京市、上海市、天津市、重庆市)
                const municipalities = ['北京市', '上海市', '天津市', '重庆市']
                const municipalityMatch = municipalities.find(city => previousOwnerAddress.startsWith(city))

                if (municipalityMatch) {
                  // 直辖市:省和市都是同一个名称
                  provinceName = municipalityMatch
                  cityName = municipalityMatch
                } else {
                  // 普通省份:例如:"山东省济南市历下区" -> 省:"山东省",市:"济南市"
                  const provinceMatch = previousOwnerAddress.match(/^(.+?省)/)
                  const cityMatch = previousOwnerAddress.match(/省(.+?市)/)

                  if (provinceMatch && cityMatch) {
                    provinceName = provinceMatch[1]
                    cityName = cityMatch[1]
                  }
                }

                if (provinceName && cityName) {
                  // 清空上牌城市的ID,只保留名称
                  this.formData.carBaseReqDTO.registrationProvinceId = 0
                  this.formData.carBaseReqDTO.registrationCityId = 0
                  this.formData.carBaseReqDTO.registrationProvinceName = provinceName
                  this.formData.carBaseReqDTO.registrationCityName = cityName
                }
              }

              this.formData.carLicenseReqDTO.previousOwnerName = res.data.data.previousOwnerName
              this.formData.carLicenseReqDTO.carSeriesName = res.data.data.carSeriesName
              this.formData.carLicenseReqDTO.carTypeName = res.data.data.carTypeName
              // 行驶证识别到 VIN 后,再调用 queryByVin
              if (this.formData.carBaseReqDTO.vin) {
                uni.$api.evaluationApi
                  .queryByVin({
                    vin: this.formData.carBaseReqDTO.vin
                  })
                  .then(res => {
                    console.log('res:', res)
                    if (res.data.code == 0) {
                      this.carTips = res.data.data.base.commonName || ''
                    } else {
                      this.carTips = ''
                    }
                  })
              }
            } else {
              uni.hideLoading()
              uni.showToast({ title: res.data.data.errorMessage, icon: 'none' })
            }
          } else {
            uni.hideLoading()
            uni.showToast({
              title: res.data.msg || '请求失败',
              icon: 'none'
            })
          }
        })
    },

    // 上一步逻辑
    prevStep() {
      if (this.currentStep > 1) {
        this.currentStep--
        // 滚动到顶部
        this.scrollToTop()
      }
    },

    // 提交表单逻辑
    submitForm: throttle(async function () {
      // 表单提交验证
      if (this.currentStep === 3) {
        const leftFront45Image = this.formImagesData['11'] // key为11的是左前45度图片
        if (!leftFront45Image || !leftFront45Image.length) {
          uni.showToast({
            title: '左前45度图片为必填项',
            icon: 'none'
          })
          return
        }
      }
      const exteriorColorField = this.formFields.find(field => field.key === 'exteriorColor')
      const interiorColorField = this.formFields.find(field => field.key === 'interiorColor')

      if (exteriorColorField && this.formData.carBaseReqDTO.exteriorColorName) {
        this.$set(this.formData.carBaseReqDTO, 'exteriorColor', this.formData.carBaseReqDTO.exteriorColorName)
      }
      if (interiorColorField && this.formData.carBaseReqDTO.interiorColorName) {
        this.$set(this.formData.carBaseReqDTO, 'interiorColor', this.formData.carBaseReqDTO.interiorColorName)
      }
      this.formData.imageList = []
      // 处理车辆图片 - fileType: 1
      this.processMediaData(this.formImagesData, 1)

      // 处理证件资料 - fileType: 2
      this.processMediaData(this.certificateImagesData, 2)

      // 处理车辆视频 - fileType: 3
      this.processMediaData(this.carVideoData, 3)

      // 处理其他图片 - fileType: 4
      this.processMediaData(this.otherImagesData, 4)
      // 处理车辆检测报告 - fileType: 5
      this.processMediaData(this.reportImageData, 5)
      uni.showLoading({
        title: '提交中...'
      })
      console.log('提交的表单数据:', this.formData)
      const guidePrice = this.formData.carBaseReqDTO.guidePrice
      this.formData.carBaseReqDTO.guidePrice = !isNaN(Number(guidePrice)) ? Number(guidePrice).toFixed(2) : '0.00'
      if (this.query.type === 'add') {
        uni.showLoading()
        const res = await uni.$api.evaluationApi.evalOrderCreate({ ...this.formData, source: 1 })
        console.log('res:', res)
        if (res.data.code == 0) {
          uni.hideLoading()
          uni.showToast({
            title: '新增成功',
            icon: 'none'
          })
          setTimeout(() => {
            uni.navigateBack({
              delta: 1
            })
          }, 300)
        } else {
          uni.hideLoading()
          uni.showToast({
            title: res.data.msg || '请求失败',
            icon: 'none'
          })
        }
      } else if (this.query.type === 'edit') {
        uni.showLoading()
        const res = await uni.$api.evaluationApi.evalOrderUpdate(this.formData)
        console.log('res:', res)
        if (res.data.code == 0) {
          uni.hideLoading()
          uni.showToast({
            title: '提交成功',
            icon: 'none'
          })
          setTimeout(() => {
            uni.navigateBack({
              delta: 1
            })
          }, 1000)
        } else {
          if (res.data.code == 3004) {
            uni.hideLoading()
            this.$refs.editTipsPopup.open().then(() => {
              uni.navigateBack({
                delta: 1
              })
            })
          } else {
            uni.hideLoading()
            uni.showToast({
              title: res.data.msg || '请求失败',
              icon: 'none'
            })
          }
        }
      }
    }, 1500),

    processMediaData(mediaData, fileType) {
      if (!mediaData || typeof mediaData !== 'object') {
        return
      }

      Object.keys(mediaData).forEach(fileSubtype => {
        const mediaItems = mediaData[fileSubtype]

        if (!Array.isArray(mediaItems)) {
          return
        }

        mediaItems.forEach(item => {
          if (!item || typeof item !== 'object' || !item.url) {
            return
          }
          const fileName = item.name
          const fileFormat = item.fileFormat

          this.formData.imageList.push({
            fileType: fileType,
            fileSubtype: parseInt(fileSubtype, 10), // 确保是数字类型
            fileUrl: item.url,
            fileFormat: fileFormat,
            fileName: fileName
          })
        })
      })
    },

    // 滚动到顶部
    scrollToTop() {
      const query = uni.createSelectorQuery().in(this)
      query.select('.form-container').boundingClientRect()
      query.selectViewport().scrollOffset()
      query.exec(res => {
        if (res && res[0]) {
          uni.pageScrollTo({
            scrollTop: res[0].top + res[1].scrollTop - 100,
            duration: 300
          })
        }
      })
    },
    onConfirm(data) {
      console.log('onConfirm', data)

      // 如果有当前字段信息
      if (this.currentField) {
        // 获取字段的目标对象、目标键和名称键
        const { targetObj, targetKey, targetNameKey, key, sourceNameKey, sourceKey } = this.currentField

        // 获取弹窗返回的值
        const chooseContent = data.chooseContent || {}

        // 定义一个通用的赋值函数,支持自定义映射规则
        const setValue = (obj, prop, value) => {
          if (obj && prop) {
            obj[prop] = value
          }
        }

        // 根据是否有targetObj进行不同的赋值逻辑
        if (targetObj && targetKey) {
          // 确保目标对象存在
          if (!this.formData[targetObj]) {
            this.formData[targetObj] = {}
          }

          // 设置主要字段值
          setValue(this.formData[targetObj], targetKey, chooseContent[sourceKey] || chooseContent)

          // 如果有名称键,设置名称值
          if (targetNameKey) {
            const nameValue = chooseContent[sourceNameKey] || ''
            setValue(this.formData[targetObj], targetNameKey, nameValue)
          }
        } else if (targetKey) {
          // 没有targetObj但有targetKey的情况
          const value = chooseContent[sourceKey] || chooseContent
          setValue(this.formData, targetKey, value)

          if (targetNameKey) {
            const nameValue = chooseContent.name || chooseContent[sourceNameKey] || ''
            setValue(this.formData, targetNameKey, nameValue)
          }
        } else {
          // 否则直接赋值到formData
          setValue(this.formData, key, chooseContent[key] || chooseContent)
        }
        console.log(this.userInfo)
        this.$set(this.formData.evalOrderBasicReqDTO, 'sellerMerchantId', this.userInfo.shopMerchantId || '')
        this.$set(this.formData.evalOrderBasicReqDTO, 'sellerMerchantName', this.userInfo.shopMerchantName || '')

        console.log('formData', this.formData)

        // 清空当前字段信息
        this.currentField = null
      }
    }
  }
}
</script>
<style scoped lang="scss">
// Popup样式
::v-deep .tipsPopup .uni-popup__wrapper {
  width: toRpx(848);
  height: toRpx(644);
  border-radius: toRpx(42);
  background: rgb(255, 255, 255) !important;
  .tipsPopupBg {
    border-radius: toRpx(42) toRpx(42) 0 0;
    width: 100%;
    height: toRpx(244);
  }
  .title {
    color: #333333;
    font-size: toRpx(40);
    font-weight: 500;
    text-align: center;
    margin-top: toRpx(48);
  }
  .tipsConent {
    color: #666666;
    font-size: toRpx(32);
    font-weight: 400;
    padding: toRpx(16) toRpx(64);
    line-height: toRpx(48);
    text {
      color: #347bff;
    }
  }
}
.add-evaluation-from {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-image: url('@/assets/images/common/page-bg.webp');
  background-size: 100%;
  padding: toRpx(160) toRpx(64) toRpx(48);
  box-sizing: border-box;
  .nav-bar {
    position: fixed;
    width: 100%;
    height: toRpx(96);
    left: 0;
    top: toRpx(48);
    z-index: 999;
    pointer-events: none;

    .back {
      height: 100%;
      aspect-ratio: 1/1;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: auto;
    }

    .title {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-weight: 700;
      font-size: toRpx(32);
      color: #1a1a1a;
    }
  }
  .detail-content {
    width: 100%;
    height: 100%;
    border-radius: toRpx(48);
    box-sizing: border-box;
    overflow: hidden;
    background: #f1f4ff;
    backdrop-filter: blur(toRpx(16));
    box-shadow: inset 0 0 toRpx(16) 0 #ffffff;
    padding: 0 toRpx(48);
    box-sizing: border-box;
    position: relative;
    &::after {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      z-index: -2;
      width: 100%;
      height: toRpx(120);
      background: linear-gradient(0deg, #94c2ff00 0%, #5294ff 100%);
      opacity: 0.15;
    }

    &::before {
      content: '';
      position: absolute;
      left: toMinusRpx(20);
      top: toMinusRpx(28);
      z-index: -1;
      width: toRpx(136);
      height: toRpx(136);
      opacity: 0.6;
      background: linear-gradient(-44.4deg, #94c2ff00 0%, #5294ff 100%);
      filter: blur(toRpx(24));
    }
    .stepper-container {
      display: flex;
      align-items: center;
      padding: toRpx(32) 0;

      > view {
        display: flex;
        align-items: center;
      }

      .step-number-circle {
        width: toRpx(46);
        height: toRpx(46);
        border-radius: 50%;
        border: toRpx(2) solid #999999;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;

        &::before {
          content: '';
          width: toRpx(38);
          height: toRpx(38);
          border-radius: 50%;
          background-color: #999999;
          position: absolute;
          z-index: 0;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
        }

        &.active {
          border: toRpx(2) solid #4673ff;

          &::before {
            background-color: #4673ff;
          }
        }
      }

      .step-number {
        font-size: toRpx(28);
        color: #fff;
        position: relative;
        z-index: 1;
      }

      .step-name {
        margin-left: toRpx(16);
        font-size: toRpx(32);
        color: #999999;

        &.active {
          color: #4673ff;
        }
      }

      .dash-line {
        width: toRpx(64);
        height: 0;
        border-top: toRpx(4) dashed #d6d6d6;
        margin: 0 toRpx(32);

        &.active {
          border-top: toRpx(4) dashed #4673ff;
        }
      }
    }
    .scanBtn {
      width: toRpx(188);
      height: toRpx(64);
      border-radius: toRpx(64);
      background: #ffffff;
      color: #333333;
      font-size: toRpx(28);
      font-weight: 400;
      .sprite-icon {
        margin-right: toRpx(8);
      }
    }
    .fromBox {
      width: 100%;
      height: calc(100% - #{toRpx(268)});
    }

    .form-container-upload {
      width: 100%;

      height: 100%;
      overflow-y: auto;
      padding-right: toRpx(8);
    }

    /* 上传按钮样式 */
    .upload-btn {
      width: toRpx(200);
      height: toRpx(64);
      border-radius: toRpx(32);
      border: toRpx(2) dashed #999999;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #999999;
      font-size: toRpx(28);
    }

    /* 上传区域样式 */
    .upload-section {
      margin-bottom: toRpx(40);
      grid-column: 1 / -1;
      padding: toRpx(32) toRpx(48);
      border-radius: toRpx(16);
      background-color: #fff;
    }

    .section-title {
      font-size: toRpx(32);
      font-weight: 600;
      color: #333333;
      margin-bottom: toRpx(24);
    }

    .upload-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: toRpx(24);
    }
    .upload-item-container {
      align-items: flex-start;
      .upload-label {
        color: #666666;
        font-size: toRpx(26);
        font-weight: 400;
        display: flex;
        align-items: flex-start;
        margin-right: toRpx(42);
        width: toRpx(180);
      }
      .requiredLabel {
        color: #f24724;
        font-size: toRpx(28);
        font-weight: 400;
        margin-left: toRpx(8);
      }
    }

    .upload-item {
      aspect-ratio: 1;
      border-radius: toRpx(16);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      width: toRpx(240);
      height: toRpx(240);
      border-radius: toRpx(12);
      opacity: 1;
      background: #f5f8ff;
    }

    .upload-placeholder {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #999999;
    }

    .upload-text {
      margin-top: toRpx(12);
      font-size: toRpx(24);
    }
  }

  .button-module {
    margin-bottom: toRpx(24);
    margin-top: toRpx(44);
    .button-container {
      width: 100%;
      display: flex;
      justify-content: center;
      gap: toRpx(32);
    }

    .cancel-btn {
      width: toRpx(724);
      height: toRpx(80);
      border-radius: toRpx(48);
      border: toRpx(1) solid #ffffff;
      background: #3b73ff1a;
      text-align: center;
      line-height: toRpx(80);
      color: #4673ff;
      font-size: toRpx(28);
      font-weight: 500;
    }

    .next-btn {
      width: toRpx(724);
      height: toRpx(80);
      border-radius: toRpx(48);
      border: toRpx(1) solid #ffffff;
      background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
      text-align: center;
      line-height: toRpx(80);
      color: #ffffff;
      font-size: toRpx(28);
      font-weight: 500;
    }
  }
}
</style>