addextrainfo.js 93.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 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 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583
// pages/main/addtionalreduce/addextrainfo/addextrainfo.js
var format = require('../../../../utils/util.js');
var countryInfo = require('../../../../utils/country.js');
var OSSInit;
var app = getApp();
var baseUrl = app.globalData.baseUrl;
const AddTypeNames = {
  'children_education': '子女教育',
  'continuing_education': '继续教育',
  'support_duty': '被赡养老人',
  'medical_fund': '大病医疗支出',
  'house_fund': '住房租金'
}
const Deduce_amounts_month = {
  'children_education': 1000,
  'continuing_education': 400,
  'support_duty': 2000,
  'medical_fund': 0,
  'house_fund_rent': 1000,
  "house_fund_loan":1000
}
const Deduce_amounts_year = {
  'children_education': 12000,
  'continuing_education': 4800,
  'continuing_education_non': 3600,
  'support_duty': 24000,
  'medical_fund': 0,
  'house_fund_rent': 12000,
  "house_fund_loan": 12000
}

Page({
  idcard_belong: null, //照片信息获取返回时判断所属
  legal_entity_id: "",
  legal_entity: "",
  supporttype:"",
  is_single:"",
  share_method:"",
  isEdit:false,
  edit_id:null,
  data: {
    hasLover:false,
    hasGetLover:false,
    house_type: "",
    deduction_amount: '',
    lable: 0,
    title: '',
    isIdCard: true,
    workAddress_haschanged: false,
    loanAddress_haschanged: false,
    rentAddress_haschanged: false,
    extrainfo_arr: ["请上传子女出生证明、学籍信息凭证、学费凭证、本人结婚证和分摊协议", "请上传学历学籍凭证", "请上传出生证明或关系证明、独生子女证、分摊协议、其他法定赡养人赡养证明", "请上传诊断书和医疗费用收据", "请上传首套房证明、还款证明、不动产登记证、结婚证和夫妻约定抵扣协议"],
    cur_index: '',

    hasLoverData: {
      label: '是否有配偶',
      isrequre: true,
      bindtype: 'hasLover',
      selected: '',
      isblack: 'true',
      placeholder: '请选择',
      values: ['是', '否'],
      onChange: 'onPickerSelect'
    },
    lovercardtypeData: {
      label: '配偶证照类型',
      bindtype: 'lovercardtype',
      selected: '居民身份证',
      disabled: true,
      placeholder: '请选择证照类型',
      values: ["居民身份证", "军官证", '士兵证', '武警警官证', '港澳居民来往内地通行证', '外交官证', '中国护照',
        '外国护照', '香港永久性居民身份证', '澳门特别行政区永久性居民身份证', '台湾身份证', '台湾居民来往大陆通行证', '外国人永久居留证'
      ],
      onChange: 'onPickerSelect'
    },
    loverbirthDate: {
      label: '出生日期',
      bindtype: 'loverbirthday',
      selected: '',
      disabled: true,
      placeholder: '请选择出生日期',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      end: '2018-01-01',
      onChange: 'onPickerSelect',
    },
    older_relativeData: {
      label: '与纳税人关系',
      isrequre: true,
      // disabled: true,
      bindtype: 'older_relative',
      selected: "",
      isblack: 'true',
      placeholder: '请选择与纳税人关系',
      values: ["父母", "其他"],
      onChange: 'onPickerSelect'
    },
    taxperson_relativeData: {
      label: '与纳税人的关系',
      isrequre: true,
      bindtype: 'taxperson_relative',
      selected: '',
      isblack: 'true',
      placeholder: '请选择与纳税人的关系',
      values: ["本人", "配偶", "子女"],
      onChange: 'onPickerSelect'
    },
    childrenpercentData: {
      label: '分配比例',
      bindtype: 'child_percent',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["0%", "50%", "100%"],
      placeholder: '请选择分配比例',
      onChange: 'onPickerSelect'
    },
    childrencardtypeData: {
      label: '子女证照类型',
      isrequre: true,
      bindtype: 'childrencardtype',
      selected: '居民身份证',
      disabled: true,
      isblack: 'true',
      placeholder: '请选择证照类型',
      values: ["居民身份证", "军官证", '士兵证', '武警警官证', '港澳居民来往内地通行证', '外交官证', '中国护照',
        '外国护照', '香港永久性居民身份证', '澳门特别行政区永久性居民身份证', '台湾身份证', '台湾居民来往大陆通行证', '外国人永久居留证'
      ],
      onChange: 'onPickerSelect'
    },
    commonbirthDate: {
      label: '出生日期',
      isrequre: true,
      disabled:true,
      bindtype: 'commonbirthday',
      selected: '',
      isblack: 'true',
      placeholder: '出生日期',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      end: '2018-01-01',
      onChange: 'onPickerSelect',
    },
    childedudegreeData: {
      label: '子女受教育阶段',
      isrequre: true,
      bindtype: 'child_edu_degree',
      selected: '',
      isblack: 'true',
      // values: ["学前教育(满3岁)", "小学教育", "初中教育", "普通高中教育", "中等职业教育", "大学专科教育", "大学本科教育", "硕士研究生教育", "博士研究生教育"],
      values: ["学前教育阶段", "义务教育", "高中阶段教育", "高等教育"],
      placeholder: '请选择教育阶段',
      onChange: 'onPickerSelect'
    },
    // edudegreeData: {
    //   label: '教育阶段',
    //   bindtype: 'edu_degree',
    //   selected: '',
    //   isblack: 'true',
    //   values: ["专科", "本科", "硕士研究生", "博士研究生","其他"],
    //   placeholder: '请选择教育阶段',
    //   onChange: 'onPickerSelect'
    // },
    edutypeData: {
      label: '继续教育情况',
      isrequre: true,
      bindtype: 'edu_type',
      selected: '',
      isblack: 'true',
      values: ["学历(学位)继续教育", "职业资格继续教育"],
      placeholder: '请选择教育情况',
      onChange: 'onPickerSelect'
    },
    edustyleData: {
      label: '继续教育类型',
      isrequre: true,
      bindtype: 'edu_style',
      selected: '',
      isblack: 'true',
      values: ["技能人员职业资格", "专业技术人员职业资格"],
      placeholder: '请选择教育类型',
      onChange: 'onPickerSelect'
    },
    certificateDate: {
      label: '证书名称',
      maxWidth: 460,
      isrequre: true,
      bindtype: 'certificate',
      values: [],
      placeholder: '请输入证书名称',
      onChange: 'onPickerSelect'
    },
    edulevelData: {
      label: '教育阶段',
      isrequre: true,
      bindtype: 'edu_level',
      selected: '',
      isblack: 'true',
      // values: ["专科", "本科", "硕士研究生", "博士研究生", "其他"],
      values: ["大学专科", "大学本科", "硕士研究生", "博士研究生", "其他"],
      placeholder: '请选择学历教育阶段',
      onChange: 'onPickerSelect'
    },
    // supporttypeData: {
    //   label: '赡养类型',
    //   isrequre: true,
    //   bindtype: 'support_type',
    //   selected: '',
    //   isblack: 'true',
    //   values: ["独生子女", "非独生子女"],
    //   placeholder: '请选择赡养类型',
    //   onChange: 'onPickerSelect'
    // },
    shareMethodData: {
      label: '分摊方式',
      isrequre: true,
      bindtype: 'share_method',
      selected: '',
      isblack: 'true',
      values: ["赡养人平均分摊", "赡养人约定分摊", "被赡养人指定分摊"],
      placeholder: '请选择分摊方式',
      onChange: 'onPickerSelect'
    },
    oldercardtypeData: {
      label: '被赡养人证照类型',
      isrequre: true,
      disabled: true,
      bindtype: 'oldercardtype',
      selected: '居民身份证',
      isblack: 'true',
      placeholder: '请选择被赡养人证照类型',
      values: ["居民身份证", "军官证", '士兵证', '武警警官证', '港澳居民来往内地通行证', '外交官证', '中国护照',
        '外国护照', '香港永久性居民身份证', '澳门特别行政区永久性居民身份证', '台湾身份证', '台湾居民来往大陆通行证', '外国人永久居留证'
      ],
      onChange: 'onPickerSelect'
    },
    cardtypeData: {
      label: '证照类型',
      isrequre: true,
      bindtype: 'cardtype',
      selected: '居民身份证',
      disabled: true,
      isblack: 'true',
      placeholder: '证照类型',
      values: ["居民身份证", "军官证", '士兵证', '武警警官证', '港澳居民来往内地通行证', '外交官证', '中国护照',
        '外国护照', '香港永久性居民身份证', '澳门特别行政区永久性居民身份证', '台湾身份证', '台湾居民来往大陆通行证', '外国人永久居留证'
      ],
      onChange: 'onPickerSelect'
    },
    olderbirthDate: {
      label: '被赡养人出生日期',
      isrequre: true,
      disabled: true,
      bindtype: 'olderbirthday',
      selected: '',
      isblack: 'true',
      placeholder: '出生日期',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      end: '2018-01-01',
      onChange: 'onPickerSelect',
    },
    beforemarryData: {
      label: '是否首套婚前贷款且婚后分别扣除50%',
      bindtype: 'before_marry',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择',
      onChange: 'onPickerSelect'
    },
    isselfData: {
      label: '是否本人借款',
      bindtype: 'is_self_loan',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择',
      onChange: 'onPickerSelect'
    },
    reducetypeData: {
      label: '扣除方式',
      isrequre: false,
      disabled: true,
      bindtype: 'reduce_type',
      selected: '',
      values: ["月度", "年度"],
      placeholder: '请选择扣除方式',
      onChange: 'onPickerSelect'
    },
    studystartdate: {
      label: '受教育时间起',
      isrequre: true,
      bindtype: 'study_start_date',
      selected: '',
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择时间',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "month",
      datelong: 0,
      start: '1970-01-01',
      end: (new Date()).getFullYear() +'-'+ ((new Date()).getMonth()+1),
      // start: (new Date()).getFullYear() + '-09-01',//'1970-01-01',
      // end: (new Date()).getFullYear() + '-09-01',
      // onTap: 'studyDataTap'
    },
    studyEndDate: {
      label: '受教育时间止',
      // isrequre: true,
      bindtype: 'study_end_date',
      selected: '',
      // isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择时间',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "month",
      start: '1970-01-01',
      // start: (new Date()).getFullYear() + '-09-01',//'1970-01-01',
      // end: (new Date()).getFullYear() + '-09-01',
      // onTap: 'studyDataTap'
    },
    studyPeriodDate: {
      label: '教育终止时间',
      // isrequre: true,
      bindtype: 'study_per_date',
      selected: '',
      values: ["是", "否"],
      placeholder: '请选择时间',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "month",
      start: '1970-01-01',
      // start: (new Date()).getFullYear() + '-07-31',//'1970-01-01',
      // end: (new Date()).getFullYear() + '-07-31',
      // onTap: 'studyDataTap',
      datelong: 0,
    },
    applydate: {
      label: '发证(批准)日期',
      isrequre: true,
      bindtype: 'apply_date',
      selected: '',
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择时间',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      datelong: 0,
    },
    identifytypeData: {
      label: '证书类型',
      bindtype: 'identify_type',
      selected: '',
      isrequre: true,
      isblack: 'true',
      // values: ["产权证", "不动产权登记证", "出售合同号", "预售合同号"],
      values: ["房屋所有权证", "不动产权证", "房屋买卖合同", "房屋预售合同"],
      placeholder: '请选择证书类型',
      onChange: 'onPickerSelect'
    },
    loantypeData: {
      label: '贷款类型',
      bindtype: 'loan_type',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["公积金贷款", "商业贷款","组合贷款"],
      placeholder: '请选择贷款类型',
      onChange: 'onPickerSelect'
    },
    leasetypeData: {
      label: '出租方类型',
      bindtype: 'lease_type',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["企业", "个人"],
      placeholder: '请选择出租方类型',
      onChange: 'onPickerSelect'
    },
    workingcityInfo: {
      label: '主要工作城市',
      maxWidth: 430,
      mode: 'region',
      isrequre: true,
      bindtype: 'working_city',
      isblack: 'true',
      address_code: ['', ''],
      address_value: ['', ''],
      selected: '',
      placeholder: '请选择城市',
      requestdata: {},
      onChange: 'onPickerSelect'
    },
    houseLocateInfo: {
      label: '房屋坐落地址',
      mode: 'region',
      maxWidth: 430,
      // isrequre: true,
      bindtype: 'house_locate',
      // isblack: 'true',
      address_code: ['', '', ''],
      address_value: ['', '', ''],
      selected: '',
      requestdata: {},
      placeholder: '请选择地址',
      onChange: 'onPickerSelect'
    },
    rentLocateInfo: {
      label: '租赁房屋坐落地址',
      mode: 'region',
      // isrequre: true,
      maxWidth: 375,
      bindtype: 'rent_house_locate',
      // isblack: 'true',
      address_code: ['', '', ''],
      address_value: ['', '', ''],
      selected: '',
      requestdata: {},
      placeholder: '请选择地址',
      onChange: 'onPickerSelect'
    },
    firstpaybackDate: {
      label: '首次还款日期',
      bindtype: 'payback_date',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择日期',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      datelong: 0,
    },
    firstpaybackDate_2: {
      label: '首次还款日期',
      bindtype: 'payback_date_2',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择日期',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      datelong: 0,
    },
    leasestartDate: {
      label: '租赁期起',
      bindtype: 'lease_start_date',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择日期',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      datelong: 0,
    },
    leaseendDate: {
      label: '租赁期止',
      bindtype: 'lease_end_date',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["是", "否"],
      placeholder: '请选择日期',
      onChange: 'onPickerSelect',
      mode: "date",
      fields: "day",
      start: '1970-01-01',
      datelong: 0,
    },
    loandatelongData: {
      label: '贷款期限(月数)',
      bindtype: 'loan_datelong',
      selected: '',
      isrequre: true,
      isblack: 'true',
      values: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
      placeholder: '请选择贷款期限',
      onChange: 'onPickerSelect'
    },
    schoolCountryData: {
      label: '就读国家(地区)',
      bindtype: 'school_country',
      isrequre: true,
      selected: '中国',
      isblack: 'true',
      values: [],
      placeholder: '中国',
      onChange: 'onPickerSelect',
    },
    // bankInfo: {
    //   label: '公积金贷款银行',
    //   bindtype: 'bank',
    //   maxWidth: 400,
    //   isrequre: true,
    //   placeholder: '请选择贷款银行',
    //   selected: '',
    //   values: [],
    //   onChange: 'onPickerSelect'
    // },
    // bankInfo_2: {
    //   label: '商业贷款银行',
    //   bindtype: 'bank_2',
    //   maxWidth: 430,
    //   isrequre: true,
    //   placeholder: '请选择贷款银行',
    //   selected: '',
    //   values: [],
    //   onChange: 'onPickerSelect'
    // },
    edu_lable: "school",
    oldersupport_lable: "",
    img_path: "/images/upload_img.png"
  },

  /**
   * Lifecycle function--Called when page load
   */
  onLoad: function(options) {

    this.getTaxHostInfo()
    var pages = getCurrentPages()
    var frontPage = pages[pages.length - 2]
    console.log('---------frontPage', frontPage.data)
    console.log("options", options);
    const nameKey = options.status
    var title = AddTypeNames[nameKey]

    this.legal_entity_id = frontPage.data.legal_entity_id
    this.legal_entity = frontPage.data.legal_entity

    var reduce_typeData = this.data.reducetypeData
    var deduction_amount, house_type=''
    if (options.reducetype == '月度') {
      reduce_typeData.selected = '月度'
      //   deduction_amount = Deduce_amounts_month[nameKey] ? Deduce_amounts_month[nameKey] : 0
    } else {
      reduce_typeData.selected = '年度'
      //   deduction_amount = Deduce_amounts_year[nameKey] ? Deduce_amounts_year[nameKey] : 0
    }
    if ("children_education" == options.status) {
      this.loadCountry()
      if (options.isedit != 'true'){
        this.getTaxList()
      }
    } else if ("continuing_education" == options.status) {
      this.getCertificates()
      var studystart_date = this.data.studystartdate
      studystart_date.label = "入学时间起"
      var studyend_date = this.data.studyEndDate
      studyend_date.label = "(预计)毕业时间"
      studyend_date.isrequre = true
      this.setData({
        studystartdate: studystart_date,
        studyEndDate: studyend_date
      })
    } else if ("medical_fund" == options.status) {
      var cardtype_data = this.data.cardtypeData
      cardtype_data.label = "病人证照类型"
      var commonbirth_date = this.data.commonbirthDate
      commonbirth_date.label = "病人出生日期"

      this.setData({
        cardtypeData: cardtype_data,
        commonbirthDate: commonbirth_date
      })
    } else if ("support_duty" == options.status) {
      deduction_amount = parseFloat(frontPage.data.reduce_amount)
      this.supporttype = frontPage.data.issinglechildData.selected == '是' ? 'D' : 'S',//是否独生
      this.is_single = frontPage.data.issinglechildData.selected == '是' ? 'y' : 'n',//是否独生
      this.share_method = frontPage.data.shareMethodData.selected
      this.setData({
        deduction_amount: deduction_amount
      })
    } else if (frontPage.data.house_type == "rent" || frontPage.data.house_type == "house_fund_rent") { 
      // this.getbanklist()
      if (options.isedit != 'true') {
        this.getTaxList()
      }
      house_type = "house_fund_rent"
      title = '住房租金'
      if (options.reducetype == '月度') {
        reduce_typeData.selected = '月度'
        // deduction_amount = Deduce_amounts_month["house_fund_rent"]
      } else {
        // deduction_amount = Deduce_amounts_year["house_fund_rent"]
        reduce_typeData.selected = '年度'
      }
    } else if (frontPage.data.house_type == "house_fund_loan") {
      // this.getbanklist()
      if (options.isedit != 'true') {
        this.getTaxList()
      }
      house_type = "house_fund_loan"
      title = '住房贷款利息'
      if (options.reducetype == '月度') {
        reduce_typeData.selected = '月度'
        deduction_amount = Deduce_amounts_month["house_fund_loan"]
      } else {
        deduction_amount = Deduce_amounts_year["house_fund_loan"]
        reduce_typeData.selected = '年度'
      }
      this.setData({
        deduction_amount: deduction_amount
      })
    }

    this.setData({
      title: title,
      cur_index: nameKey,
      house_type: house_type,
      reducetypeData: reduce_typeData,
    })
    wx.setNavigationBarTitle({
      title: title,
    })
    this.initOSS()
    if (options.datas && options.datas.length > 0 && options.datas !="undefined") {
      if (options.isedit == 'true'){
        this.isEdit = true
        this.handlEditData(JSON.parse(options.datas))
      }else{
        this.isEdit = false
        this.handleTransData(JSON.parse(options.datas))
      }
    }
  },

  getTaxHostInfo: function () {
    var that = this;
    var Authorization = app.globalData.Authorization;
    wx.request({
      url: baseUrl + 'persontax/v1/personal-taxes',
      method: "GET",
      header: {
        'content-type': 'application/json', // 默认值
        "Authorization": Authorization
      },
      data: {
        'all': true
      },
      success: function (res) {
        if (res.statusCode == 200) {
          var data = res.data
          if (data.items && data.items.length > 0) {
            for (var i = 0; i < data.items.length; i++) {
              if (data.items[i].family_ties == "本人") {
                app.globalData.hostInfo = data.items[i]
                break;
              }
            }
          }
        }
      }
    })
  },


  getTaxList: function () {
    var that = this;
    wx.showLoading({
      title: '加载中',
    })
    var Authorization = app.globalData.Authorization;
    console.log('Authorization', Authorization)
    if (!Authorization || Authorization.length < 10) {
      return
    }
    wx.request({
      url: baseUrl + 'persontax/v1/personal-taxes',
      method: "GET",
      header: {
        'content-type': 'application/json', // 默认值
        "Authorization": Authorization
      },
      data: {
        'type': '1'
      },
      success: function (res) {
        console.log('是否有配偶接口数据', res)
        if (res.data.items && res.data.items[0]) {
          var hasLoverData = that.data.hasLoverData
          hasLoverData.selected = '是'
          hasLoverData.disabled = true
          var data = res.data.items[0], setData = { hasGetLover:true, hasLover: true, hasLoverData: hasLoverData}
          if (data.name && data.name.length) {
            setData.spouse_name = data.name
          }
          if (data.id_card_no && data.id_card_no.length) {
            setData.spouse_id_card_no = data.id_card_no
            that.dealIdInfo(data.id_card_no, 'spouse_id_card_no_input')
          }
          that.setData(setData)
        }
      },
      fail(res) {
        console.log(res.data)
      },
      complete() {
        wx.hideLoading()
        that.setData({
          load_finish: true
        })
      }
    })
  },
  loadCountry: function() {
    countryInfo.init(this)
    var countrylist = this.data.country
    var country_data = this.data.schoolCountryData
    for (var i = 0; i < countrylist.length; i++) {
      country_data.values.push(countrylist[i].name)
    }
    console.log("countrydata", country_data)
    this.setData({
      schoolCountryData: country_data
    })
  },
  handlEditData: function (data) {

    this.edit_id = data.id
    console.log('data===', data)
    switch (this.data.cur_index + '') {
      case 'children_education':
        var setData = {}
        var commonbirthDate = this.data.commonbirthDate
        commonbirthDate.selected = format.formatTime_date(data.birth_date)
        commonbirthDate.datelong = data.birth_date
        setData.commonbirthDate = commonbirthDate
        var childrenpercentData = this.data.childrenpercentData
        childrenpercentData.selected = data.percent + '%'
        setData.childrenpercentData = childrenpercentData
        var studystartdate = this.data.studystartdate
        studystartdate.selected = format.formatTime_month(data.education_start)
        studystartdate.datelong = data.education_start
        setData.studystartdate = studystartdate
        var studyEndDate = this.data.studyEndDate
        studyEndDate.selected = format.formatTime_month(data.education_end)
        studyEndDate.datelong = data.education_end
        setData.studyEndDate = studyEndDate
        var studyPeriodDate = this.data.studyPeriodDate
        if (data.education_period_end > 0){
          studyPeriodDate.selected = format.formatTime_month(data.education_period_end)
          studyPeriodDate.datelong = data.education_period_end
        }
        studyPeriodDate.start = studystartdate.selected
        studyPeriodDate.end = studyEndDate.selected
        setData.studyPeriodDate = studyPeriodDate
        setData.deduction_amount = data.deduction_amount
        if (data.children_id_card_no && data.children_id_card_no.length) {
          setData.children_id_card_no = data.children_id_card_no
          this.dealIdInfo(data.children_id_card_no, 'children_id_card_no_input')
        }
        if (data.children_name && data.children_name.length) {
          setData.children_name = data.children_name
        }
        // if (data.student_no && data.student_no.length) {
        //   setData.children_student_no = data.student_no
        // }
        if (data.education_period && data.education_period.length) {
          var childedudegreeData = this.data.childedudegreeData
          childedudegreeData.selected = data.education_period
          setData.childedudegreeData = childedudegreeData
        }
        if (data.school_country && data.school_country.length) {
          var schoolCountryData = this.data.schoolCountryData
          schoolCountryData.selected = data.school_country
          setData.schoolCountryData = schoolCountryData
        }
        if (data.school_name && data.school_name.length) {
          setData.school_name = data.school_name
        }

        var hasLoverData = this.data.hasLoverData
        hasLoverData.selected = data.has_spouse == 'y' ? '是' : '否'
        hasLoverData.disabled = data.has_spouse == 'y' ? true : false
        setData.hasLover = data.has_spouse == 'y' ? true : false
        setData.hasGetLover = data.has_spouse == 'y' ? true : false
        setData.hasLoverData = hasLoverData
        if (data.spouse_name && data.spouse_name.length) {
          setData.spouse_name = data.spouse_name
        }
        if (data.spouse_id_card_no && data.spouse_id_card_no.length) {
          setData.spouse_id_card_no = data.spouse_id_card_no
          this.dealIdInfo(data.spouse_id_card_no, 'spouse_id_card_no_input')
        }
        this.setData(setData)
        break;
      case 'continuing_education':
        var setData = {}
        if (data.education_type && data.education_type.length) {
          if ('title' == data.education_type) {
            setData.edu_lable = 'school'
            var edutypeData = this.data.edutypeData
            edutypeData.selected = "学历(学位)继续教育"
            setData.edutypeData = edutypeData

            if (data.education_period && data.education_period.length) {
              var edulevelData = this.data.edulevelData
              edulevelData.selected = data.education_period
              setData.edulevelData = edulevelData
            }
            var studystartdate = this.data.studystartdate
            studystartdate.selected = format.formatTime_month(data.education_start)
            studystartdate.datelong = data.education_start
            setData.studystartdate = studystartdate
            var studyEndDate = this.data.studyEndDate
            studyEndDate.selected = format.formatTime_month(data.education_end)
            studyEndDate.datelong = data.education_end
            setData.studyEndDate = studyEndDate

          } else {
            setData.edu_lable = 'tech'
            var edutypeData = this.data.edutypeData
            edutypeData.selected = "职业资格继续教育"
            var edustyleData = this.data.edustyleData
            var certificateDate = this.data.certificateDate
            if (data.education_type == 'major'){
              edustyleData.selected = "专业技术人员职业资格"
              // certificateDate.values = this.major_cers //  网络延迟
            } else if (data.education_type == 'profession'){
              edustyleData.selected = "技能人员职业资格"
              // certificateDate.values = this.profs_cers //  网络延迟
            }
            setData.edutypeData = edutypeData
            setData.edustyleData = edustyleData
            var applydate = this.data.applydate
            applydate.selected = format.formatTime_date(data.approval_date)
            applydate.datelong = data.approval_date
            setData.applydate = applydate
            
            if (data.certification_name && data.certification_name.length) {
              certificateDate.selected = data.certification_name
              setData.certificateDate = certificateDate
            }
            if (data.certification_no && data.certification_no.length) {
              setData.certification_no = data.certification_no
            }
            if (data.certification_authority && data.certification_authority.length) {
              setData.certification_authority = data.certification_authority
            }
          }
        }
        this.setData(setData)
        break;
      case 'support_duty':
        var setData = {}
        var olderbirthDate = this.data.olderbirthDate
        olderbirthDate.selected = format.formatTime_date(data.birth_date)
        olderbirthDate.datelong = data.birth_date
        setData.olderbirthDate = olderbirthDate
        if (data.supported_name && data.supported_name.length) {
          setData.supported_name = data.supported_name
        }
        if (data.id_card_no && data.id_card_no.length) {
          setData.id_card_no = data.id_card_no
          this.dealIdInfo(data.id_card_no, 'older_id_card_no_input')
        }
        if (data.relationship && data.relationship.length) {
          var older_relativeData = this.data.older_relativeData
          older_relativeData.selected = data.relationship
          setData.older_relativeData = older_relativeData
        }
        this.is_single = data.is_single
        this.supporttype = data.is_single=='y'? 'D': 'S'
        this.share_method = data.share_method
        this.setData(setData)
        break;
        
      // case 'medical_fund':
      //   var setData = {}
      //   var commonbirthDate = this.data.commonbirthDate
      //   commonbirthDate.selected = format.formatTime_date(data.patient_birthday)
      //   commonbirthDate.datelong = data.patient_birthday
      //   setData.commonbirthDate = commonbirthDate
      //   if (data.name && data.name.length) {
      //     setData.name = data.name
      //   }
      //   if (data.id_card_no && data.id_card_no.length) {
      //     setData.id_card_no = data.id_card_no
      //     this.dealIdInfo(data.id_card_no, 'medical_id_card_no_input')
      //   }
      //   if (data.family_ties && data.family_ties.length) {
      //     var taxperson_relativeData = this.data.taxperson_relativeData
      //     taxperson_relativeData.selected = data.family_ties
      //     setData.taxperson_relativeData = taxperson_relativeData
      //   }
      //   this.setData(setData)
      //   break;
      case "house_fund":
        var setData = {}
        var hasLoverData = this.data.hasLoverData
        hasLoverData.selected = data.has_spouse == 'y'?'是':'否'
        hasLoverData.disabled = data.has_spouse == 'y' ? true : false
        setData.hasLover = data.has_spouse=='y'?true:false
        setData.hasGetLover = data.has_spouse == 'y' ? true : false
        setData.hasLoverData = hasLoverData
        if (data.spouse_name && data.spouse_name.length) {
          setData.spouse_name = data.spouse_name
        }
        if (data.id_card_no && data.id_card_no.length) {
          setData.spouse_id_card_no = data.id_card_no
          this.dealIdInfo(data.id_card_no, 'spouse_id_card_no_input')
        }
        if (this.data.house_type == 'house_fund_rent'){
          var workingcityInfo = this.data.workingcityInfo
          workingcityInfo.requestdata = data.work_city
          workingcityInfo.selected = data.work_city.province + data.work_city.city
          workingcityInfo.address_value = [data.work_city.province, data.work_city.city, data.work_city.district]
          workingcityInfo.address_code = [data.work_city.province_code, data.work_city.city_code, data.work_city.district_code]
          setData.workingcityInfo = workingcityInfo
          this.getCityLevel({
            'province_code': workingcityInfo.address_code[0],
            'province': workingcityInfo.address_value[0],
            'city_code': workingcityInfo.address_code[1],
            'city': workingcityInfo.address_value[1],
            'district_code': workingcityInfo.address_code[2],
            'district': workingcityInfo.address_value[2]
          })
          var leasetype_Data = this.data.leasetypeData
          leasetype_Data.selected = data.owner_type
          this.data.cardtypeData.hidden = data.owner_type == "企业"
          setData.leasetypeData = leasetype_Data,
          setData.cardtypeData = this.data.cardtypeData
          setData.owner_name = data.owner_name
          setData.owner_credit_no = data.owner_credit_no

          if (data.house_address && data.house_address.province) {
            var rentLocateInfo = this.data.rentLocateInfo
            rentLocateInfo.requestdata = data.house_address
            rentLocateInfo.selected = data.house_address.province + data.house_address.city + data.house_address.district
            rentLocateInfo.address_value = [data.house_address.province, data.house_address.city, data.house_address.district]
            rentLocateInfo.address_code = [data.house_address.province_code, data.house_address.city_code, data.house_address.district_code]
            setData.rentLocateInfo = rentLocateInfo
          }
          setData.house_detail_address = data.house_detail_address
          setData.rent_contract_no = data.rent_contract_no

          var leasestartDate = this.data.leasestartDate
          leasestartDate.selected = format.formatTime_date(data.rent_start)
          leasestartDate.datelong = data.rent_start
          setData.leasestartDate = leasestartDate
          var leaseendDate = this.data.leaseendDate
          leaseendDate.selected = format.formatTime_date(data.rent_end)
          leaseendDate.datelong = data.rent_end
          setData.leaseendDate = leaseendDate
          setData.owner_id_card_no = data.owner_id_card_no

        } else if (this.data.house_type == 'house_fund_loan'){
      
          if (data.house_address && data.house_address.province) {
            var houseLocateInfo = this.data.houseLocateInfo
            houseLocateInfo.requestdata = data.house_address
            houseLocateInfo.selected = data.house_address.province + data.house_address.city + data.house_address.district
            houseLocateInfo.address_value = [data.house_address.province, data.house_address.city, data.house_address.district]
            houseLocateInfo.address_code = [data.house_address.province_code, data.house_address.city_code, data.house_address.district_code]
            setData.houseLocateInfo = houseLocateInfo
          }
          if (data.house_detail_address && data.house_detail_address.length) {
            setData.house_detail_address = data.house_detail_address
          }
          if (data.certification_type && data.certification_type.length) {
            var identifytypeData = this.data.identifytypeData
            identifytypeData.selected = data.certification_type
            setData.identifytypeData = identifytypeData
          }
          if (data.certification_no && data.certification_no.length) {
            setData.certification_no = data.certification_no
          }
          if (data.loan_before_marry && data.loan_before_marry.length) {
            var beforemarryData = this.data.beforemarryData
            beforemarryData.selected = data.loan_before_marry=='y'?'是':'否'
            setData.beforemarryData = beforemarryData
          }
          if (data.loan_by_self && data.loan_by_self.length) {
            var isselfData = this.data.isselfData
            isselfData.selected = data.loan_by_self == 'y' ? '是' : '否'
            setData.isselfData = isselfData
          }

          if (data.loan_type && data.loan_type.length) {
            var loantypeData = this.data.loantypeData
            loantypeData.selected = data.loan_type
            setData.loantypeData = loantypeData
          }
          if (data.loan_contract_no && data.loan_contract_no.length) {
            setData.loan_contract_no = data.loan_contract_no
          }
          if (data.loan_bank && data.loan_bank.length) {
            // var bank_data = this.data.bankInfo
            // bank_data.selected = data.loan_bank
            setData.loan_bank = data.loan_bank
          }
          var firstpayback_Date = this.data.firstpaybackDate
          firstpayback_Date.selected = format.formatTime_date(data.loan_start)
            firstpayback_Date.datelong = data.loan_start 
          setData.firstpaybackDate = firstpayback_Date
          if (data.loan_months>0){
            setData.loan_months = data.loan_months
          }
          if (data.sec_loan_contract_no && data.sec_loan_contract_no.length) {
            setData.sec_loan_contract_no = data.sec_loan_contract_no
          }
          if (data.sec_loan_bank && data.sec_loan_bank.length) {
            // var bank_data = this.data.bankInfo_2
            // bank_data.selected = data.sec_loan_bank
            // setData.bankInfo_2 = bank_data
            setData.sec_loan_bank = data.sec_loan_bank
          }
          var firstpaybackDate_2 = this.data.firstpaybackDate_2
          firstpaybackDate_2.selected = format.formatTime_date(data.sec_loan_start)
          firstpaybackDate_2.datelong = data.sec_loan_start
          setData.firstpaybackDate_2 = firstpaybackDate_2
          if (data.sec_loan_months > 0) {
            setData.sec_loan_months = data.sec_loan_months
          }
          if (data.rent_contract_no && data.rent_contract_no.length) {
            setData.rent_contract_no = data.rent_contract_no
          }
        }
        this.setData(setData)
        break;
    }

  },

  handleTransData: function(data) {
    switch (this.data.cur_index + '') {
      case 'children_education':
        var setData = {}
        var commonbirthDate = this.data.commonbirthDate
        commonbirthDate.selected = format.formatTime_date(data.birth_date)
        commonbirthDate.datelong = data.birth_date
        setData.commonbirthDate = commonbirthDate
        if (data.id_card_no && data.id_card_no.length) {
          setData.children_id_card_no = data.id_card_no
          this.dealIdInfo(data.id_card_no, 'children_id_card_no_input')
        }
        if (data.name && data.name.length) {
          setData.children_name = data.name
        }
        this.setData(setData)
        break;
      case 'support_duty':
        var setData = {}
        var olderbirthDate = this.data.olderbirthDate
        olderbirthDate.selected = format.formatTime_date(data.birth_date)
        olderbirthDate.datelong = data.birth_date
        setData.olderbirthDate = olderbirthDate
        if (data.name && data.name.length) {
          setData.supported_name = data.name
        }
        if (data.id_card_no && data.id_card_no.length) {
          setData.id_card_no = data.id_card_no
          this.dealIdInfo(data.id_card_no, 'older_id_card_no_input')
        }
        if (data.family_ties && data.family_ties.length) {
          var older_relativeData = this.data.older_relativeData
          older_relativeData.selected = data.family_ties
          setData.older_relativeData = older_relativeData
        }
        this.setData(setData)
        break;
      case 'medical_fund':
        var setData = {}
        var commonbirthDate = this.data.commonbirthDate
        commonbirthDate.selected = format.formatTime_date(data.patient_birthday)
        commonbirthDate.datelong = data.patient_birthday
        setData.commonbirthDate = commonbirthDate
        if (data.name && data.name.length) {
          setData.name = data.name
        }
        if (data.id_card_no && data.id_card_no.length) {
          setData.id_card_no = data.id_card_no
          this.dealIdInfo(data.id_card_no, 'medical_id_card_no_input')
        }
        if (data.family_ties && data.family_ties.length) {
          var taxperson_relativeData = this.data.taxperson_relativeData
          taxperson_relativeData.selected = data.family_ties
          setData.taxperson_relativeData = taxperson_relativeData
        }
        this.setData(setData)
        break;
      
    }

  },




  initOSS: function() {
    var that = this
    var Authorization = getApp().globalData.Authorization;
    //OSS 上传前init
    wx.showLoading()
    wx.request({
      url: baseUrl + "filemeta/v1/inits",
      header: {
        'Authorization': Authorization
      },
      method: 'POST',
      data: {
        "access_type": "web_upload",
        "action ": "put_object",
        "instance_id": "",
        "object_type": "wx_image"
      },
      success: function(result) {

        OSSInit = result.data
        console.log(' OSS init 成功', OSSInit)
      },
      fail: function(res) {
        console.log('OSS init  失败', res)
      },
      complete: function() {
        wx.hideLoading()
      }
    })
  },

  /**
   * Lifecycle function--Called when page is initially rendered
   */
  onReady: function() {

  },

  onShow: function() {
    var that = this
    var id_error //= this.data.id_error
    wx.getStorage({
      key: 'id_info',
      success: function(res) {
        console.log('id_info', res.data)
        if (res.data && res.data.length > 0) {
          var id_info = JSON.parse(res.data)
          var birth_day, data={}
          if (id_info.birthday.month > 9 && id_info.birthday.day > 9) {
            birth_day = id_info.birthday.year + '-' + id_info.birthday.month + '-' + id_info.birthday.day;
          } else if (id_info.birthday.month > 9 && id_info.birthday.day < 10) {
            birth_day = id_info.birthday.year + '-' + id_info.birthday.month + '-0' + id_info.birthday.day;
          } else if (id_info.birthday.month < 10 && id_info.birthday.day > 9) {
            birth_day = id_info.birthday.year + '-0' + id_info.birthday.month + '-' + id_info.birthday.day;
          } else if (id_info.birthday.month < 10 && id_info.birthday.day < 10) {
            birth_day = id_info.birthday.year + '-0' + id_info.birthday.month + '-0' + id_info.birthday.day;
          }

          if (that.idcard_belong == 'children_id_card_no') {
            that.data.commonbirthDate.selected = birth_day
            that.data.commonbirthDate.datelong = (Date.parse(new Date(birth_day)) / 1000)
            data = {
              children_id_card_no: id_info.id_card_number,
              children_name: id_info.name,
              commonbirthDate: that.data.commonbirthDate
            }
            if (format.getAge(birth_day) < 3) {
              that.showToast('子女年龄小于3岁,不可申报')
            }
          } else if (that.idcard_belong == 'spouse_id_card_no') {
            that.data.loverbirthDate.selected = birth_day
            that.data.loverbirthDate.datelong = (Date.parse(new Date(birth_day)) / 1000)
            data = {
              spouse_id_card_no: id_info.id_card_number,
              spouse_name: id_info.name,
              loverbirthDate: that.data.loverbirthDate
            }
          } else if (that.idcard_belong == 'older_id_card_no') {
            that.data.olderbirthDate.selected = birth_day
            that.data.olderbirthDate.datelong = (Date.parse(new Date(birth_day)) / 1000)
            data = {
              id_card_no: id_info.id_card_number,
              supported_name: id_info.name,
              olderbirthDate: that.data.olderbirthDate
            }
            if (format.getAge(birth_day) < 60) {
              that.showToast('被赡养人年龄不足60岁,不可申报')
            }
          } else if (that.idcard_belong == 'medical_id_card_no') {
            that.data.commonbirthDate.selected = birth_day
            that.data.commonbirthDate.datelong = (Date.parse(new Date(birth_day)) / 1000)
            data = {
              id_card_no: id_info.id_card_number,
              commonbirthDate: that.data.commonbirthDate
            }
          } else if (that.idcard_belong == 'owner_id_card_no') {
            console.log('id_info.id_card_number', id_info.id_card_number)
            data = {
              owner_id_card_no: id_info.id_card_number,
              owner_name: id_info.name
            }
          }
          that.setData(data)
          console.log('-cardtypeData--', that.data.cardtypeData)

        }
      },
    })
    wx.removeStorage({
      key: 'id_info',
      success: function(res) {
        console.log('remove_idinfo', res)
      },
    })
  },

  // getbanklist: function() {
  //   var that = this
  //   var Authorization = app.globalData.Authorization;
  //   var bank_info = that.data.bankInfo
  //   var bank_info_2 = that.data.bankInfo_2
  //   wx.request({
  //     url: baseUrl + 'persontax/v1/bank-list',
  //     method: "GET",
  //     header: {
  //       'content-type': 'application/json', // 默认值
  //       "Authorization": Authorization
  //     },
  //     success: function(res) {
  //       console.log(res)
  //       bank_info.values = res.data.banks//that.handleBankinfo(res.data.items)
  //       bank_info_2.values = res.data.banks//that.handleBankinfo(res.data.items)
  //       that.setData({
  //         bankInfo: bank_info,
  //         bankInfo_2: bank_info_2
  //       })
  //       console.log("bankInfo", that.data.bankInfo)
  //     },
  //     fail(res) {
  //       console.log(res)
  //     },
  //     complete() {
  //       wx.hideLoading()
  //     }
  //   })
  // },
  getCertificates: function () {
    var that = this
    var Authorization = app.globalData.Authorization;
    var bank_info = that.data.bankInfo
    wx.request({
      url: baseUrl + 'persontax/v1/certification-list' ,
      header: {
        'content-type': 'application/json', // 默认值
        "Authorization": Authorization
      },
      success: function (res) {
        console.log('certification', res)
        that.profs_cers = res.data.profession_certificates
        that.major_cers = res.data.major_certificates

        var certificateDate = that.data.certificateDate
        if (that.data.edustyleData.selected == "专业技术人员职业资格"){
          certificateDate.values = that.major_cers 
        } else if (that.data.edustyleData.selected == '技能人员职业资格') {
          certificateDate.values = that.profs_cers
        }
        that.setData({
          certificateDate: certificateDate
        })

      },
      fail(res) {
        console.log(res)
      },
      complete() {
        wx.hideLoading()
      }
    })
  },
  // handleBankinfo: function(data) {
  //   var bank_name = []
  //   for (var i = 0; i < data.length; i++) {
  //     bank_name.push(data[i].bank_name)
  //   }
  //   return bank_name
  // },

  formSubmit: function(e) {
    console.log("formSubmit", e);
    var formdata = e.detail.value
    var newdata = formdata;
    var subUrl = ''
    switch (this.data.cur_index + '') {
      case 'children_education':
        subUrl = 'persontax/v1/children-educations'
        if (!formdata.children_id_card_no || formdata.children_id_card_no.length < 1) {
          this.showToast('请填写子女证照号码')
          return
        }
        if (!format.isIDCardNum(formdata.children_id_card_no)) {
          this.showToast('身份证格式有误')
          return
        }
        if (format.getAge(this.data.commonbirthDate.selected) < 3) {
          this.showToast('子女年龄小于3岁,不可申报')
          return
        }
        if (this.data.commonbirthDate.datelong < app.globalData.hostInfo.birth_date) {
          this.showToast('子女年龄不得大于本人');
          return
        }
        if (!formdata.children_name || formdata.children_name.length < 1) {
          this.showToast('请填写子女姓名')
          return
        }
        // if (this.data.commonbirthDate.selected.length < 1) {
        //   this.showToast('请选择子女出生日期')
        //   return
        // }
        if (this.data.childrenpercentData.selected.length < 1) {
          this.showToast('请选择分配比例')
          return
        }
        // if (!formdata.children_student_no || formdata.children_student_no.length < 1) {
        //   this.showToast('请填写学籍号')
        //   return
        // }
        if (this.data.childedudegreeData.selected.length < 1) {
          this.showToast('请选择教育阶段')
          return
        }
        if (this.data.studystartdate.selected.length < 1) {
          this.showToast('请选择受教育起始日期')
          return
        }
        if (this.data.studyEndDate.selected.length < 1) {
          // this.showToast('请选择受教育时间止')
          // return
        }else{
          var activedDate = (Date.parse(new Date('2019-01-01')) / 1000)
          if (this.data.studyEndDate.datelong < activedDate) {
            this.showToast('受教育时间止不符合要求,无法申报')
            return
          }
          if (this.data.studyPeriodDate.selected.length > 0 && this.data.studyPeriodDate.datelong < activedDate) {
            this.showToast('教育终止时间不符合要求,无法申报')
            return
          }
        }
        if (!formdata.school_name || formdata.school_name.length < 1) {
          this.showToast('请填写就读学校')
          return
        }
        if (this.data.hasLoverData.selected.length < 1) {
          this.showToast('请选择是否有配偶')
          return
        }

        if (this.data.hasLover) {
          if (!formdata.spouse_name || formdata.spouse_name.length < 1) {
            this.showToast('请填写配偶姓名')
            return
          } else if (!formdata.spouse_id_card_no || formdata.spouse_id_card_no.length < 1) {
            this.showToast('请填写配偶证照号码')
            return
          } else if (!format.isIDCardNum(formdata.spouse_id_card_no)) {
            this.showToast('配偶身份证格式有误')
            return
          }else if (this.data.loverbirthDate.selected.length < 1) {
            this.showToast('请选择配偶出生日期')
            return
          }
          newdata.spouse_id_card_type = '居民身份证' //this.data.lovercardtypeData.selected
          newdata.spouse_birthday = this.data.loverbirthDate.datelong
        }
        newdata.has_spouse = this.data.hasLover?'y':'n'
        newdata.relationship = this.data.taxperson_relativeData.selected
        newdata.percent = this.data.childrenpercentData.selected.replace("%","")
        newdata.children_id_card_type = '居民身份证' //this.data.childrencardtypeData.selected
        newdata.children_birthday = this.data.commonbirthDate.datelong
        newdata.education_period_end = this.data.studyPeriodDate.datelong
        newdata.education_end = this.data.studyEndDate.datelong
        newdata.education_start = this.data.studystartdate.datelong 
        newdata.education_period = this.data.childedudegreeData.selected
        newdata.school_country = this.data.schoolCountryData.selected
        newdata.children_nation = "中国"
        newdata.nation = "中国"
        break;
      case 'continuing_education':
        subUrl = 'persontax/v1/continuing-educations'
        if (this.data.edutypeData.selected.length < 1) {
          this.showToast('请选择教育情况')
          return
        } else if (this.data.edu_lable == 'school') {
          // newdata.edu_type_lable = '0'
          if (this.data.edulevelData.selected.length < 1) {
            this.showToast('请选择学历教育阶段')
            return
          }
          if (this.data.studystartdate.selected.length < 1) {
            this.showToast('请选择入学时间')
            return
          }
          if (this.data.studyEndDate.selected.length < 1) {
            this.showToast('请选择毕业时间')
            return
          } else {
            var activedDate = (Date.parse(new Date('2019-01-01')) / 1000)
            if (this.data.studyEndDate.datelong < activedDate) {
              this.showToast('毕业日期不符合要求,无法申报')
              return
            }
          }
          newdata.education_start = this.data.studystartdate.datelong
          newdata.education_end = this.data.studyEndDate.datelong
          newdata.education_type = 'title' //学历
          newdata.education_period = this.data.edulevelData.selected
        } else if (this.data.edu_lable == 'tech') {
          if (this.data.edustyleData.selected.length < 1) {
            this.showToast('请选择教育类型')
            return
          }
          if (this.data.applydate.selected.length < 1) {
            this.showToast('请选择发证日期')
            return
          } else {
            // var d = new Date();
            // var curYear = d.getFullYear();
            var selYear = this.data.applydate.selected.substring(0, 4);
            if (selYear < 2019) {
              this.showToast('发证(批准)日期须在2019年度内')
              return
            }
          }
          // if (!formdata.certification_name || formdata.certification_name.length < 1) {
          //   this.showToast('请填写证书名称')
          //   return
          // }
          if (this.data.certificateDate.selected.length < 1) {
            this.showToast('请选择证书名称')
            return
          } 
          if (!formdata.certification_no || formdata.certification_no.length < 1) {
            this.showToast('请填写证书编号')
            return
          }
          if (!formdata.certification_authority || formdata.certification_authority.length < 1) {
            this.showToast('请填写发证机关')
            return
          }
          //新增教育类型(区别教育类别)
          // newdata.edu_type_lable = '1'
          newdata.approval_date = this.data.applydate.datelong
          newdata.education_type = this.data.edustyleData.selected == '技能人员职业资格' ? 'profession' : 'major'
          newdata.certification_name = this.data.certificateDate.selected
        }
        break;
      case 'support_duty':
        subUrl = 'persontax/v1/support-duties'
        // if (this.data.supporttypeData.selected.length < 1) {
        //   this.showToast('请选择赡养类型')
        //   return
        // }
        // if (!this.data.shareMethodData.hidden) {
        //   if (this.data.shareMethodData.selected.length < 1){
        //     this.showToast('请选择分摊方式')
        //     return
        //   }
        //   newdata.share_method = this.data.shareMethodData.selected
        // }
        if (!formdata.supported_name || formdata.supported_name.length < 1) {
          this.showToast('请填写被赡养人姓名')
          return
        } else if (this.data.oldercardtypeData.selected.length < 1) {
          this.showToast('请选择被赡养人证照类型')
          return
        } else if (!formdata.id_card_no || formdata.id_card_no.length < 1) {
          this.showToast('请填写被赡养人证照号')
          return
        } else if (!format.isIDCardNum(formdata.id_card_no)) {
          this.showToast('被赡养人身份证格式有误')
          return
        }
        // if (this.data.olderbirthDate.selected.length < 1) {
        //   this.showToast('请选择被赡养人出生日期')
        //   return
        // }
        if (format.getAge(this.data.olderbirthDate.selected) < 60) {
          this.showToast('被赡养人年龄不足60岁,不可申报')
          return
        }
        if (this.data.olderbirthDate.datelong > app.globalData.hostInfo.birth_date) {
          this.showToast('被赡养人年龄应大于本人');
          return
        }
        if (this.data.older_relativeData.selected.length < 1) {
          this.showToast('请选择与纳税人关系')
          return
        }
        // if (!formdata.percentage || formdata.percentage.length < 1 || formdata.percentage > 100) {
        //   this.showToast('请填写合理分摊比例')
        //   return
        // } else {
        //   newdata.percentage = parseFloat(formdata.percentage)
        // }
        newdata.support_type = this.supporttype
        newdata.is_single = this.is_single
        if (this.supporttype == 'S' && this.share_method.length){
          newdata.share_method = this.share_method
        }
        newdata.birthday = this.data.olderbirthDate.datelong
        newdata.relationship = this.data.older_relativeData.selected
        newdata.id_card_type = '居民身份证' //this.data.oldercardtypeData.selected
        newdata.nation = "中国"
        break;
      case 'medical_fund':
        subUrl = 'persontax/v1/medical-funds'
        if (!formdata.name || formdata.name.length < 1) {
          this.showToast('请填写姓名')
          return
        } else if (this.data.cardtypeData.selected.length < 1) {
          this.showToast('请选择证照类型')
          return
        } else if (!formdata.id_card_no || formdata.id_card_no.length < 1) {
          this.showToast('请填写证照号码')
          return
        } else if (!format.isIDCardNum(formdata.id_card_no)) {
          this.showToast('身份证格式有误')
          return
        } else if (this.data.commonbirthDate.selected.length < 1) {
          this.showToast('请选择病人出生日期')
          return
        } else if (this.data.taxperson_relativeData.selected.length < 1) {
          this.showToast('请选择与纳税人关系')
          return
        } else if (!formdata.total_amount || formdata.total_amount < 0) {
          this.showToast('请填写医疗支出总金额')
          return
        } else if (formdata.total_amount > 60000) {
          this.showToast('大病医疗支出扣除额度不得超过6万')
          return
        } else if (!formdata.amount_by_person || formdata.amount_by_person < 0) {
          this.showToast('请填写个人负担金额')
          return
        }else if (formdata.amount_by_person >60000) {
          this.showToast('个人负担金额不得超过6万')
          return
        }

        newdata.total_amount = parseFloat(formdata.total_amount)
        newdata.amount_by_person = parseFloat(formdata.amount_by_person)
        newdata.id_card_type = '居民身份证'//this.data.cardtypeData.selected
        newdata.relationship = this.data.taxperson_relativeData.selected
        newdata.patient_birthday = this.data.commonbirthDate.datelong
        newdata.patient_nation = "中国"
        break;
      case 'house_fund':
        subUrl = 'persontax/v1/house-funds'
        console.log('TITLE', this.data.title)

        if (this.data.house_type == "house_fund_loan") {
          newdata.type = 'loan'

          // if (this.data.houseLocateInfo.address_value[0].length < 1) {
          //   this.showToast('请选择住房地址')
          //   return
          // } else 
          if (!formdata.house_detail_address || formdata.house_detail_address.length < 1) {
            this.showToast('请填写房屋详细地址')
            return
          }if (this.data.identifytypeData.selected.length < 1) {
            this.showToast('请选择证书类型')
            return
          } else if (!formdata.certification_no || formdata.certification_no.length < 1) {
            this.showToast('请填写证书号码')
            return
          } else if (this.data.beforemarryData.selected.length < 1) {
            this.showToast('请选择是否首套贷款')
            return
          } else if (this.data.isselfData.selected.length < 1) {
            this.showToast('请选择是否本人借款')
            return
          } else if (this.data.loantypeData.selected.length < 1) {
            this.showToast('请选择贷款类型')
            return
          } 
          var loanType = this.data.loantypeData.selected 
          if (loanType == "公积金贷款" || loanType == "组合贷款"){
            if (!formdata.loan_contract_no || formdata.loan_contract_no.length < 1) {
              this.showToast('请填写公积金贷款合同编号')
              return
            } else if (!formdata.loan_bank || formdata.loan_bank.length < 1) {
              this.showToast('请选择公积金贷款银行')
              return
            } else if (this.data.firstpaybackDate.selected.length < 1) {
              this.showToast('请选择首次还款日期')
              return
            } else if (!formdata.loan_months || formdata.loan_months.length < 1) {
              this.showToast('请填写公积金贷款期限')
              return
            }
            newdata.loan_bank = formdata.loan_bank
            newdata.loan_start = this.data.firstpaybackDate.datelong
            newdata.loan_months = parseInt(formdata.loan_months)
          } 
          if (loanType == "商业贷款" || loanType == "组合贷款") {
            if (!formdata.sec_loan_contract_no || formdata.sec_loan_contract_no.length < 1) {
              this.showToast('请填写商业贷款合同编号')
              return
            } else if (!formdata.sec_loan_bank || formdata.sec_loan_bank.length < 1) {
              this.showToast('请选择商业贷款银行')
              return
            } else if (this.data.firstpaybackDate_2.selected.length < 1) {
              this.showToast('请选择首次还款日期')
              return
            } else if (!formdata.sec_loan_months || formdata.sec_loan_months.length < 1) {
              this.showToast('请填写商业贷款期限')
              return
            }
            newdata.sec_loan_bank = formdata.sec_loan_bank
            newdata.sec_loan_start = this.data.firstpaybackDate_2.datelong
            newdata.sec_loan_months = parseInt(formdata.sec_loan_months)
          }
          newdata.loan_before_marry = this.data.beforemarryData.selected == "是" ? 'y' : 'n'
          newdata.loan_by_self = this.data.isselfData.selected == "是" ? 'y' : 'n'
          newdata.certification_type = this.data.identifytypeData.selected

          newdata.loan_type = this.data.loantypeData.selected
          
          // newdata.loan_datelong = this.data.loandatelongData.selected
          var request_loan_address = this.getLoanAddressRequest()
          newdata.house_address = request_loan_address

        } else if (this.data.house_type == "house_fund_rent") {
          newdata.type = 'rent'
          console.log('workingcityInfo', this.data.workingcityInfo.address_value)
          if (this.data.workingcityInfo.address_value[0].length < 1) {
            this.showToast('请选择工作城市')
            return
          } else if (this.data.leasetypeData.selected.length < 1) {
            this.showToast('请选择出租方类型')
            return
          } else if (!formdata.owner_name || formdata.owner_name.length < 1) {
            this.showToast('请填写出租方名称')
            return
          } 
          if (this.data.leasetypeData.selected=='企业'){
            if (!formdata.owner_credit_no || formdata.owner_credit_no.length < 1) {
              this.showToast('请填写统一社会信用代码')
              return
            }
            newdata.owner_id_card_no = ''
          } else{
            if (!formdata.owner_id_card_no || formdata.owner_id_card_no.length < 1) {
              this.showToast('请填写证照号码')
              return
            } else if (!format.isIDCardNum(formdata.owner_id_card_no)) {
              this.showToast('身份证格式有误')
              return
            } 
            newdata.owner_id_card_type = '居民身份证'//this.data.cardtypeData.selected
          }
          // if (this.data.rentLocateInfo.address_value[0].length < 1) {
          //   this.showToast('请选择房屋地址')
          //   return
          // } else 
          if (!formdata.house_detail_address || formdata.house_detail_address.length < 1) {
            this.showToast('请填写房屋详细地址')
            return
          }
          // else if (!formdata.rent_contract_no || formdata.rent_contract_no.length < 1) {
          //   this.showToast('请填写租赁合同编号')
          //   return
          // } else 
          if (this.data.leasestartDate.selected.length < 1) {
            this.showToast('请选择租赁起始日期')
            return
          }
          if (this.data.leaseendDate.selected.length < 1) {
            this.showToast('请选择租赁终止日期')
            return
          } else {
            var activedDate = (Date.parse(new Date('2019-01-01')) / 1000)
            if (this.data.leaseendDate.datelong < activedDate) {
              this.showToast('终止日期不符合要求,无法申报')
              return
            }
          }

          newdata.owner_type = this.data.leasetypeData.selected
          newdata.rent_start = this.data.leasestartDate.datelong
          newdata.rent_end = this.data.leaseendDate.datelong

          var request_working_address = this.getWorkingAddressRequest()
          newdata.work_city = request_working_address
          var request_rent_address = this.getRentAddressRequest()
          newdata.house_address = request_rent_address
          console.log('request_working_address', request_working_address)
        }
        if (this.data.hasLoverData.selected.length < 1) {
          this.showToast('请选择是否有配偶')
          return
        }
        if (this.data.hasLover) {
          if (!formdata.spouse_name || formdata.spouse_name.length < 1) {
            this.showToast('请填写配偶姓名')
            return
          } else if (!formdata.spouse_id_card_no || formdata.spouse_id_card_no.length < 1) {
            this.showToast('请填写配偶证照号码')
            return
          } else if (!format.isIDCardNum(formdata.spouse_id_card_no)) {
            this.showToast('配偶身份证格式有误')
            return
          } else if (this.data.loverbirthDate.selected.length < 1) {
            this.showToast('请选择配偶出生日期')
            return
          }
          newdata.id_card_no = newdata.spouse_id_card_no ? newdata.spouse_id_card_no : ''
          newdata.id_card_type = '居民身份证' //this.data.lovercardtypeData.selected
          newdata.birthday = this.data.loverbirthDate.datelong
          newdata.nation = "中国"
        }
        newdata.has_spouse = this.data.hasLover ? 'y' : 'n'
        break;
    }

    if (this.data.reducetypeData.selected.length < 1) {
      this.showToast('请选择扣除方式')
      return
    }
    // else if (!formdata.reduce_money || formdata.reduce_money.length < 1) {
    //   this.showToast('请填写扣除金额')
    //   return
    // }
    if (this.data.cur_index != 'medical_fund' && this.data.cur_index != 'continuing_education') {
      newdata.deduction_type = this.data.reducetypeData.selected == '月度' ? "month" : "year"
      newdata.deduction_amount = this.data.deduction_amount //formdata.reduce_money 
    }
    newdata.legal_entity_id = this.legal_entity_id
    newdata.legal_entity = this.legal_entity
    if (this.isEdit) {
      newdata.id = this.edit_id
    }
    console.log("newdata", newdata);
    this.addDatas(newdata, subUrl)
  },

  addDatas: function(newdata, subUrl) {
    // wx.showModal({
    //   title: '确认要提交申报吗?',
    //   content: '确认后将不能修改',
    //   showCancel: true,
    //   confirmColor: '#357AEB',
    //   cancelColor: '#999',
    //   success: function(res) {
    //     if (res.confirm) {
    //      ///接口
    //     } else if (res.cancel) {}
    //   }
    // })
    var that = this;
    var Authorization = app.globalData.Authorization;
    wx.showLoading()
    wx.request({
      url: baseUrl + subUrl,
      method: "POST",
      header: {
        'content-type': 'application/json',
        "Authorization": Authorization
      },
      data: newdata,
      success(res) {
        wx.hideLoading()
        if (res && res.statusCode < 300) {
          wx.navigateBack({
            delta: 1
          })
        } else {
          wx.showToast({
            title: res.data.message ? res.data.message : '请求出错',
            icon: 'none',
            duration: 2000
          })
        }
      },
      complete(){
        wx.hideLoading()
      }
    })
  },

  getIdInfo: function(e) {
    this.idcard_belong = e.currentTarget.id
    if (this.data.isIdCard) {
      wx.navigateTo({
        url: '../../taxperson/idinfo/idinfo',
        success: function(res) {},
      })
    }
  },
  idChange: function (e) {
    console.log('idCardNoChange',e, e.detail.value)
    var idCardNo = e.detail.value
    if (e.detail.value.length == 18) {
      if (!format.isIDCardNum(idCardNo)) {
        wx.showToast({
          image: "../../../../images/warn.png",
          title: '身份证格式有误'
        })
        return;
      }
      this.dealIdInfo(idCardNo, e.currentTarget.id)
    }
  },
  medicalInput: function (e) {
    console.log('-------', e.detail.value)
    var num = parseFloat(e.detail.value)
    switch (e.currentTarget.id) {
      case 'medical_total_input':
        this.setData({
          total_amount: num.toFixed(2)
        })
        break;
      case 'medical_amount_input':
        this.setData({
          amount_by_person: num.toFixed(2)
        })
        break;
    }
  },
  loan_input: function (e) {
    var value = e.detail.value
    switch (e.currentTarget.id) {
      case 'loan_contract_no':
        this.setData({
          loan_contract_no: value
        })
        break;
      case 'loan_months':
        if (value.length && value <= 0) {
          value = 1
        } else if (value > 240) {
          value = 240
          this.showToast('月数不得大于240')
        }
        this.setData({
          loan_months: value
        })
        break;
      case 'sec_loan_contract_no':
        this.setData({
          sec_loan_contract_no: value
        })
        break;
      case 'sec_loan_months':
        if (value.length && value <= 0) {
          value = 1
        }else if (value>240){
          value = 240
          this.showToast('月数不得大于240')
        }
        this.setData({
          sec_loan_months: value
        })
        break;
    }
  },
  //根据身份证号码,获取相关信息
  dealIdInfo: function (idCardNum, idcard_belong) {
    var info = format.analyzeIDCard(idCardNum)
    console.log('info', info.age, info.sex, info.birthDay, (Date.parse(new Date(info.birthDay)) / 1000))
    var data = {}
    if (idcard_belong == 'children_id_card_no_input') {
      this.data.commonbirthDate.selected = info.birthDay
      this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
      data = {
        commonbirthDate: this.data.commonbirthDate
      }
      if (info.age<3){
        this.showToast('子女年龄小于3岁,不可申报')
      }
    } else if (idcard_belong == 'spouse_id_card_no_input') {
      this.data.loverbirthDate.selected = info.birthDay
      this.data.loverbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
      data = {
        loverbirthDate: this.data.loverbirthDate
      }
    } else if (idcard_belong == 'medical_id_card_no_input') {
      this.data.commonbirthDate.selected = info.birthDay
      this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
      data = {
        commonbirthDate: this.data.commonbirthDate
      }
    } else if (idcard_belong == 'older_id_card_no_input') {
      this.data.olderbirthDate.selected = info.birthDay
      this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
      data = {
        olderbirthDate: this.data.olderbirthDate
      }
      if (info.age < 60) {
        this.showToast('被赡养人年龄不足60岁,不可申报')
      }
    } else if (idcard_belong == 'owner_id_card_no_input') {
      // this.data.olderbirthDate.selected = info.birthDay
      // this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
      // data = {
      //   owner_id_card_no: idCardNum,
      // }
    }
    if (info.age) {
      // data.age = info.age
    }
    if (info.sex) {
      // var gender_data = this.data.genderData
      // gender_data.selected = info.sex
      // data.genderData = gender_data
    }
    this.setData(data)
  },
  // studyDataTap: function (e) {
  //   console.log('studyDataTap',e)
  //   if (e.currentTarget.id == 'study_start_date'){
  //     var study_startdate = this.data.studystartdate
  //     study_startdate.start = '1970-01-01'
  //     study_startdate.end = ''
  //     this.setData({
  //       studystartdate: study_startdate
  //     })
  //   } else if (e.currentTarget.id == 'study_end_date') {
  //     console.log('study_end_date')
  //     var study_enddate = this.data.studyEndDate
  //     study_enddate.start = '1970-01-01'
  //     study_enddate.end = ''
  //     this.setData({
  //       studyEndDate: study_enddate
  //     })
  //   } 
  // },
  onPickerSelect: function(e) {
    console.log('picker发送选择改变,携带值为', e)
    switch (e.currentTarget.id) {
      case 'hasLover':
        var hasLoverData = this.data.hasLoverData
        hasLoverData.selected = hasLoverData.values[e.detail.value]
        var hasLover = e.detail.value == '0'
        this.setData({
          hasLoverData: hasLoverData,
          hasLover: hasLover
        })
        break;
      case 'lovercardtype':
        var lover_cardtypeData = this.data.lovercardtypeData
        lover_cardtypeData.selected = lover_cardtypeData.values[e.detail.value]
        this.setData({
          lovercardtypeData: lover_cardtypeData
        })
        break;
      case 'loverbirthday':
        var lover_birthDate = this.data.loverbirthDate
        lover_birthDate.selected = e.detail.value
        lover_birthDate.datelong = (Date.parse(new Date(e.detail.value)) / 1000)
        this.setData({
          loverbirthDate: lover_birthDate
        })
        break;
      case 'older_relative':
        var older_relativeData = this.data.older_relativeData
        older_relativeData.selected = older_relativeData.values[e.detail.value]
        this.setData({
          older_relativeData: older_relativeData
        })
        break;
      case 'taxperson_relative':
        var taxperson_relativedata = this.data.taxperson_relativeData
        taxperson_relativedata.selected = taxperson_relativedata.values[e.detail.value]
        this.setData({
          taxperson_relativeData: taxperson_relativedata
        })
        break;
      case 'childrencardtype':
        var children_cardtypedata = this.data.childrencardtypeData
        children_cardtypedata.selected = children_cardtypedata.values[e.detail.value]
        this.setData({
          childrencardtypeData: children_cardtypedata
        })
        break;
      case 'child_percent':
        var childrenpercent_data = this.data.childrenpercentData
        childrenpercent_data.selected = childrenpercent_data.values[e.detail.value]
        var deduction_amount = 0
        if (e.detail.value == '0') {
          deduction_amount = 0
        } else if (e.detail.value == '1') {
          deduction_amount = 500
        }else {
          deduction_amount = 1000
        }
        this.setData({
          childrenpercentData: childrenpercent_data,
          deduction_amount: deduction_amount
        })
        break;
      break;
      case 'commonbirthday':
        var children_birthDate = this.data.commonbirthDate
        children_birthDate.selected = e.detail.value
        children_birthDate.datelong = (Date.parse(new Date(e.detail.value)) / 1000)
        this.setData({
          commonbirthDate: children_birthDate
        })
        break;
      case 'study_start_date':
        var select_date = e.detail.value
        var study_startdate = this.data.studystartdate
        study_startdate.selected = select_date
        study_startdate.datelong = (Date.parse(new Date(select_date)) / 1000)
        //处理两个终止时间的限制
        var select_year = select_date.substring(0, 4)
        var start = select_date
        if (select_year<2019){
          start = '2019-01'
        } 
        var studyPeriodDate = this.data.studyPeriodDate
        studyPeriodDate.start = start
        studyPeriodDate.selected = ''
        studyPeriodDate.datelong = null
        var study_enddate = this.data.studyEndDate
        study_enddate.start = start
        study_enddate.selected = ''
        this.setData({
          studystartdate: study_startdate,
          studyPeriodDate: studyPeriodDate,
          studyEndDate: study_enddate
        })
        break;
      case 'study_end_date':
        var study_enddate = this.data.studyEndDate
        study_enddate.selected = e.detail.value
        var datelong = (Date.parse(new Date(e.detail.value)) / 1000)
        study_enddate.datelong = datelong
       
        var studyPeriodDate = this.data.studyPeriodDate
        studyPeriodDate.end = e.detail.value
        studyPeriodDate.selected = ''
        studyPeriodDate.datelong = null
        this.setData({
          studyPeriodDate: studyPeriodDate,
          studyEndDate: study_enddate
        })
        // var activedDate = (Date.parse(new Date('2019-01-01')) / 1000)
        // if (datelong < activedDate){
        //   this.showToast('教育终止时间不符合要求,无法申报')
        // }
        break;
      case 'study_per_date':
        var studyPeriodDate = this.data.studyPeriodDate
        studyPeriodDate.selected = e.detail.value
        var datelong = (Date.parse(new Date(e.detail.value)) / 1000)
        studyPeriodDate.datelong = datelong
        if (datelong > this.data.studyEndDate.datelong) {
          wx.showToast({
            title: '教育终止日应不大于受教育时间止',
            icon:'none'
          })
          return
        }
        this.setData({
          studyPeriodDate: studyPeriodDate,
        })
        // var activedDate = (Date.parse(new Date('2019-01-01')) / 1000)
        // if (datelong < activedDate) {
        //   this.showToast('受教育时间止不符合要求,无法申报')
        // }
        break;
      case 'child_edu_degree':
        var childedudegreeData = this.data.childedudegreeData
        childedudegreeData.selected = childedudegreeData.values[e.detail.value]
        this.setData({
          childedudegreeData: childedudegreeData
        })
        break;
        // case 'edu_degree':
        //   var edudegree_data = this.data.edudegreeData
        //   edudegree_data.selected = edudegree_data.values[e.detail.value]
        //   this.setData({
        //     edudegreeData: edudegree_data
        //   })
        //   break;
      case 'school_country':
        var schoolCountry_data = this.data.schoolCountryData
        schoolCountry_data.selected = schoolCountry_data.values[e.detail.value]
        this.setData({
          schoolCountryData: schoolCountry_data
        })
        break;
      // case 'support_type':
      //   var support_typeData = this.data.supporttypeData
      //   support_typeData.selected = support_typeData.values[e.detail.value]
      //   var share_methodData = this.data.shareMethodData
      //   share_methodData.hidden = e.detail.value == 0
      //   this.setData({
      //     oldersupport_lable: e.detail.value == 0 ? 'single' : 'together',
      //     supporttypeData: support_typeData,
      //     shareMethodData: share_methodData
      //   })
      //   break;
      // case 'share_method':
      //   var share_methodData = this.data.shareMethodData
      //   share_methodData.selected = share_methodData.values[e.detail.value]
      //   this.setData({
      //     shareMethodData: share_methodData
      //   })
      //   break;
      case 'oldercardtype':
        var older_cardtypeData = this.data.oldercardtypeData
        older_cardtypeData.selected = older_cardtypeData.values[e.detail.value]
        this.setData({
          oldercardtypeData: older_cardtypeData
        })
        break;
      case 'olderbirthday':
        var older_birthDate = this.data.olderbirthDate
        older_birthDate.selected = e.detail.value
        older_birthDate.datelong = Date.parse(new Date(e.detail.value)) / 1000,
          this.setData({
            olderbirthDate: older_birthDate
          })
        break;
      case 'reduce_type':
        var reduce_typeData = this.data.reducetypeData
        var deduction_amount
        var key = this.data.cur_index
        if (this.data.house_type.length) {
          key = this.data.house_type
        }
        if (e.detail.value == '0') {
          deduction_amount = Deduce_amounts_month[key]
        } else {
          deduction_amount = Deduce_amounts_year[key]
        }
        reduce_typeData.selected = reduce_typeData.values[e.detail.value]
        this.setData({
          reducetypeData: reduce_typeData,
          deduction_amount: deduction_amount
        })
        break;
      case 'edu_type':
        var edutypee_data = this.data.edutypeData
        edutypee_data.selected = edutypee_data.values[e.detail.value]
        var reducetypeData = this.data.reducetypeData
        var deduction_amount
        // if (e.detail.value == '1') {//非学历教育
        //   reducetypeData.selected = '年度'
        //   // reducetypeData.disabled = true 
        //   deduction_amount = Deduce_amounts_year['continuing_education_non']
        // }else {
        //   // reducetypeData.disabled = false 
        //   reducetypeData.selected = '月度'
        //   deduction_amount = Deduce_amounts_month['continuing_education']
        // }
        this.setData({
          edu_lable: e.detail.value == 0 ? 'school' : 'tech',
          edutypeData: edutypee_data,
          // reducetypeData: reducetypeData,
          // deduction_amount: deduction_amount
        })
        break;
      case 'edu_style':
        var edustyle_data = this.data.edustyleData
        edustyle_data.selected = edustyle_data.values[e.detail.value]
        var certificateDate = this.data.certificateDate
        certificateDate.values = e.detail.value == '0' ? this.profs_cers : this.major_cers
        certificateDate.selected = ''
        this.setData({
          edustyleData: edustyle_data,
          certificateDate: certificateDate
        })
        break;
      case 'certificate':
        var certificateDate = this.data.certificateDate
        certificateDate.selected = certificateDate.values[e.detail.value]
        this.setData({
          certificateDate: certificateDate
        })
        break;
      case 'edu_level':
        var edulevel_data = this.data.edulevelData
        edulevel_data.selected = edulevel_data.values[e.detail.value]
        this.setData({
          edulevelData: edulevel_data
        })
        break;
      case 'apply_date':
        var apply_date = this.data.applydate
        apply_date.selected = e.detail.value
        apply_date.datelong = Date.parse(new Date(e.detail.value)) / 1000,
        console.log('apply_date', Date.parse(new Date(e.detail.value)))
        this.setData({
          applydate: apply_date
        })
        var selYear = apply_date.selected.substring(0, 4);
        if (selYear < 2019) {
          this.showToast('发证(批准)日期须在2019年度内')
          return
        }
        break;
      case 'cardtype':
        var cardtype_Data = this.data.cardtypeData
        cardtype_Data.selected = cardtype_Data.values[e.detail.value]
        this.setData({
          cardtypeData: cardtype_Data
        })
        break;
      case 'identify_type':
        var identifytype_Data = this.data.identifytypeData
        identifytype_Data.selected = identifytype_Data.values[e.detail.value]
        this.setData({
          identifytypeData: identifytype_Data
        })
        break;
      case 'before_marry':
        var beforemarry_Data = this.data.beforemarryData
        beforemarry_Data.selected = beforemarry_Data.values[e.detail.value]
        this.setData({
          beforemarryData: beforemarry_Data
        })
        break;
      case 'is_self_loan':
        var isself_Data = this.data.isselfData
        isself_Data.selected = isself_Data.values[e.detail.value]
        this.setData({
          isselfData: isself_Data
        })
        break;

      case 'loan_type':
        var loantype_Data = this.data.loantypeData
        loantype_Data.selected = loantype_Data.values[e.detail.value]
        this.setData({
          loantypeData: loantype_Data
        })
        break;
      case 'payback_date':
        var firstpayback_Date = this.data.firstpaybackDate
        firstpayback_Date.selected = e.detail.value
        firstpayback_Date.datelong = Date.parse(new Date(e.detail.value)) / 1000,
        this.setData({
          firstpaybackDate: firstpayback_Date
        })
        break;
      case 'payback_date_2':
        var firstpayback_Date = this.data.firstpaybackDate_2
        firstpayback_Date.selected = e.detail.value
        firstpayback_Date.datelong = Date.parse(new Date(e.detail.value)) / 1000,
          this.setData({
            firstpaybackDate_2: firstpayback_Date
          })
        break;
      case 'loan_datelong':
        var loandatelong_Data = this.data.loandatelongData
        loandatelong_Data.selected = loandatelong_Data.values[e.detail.value]
        this.setData({
          loandatelongData: loandatelong_Data
        })
        break;
      case 'lease_type':
        var leasetype_Data = this.data.leasetypeData
        leasetype_Data.selected = leasetype_Data.values[e.detail.value]
        this.data.cardtypeData.hidden = leasetype_Data.selected == "企业"
        this.setData({
          leasetypeData: leasetype_Data,
          cardtypeData: this.data.cardtypeData
        })
        break;
      case 'lease_start_date':
        var leasestart_Date = this.data.leasestartDate
        leasestart_Date.selected = e.detail.value
        leasestart_Date.datelong = Date.parse(new Date(e.detail.value)) / 1000,
        this.setData({
          leasestartDate: leasestart_Date
        })
        break;
      case 'lease_end_date':
        var leaseend_Date = this.data.leaseendDate
        leaseend_Date.selected = e.detail.value
        leaseend_Date.datelong = Date.parse(new Date(e.detail.value)) / 1000,
        this.setData({
          leaseendDate: leaseend_Date
        })
        var activedDate = (Date.parse(new Date('2019-01-01')) / 1000)
        if (leaseend_Date.datelong < activedDate) {
          this.showToast('终止日期不符合要求,无法申报')
        }
        break;
      // case 'bank':
      //   var bank_data = this.data.bankInfo
      //   bank_data.selected = bank_data.values[e.detail.value]
      //   this.setData({
      //     bankInfo: bank_data
      //   })
      //   break;
      // case 'bank_2':
      //   var bank_data_2 = this.data.bankInfo_2
      //   bank_data_2.selected = bank_data_2.values[e.detail.value]
      //   this.setData({
      //     bankInfo_2: bank_data_2
      //   })
      //   break;
      case 'house_locate':
        console.log('house_locate', e)
        var house_address = this.data.houseLocateInfo;
        house_address.address_value = e.detail.value
        if (e.detail.value[0] == e.detail.value[1]) {
          house_address.selected = e.detail.value[1] + e.detail.value[2]
        } else {
          house_address.selected = e.detail.value[0] + e.detail.value[1] + e.detail.value[2]

        }
        house_address.address_value = e.detail.value
        house_address.address_code = e.detail.code
        this.setData({
          loanAddress_haschanged: true,
          houseLocateInfo: house_address
        })
        break;
      case 'working_city':
        console.log('working_city', e)
        var work_address = this.data.workingcityInfo;
        work_address.address_value = e.detail.value
        if (e.detail.value[0] == e.detail.value[1]) {
          work_address.selected = e.detail.value[1] + e.detail.value[2]
        } else {
          work_address.selected = e.detail.value[0] + e.detail.value[1]
        }
        work_address.address_value = e.detail.value
        work_address.address_code = e.detail.code
        this.getCityLevel({
          'province_code': e.detail.code[0],
          'province': e.detail.value[0],
          'city_code': e.detail.code[1],
          'city': e.detail.value[1],
          'district_code': e.detail.code[2],
          'district': e.detail.value[2]
        })
        this.setData({
          workAddress_haschanged: true,
          workingcityInfo: work_address
        })
        break;
      case 'rent_house_locate':
        console.log('rent_house_locate', e)
        var rent_address = this.data.rentLocateInfo;
        rent_address.address_value = e.detail.value
        if (e.detail.value[0] == e.detail.value[1]) {
          rent_address.selected = e.detail.value[1] + e.detail.value[2]
        } else {
          rent_address.selected = e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
        }
        rent_address.address_value = e.detail.value
        rent_address.address_code = e.detail.code
        // this.getCityLevel({
        //   'province_code': e.detail.code[0] ,
        //   'province': e.detail.value[0],
        //   'city_code': e.detail.code[1] ,
        //   'city': e.detail.value[1],
        //   'district_code': e.detail.code[2] ,
        //   'district': e.detail.value[2]
        // })
        this.setData({
          rentAddress_haschanged: true,
          rentLocateInfo: rent_address
        })
        break;
    }
    // var educate_name = this.data.edu_array[e.detail.value]
    // this.setData({
    //   edu_name: educate_name
    // })
  },
  getCityLevel:function(loc){
    var that = this;
    var Authorization = app.globalData.Authorization;
    wx.request({
      url: baseUrl + 'persontax/v1/house-rent-deductions',
      header: {
        'content-type': 'application/json',
        "Authorization": Authorization
      },
      method:"POST",
      data: { 'address_codes': loc},
      success(res) {
        if (res && res.statusCode < 300) {
          that.setData({
            deduction_amount: res.data.amount
          })
        } else {
          wx.showToast({
            title: res.data.message ? res.data.message : '请求出错',
            icon: 'none'
          })
        }
      }
    })
  },


  // goupload: function(e) {
  //   console.log(e)
  //   var that = this
  //   wx.chooseImage({
  //     sourceType: ['camera', 'album'],
  //     // sizeType: ['original'],
  //     count: 1,
  //     success: function(res) {
  //       console.log('success', res)
  //       that.setData({
  //         img_path: res.tempFilePaths[0]
  //       })
  //       that.uploadImage(that.data.img_path)
  //     }
  //   })
  // },

  // uploadImage: function(path) {
  //   var that = this
  //   wx.showLoading({
  //     title: '上传图片中...',
  //   })
  //   console.log('key', 'imagepath_' + path.substring(path.length - 10, path.length))
  //   wx.uploadFile({
  //     url: getApp().globalData.OSSUrl,
  //     filePath: path,
  //     name: 'file',
  //     formData: {
  //       'key': 'imagepath_' + path.substring(path.length - 15, path.length),
  //       'OSSAccessKeyId': OSSInit.access_key_id,
  //       'policy': OSSInit.policy,
  //       'signature': OSSInit.signature,
  //       'callback': OSSInit.callback_body,
  //       'x:access_token': OSSInit.callback_token,
  //       'success_action_status': '200',
  //     },
  //     success: function(res) {
  //       console.log('uploadFile', res.data)
  //       if (res.statusCode == 200) {
  //         var data = JSON.parse(res.data)
  //         console.log('上传成功', res)
  //         that.oss_bucket = data.bucket

  //       } else {
  //         var title = '图片上传失败,请重新上传'
  //         if (res.statusCode == 413) {
  //           title = '图片体积过大,请选择较小图片上传'
  //         }
  //         wx.showModal({
  //           title: '上传失败',
  //           content: title,
  //           showCancel: false,
  //           confirmColor: '#4E8FE7'
  //         })
  //       }
  //       wx.hideLoading()
  //     },
  //     fail: function(err) {
  //       console.log('fail', err)
  //       wx.showModal({
  //         title: '上传失败',
  //         content: '图片上传失败,请重新上传',
  //         showCancel: false,
  //         confirmColor: '#4E8FE7'
  //       })
  //       wx.hideLoading()
  //     },
  //     complete(res) {
  //       console.log('complete', res)
  //       wx.hideLoading()
  //     }
  //   })
  // },

  getWorkingAddressRequest: function() {
    var that = this
    if (that.data.workAddress_haschanged) {
      return {
        "province_code": that.data.workingcityInfo.address_code[0],
        "province": that.data.workingcityInfo.address_value[0],
        "city_code": that.data.workingcityInfo.address_code[1],
        "city": that.data.workingcityInfo.address_value[1],
        "district_code": "",
        "district": ""
      }
    } else {
      return that.data.workingcityInfo.requestdata
    }
  },

  getRentAddressRequest: function() {
    var that = this
    if (that.data.rentAddress_haschanged) {
      return {
        "province_code": that.data.rentLocateInfo.address_code[0],
        "province": that.data.rentLocateInfo.address_value[0],
        "city_code": that.data.rentLocateInfo.address_code[1],
        "city": that.data.rentLocateInfo.address_value[1],
        "district_code": that.data.rentLocateInfo.address_code[2],
        "district": that.data.rentLocateInfo.address_value[2]
      }
    } else {
      return that.data.rentLocateInfo.requestdata
    }
  },

  getLoanAddressRequest: function() {
    var that = this
    if (that.data.loanAddress_haschanged) {
      return {
        "province_code": that.data.houseLocateInfo.address_code[0],
        "province": that.data.houseLocateInfo.address_value[0],
        "city_code": that.data.houseLocateInfo.address_code[1],
        "city": that.data.houseLocateInfo.address_value[1],
        "district_code": that.data.houseLocateInfo.address_code[2],
        "district": that.data.houseLocateInfo.address_value[2]
      }
    } else {
      return that.data.houseLocateInfo.requestdata
    }
  },

  showToast: function(data) {
    if (data && data.length > 0) {
      wx.showToast({
        title: data,
        icon: "none"
      })
    }
  },

  /**
   * Lifecycle function--Called when page hide
   */
  onHide: function() {

  },

  /**
   * Lifecycle function--Called when page unload
   */
  onUnload: function() {

  },

  /**
   * Page event handler function--Called when user drop down
   */
  onPullDownRefresh: function() {

  },

  /**
   * Called when page reach bottom
   */
  onReachBottom: function() {

  },

  /**
   * Called when user click on the top right corner to share
   */
  onShareAppMessage: function() {

  }

})