applyAccount.vue 61.4 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
<!-- 申请虚拟账户成本 -->
<template>
  <div class="apply-account">
    <edit-form
      ref="editFormRef"
      :title="formTitle"
      :current-page="custType"
      :settlement-page="editForm.settlementType"
      :contract-type-page="editForm.contractType"
      :edit-form="editForm"
      :form-rules="formRules"
      :form-list="formList"
      @handleConfirm="handleConfirm"
      @handleDraft="handleDraft"
      @handleCancel="handleCancel"
    >
      <span
        style="display: inline-block; color: red; margin: 10px 54px"
        slot="failMessage"
        >{{ failMessage }}</span
      >
      <span slot="custType" slot-scope="scope">
        <el-radio-group
          size="mini"
          v-model="custType"
          @change="scope.scope.handleRadioChange"
        >
          <el-radio
            v-for="(subItem, subIdx) in scope.scope.radioOptList"
            :key="subIdx"
            :label="subItem.value"
            >{{ subItem.label }}</el-radio
          >
        </el-radio-group>
      </span>
      <div slot="businessLicense" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="营业执照"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <span class="img-explain"
          >营业执照必须清晰可见,图片大小在1MB以内,支持jpg/png格式。</span
        >
      </div>
      <span slot="provincesAndCities">
        <!-- slot-scope="scope" -->
        <el-cascader
          v-model="editForm.provincesAndCities"
          size="mini"
          ref="cascader"
          placeholder="请选择 省/市/区"
          style="width: 350px"
          :options="provincesAndCities_options"
          :props="{ label: 'name', value: 'code', children: 'childrenList' }"
        />
      </span>
      <span slot="companyAddr">
        <!-- slot-scope="scope" -->
        <el-input
          v-model="editForm.companyAddr"
          type="textarea"
          placeholder="请输入企业地址"
          style="width: 350px"
          :rows="3"
          maxlength="100"
          size="mini"
          show-word-limit
        />
      </span>
      <div slot="accountLicenese" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="开户许可证"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
      </div>
      <div slot="idCard" slot-scope="scope" class="idImg">
        <div class="idItem">
          <gl-upload-img
            :id="scope.scope.slotName"
            :form-obj="scope.scope"
            :pic-obj="picObj"
            txt-descript="法人身份证正面照"
            @handleImgChange="handleImgChange"
            @handleImgRemove="handleImgRemove"
          />
          <gl-upload-img
            :id="scope.scope.otherName"
            :form-obj="scope.scope"
            attr-name="otherName"
            :pic-obj="picObj"
            txt-descript="法人身份证反面照"
            @handleImgChange="handleImgChange"
            @handleImgRemove="handleImgRemove"
          />
        </div>
        <div class="idItem">
          <gl-upload-img
            :id="scope.scope.threeName"
            :form-obj="scope.scope"
            attr-name="threeName"
            :pic-obj="picObj"
            txt-descript="被授权人身份证正面照"
            @handleImgChange="handleImgChange"
            @handleImgRemove="handleImgRemove"
            :show="editForm.settlementType == 3"
          />
          <gl-upload-img
            :id="scope.scope.fourName"
            :form-obj="scope.scope"
            attr-name="fourName"
            :pic-obj="picObj"
            txt-descript="被授权人身份证反面照"
            @handleImgChange="handleImgChange"
            @handleImgRemove="handleImgRemove"
            :show="editForm.settlementType == 3"
          />
        </div>
        <!-- <span
                class="img-explain">1、法人身份证号、法人身份证照、法人手机号三者必须匹配。<br />2、身份证照片必须清晰可见。图片大小在1MB内支持png、jpg格式。</span> -->
        <span class="img-explain"
          >身份证照片必须清晰可见,图片大小在1M以内,支持jpg\png格式。</span
        >
      </div>
      <div slot="handIdCard" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="手持身份证照"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <span class="img-explain">人脸和身份证上的信息必须清晰可见。</span>
      </div>
      <div slot="powerOfAttorney" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="结算授权书"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <span class="img-explain"
          >授权书里的授权人需与身份证照里的被授权人保持一致。<br /><br /><a
            @click="lookDemo"
            class="demo_a"
            >查看示例</a
          ></span
        >
      </div>
      <div slot="powerOfLegal" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="法人手持授权书"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <span class="img-explain">人脸和授权书上的信息必须清晰可见。</span>
      </div>
      <div slot="bankCard" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="银行卡正面照"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <gl-upload-img
          :id="scope.scope.otherName"
          :form-obj="scope.scope"
          attr-name="otherName"
          :pic-obj="picObj"
          txt-descript="银行卡反面照"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
      </div>
      <div slot="bankCard2" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.otherName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          attr-name="otherName"
          txt-descript="结算账户正面"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
      </div>
      <div slot="bankCounty" slot-scope="scope" class="flex">
        <span>{{ editForm.bankProvince }}</span>
        <span :class="[editForm.bankCity ? 'areaPadding' : '']">{{
          editForm.bankCity
        }}</span>
        <el-select v-model="editForm.bankCounty" size="mini" clearable>
          <el-option
            v-for="item in scope.scope.optionList"
            :key="item.name"
            :label="item.name"
            :value="item.name"
          />
        </el-select>
      </div>
      <div slot="clientAgreement" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="客户协议首页"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <gl-upload-img
          :id="scope.scope.otherName"
          :form-obj="scope.scope"
          attr-name="otherName"
          :pic-obj="picObj"
          txt-descript="客户协议书2"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <span class="img-explain">大小1M以内,支持png、jpg格式。</span>
      </div>
      <div slot="doorHead" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="门头照"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
      </div>
      <div slot="businessPremiese" slot-scope="scope" class="flex">
        <gl-upload-img
          :id="scope.scope.slotName"
          :form-obj="scope.scope"
          :pic-obj="picObj"
          txt-descript="经营场所照"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <gl-upload-img
          :id="scope.scope.otherName"
          :form-obj="scope.scope"
          attr-name="otherName"
          :pic-obj="picObj"
          txt-descript="收银台照"
          @handleImgChange="handleImgChange"
          @handleImgRemove="handleImgRemove"
        />
        <span class="img-explain">大小1M以内,支持png、jpg格式。</span>
      </div>
      <!-- smsCode -->
      <div slot="smsCode" slot-scope="scope">
        <el-input
          v-model="editForm[scope.scope.name]"
          size="mini"
          placeholder="请输入验证码"
          style="width: 200px; margin-right: 10px"
        />
        <el-button
          size="mini"
          @click="handleSend"
          :disabled="isSend || editForm.operPhone.length !== 11"
        >
          {{ isSend ? sendMsg + "秒后,重试" : "获取验证码" }}
        </el-button>
      </div>
    </edit-form>
    <el-dialog :visible.sync="lookImgVisible">
      <img width="100%" :src="lookUrl" alt="图片" />
    </el-dialog>
  </div>
</template>

<script>
import { mapActions } from "vuex"
// import _ from 'lodash'
import { deepClone } from "@/common/util"
import { Validator } from "@/common/validator"
import editForm from "./editForm"
import glUploadImg from "./glUploadImg"
import {
  uploadImg,
  imgRecognitionApi,
  getBankListApi,
  getYseBankListApi,
  sendToSmsCodeApi
} from "@/api/sys.base"
import {
  registerYseMerchantApiNew,
  draftYseMerchantApiNew,
  getDetailApi,
  getAreaInfoApi,
  getAreaInfoByOpenAccBankTypeApi
} from "@api/publicAccount"
export default {
  name: "ApplyAccount",
  data() {
    var checkPhoneObj = {
      required: true,
      validator: (rule, value, callback) => {
        Validator.checkPhoneNumber(value)
          ? callback()
          : callback(new Error("你输入的手机号码不正确,请重新输入"))
      },
      trigger: "change"
    }
    var checkNumOrLetterObj = {
      required: true,
      validator: (rule, value, callback) => {
        Validator.checkNumOrLetters(value)
          ? callback()
          : callback(new Error("仅支持输入数字或字母,请重新输入"))
      },
      trigger: "change"
    }
    var checkIdCardObj = {
      required: true,
      validator: (rule, value, callback) => {
        Validator.checkIdCard(value)
          ? callback()
          : callback(new Error("你输入的身份证号不正确,请重新输入"))
      },
      trigger: "change"
    }
    return {
      // 要放大的图片
      lookUrl: "",
      // 控制图片放大弹窗
      lookImgVisible: false,
      // 缓存当前merchantId
      sessionName: "applyAccMerchant",
      targetAccount: {},
      // 验证码
      showtips: false,
      isSend: false,
      sendMsg: "获取验证码",
      time: "",
      // 编辑-错误信息
      failMessage: "",
      // O - 小微商户;C - 个体商户;B - 个体商户(三个表单数据隔离)
      custType: "B",
      // 1-对公账户结算 2-法人结算 3-授权人结算
      // settlementType: '1',
      // 标记radio改变前的值
      markCustType: "O",
      // 传给组件的obj
      editForm: {
        legalName: "", // 法人姓名
        legalCertNo: "", // 法人身份证号
        legalCertStartDate: "", // 身份证开始时间
        legalCertExpire: "", // 身份证结束时间
        legalTel: "", // 法人手机号
        bankAccountNo: "", // 'O': '结算银行卡号','C': '结算银行卡号','B': '账户号'
        bankAccountName: "", // 'O': '结算银行卡用户名','C': '结算银行卡用户名','B': '账户名称'
        bankTelephoneNo: "", // 银行预留手机号
        bankType: "", // 'O': '结算银行卡开户行','C': '结算银行卡开户行','B': '开户账户开户行'
        bankName: "", // 银行名称
        openAccBankType: "", // 开户行类型
        openAccBankName: "", // 开户行名称
        operPhone: "", // 操作人手机号
        smsCode: "", // 操作人手机号验证码
        papers: {},
        companyAddr: "", // 企业地址
        settlementType: 1, // 结算方式(1-对公账户结算 2-法人结算 3-授权人结算)
        contractType: 1, // 签约类型(1-线下签约 2-电子签约)
        provincesAndCities: [], // 省市区
        provinceCode: "", // 企业所在省份code
        province: "", // 企业所在省份
        cityCode: "", // 企业所在城市code
        city: "", // 企业所在城市
        bankProvince: "", // 开户行省
        bankCity: "", // 开户行市
        bankCounty: "", // 开户行区县
        legalAddress: "", // 法人地址
        unincorporatedName: "", // 授权人姓名
        unincorporatedId: "", // 授权人身份证号
        legalGender: "", // 性别
        busLicenceName: "", // 营业执照全称
        busLicense: "", // 统一社会信用代码
        busLicenseStartDate: "", // 营业执照开始时间
        busLicenseExpire: "", // 营业执照结束时间
        contractorPhone: "", // 签约人手机号
        busLicenseDateFlag: 0, // 营业执照长期有效标志位,0-正常,1-长期有效
        legalCertDateFlag: 0 // 法人身份证长期有效期标志位,0-正常,1-长期有效
      },
      OCeditForm: {
        bankAccountType: "" // 银行卡账户类型
      },
      BCeditForm: {
        busLicenceName: "", // 营业执照全称
        anotherName: "", // 简称
        busLicense: "", // 统一社会信用代码
        busLicenseStartDate: "", // 营业执照开始时间
        busLicenseExpire: "" // 营业执照结束时间
      },
      // 固定参数
      defaultForm: {},
      // 小微商户Obj - 三个表单数据隔离
      microEditForm: {
        custType: "O"
      },
      // 个体商户Obj
      customerEditForm: {
        custType: "C"
      },
      // 企业商户Obj
      businessEditForm: {
        custType: "B"
      },
      // 类型对应的对象form
      typeToForm: {
        O: "microEditForm",
        C: "customerEditForm",
        B: "businessEditForm"
      },
      // 图片列表
      picObj: {
        // 个体-营业执照
        businessLicense: {
          attrName: "19",
          url: "",
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["C", "B"],
          validate: {
            name: "custType",
            list: ["C", "B"]
          }
        },
        // 身份证
        idCard: {
          attrName: "00",
          url: ""
        },
        idCardBack: {
          attrName: "30",
          url: ""
        },
        // 手持身份证
        handIdCard: {
          attrName: "33",
          url: ""
          // 根据currentPage不同,展示/隐藏
          // showAttrList: ['O']
        },
        // 开户许可证
        accountLicenese: {
          attrName: "37",
          url: "",
          // 根据currentPage不同,展示/隐藏
          // showAttrList: ['B', 'C']
          showForsettlement: [1],
          validate: {
            name: "settlementType",
            list: [1]
          }
        },
        // 银行卡
        bankCard: {
          attrName: "35",
          url: ""
          // 根据currentPage不同,展示/隐藏
          // showAttrList: ['O', 'C']
        },
        bankCardBack: {
          attrName: "36",
          url: "",
          // 根据currentPage不同,展示/隐藏
          // showAttrList: ['O', 'C']
          showForsettlement: [2, 3],
          validate: {
            name: "settlementType",
            list: [2, 3]
          }
        },
        // 客户协议书
        clientAgreement: {
          attrName: "A012",
          url: "",
          showForContractType: [1],
          // contractType: [1]
          validate: {
            name: "contractType",
            list: [1]
          }
          // show
        },
        clientAgreementTwo: {
          attrName: "31",
          url: "",
          showForContractType: [1],
          validate: {
            name: "contractType",
            list: [1]
          }
        },
        // 门头照
        doorHead: {
          attrName: "34",
          url: ""
        },
        // 经营场所
        // 内景照片
        businessPremiese: {
          attrName: "A007",
          url: ""
        },
        // 收银台照片
        businessPremieseTwo: {
          attrName: "A008",
          url: ""
        },
        // 被授权人身份证正面
        authorizerIdCard: {
          attrName: "38",
          url: "",
          validate: {
            name: "settlementType",
            list: [3]
          }
        },
        // 被授权人身份证反面
        authorizerIdCardBack: {
          attrName: "39",
          url: "",
          validate: {
            name: "settlementType",
            list: [3]
          }
        },
        // 结算授权书
        powerOfAttorney: {
          attrName: "41",
          url: "",
          showForsettlement: [3],
          validate: {
            name: "settlementType",
            list: [3]
          }
        },
        // 法人手持授权书
        powerOfLegal: {
          attrName: "40",
          url: "",
          showForsettlement: [3],
          validate: {
            name: "settlementType",
            list: [3]
          }
        }
      },
      formRules: {},
      formTitle: "申请虚拟对公账号",
      formList: [
        {
          isTitle: true,
          titleName: "商户类型"
        },
        {
          label: "商户类型",
          name: "custType",
          slotName: "custType",
          radioOptList: [
            {
              value: "B",
              label: "企业商户"
            },
            {
              value: "C",
              label: "个体商户"
            },
            {
              value: "O",
              label: "小微商户"
            }
          ],
          rules: [
            { required: true, message: "请选择商户类型", trigger: "change" }
          ],
          handleRadioChange: (val) => {
            // 验证码清空
            this.isSend = false
            this.time && clearTimeout(this.time)
            // 写入切换后的Obj
            this.editForm = this[this.typeToForm[this.custType]]
            if (val == "B" || val == "C") {
              // 当切换商户类型时,将结算方式重置到最前位置选项
              this.editForm.settlementType = 1
            } else {
              this.editForm.settlementType = 2
            }
            this.afterChangePic()
            this.recoveryOpenAccBank()
            this.markCustType = this.custType
          }
        },
        {
          isTitle: true,
          titleName: "企业信息"
        },
        {
          label: "企业名称",
          name: "anotherName",
          type: "input",
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["O"],
          rules: [
            { required: true, message: "请输入企业名称", trigger: "change" }
          ]
        },
        {
          label: "营业执照",
          name: "businessLicense",
          useDefaultImg: true,
          type: "image",
          slotName: "businessLicense",
          autoRecognitionFn: (imgUrl) => this.handleAutoRecognition(3, imgUrl),
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["C", "B"]
        },
        {
          label: "营业执照全称",
          name: "busLicenceName",
          type: "input",
          maxlength: 50,
          placeholder: "必须与营业执照保持一致",
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["C", "B"],
          rules: [
            { required: true, message: "请输入营业执照全称", trigger: "change" }
          ]
        },
        {
          label: "简称",
          name: "anotherName",
          type: "input",
          maxlength: 20,
          placeholder: "商户简称",
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["C", "B"],
          noshowRequired: true,
          // rules: [{ required: false }]
          rules: [{ required: false }]
        },
        {
          label: "统一社会信用代码",
          name: "busLicense",
          type: "input",
          maxlength: 40,
          placeholder: "必须与营业执照保持一致",
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["C", "B"],
          rules: [
            {
              required: true,
              message: "请输入统一社会信用代码",
              trigger: "change"
            },
            checkNumOrLetterObj
          ]
        },
        {
          label: "营业执照有效期",
          placeholder: "营业执照开始时间",
          name: "busLicenseStartDate",
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["C", "B"],
          type: "datePicker",
          isClear: true,
          style: {
            display: "inline-block",
            width: "420px"
          },
          itemSuffix: "~",
          itemSuffixStyle: {
            "margin-left": "10px"
          },
          rules: [
            {
              required: true,
              message: "请选择营业执照开始时间",
              trigger: "change"
            }
          ],
          handleChange: (value) => {
            console.log(value)
            if (
              value &&
              this.editForm.busLicenseExpire &&
              new Date(value).getTime() >
                new Date(this.editForm.busLicenseExpire).getTime()
            ) {
              this.editForm.busLicenseStartDate = ""
              this.$message.error("营业执照有效期开始时间不应大于结束时间")
            }
          }
        },
        {
          label: "",
          placeholder: "营业执照结束时间",
          name: "busLicenseExpire",
          // 根据currentPage不同,展示/隐藏
          showAttrList: ["C", "B"],
          type: "datePicker",
          isClear: true,
          style: {
            display: "inline-block"
          },
          rules: [
            {
              required: true,
              message: "请选择营业执照结束时间",
              trigger: "change"
            }
          ],
          handleChange: (value) => {
            if (
              value &&
              this.editForm.busLicenseStartDate &&
              new Date(value).getTime() <
                new Date(this.editForm.busLicenseStartDate).getTime()
            ) {
              this.editForm.busLicenseExpire = ""
              this.$message.error("营业执照有效期结束时间不应小于开始时间")
            }
          }
        },
        {
          // 站位,解决插槽样式问题
          label: "",
          checkboxLabel: "长期有效",
          name: "busLicenseTimePermanent",
          showAttrList: ["C", "B"],
          type: "checkbox",
          style: {
            display: "inline-block",
            "margin-left": "15px"
          },
          handleChange: (value) => {
            if (value) {
              this.editForm.busLicenseExpire = ""
              this.editForm.busLicenseDateFlag = 1
              this.formList[
                this.findFormIdx("busLicenseExpire")
              ].isDisabled = true
              this.formList[this.findFormIdx("busLicenseExpire")].rules = []
            } else {
              this.editForm.busLicenseDateFlag = 0
              this.formList[
                this.findFormIdx("busLicenseExpire")
              ].isDisabled = false
              this.formList[this.findFormIdx("busLicenseExpire")].rules = [
                {
                  required: true,
                  message: "请选择营业执照结束时间",
                  trigger: "change"
                }
              ]
            }
          }
        },
        {
          label: "企业地址",
          name: "provincesAndCities",
          slotName: "provincesAndCities",
          type: "other",
          // style: {
          //   'display': 'inline-block',
          //   'width': '25%'
          // },
          rules: [
            { required: true, message: "请选择省市区", trigger: "change" }
          ]
        },
        {
          label: "",
          name: "companyAddr",
          slotName: "companyAddr",
          type: "other",
          style: {
            "padding-left": "170px"
          },
          rules: [
            { required: true, message: "请输入企业地址", trigger: "change" }
          ]
        },
        {
          isTitle: true,
          titleName: "身份证信息"
        },
        {
          label: "结算方式",
          name: "settlementType",
          // slotName: 'settlementType',
          type: "radio",
          radioOptList: [
            {
              value: 1,
              label: "对公账户结算"
            },
            {
              value: 2,
              label: "法人结算"
            },
            {
              value: 3,
              label: "授权人结算"
            }
          ],
          showAttrList: ["B", "C"],
          rules: [
            { required: true, message: "请选择结算方式", trigger: "change" }
          ],
          handleRadioChange: () => {
            // // 验证码清空
            // this.isSend = false
            // this.time && clearTimeout(this.time)
            // // 写入切换后的Obj
            // this.editForm = this[this.typeToForm[this.custType]]
            // this.afterChangePic()
            // this.recoveryOpenAccBank()
            // this.markCustType = this.custType
          }
        },
        {
          label: "结算方式",
          name: "settlementType",
          // slotName: 'settlementType_O',
          type: "radio",
          radioOptList: [
            {
              value: 2,
              label: "法人结算"
            }
          ],
          showAttrList: ["O"],
          rules: [
            { required: true, message: "请选择结算方式", trigger: "change" }
          ]
        },
        {
          // label: '法人身份证照',
          label: {
            1: "法人身份证照",
            2: "法人身份证照",
            3: "身份证照"
          },
          name: "idCard",
          otherName: "idCardBack",
          threeName: "authorizerIdCard",
          fourName: "authorizerIdCardBack",
          type: "image",
          slotName: "idCard",
          // rules: [{ required: true, message: '请上传法人身份证', trigger: 'change' }],
          autoRecognitionFn: (imgUrl, attrName) =>
            this.handleAutoRecognition(1, imgUrl, attrName)
        },
        {
          label: "法人姓名",
          name: "legalName",
          type: "input",
          maxlength: 16,
          rules: [
            { required: true, message: "请输入法人姓名", trigger: "change" }
          ]
        },
        {
          label: "法人性别",
          name: "legalGender",
          type: "radio",
          radioOptList: [
            {
              value: 0,
              label: "男"
            },
            {
              value: 1,
              label: "女"
            }
          ],
          // showForsettlement: [1, 2],
          rules: [{ required: true, message: "请选择性别", trigger: "change" }]
        },
        {
          label: "法人手机号",
          name: "legalTel",
          type: "input",
          maxlength: "11",
          rules: [
            { required: true, message: "请输入法人手机号", trigger: "change" },
            checkPhoneObj
          ]
        },
        {
          label: "法人身份证号",
          name: "legalCertNo",
          type: "input",
          rules: [
            {
              required: true,
              message: "请输入法人身份证号",
              trigger: "change"
            },
            checkIdCardObj
          ]
        },
        {
          label: "身份证有效期",
          placeholder: "身份证开始时间",
          name: "legalCertStartDate",
          type: "datePicker",
          isClear: true,
          style: {
            display: "inline-block",
            width: "420px"
          },
          itemSuffix: "~",
          itemSuffixStyle: {
            "margin-left": "10px"
          },
          rules: [
            {
              required: true,
              message: "请选择身份证开始时间",
              trigger: "change"
            }
          ],
          handleChange: (value) => {
            if (
              value &&
              this.editForm.legalCertExpire &&
              new Date(value).getTime() >
                new Date(this.editForm.legalCertExpire).getTime()
            ) {
              this.editForm.legalCertStartDate = ""
              this.$message.error("身份证有效期开始时间不应大于结束时间")
            }
          }
        },
        {
          label: "",
          placeholder: "身份证结束时间",
          name: "legalCertExpire",
          type: "datePicker",
          isClear: true,
          style: {
            display: "inline-block"
          },
          rules: [
            {
              required: true,
              message: "请选择身份证结束时间",
              trigger: "change"
            }
          ],
          handleChange: (value) => {
            if (
              value &&
              this.editForm.legalCertStartDate &&
              new Date(value).getTime() <
                new Date(this.editForm.legalCertStartDate).getTime()
            ) {
              this.editForm.legalCertExpire = ""
              this.$message.error("身份证有效期结束时间不应小于开始时间")
            }
          }
        },
        {
          label: "",
          checkboxLabel: "长期有效",
          name: "legalCertTimePermanent",
          type: "checkbox",
          style: {
            display: "inline-block",
            "margin-left": "15px"
          },
          handleChange: (value) => {
            if (value) {
              this.editForm.legalCertExpire = ""
              this.editForm.legalCertDateFlag = 1
              this.formList[
                this.findFormIdx("legalCertExpire")
              ].isDisabled = true
              this.formList[this.findFormIdx("legalCertExpire")].rules = []
            } else {
              this.editForm.legalCertDateFlag = 0
              this.formList[
                this.findFormIdx("legalCertExpire")
              ].isDisabled = false
              this.formList[this.findFormIdx("legalCertExpire")].rules = [
                {
                  required: true,
                  message: "请选择身份证结束时间",
                  trigger: "change"
                }
              ]
            }
          }
        },
        {
          label: "法人地址",
          name: "legalAddress",
          type: "input",
          rules: [
            { required: true, message: "请输入法人地址", trigger: "change" }
          ]
        },
        {
          label: "法人手持身份证照",
          name: "handIdCard",
          slotName: "handIdCard",
          // showAttrList: ['O'],
          type: "image"
          // rules: [{ required: true, message: '请上传身份证正面', trigger: 'change' }]
        },
        {
          label: "被授权人姓名",
          name: "unincorporatedName",
          type: "input",
          maxlength: 16,
          showForsettlement: [3],
          rules: [
            { required: true, message: "请输入被授权人姓名", trigger: "change" }
          ]
        },
        {
          label: "被授权人身份证号",
          name: "unincorporatedId",
          type: "input",
          showForsettlement: [3],
          rules: [
            {
              required: true,
              message: "请输入被授权人身份证号",
              trigger: "change"
            },
            checkIdCardObj
          ]
        },
        {
          label: "结算授权书",
          name: "powerOfAttorney",
          slotName: "powerOfAttorney",
          useDefaultImg: true,
          showForsettlement: [3],
          type: "image"
        },
        {
          label: "法人手持授权书",
          name: "powerOfLegal",
          slotName: "powerOfLegal",
          useDefaultImg: true,
          showForsettlement: [3],
          type: "image"
        },
        {
          isTitle: true,
          titleName: "收款账户"
        },
        // {
        //   label: '银行卡账户类型',
        //   name: 'bankAccountType',
        //   type: 'radio',
        //   showAttrList: ['O', 'C'],
        //   rules: [{ required: true, message: '请选择银行卡账户类型', trigger: 'change' }],
        //   radioOptList: [{
        //     value: 'corporate',
        //     label: '对公账户'
        //   }, {
        //     value: 'personal',
        //     label: '对私账户'
        //   }],
        //   handleChange: (value) => {
        //     this.$refs.editFormRef.$refs.editForm.validateField('bankAccountName')
        //   }
        // },
        {
          label: "开户许可证/印鉴卡",
          name: "accountLicenese",
          useDefaultImg: true,
          type: "image",
          slotName: "accountLicenese",
          // 根据currentPage不同,展示/隐藏
          // showAttrList: ['B', 'C']
          showForsettlement: [1]
        },
        {
          label: "结算账户正面信息",
          name: "bankCard",
          otherName: "bankCard",
          useDefaultImg: true,
          type: "image",
          slotName: "bankCard2",
          showForsettlement: [1]
        },
        {
          label: "银行卡正反面照",
          name: "bankCard",
          otherName: "bankCardBack",
          // showAttrList: ['O', 'C'],
          showForsettlement: [2, 3],
          type: "image",
          slotName: "bankCard",
          autoRecognitionFn: (imgUrl) => this.handleAutoRecognition(2, imgUrl)
        },
        {
          // label: {
          //   'O': '结算银行卡开户行',
          //   'C': '结算银行卡开户行',
          //   'B': '开户账户开户行'
          // },
          label: "开户账户开户行",
          name: "bankType",
          placeholder: {
            1: "开户行需与上传的开户许可证/印鉴卡照保持一致",
            2: "开户行需与上传的银行卡照保持一致",
            3: "开户行需与上传的银行卡照保持一致"
          },
          rules: [
            { required: true, message: "请选择开户行", trigger: "change" }
          ],
          type: "select",
          optionId: "bankType",
          optionLabel: "bankName",
          optionList: [],
          hanleSelectChange: (e, item) => {
            this.editForm.bankName = item.optionList.find(
              (i) => i.bankType === e
            ).bankName
            // console.log(this.editForm.bankName)
            this.formList[this.findFormIdx("openAccBankType")].optionList = []
            this.editForm.openAccBankType = ""
          }
        },
        {
          label: "开户支行",
          name: "openAccBankType",
          type: "filterSelect",
          placeholder: {
            1: "开户支行需与上传的开户许可证/印鉴卡照保持一致",
            2: "开户支行需与上传的银行卡照保持一致",
            3: "开户支行需与上传的银行卡照保持一致"
          },
          optionId: "branchBankType",
          optionLabel: "branchBankName",
          rules: [
            { required: true, message: "请选择开户支行", trigger: "change" }
          ],
          optionList: [],
          remoteMethod: (query, item) => {
            if (this.editForm.bankType) {
              var params = {
                currentPage: 1,
                pageSize: 200,
                keyword: query,
                bankName: this.editForm.bankName
              }
              getYseBankListApi(params).then((res) => {
                item.optionList = res.list
              })
            }
          },
          hanleSelectChange: (e, item) => {
            this.editForm.openAccBankName = item.optionList.find(
              (i) => i.branchBankType === e
            ).branchBankName
            this.getAreaInfoByOpenAccBankType(e)
          }
        },
        {
          label: "支行所属省市区",
          name: "bankCounty",
          slotName: "bankCounty",
          type: "other",
          rules: [
            { required: true, message: "请选择支行所属区", trigger: "change" }
          ],
          optionList: []
        },
        {
          // label: {
          //   'O': '结算银行卡号',
          //   'C': '结算银行卡号',
          //   'B': '账户号'
          // },
          label: "账户号",
          name: "bankAccountNo",
          type: "input",
          maxlength: 32,
          // placeholder: {
          //   'O': '请填写银行卡号,卡号需与上传的银行卡照一致',
          //   'C': '请填写银行卡号,卡号需与上传的银行卡照一致',
          //   'B': '卡号需与上传的开户许可证照一致'
          // },
          placeholder: {
            1: "卡号必须与上传的开户许可证/印鉴卡照一致",
            2: "卡号必须与上传的银行卡照一致",
            3: "卡号必须与上传的银行卡照一致"
          },
          rules: [
            { required: true, message: "请输入卡号", trigger: "change" },
            checkNumOrLetterObj
          ]
        },
        {
          // label: {
          //   'O': '结算银行卡用户名',
          //   'C': '结算银行卡用户名',
          //   'B': '账户名称'
          // },
          label: "账户名称",
          name: "bankAccountName",
          type: "input",
          placeholder: {
            1: "名称必须与上传的开户许可证/印鉴卡照一致",
            2: "名称必须与上传的银行卡照一致",
            3: "名称必须与上传的银行卡照一致"
          },
          // showForsettlement: [1],
          rules: [
            { required: true, message: "请输入账户名称", trigger: "change" },
            {
              required: true,
              validator: (rule, value, callback) => {
                if (
                  this.editForm.legalName &&
                  this.editForm.bankAccountType === "personal" &&
                  this.editForm.legalName !== value
                ) {
                  callback(
                    new Error(
                      (this.custType !== "B"
                        ? "结算银行卡用户名"
                        : "账户名称") + "需与法人姓名一致"
                    )
                  )
                }
                callback()
              },
              trigger: "change"
            }
          ]
        },
        {
          label: "银行预留手机号",
          name: "bankTelephoneNo",
          // 根据currentPage不同,展示/隐藏
          // showAttrList: ['O', 'C'],
          type: "input",
          maxlength: "11",
          placeholder: "手机号必须是银行卡预留手机号",
          rules: [
            {
              required: true,
              message: "请输入银行预留手机号",
              trigger: "change"
            },
            checkPhoneObj
          ]
        },
        {
          isTitle: true,
          titleName: "签约信息"
        },
        {
          label: "门头照",
          name: "doorHead",
          useDefaultImg: true,
          type: "image",
          slotName: "doorHead"
        },
        {
          label: "经营场所图",
          name: "businessPremiese",
          otherName: "businessPremieseTwo",
          useDefaultImg: true,
          type: "image",
          slotName: "businessPremiese"
        },
        {
          label: "签约类型",
          name: "contractType",
          type: "radio",
          radioOptList: [
            {
              value: 1,
              label: "线下签约"
            }
            // {
            //   value: 2,
            //   label: '电子签约'
            // }
          ],
          rules: [
            { required: true, message: "请选择签约类型", trigger: "change" }
          ],
          handleRadioChange: () => {
            // // 验证码清空
            // this.isSend = false
            // this.time && clearTimeout(this.time)
            // // 写入切换后的Obj
            // this.editForm = this[this.typeToForm[this.custType]]
            // this.afterChangePic()
            // this.recoveryOpenAccBank()
            // this.markCustType = this.custType
          }
        },
        {
          label: "客户协议书",
          name: "clientAgreement",
          otherName: "clientAgreementTwo",
          useDefaultImg: true,
          type: "image",
          slotName: "clientAgreement",
          showForContractType: [1]
        },
        {
          label: "签约人手机号",
          name: "contractorPhone",
          type: "input",
          maxlength: "11",
          showForContractType: [2],
          rules: [
            {
              required: true,
              message: "请输入签约人手机号",
              trigger: "change"
            },
            checkPhoneObj
          ]
        },
        {
          label: "操作人手机号",
          name: "operPhone",
          type: "input",
          maxlength: "11",
          rules: [
            {
              required: true,
              message: "请输入操作人手机号",
              trigger: "change"
            },
            checkPhoneObj
          ]
        },
        {
          label: "操作人手机号验证码",
          name: "smsCode",
          type: "",
          slotName: "smsCode",
          rules: [
            {
              required: true,
              message: "请输入操作人手机号验证码",
              trigger: "change"
            }
          ]
        }
      ],
      baseDate: {},

      provincesAndCities_options: []
    }
  },

  components: {
    editForm,
    glUploadImg
  },

  mounted() {
    if (this.$route.params.merchantId) {
      this.targetAccount = this.$route.params
      sessionStorage.setItem(
        this.sessionName,
        JSON.stringify(this.$route.params)
      )
    } else {
      Object.assign(
        this.targetAccount,
        JSON.parse(sessionStorage.getItem(this.sessionName))
      )
    }
    // console.log(this.formList)
    // 小微商户Obj
    this.microEditForm = {
      custType: "O",
      anotherName: "",
      ...deepClone(this.editForm),
      // ...(deepClone(this.OCeditForm)),
      settlementType: "2"
    }
    // 个体商户Obj
    this.customerEditForm = {
      custType: "C",
      ...deepClone(this.editForm),
      // ...(deepClone(this.OCeditForm)),
      ...deepClone(this.BCeditForm)
    }
    // 企业商户Obj
    this.businessEditForm = {
      custType: "B",
      // bankAccountType: 'corporate',
      ...deepClone(this.editForm),
      ...deepClone(this.BCeditForm)
    }
    this.editForm = this[this.typeToForm[this.custType]]

    this.getBankList()
    this.getAreaInfo()
    // 编辑 - 恢复数据
    this.getDetail()
  },

  methods: {
    ...mapActions({
      close: "d2admin/page/close"
    }),
    // 获取详情,数据恢复
    getDetail() {
      getDetailApi({ merchantId: this.targetAccount.merchantId }).then(
        (res) => {
          // console.log(res)
          if (res.yseMerchantInfo) {
            this.custType = res.yseMerchantInfo.custType
            this.markCustType = res.yseMerchantInfo.custType
            this.editForm = this[this.typeToForm[this.custType]]

            // 需要写入editForm的属性
            var needAttrList = ["bankName", "openAccBankName"]
            // 返回res的对象属性
            var resObj = deepClone({
              ...res.bankInfo,
              ...res.serviceMerchant,
              ...res.yseMerchantInfo
            })
            console.log(resObj)

            this.formList.forEach((item, index) => {
              if (item.hasOwnProperty("type") && item.type !== "image") {
                if (item.hasOwnProperty("showAttrList")) {
                  item.showAttrList.includes(this.custType) &&
                    needAttrList.push(item.name)
                } else {
                  needAttrList.push(item.name)
                }
              }
            })

            // 额外写入editForm的属性
            var otherAttrList = ["bankProvince", "bankCity"]
            needAttrList = [...needAttrList, ...otherAttrList]
            // needAttrList = needAttrList.concat(otherAttrList)
            // console.log('needAttrList')
            // console.log(needAttrList)

            // 文字恢复
            needAttrList.forEach((item) => {
              // this.editForm[item] = resObj[item] || ''
              if (resObj[item]) {
                this.editForm[item] = resObj[item]
              } else {
                this.editForm[item] = resObj[item] == 0 ? resObj[item] : ""
              }
            })
            // 企业地址省市区
            this.editForm.provincesAndCities = [
              res.yseMerchantInfo.provinceCode,
              res.yseMerchantInfo.cityCode,
              res.yseMerchantInfo.countyCode
            ]
            // 身份证有效期
            if (res.yseMerchantInfo.legalCertStartDate) {
              const startDate = res.yseMerchantInfo.legalCertStartDate
              this.$set(
                this.editForm,
                "legalCertStartDate",
                startDate.slice(0, 4) +
                  "-" +
                  startDate.slice(4, 6) +
                  "-" +
                  startDate.slice(6)
              )
            }
            if (res.yseMerchantInfo.legalCertExpire) {
              const endDate = res.yseMerchantInfo.legalCertExpire
              this.$set(
                this.editForm,
                "legalCertExpire",
                endDate.slice(0, 4) +
                  "-" +
                  endDate.slice(4, 6) +
                  "-" +
                  endDate.slice(6)
              )
            }
            if (res.yseMerchantInfo.legalCertDateFlag == 1) {
              this.editForm.legalCertTimePermanent = true
              this.formList[
                this.findFormIdx("legalCertTimePermanent")
              ].handleChange(true)
            }
            // 营业有效期
            if (res.yseMerchantInfo.busLicenseStartDate) {
              const startDate = res.yseMerchantInfo.busLicenseStartDate
              this.$set(
                this.editForm,
                "busLicenseStartDate",
                startDate.slice(0, 4) +
                  "-" +
                  startDate.slice(4, 6) +
                  "-" +
                  startDate.slice(6)
              )
            }
            if (res.yseMerchantInfo.busLicenseExpire) {
              const endDate = res.yseMerchantInfo.busLicenseExpire
              this.$set(
                this.editForm,
                "busLicenseExpire",
                endDate.slice(0, 4) +
                  "-" +
                  endDate.slice(4, 6) +
                  "-" +
                  endDate.slice(6)
              )
            }
            if (res.yseMerchantInfo.busLicenseDateFlag == 1) {
              this.editForm.busLicenseTimePermanent = true
              this.formList[
                this.findFormIdx("busLicenseTimePermanent")
              ].handleChange(true)
            }
            // 开户行列表恢复
            this.recoveryOpenAccBank()
            // 支行所属区域列表恢复
            if (this.editForm.openAccBankType) {
              this.getAreaInfoByOpenAccBankType(this.editForm.openAccBankType)
            }
            // 图片恢复
            var picKeys = Object.keys(this.picObj)
            var keytoPic = {}
            picKeys.forEach((item) => {
              keytoPic[this.picObj[item].attrName] = item
            })

            var isOldLen = res.papersList.filter(
              (item) => item.papersType == "31"
            ).length

            if (isOldLen == 2) {
              var idx = res.papersList.findIndex(
                (item) => item.papersType == "31"
              )
              res.papersList[idx].papersType = "A012"
            }

            res.papersList.forEach((item) => {
              // this.editForm.papers.hasOwnProperty(item.papersType) && (item.papersType = 'need_' + item.papersType)
              this.editForm.papers[item.papersType] = item.imgUrl
              this.picObj[keytoPic[item.papersType]].url = item.imgUrl
            })

            console.log(this.editForm)
            this.failMessage = res.yseMerchantInfo.failMessage
            // this.editForm.busLicenseTimePermanent = true
            // this.formList[this.findFormIdx('busLicenseTimePermanent')].handleChange(true)
          }
        }
      )
    },
    // 获取省市区信息
    getAreaInfo() {
      getAreaInfoApi({ areaType: "2" }).then((res) => {
        this.provincesAndCities_options = res.areaList
      })
    },
    // 开户行
    getBankList() {
      getBankListApi({}).then((res) => {
        this.formList[this.findFormIdx("bankType")].optionList = res
      })
    },
    // 根据开户支行编号查询区域信息
    getAreaInfoByOpenAccBankType(code) {
      getAreaInfoByOpenAccBankTypeApi({ openAccBankType: code }).then((res) => {
        this.formList[this.findFormIdx("bankCounty")].optionList = res.areaList
        this.editForm.bankProvince = res.province
        this.editForm.bankCity = res.city
      })
    },

    // 支行
    getYseBankList() {},
    // 找到在formList的位置,通过name来匹配
    findFormIdx(name) {
      return this.formList.findIndex((item) => item.name === name)
    },
    // 切换radio后,将obj里面的图片写入editForm
    afterChangePic() {
      // this[this.typeToForm[this.custType]]
      var picKeys = Object.keys(this.picObj)
      picKeys.forEach((item) => {
        var targetTem = this.picObj[item]
        if (
          Object.keys(this[this.typeToForm[this.custType]].papers).includes(
            targetTem.attrName
          )
        ) {
          this.picObj[item].url =
            this[this.typeToForm[this.custType]].papers[targetTem.attrName]
        } else {
          this.$set(this.picObj[item], "url", "")
        }
      })
      // console.log(this.picObj)
    },
    // 切换radio/编辑,开户行恢复opt数据
    recoveryOpenAccBank() {
      this.formList[this.findFormIdx("openAccBankType")].optionList = this
        .editForm.openAccBankType
        ? [
            {
              branchBankType: this.editForm.openAccBankType,
              branchBankName: this.editForm.openAccBankName
            }
          ]
        : []
    },
    // 上传/删除图片后,将图片的值写入Obj中
    // writeToEditForm(attrName, isAdd = true) {
    //   isAdd
    //     ? (this.editForm.papers[this.picObj[attrName].attrName] = this.picObj[attrName].url)
    //     : delete this.editForm.papers[this.picObj[attrName].attrName]
    // },
    handleImgChange({ file, attrName, targetItem }) {
      var hasFnList = [
        "idCard",
        "idCardBack",
        "bankCard",
        "businessLicense",
        "authorizerIdCard"
      ]
      var reader = new FileReader()
      var fileInfo = file.raw
      reader.readAsDataURL(fileInfo)
      reader.onload = (e) => {
        const imgFile = e.target.result
        // const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
        const base64 =
          fileInfo.name.split(".")[fileInfo.name.split(".").length - 1] +
          "@" +
          imgFile.split(",")[1]
        uploadImg({ file: base64 }).then((res) => {
          this.picObj[attrName].url = res
          this.editForm.papers[this.picObj[attrName].attrName] =
            this.picObj[attrName].url
          // this.writeToEditForm(attrName)
          // this.$refs.editFormRef.$refs.editForm.clearValidate(targetItem.name)
          if (hasFnList.includes(attrName)) {
            targetItem.autoRecognitionFn &&
              targetItem.autoRecognitionFn(res, attrName)
          }
        })
      }
    },
    handleImgRemove({ attrName, targetItem }) {
      this.picObj[attrName].url = ""
      delete this.editForm.papers[this.picObj[attrName].attrName]
      // this.writeToEditForm(attrName, false)
      // this.$refs.editFormRef.$refs.editForm.validateField(targetItem.name)
    },
    handlePreview(file, attrName) {
      // console.log(file)
      // console.log(attrName)
    },
    // 验证码
    handleSend() {
      sendToSmsCodeApi({ phone: this.editForm.operPhone }).then((res) => {
        this.notice.okTips("已发送,30分钟内有效")
        this.isSend = true
        this.showtips = true
        this.sendMsg = 60
        this.msgDown()
      })
    },
    msgDown() {
      this.time = setTimeout(() => {
        clearTimeout(this.time)
        if (this.sendMsg > 1) {
          --this.sendMsg
          this.msgDown()
        } else {
          this.isSend = false
        }
      }, 1000)
    },
    // 自动识别type - 识别类型(1:身份证;2:银行卡;3:营业执照);imgUrl - 图片地址; attrName-当类型都是身份证时区分法人或被授权人
    handleAutoRecognition(type, imgUrl, attrName) {
      // console.log(type)
      // console.log(imgUrl)
      // console.log(attrName)

      imgRecognitionApi({ type: type, imgUrl: imgUrl }).then((res) => {
        var sexShow = { 男: 0, 女: 1 }
        // 身份证正面
        if (type === 1 && !res.issueDate) {
          if (attrName == "authorizerIdCard") {
            res.name && this.$set(this.editForm, "unincorporatedName", res.name)
            res.cardNo &&
              this.$set(this.editForm, "unincorporatedId", res.cardNo)
          } else {
            res.name && this.$set(this.editForm, "legalName", res.name)
            res.cardNo && this.$set(this.editForm, "legalCertNo", res.cardNo)
            res.sex && this.$set(this.editForm, "legalGender", sexShow[res.sex])
            res.sex && this.$set(this.editForm, "legalAddress", res.address)
          }
        } else if (type === 1 && (res.issueDate || res.expiryDate)) {
          // 身份证反面
          this.$set(
            this.editForm,
            "legalCertStartDate",
            res.issueDate.length === 8
              ? res.issueDate.slice(0, 4) +
                  "-" +
                  res.issueDate.slice(4, 6) +
                  "-" +
                  res.issueDate.slice(6)
              : ""
          )
          this.$set(
            this.editForm,
            "legalCertExpire",
            res.expiryDate.length === 8
              ? res.expiryDate.slice(0, 4) +
                  "-" +
                  res.expiryDate.slice(4, 6) +
                  "-" +
                  res.expiryDate.slice(6)
              : ""
          )
        } else if (type === 2 && res.cardNo) {
          // 银行卡
          this.$set(this.editForm, "bankAccountNo", res.cardNo)
        } else if (type === 3) {
          // 营业执照
          res.name && this.$set(this.editForm, "busLicenceName", res.name)
          res.registerNumber &&
            this.$set(this.editForm, "busLicense", res.registerNumber)
          if (res.establishDate || res.validPeriod) {
            var startDate =
              res.establishDate.length === 11
                ? res.establishDate
                    .replace(/['年', '月', '日']/g, "-")
                    .slice(0, res.establishDate.length - 1)
                : ""
            var endDate =
              res.validPeriod.length === 11
                ? res.validPeriod
                    .replace(/['年', '月', '日']/g, "-")
                    .slice(0, res.validPeriod.length - 1)
                : ""
            this.$set(this.editForm, "busLicenseStartDate", startDate)
            this.$set(this.editForm, "busLicenseExpire", endDate)
          }
          res.address && this.$set(this.editForm, "companyAddr", res.address)
        }
      })
    },
    getParams() {
      // 获取企业省市
      this.getProvincesAndCities()
      var params = deepClone(this.editForm)
      params.merchantId = this.targetAccount.merchantId
      // 身份证日期
      params.legalCertStartDate &&
        (params.legalCertStartDate = params.legalCertStartDate.replace(
          /-/g,
          ""
        ))
      params.legalCertExpire &&
        (params.legalCertExpire = params.legalCertExpire.replace(/-/g, ""))
      // 营业时间
      params.busLicenseStartDate &&
        (params.busLicenseStartDate = params.busLicenseStartDate.replace(
          /-/g,
          ""
        ))
      params.busLicenseExpire &&
        (params.busLicenseExpire = params.busLicenseExpire.replace(/-/g, ""))
      // 处理图片
      var picKeys = Object.keys(params.papers)
      picKeys.forEach((item) => {
        if (item.includes("need_")) {
          const addToAttr = item.split("_")[1]
          params.papers[addToAttr] =
            (picKeys.includes(addToAttr) ? params.papers[addToAttr] : "") +
            "|" +
            params.papers[item]
          delete params.papers[item]
        }
      })

      return params
    },

    jumpScroll(idName) {
      console.log(idName)
      document.getElementById(idName).scrollIntoView()
    },
    // 确认
    handleConfirm() {
      var params = this.getParams()
      // var picKeys = Object.keys(this.picObj)
      // debugger
      // const limitList = ['showForsettlement', 'showAttrList', 'showContractType']
      for (const key in this.picObj) {
        const obj = this.picObj[key]
        if (!obj.url) {
          if (obj.validate) {
            const name = obj.validate.name
            const list = obj.validate.list
            if (list.includes(params[name])) {
              return this.jumpScroll(key)
            }
          } else {
            console.log(key)
            return this.jumpScroll(key)
          }
        }
      }

      // for (var item of picKeys) {
      //   if (!this.picObj[item].url) {
      //     if (!this.picObj[item].hasOwnProperty('showAttrList')) {
      //       console.log(item)
      //       this.jumpScroll(item)
      //       return true
      //     }
      //     if (this.picObj[item].showAttrList.includes(this.custType)) {
      //       console.log(item)
      //       this.jumpScroll(item)
      //       return true
      //     }
      //   }
      // }
      // console.log(params)
      registerYseMerchantApiNew(params).then((res) => {
        this.notice.okTips()
        this.handleCancel()
      })
    },
    // 存草稿
    handleDraft() {
      var params = this.getParams()
      // return console.log(params)
      draftYseMerchantApiNew(params).then((res) => {
        this.notice.okTips()
        this.handleCancel()
      })
    },
    // 删除session
    deleteSession() {
      sessionStorage.removeItem(this.sessionName)
    },
    // 取消
    handleCancel() {
      this.isSend = false
      this.time && clearTimeout(this.time)
      this.deleteSession()
      this.close({ tagName: "/accountList_new" })
      this.$router.push({ name: "accountList_new" })
      this.close({ tagName: "/applyAccount_new" })
    },

    lookDemo() {
      // public 文件需要使用绝对路径引入
      this.lookUrl = `${process.env.VUE_APP_PUBLIC_PATH}account/hetong.png`
      this.lookImgVisible = !this.lookImgVisible
    },

    getProvincesAndCities() {
      const nodesInfo = this.$refs.cascader.getCheckedNodes()

      if (
        nodesInfo.length == 0 ||
        Object.prototype.toString.call(nodesInfo[0]) != "[object Object]"
      ) {
        return
      }
      console.log(nodesInfo)
      this.editForm.provinceCode = nodesInfo[0].pathNodes[0].value
      this.editForm.province = nodesInfo[0].pathNodes[0].label
      this.editForm.cityCode = nodesInfo[0].pathNodes[1].value
      this.editForm.city = nodesInfo[0].pathNodes[1].label
      this.editForm.countyCode = nodesInfo[0]?.pathNodes[2]?.value || ""
      this.editForm.county = nodesInfo[0]?.pathNodes[2]?.label || ""
      // this.editForm.countyCode = nodesInfo[0].pathNodes[2].value
      // this.editForm.county = nodesInfo[0].pathNodes[2].label
    }
  }
}
</script>
<style>
.apply-account .flex {
  display: flex;
  align-items: flex-start;
  /* flex-direction: column; */
}

.idImg {
  width: 400px;
  display: flex;
  flex-direction: column;
}

.idItem {
  display: flex;
  align-items: flex-start;
  color: #999999;
  /* margin-bottom: 20px; */
}

.idItem + .idItem {
  margin-top: 20px;
}

#authorizerIdCard,
#idCard {
  width: 160px;
  box-sizing: border-box;
  /* margin-right: 25px; */
}

.apply-account .flex .gl-upload-img {
  color: #999999;
  margin-right: 20px;
  text-align: center;
}

/* #idCard {

} */
.apply-account .img-explain {
  display: inline-block;
  width: 220px;
  font-size: 12px;
  color: #2a58ad;
  line-height: 16px;
  /* margin-top: 20px; */
}

.idImg .img-explain {
  margin-top: 20px;
  width: 400px;
}

.demo_a {
  text-decoration: underline !important;
  cursor: pointer;
  font-weight: bold;
}

.areaPadding {
  padding-left: 20px;
  padding-right: 20px;
}
</style>