addinfo.js 25.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835
// pages/main/addinfo/addinfo.js
var app = getApp();
var format = require('../../../utils/util.js');
var baseUrl = app.globalData.baseUrl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isshow01: false,
    isshow02: false,
    isshow03: false,
    proffessionlist: {},
    banklist: {},
    isself: false,
    isIdCard: true,
    name: '',
    card_number: '',
    birthday: '',
    requestBody: {},
    profession_index:[0,0,0],

    relativeData: {
      isrequre: true,
      label: '关系',
      bindtype: 'relative',
      selected: '',
      disabled: false,
      placeholder: '请选择关系',
      values: ["子女", "配偶"],
      onChange: 'onPickerSelect'
    },
    personstatusData: {
      isrequre: true,
      label: '纳税人状态',
      bindtype: 'personstatus',
      selected: '',
      placeholder: '请选择纳税人状态',
      values: ["正常", "非正常"],
      onChange: 'onPickerSelect'
    },
    cardtypeData: {
      isrequre: true,
      label: '证照类型',
      bindtype: 'cardtype',
      selected: '',
      placeholder: '请选择证照类型',
      values: ["居民身份证", "军官证", '士兵证', '武警警官证', '港澳居民来往大陆通行证', '外交官证', '中国护照',
        '外国护照', '香港永久性居民身份证', '澳门特别行政区永久性居民身份证', '台湾身份证', '外国人永久居留证'
      ],
      onChange: 'onPickerSelect'
    },
    forignerInfo: {
      isrequre: true,
      label: '是否境外人员',
      bindtype: 'forigner',
      placeholder: '否',
      disabled: true,
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    bankInfo: {
      label: '开户银行',
      bindtype: 'bank',
      selected: '',
      placeholder: '请选择开户银行',
      onChange: 'onPickerSelect'
    },
    genderData: {
      label: '性别',
      bindtype: 'gender',
      selected: '',
      placeholder: '请选择性别',
      values: ["男", "女"],
      onChange: 'onPickerSelect'
    },
    professionData: {
      mode: 'multiSelector',
      label: '职业',
      bindtype: 'profession',
      selected: '',
      range_key: 'label',
      placeholder: '请选择职业',
      onChange: 'onPickerSelect'
    },
    degreeData: {
      label: '学历',
      bindtype: 'degree',
      selected: '',
      placeholder: '请选择学历',
      values: ["研究生", "大学本科", '大学本科以下'],
      onChange: 'onPickerSelect'
    },
    disabilityInfo: {
      label: '是否残疾',
      bindtype: 'disable',
      selected: '',
      placeholder: '请选择是否残疾',
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    lieshuInfo: {
      label: '是否烈属',
      bindtype: 'lieshu',
      selected: '',
      placeholder: '请选择是否烈属',
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    lonelyolderInfo: {
      label: '是否孤老',
      bindtype: 'lonelyolder',
      selected: '',
      placeholder: '请选择是否孤老',
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    investInfo: {
      isrequre: true,
      label: '是否股东、投资者',
      bindtype: 'invest',
      selected: '',
      placeholder: '请选择是否股东、投资者',
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    specificIndustryInfo: {
      isrequre: true,
      label: '是否特定行业',
      bindtype: 'specificIndustry',
      selected: '',
      placeholder: '请选择是否特定行业',
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    employeeInfo: {
      label: '是否雇员',
      bindtype: 'employee',
      selected: '',
      placeholder: '请选择是否雇员',
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    investpersonalInfo: {
      label: '是否天使投资个人',
      bindtype: 'investpersonal',
      selected: '',
      placeholder: '请选择是否天使投资个人',
      values: ["否", "是"],
      onChange: 'onPickerSelect'
    },
    // 时间picker
    birthDate: {
      label: '出生年月',
      bindtype: 'birthday',
      selected: '',
      placeholder: '请选择出生日期',
      mode: "date",
      fields: "day",
      start: '1949-01-01',
      onChange: 'birthdayChange',
    },
    startDate: {
      label: '在职受雇日期',
      bindtype: 'startday',
      selected: '',
      placeholder: '请选择受雇日期',
      mode: "date",
      fields: "day",
      start: '1990-01-01',
      onChange: 'startChange',
    },
    endDate: {
      label: '离职日期',
      bindtype: 'endday',
      selected: '',
      placeholder: '请选择离职日期',
      mode: "date",
      fields: "day",
      start: '2010-01-01',
      onChange: 'endChange',
    },
    // 地址选择器
    contactaddressInfo: {
      label: '联系地址',
      mode: 'region',
      address_code: ['', '', ''],
      address_value: ['', '', ''],
      selected: '',
      placeholder: '请选择联系地址',
      onChange: 'contactAddressSelect'
    },
    currentaddressInfo: {
      label: '居住地',
      mode: 'region',
      address_code: ['', '', ''],
      address_value: ['', '', ''],
      selected: '',
      placeholder: '请选择居住地',
      onChange: 'currentAddressSelect'
    },
    birthaddressInfo: {
      label: '户籍所在地',
      mode: 'region',
      address_code: ['', '', ''],
      address_value: ['', '', ''],
      selected: '',
      placeholder: '请选择户籍所在地',
      onChange: 'birthAddressSelect'
    },
    title: '',
    condition: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.handleData()
    this.getproffessiondata()
    this.getbanklist()
  },

  handleData:function(){
    var curdate = format.curDateTime()
    console.log('curdate', curdate) 
    this.data.birthDate.end = curdate
    this.data.startDate.end = curdate
    this.data.endDate.end = curdate
  },

  getproffessiondata: function() {
    var that = this
    var Authorization = app.globalData.Authorization;
    var proffession_info = that.data.professionData
    wx.request({
      url: baseUrl + 'common/v1/professions',
      method: "GET",
      header: {
        'content-type': 'application/json', // 默认值
        "Authorization": Authorization
      },
      success: function(res) {
        proffession_info.values = that.handleProfession(res.data.items)
        console.log('proffession_info------', proffession_info)
        that.setData({
          proffessionlist: res.data.items,
          professionData: proffession_info
        })
      },
      fail(res) {
        console.log(res)
      }
    })
  },

  handleProfession: function(items) {
    var new_profession_data = []
    var list = [],
      tempTwo = {},
      tempOne = {},
      tempThree = {};
    items.map((d) => {
      if (!tempOne[d.one_level_code]) {
        tempOne[d.one_level_code] = {
          "value": d.one_level_code,
          "label": d.one_level_name,
          "children": []
        };
      }
      if (!tempTwo[d.two_level_code]) {
        var districtArray = [];
        districtArray.push({
          "value": d.three_level_code,
          "label": d.three_level_name,
          "children": []
        });

        tempTwo[d.two_level_code] = {
          "value": d.two_level_code,
          "label": d.two_level_name,
          "children": districtArray
        };

      } else {
        if (!tempThree[d.three_level_code]) {
          tempTwo[d.two_level_code].children.push({
            "value": d.three_level_code,
            "label": d.three_level_name,
            "children": []
          });
          tempThree[d.three_level_code] = "y"
        }
      }
    });
    items.map((d) => {
      if (tempTwo[d.two_level_code]) {
        tempOne[d.one_level_code].children.push(tempTwo[d.two_level_code]);
        tempTwo[d.two_level_code] = null;
      }
    });
    for (var key in tempOne) {
      list.push(tempOne[key]);
    }
    new_profession_data = [list, list[0].children, list[0].children[0].children]
    console.log('new_profession_data', new_profession_data)
    return new_profession_data;
    
  },

  getbanklist: function() {
    var that = this
    var Authorization = app.globalData.Authorization;
    var bank_info = that.data.bankInfo
    wx.request({
      url: baseUrl + 'walletmgm/v1/bankinfos',
      method: "GET",
      header: {
        'content-type': 'application/json', // 默认值
        "Authorization": Authorization
      },
      success: function(res) {
        console.log(res)
        if (res.data && res.data.items && res.data.items.length > 0) {
          bank_info.values = that.handleBankinfo(res.data.items)

          that.setData({
            banklist: res.data.items,
            bankInfo: bank_info
          })
        }
        console.log("bankInfo", that.data.bankInfo)
      },
      fail(res) {
        console.log(res)
      }
    })
  },

  handleBankinfo: function(data) {
    var bank_name = []
    for (var i = 0; i < data.length; i++) {
      bank_name.push(data[i].bank_name)
    }
    return bank_name
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    var that = this
    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 = id_info.birthday.year + '-' + id_info.birthday.month + '-' + id_info.birthday.day;
          var cardtype_Data = that.data.cardtypeData
          cardtype_Data.selected = '居民身份证'
          var gender_Data = that.data.genderData
          gender_Data.selected = id_info.gender

          that.data.birthDate.selected = birth_day
          
          if (that.data.name.length > 0 && id_info.name != that.data.name){
            that.showtoast("姓名冲突")
            return
          }
          if (that.data.card_number.length > 0 && id_info.card_number != that.data.id_card_no) {
            that.showtoast("证照号码冲突")
            return
          }
          that.setData({
            name: id_info.name,
            birthday: birth_day,
            cardtypeData: cardtype_Data,
            genderData: gender_Data,
            birthDate: that.data.birthDate,
            card_number: id_info.id_card_number
          })
          
        }
      },
    })
    wx.removeStorage({
      key: 'id_info',
      success: function(res) {
        console.log('remove_idinfo', res)
      },
    })
  },

  span: function(e) {
    console.log(e)
    if ("1" == e.target.id) {
      this.setData({
        isshow01: !this.data.isshow01
      })
    } else if ("2" == e.target.id) {
      this.setData({
        isshow02: !this.data.isshow02
      })
    } else if ("3" == e.target.id) {
      this.setData({
        isshow03: !this.data.isshow03
      })
    }

  },
  // =============普通单列picker选中处理==============
  onPickerSelect: function(e) {
    console.log('picker发送选择改变,携带值为', e)
    switch (e.currentTarget.id) {
      case 'relative':
        var relative_data = this.data.relativeData
        relative_data.selected = relative_data.values[e.detail.value]
        this.setData({
          relativeData: relative_data
        })
        break;
      case 'personstatus':
        var personstatus_data = this.data.personstatusData
        personstatus_data.selected = personstatus_data.values[e.detail.value]
        this.setData({
          personstatusData: personstatus_data
        })
        break;
      case 'cardtype':
        var is_idcard = this.data.isIdCard
        var cardtype_data = this.data.cardtypeData
        cardtype_data.selected = cardtype_data.values[e.detail.value]
        if (0 == e.detail.value) {
          is_idcard = true
        } else {
          is_idcard = false
        }
        this.setData({
          isIdCard: is_idcard,
          cardtypeData: cardtype_data
        })
        break;
      case 'forigner':
        var forigner_data = this.data.forignerInfo
        forigner_data.selected = forigner_data.values[e.detail.value]
        this.setData({
          forignerInfo: forigner_data
        })
        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 'gender':
        var gender_data = this.data.genderData
        gender_data.selected = gender_data.values[e.detail.value]
        this.setData({
          genderData: gender_data
        })
        break;
      case 'profession':
        var profession_data = this.data.professionData
        console.log(profession_data.values[e.detail.value[e.detail.value[0]]][0])
        var profession_name = profession_data.values[e.detail.value[e.detail.value[0]]][0].children[e.detail.value[1]].children[e.detail.value[2]].label
        profession_data.selected = profession_name
        this.setData({
          profession_index: e.detail.value,
          professionData: profession_data
        })
        break;
      case 'degree':
        var degree_data = this.data.degreeData
        degree_data.selected = degree_data.values[e.detail.value]
        this.setData({
          degreeData: degree_data
        })
        break;
      case 'disable':
        var disable_data = this.data.disabilityInfo
        disable_data.selected = disable_data.values[e.detail.value]
        this.setData({
          disabilityInfo: disable_data
        })
        break;
      case 'lieshu':
        var lieshu_data = this.data.lieshuInfo
        lieshu_data.selected = lieshu_data.values[e.detail.value]
        this.setData({
          lieshuInfo: lieshu_data
        })
        break;
      case 'lonelyolder':
        var lonelyolder_data = this.data.lonelyolderInfo
        lonelyolder_data.selected = lonelyolder_data.values[e.detail.value]
        this.setData({
          lonelyolderInfo: lonelyolder_data
        })
        break;
      case 'invest':
        var invest_data = this.data.investInfo
        invest_data.selected = invest_data.values[e.detail.value]
        this.setData({
          investInfo: invest_data
        })
        break;
      case 'specificIndustry':
        var specificIndustry_data = this.data.specificIndustryInfo
        specificIndustry_data.selected = specificIndustry_data.values[e.detail.value]
        this.setData({
          specificIndustryInfo: specificIndustry_data
        })
        break;
      case 'employee':
        var employee_data = this.data.employeeInfo
        employee_data.selected = employee_data.values[e.detail.value]
        this.setData({
          employeeInfo: employee_data
        })
        break;
      case 'investpersonal':
        var investpersonal_data = this.data.investpersonalInfo
        investpersonal_data.selected = investpersonal_data.values[e.detail.value]
        this.setData({
          investpersonalInfo: investpersonal_data
        })
        break;
    }

  },

  // =============日期picker选中处理==============
  birthdayChange: function(e) {
    var birth_date = this.data.birthDate;
    birth_date.selected = e.detail.value
    this.setData({
      birthday: e.detail.value,
      birthDate: birth_date
    })
  },

  startChange: function(e) {
    var start_date = this.data.startDate;
    start_date.selected = e.detail.value
    this.setData({
      startDate: start_date
    })
  },

  endChange: function(e) {
    var end_date = this.data.endDate;
    end_date.selected = e.detail.value
    this.setData({
      endDate: end_date
    })
  },

  // =============地区picker选中处理==============

  contactAddressSelect: function(e) {
    console.log('contactAddressSelect', e)
    var contact_address = this.data.contactaddressInfo;
    contact_address.address_value = e.detail.value
    contact_address.address_code = e.detail.code
    this.setData({
      contactaddressInfo: contact_address
    })
  },

  currentAddressSelect: function(e) {
    console.log('currentAddressSelect', e)
    var current_address = this.data.currentaddressInfo;
    current_address.address_value = e.detail.value
    current_address.address_code = e.detail.code
    this.setData({
      currentaddressInfo: current_address
    })
  },

  birthAddressSelect: function(e) {
    console.log('birthAddressSelect', e)
    var birth_address = this.data.birthaddressInfo;
    birth_address.address_value = e.detail.value
    birth_address.address_code = e.detail.code
    this.setData({
      birthaddressInfo: birth_address
    })
  },

  // =============其他数据选中处理==============

  getIdInfo: function(e) {
    if (this.data.isIdCard) {
      wx.navigateTo({
        url: '../idinfo/idinfo',
        success: function(res) {},
      })
    }
  },

  formSubmit: function(e) {
    console.log("date", Date.parse(new Date(this.data.birthday)) / 1000)
    // var pro_index = this.data.profession_index
    // var profession_datas = this.data.professionData.values[pro_index[pro_index[0]]][0]
    // console.log('profession_datas', profession_datas)
    // var regMoney = /^[0-9]*(/.[0-9]{1,2})?$/;
    var regMoney = /^[0-9]*(\.[0,9]{1,2})?$/;
    var regMobile = /^1[3|4|5|7|8][0-9]{9}$/;
    var regname = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/;
    var regEmail = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
    var formdata = e.detail.value;
    console.log("formdata", formdata);
    console.log('idnum', this.data.card_number.length < 1&&!format.isIDCardNum(formdata.id_card_no))
    if (formdata.name.length < 1) {
      this.showtoast('有必填项未填写');
      return
    } else if (!regname.test(formdata.name)) {
      this.showtoast('请输入正确姓名');
      return
    } else if (this.data.relativeData.selected.length < 1) {
      this.showtoast('有必填项未填写');
      return
    } else if (this.data.personstatusData.selected.length < 1) {
      this.showtoast('有必填项未填写');
      return
    } else if (this.data.cardtypeData.selected.length < 1) {
      this.showtoast('有必填项未填写');
      return
    } else if (this.data.isIdCard && (this.data.card_number.length < 1 && formdata.id_card_no.length < 1)) {
      this.showtoast('有必填项未填写');
      return
    } else if (this.data.isIdCard &&!format.isIDCardNum(formdata.id_card_no)) {
      this.showtoast('证件号码有误');
      return
    }else if (!this.data.isIdCard && (!formdata.id_card_no || formdata.id_card_no.length < 1)) {
      this.showtoast('有必填项未填写');
      return
    } else if (formdata.mobile.length < 1) {
      this.showtoast('有必填项未填写');
      return
    } else if (!regMobile.test(formdata.mobile)){
      this.showtoast('请输入正确手机号');
      return
    } else if (this.data.investInfo.selected.length < 1) {
      this.showtoast('有必填项未填写');
      return
    } else if (this.data.specificIndustryInfo.selected.length < 1) {
      this.showtoast('有必填项未填写');
      return
    } else if (formdata.email && formdata.email.length > 0 && !regEmail.test(formdata.email)){
      this.showtoast('请输入正确邮箱');
      return
    } else if (formdata.company_equity_total && formdata.company_equity_total.length > 0 && !regMoney.test(formdata.company_equity_total)) {
      this.showtoast('请输入正确金额');
      return
    } else if (formdata.personal_equity_total && formdata.personal_equity_total.length > 0 && !regMoney.test(formdata.personal_equity_total)) {
      this.showtoast('请输入正确金额');
      return
    }
    var new_card_num = ''
    if (this.data.isIdCard) {
      if (this.data.card_number.length > 0) {
        new_card_num = this.data.card_number
      }
      if (formdata.id_card_no.length > 0) {
        new_card_num = formdata.id_card_no
      }
    }
    
    if (!this.data.isIdCard && formdata.id_card_no && formdata.id_card_no.length > 0) {
      new_card_num = formdata.id_card_no
    }
    this.setData({
      card_number: new_card_num,
    })
    this.goCommit(formdata);
  },

  goCommit: function(data) {
    var that = this
    var formdata = data
    console.log("form_data", formdata);
    var pro_index = that.data.profession_index
    var profession_data_info = that.data.professionData.values[pro_index[pro_index[0]]][0]
    console.log('profession_datas', profession_data_info)
    var Authorization = app.globalData.Authorization;
    wx.request({
      url: baseUrl + 'persontax/v1/personal-taxes',
      method: "POST",
      data: {
        "name": that.data.name.length > 0 ? that.data.name : formdata.name,
        "family_ties": that.data.relativeData.selected,
        "native": "中国",
        "id_card_type": that.data.cardtypeData.selected,
        "id_card_no": that.data.card_number,
        "gender": that.data.genderData.selected,
        "birth_date": Date.parse(new Date(this.data.birthday)) / 1000,
        "profession": {
          "one_level_code": profession_data_info.value,
          "one_level_name": profession_data_info.label,
          "two_level_code": profession_data_info.children[pro_index[1]].value,
          "two_level_name": profession_data_info.children[pro_index[1]].label,
          "three_level_code": profession_data_info.children[pro_index[1]].children[pro_index[2]].value,
          "three_level_name": profession_data_info.children[pro_index[1]].children[pro_index[2]].label
        },
        "education": that.data.degreeData.selected,
        "taxpayer_no": formdata.taxpayer_no ? formdata.taxpayer_no : '',
        "taxpayer_status": that.data.personstatusData.selected,
        "is_martyr_family": that.data.lieshuInfo.selected,
        "martyr_family_no": formdata.martyr_family_no,
        "is_disability": that.data.disabilityInfo.selected,
        "disability_no": formdata.disability_no,
        "is_lonely_man": that.data.lonelyolderInfo.selected,
        "is_overseas_personnel": "否",
        "comment": formdata.comment,
        "current_address": {
          "province_code": that.data.currentaddressInfo.address_code[0],
          "province": that.data.currentaddressInfo.address_value[0],
          "city_code": that.data.currentaddressInfo.address_code[1],
          "city": that.data.currentaddressInfo.address_value[1],
          "district_code": that.data.currentaddressInfo.address_code[2],
          "district": that.data.currentaddressInfo.address_value[2]
        },
        "current_address_detail": formdata.current_address_detail,
        "huji_address": {
          "province_code": that.data.birthaddressInfo.address_code[0],
          "province": that.data.birthaddressInfo.address_value[0],
          "city_code": that.data.birthaddressInfo.address_code[1],
          "city": that.data.birthaddressInfo.address_value[1],
          "district_code": that.data.birthaddressInfo.address_code[2],
          "district": that.data.birthaddressInfo.address_value[2]
        },
        "huji_address_detail": formdata.huji_address_detail,
        "mobile": formdata.mobile,
        "contact_address": {
          "province_code": that.data.contactaddressInfo.address_code[0],
          "province": that.data.contactaddressInfo.address_value[0],
          "city_code": that.data.contactaddressInfo.address_code[1],
          "city": that.data.contactaddressInfo.address_value[1],
          "district_code": that.data.contactaddressInfo.address_code[2],
          "district": that.data.contactaddressInfo.address_value[2]
        },
        "contact_address_detail": formdata.contact_address_detail,
        "email": formdata.email,
        "bank": that.data.bankInfo.selected,
        "bank_account": formdata.bank_account,
        "join_date": that.data.startDate.selected.length > 0 ? Date.parse(new Date(that.data.startDate.selected)) / 1000 : null,
        "separate_date": that.data.endDate.selected.length > 0 ? Date.parse(new Date(that.data.endDate.selected)) / 1000 : null,
        "is_employee": that.data.employeeInfo.selected,
        "is_specific_profession": that.data.specificIndustryInfo.selected,
        "is_investor": that.data.investInfo.selected,
        "is_business_angel": that.data.investpersonalInfo.selected,
        "company_equity_total": parseFloat(formdata.company_equity_total),
        "personal_equity_total": parseFloat(formdata.personal_equity_total),
        "employee_no": formdata.employee_no
      },
      header: {
        'content-type': 'application/json', // 默认值
        "Authorization": Authorization
      },
      success: function(res) {
        console.log(res)
        if(res.statusCode==200){
          wx.redirectTo({
            url: '../home/home',
          })
        } else {
          wx.showModal({
            title: res.data.message,
            content: '',
          })
        }
        
      },
      fail(res) {
        console.log(res)
      }
    })
  },

  showtoast: function(title) {
    wx.showToast({
      title: title,
      duration:2000,
      image: '/images/error.png'
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})