lookandupdate.js 24.8 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
// pages/main/addtionalreduce/childreneducate/childreneducate.js
var app = getApp();
var baseUrl = app.globalData.baseUrl;
var format = require('../../../../utils/util.js');
Page({

  /**
   * Page initial data
   */
  data: {
    cur_status: "",
    legal_entity_id: "",
    legal_entity: "",
    house_type: "",
    btn_show:false,
    person_total_amount: 0,
    remaining_amount: 0,
    input_disable: false,
    origindata: {},
    declareStatus: {
      "to_declare": "待申报",
      "declaring": "申报中",
      "success": "审核成功",
      "failed": "审核失败"
    },
    additiontitle: {
      "children_education": "子女教育",
      "continuing_education": "继续教育",
      "support_duty": "赡养老人",
      "medical_fund": "大病医疗",
      "house_fund": "住房"
    },
    title: '',
    imgpath: '',
    new_data: null,
    modal_images: {
      "children_education": "/images/childedu_declare.png",
      "continuing_education": "/images/continueedu_declare.png",
      "support_duty": "/images/support_older_declare.png",
      "medical_fund": "/images/health_declare.png",
      "house_fund": "/images/house_declare.png"
    },
    showModal_img: false,
    showModal_reducetype: false,
    showModal_addtype: false,
    url_arr: {
      "children_education": "persontax/v1/children-educations/",
      "continuing_education": "persontax/v1/continuing-educations/",
      "support_duty": "persontax/v1/support-duties/",
      "medical_fund": "persontax/v1/medical-funds/",
      "house_fund": "persontax/v1/house-funds/"
    },
    reducetype: {
      "": "月",
      "month": "月",
      "year": "年"
    },
    issinglechildData: {
      label: '是否独生子女',
      bindtype: 'issingle_child',
      selected: '',
      isblack: 'true',
      disabled: false,
      placeholder: '请选择是否独生子女',
      values: ["是", "否"],
      onChange: 'onPickerSelect'
    },
    shareMethodData: {
      label: '分摊方式',
      bindtype: 'share_method',
      selected: '',
      isblack: 'true',
      disabled: false,
      values: ["赡养人平均分摊", "赡养人约定分摊", "被赡养人指定分摊"],
      placeholder: '请选择分摊方式',
      onChange: 'onPickerSelect'
    },
    additionInfo: [],
    reducetypeData: ["月度", "年度"],
    modalData: {},
    children_modalData: {
      title: "请选择子女进行申报",
      datas: [],
      lefttext: "添加新子女并申报",
      righttext: "确定为该子女申报",
    },
    support_older_modalData: {
      title: "请选择父母或祖父母进行申报",
      datas: [],
      lefttext: "添加被赡养人并申报",
      righttext: "确定为该被赡养人申报",
    },
    medical_modalData: {
      title: "请选择本人、配偶或子女进行大病支出申报",
      datas: [],
      lefttext: "添加家庭成员并申报",
      righttext: "确定为该选择的人申报",
    },
    spousedataData: {}, //配偶数据
    reduce_amount: -1,
    selected_reduceindex: 0,
    selected_addindex: 0
  },

  /**
   * Lifecycle function--Called when page load
   */
  onLoad: function(options) {
    var that = this
    var housetype, housestatus
    wx.showLoading({
      title: '',
    })
    console.log("options", options);
    if (options.status == 'house_fund_rent') {
      housetype = 'house_fund_rent'
      housestatus = 'house_fund'
    } else if (options.status == 'house_fund_loan') {
      housetype = 'house_fund_loan'
      housestatus = 'house_fund'
    } else {
      housetype = ''
      housestatus = options.status
    }
    this.setData({
      cur_status: housestatus,
      house_type: housetype,
      legal_entity_id: options.legal_entity_id,
      legal_entity: options.legal_entity,
      selected_reduceindex: options.status == 'medical_fund' ? 1 : 0
    })
    wx.setNavigationBarTitle({
      "title": that.data.additiontitle[this.data.cur_status],
    })

  },

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

  },

  /**
   * Lifecycle function--Called when page show
   */
  onShow: function() {
    var that = this
    this.getAdditionInfo()
    this.getTaxList()
  },

  getAdditionInfo() {
    var that = this;
    var Authorization = getApp().globalData.Authorization;
    wx.request({
      url: baseUrl + that.data.url_arr[that.data.cur_status] + that.data.legal_entity_id,
      header: {
        'content-type': 'application/json',
        "Authorization": Authorization
      },
      success: function(res) {
        if (res && res.data) {
          console.log("res", res)
          that.handleAddition(res.data)
        }
      },
      fail: function(res) {
        wx.hideLoading()
      }
    })
  },

  handleAddition: function(data) {
    var that = this
    var newdata = data.items
    var inputdisable = this.data.input_disable
    this.setData({
      origindata: data
    })
    if (newdata && newdata.length > 0) {
      var btn_show = this.data.btn_show
      if (that.data.cur_status == "continuing_education") {
        var professionlist = newdata[0].profession_items
        for (var i = 0; i < professionlist.length > 0; i++) {
          if (professionlist[i].approval_date) {
            professionlist[i].approval_date = this.formatDate(professionlist[i].approval_date)
          }
        }
        var titlelist = newdata[0].title_items
        for (var i = 0; i < titlelist.length > 0; i++) {
          if (titlelist[i].education_start) {
            titlelist[i].education_start = this.formatDate(titlelist[i].education_start).substring(0, 7)
          }
          if (titlelist[i].education_end) {
            titlelist[i].education_end = this.formatDate(titlelist[i].education_end).substring(0, 7)
          }
        }
          btn_show = true
        // this.setData({
        //   issinglechildData: issinglechild_Data,
        //   shareMethodData: shareMethod_Data
        // })
      } else if (that.data.cur_status == "support_duty") {
        
        var supportlist = newdata[0].support_duties
        if (supportlist && supportlist.length > 0) {
          for (var i = 0; i < supportlist.length; i++) {
            if (supportlist[i].birthday) {
              supportlist[i].birthday = this.formatDate(supportlist[i].birthday)
            }
          }
        }
        var cosupportlist = newdata[0].co_supporters
        if (cosupportlist && cosupportlist.length > 0) {
          for (var i = 0; i < cosupportlist.length; i++) {
            if (cosupportlist[i].birthday) {
              cosupportlist[i].birthday = this.formatDate(cosupportlist[i].birthday)
            }
            if (cosupportlist[i].id_card_no) {
              cosupportlist[i].id_card_no = this.formatIdNum(cosupportlist[i].id_card_no)
            }
          }
        }

        var issinglechild_Data = this.data.issinglechildData;
        var shareMethod_Data = this.data.shareMethodData;
        if (supportlist.length < 1 && cosupportlist.length<1){
          btn_show = true
          inputdisable = false
          issinglechild_Data.disabled = false;
          shareMethod_Data.disabled = false;
        }else{
          btn_show = false
          inputdisable = true
          issinglechild_Data.disabled = true;
          issinglechild_Data.selected = data.is_single == 'y' ? "是" : "否";

          shareMethod_Data.disabled = true;
          shareMethod_Data.selected = data.share_method ? data.share_method : "";
        }

        this.setData({
          issinglechildData: issinglechild_Data,
          shareMethodData: shareMethod_Data,
        })
      } else {
        for (var i = 0; i < newdata.length; i++) {
          if (newdata[i].education_start) {
            newdata[i].education_start = this.formatDate(newdata[i].education_start).substring(0, 7)
          }
          if (newdata[i].education_end) {
            newdata[i].education_end = this.formatDate(newdata[i].education_end).substring(0, 7)
          }
          if (newdata[i].patient_birthday) {
            newdata[i].patient_birthday = this.formatDate(newdata[i].patient_birthday)
          }
          //详情迁移
          if (newdata[i].children_birthday) {
            newdata[i].children_birthday = this.formatDate(newdata[i].children_birthday)
          }
          if (newdata[i].spouse_birthday) {
            newdata[i].spouse_birthday = this.formatDate(newdata[i].spouse_birthday)
          }
          if (newdata[i].birthday) {
            newdata[i].birthday = this.formatDate(newdata[i].birthday)
          }
          if (newdata[i].rent_start) {
            newdata[i].rent_start = this.formatDate(newdata[i].rent_start)
          }
          if (newdata[i].rent_end) {
            newdata[i].rent_end = this.formatDate(newdata[i].rent_end)
          }
          if (newdata[i].loan_start) { //公积金
            newdata[i].loan_start = this.formatDate(newdata[i].loan_start)
          }
          if (newdata[i].sec_loan_start) { //商业
            newdata[i].sec_loan_start = this.formatDate(newdata[i].sec_loan_start)
          }

          if (newdata[i].children_id_card_no) {
            newdata[i].children_id_card_no = this.formatIdNum(newdata[i].children_id_card_no)
          }
          if (newdata[i].spouse_id_card_no) {
            newdata[i].spouse_id_card_no = this.formatIdNum(newdata[i].spouse_id_card_no)
          }
          if (newdata[i].id_card_no) {
            newdata[i].id_card_no = this.formatIdNum(newdata[i].id_card_no)
          }

          if (newdata[i].house_address) {
            if (newdata[i].house_address.province == newdata[i].house_address.city) {
              newdata[i].house_address_new = newdata[i].house_address.city + newdata[i].house_address.district
            } else {
              newdata[i].house_address_new = newdata[i].house_address.province + newdata[i].house_address.city + newdata[i].house_address.district
            }
          }

          if (newdata[i].work_city) {
            newdata[i].work_city_new = newdata[i].work_city.province + newdata[i].work_city.city
          }

          if (newdata[i].co_supporters && newdata[i].co_supporters.length > 0) {
            for (var j = 0; j < newdata[i].co_supporters.length; j++) {
              if (newdata[i].co_supporters[j].birthday) {
                newdata[i].co_supporters[j].birthday = this.formatDate(newdata[i].co_supporters[j].birthday)
              }
              newdata[i].co_supporters[j].id_card_no = this.formatIdNum(newdata[i].co_supporters[j].id_card_no)
            }
          }
        }

        var housetype_new = this.data.house_type
        if (newdata.length > 0 && newdata[0].type) {
          housetype_new = newdata[0].type == 'loan' ? "house_fund_loan" : "house_fund_rent"
        }
        console.log("housetype_new", housetype_new)
        if (housetype_new !="house_fund_loan"){
          btn_show = true
        }
        this.setData({
          house_type: housetype_new,
        })
      }
      this.setData({
        reduce_amount: data.month_deduction_amount ? data.month_deduction_amount : 0,
        input_disable: inputdisable,

        btn_show: btn_show,
        person_total_amount: data.person_total_amount ? data.person_total_amount : 0,
        remaining_amount: data.remaining_amount ? data.remaining_amount : 0,
        additionInfo: newdata
      })
      console.log("newdata", newdata)
      wx.hideLoading()
    } else {
      this.setData({
        btn_show : true,
        additionInfo: newdata
      })
    }
  },

  goaddSupporter: function() {
    wx.navigateTo({
      url: '../adddupporters/adddupporters?id=' + this.data.legal_entity_id,
    })

  },

  // lookimg: function() { //查看材料

  //   if (this.data.imgpath && this.data.imgpath.length > 0) {
  //     wx.previewImage({
  //       urls: [this.data.imgpath],
  //     })
  //   } else {
  //     wx.showToast({
  //       title: '暂无可查看资料',
  //     })
  //   }
  // },

  showdetail: function(e) {
    if (this.data.additionInfo && this.data.additionInfo.length > 0) {
      var info
      if (this.data.cur_status == "support_duty") {
        info = JSON.stringify(this.data.additionInfo[0].support_duties[e.currentTarget.id])
      } else {
        info = JSON.stringify(this.data.additionInfo[e.currentTarget.id])
      }
      console.log("showdetail", info)

      wx.navigateTo({
        url: '../additiondetail/additiondetail?datas=' + info + "&status=" + this.data.cur_status,
      })
    }
  },

  godelete: function(e) { //删除
    var that = this;
    console.log("godelete", e)
    wx.showModal({
      title: '',
      content: '确认要删除吗?',
      confirmColor: '#357aeb',
      success(res) {
        if (res.confirm) {
          console.log('用户点击确定')
          that.deleteInfo(e)
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })
  },

  deleteInfo:function(e){
    var that = this;
    var new_id
    var statustype = this.data.cur_status
    if (this.data.cur_status == "continuing_education") {
      if (e.currentTarget.id.indexOf('title') != -1) {
        new_id = this.data.additionInfo[0].title_items[e.currentTarget.id.replace('title', '')].id
      }
      if (e.currentTarget.id.indexOf('profession') != -1) {
        new_id = this.data.additionInfo[0].profession_items[e.currentTarget.id.replace('profession', '')].id
      }
    } else if (this.data.cur_status == "support_duty") {
      if (e.currentTarget.id.indexOf('support_duty') != -1) {
        new_id = this.data.additionInfo[0].support_duties[e.currentTarget.id.replace('support_duty', '')].id
      }
      if (e.currentTarget.id.indexOf('co_supporter') != -1) {
        statustype = "co_supporter"
        new_id = this.data.additionInfo[0].co_supporters[e.currentTarget.id.replace('co_supporter', '')].id
      }
    } else {
      new_id = this.data.additionInfo[e.currentTarget.id].id
    }
    var Authorization = getApp().globalData.Authorization;
    wx.request({
      url: baseUrl + 'persontax/v1/op/delete',
      data: {
        item_type: statustype,
        id: new_id
      },
      header: {
        'content-type': 'application/json',
        "Authorization": Authorization
      },
      method: "POST",
      success: function (res) {
        console.log("success", res)
        if (res.statusCode == 200) {
          that.getAdditionInfo()
        } else {
          wx.showToast({
            title: res.data.message,
            icon: "none"
          })
        }

      },
      fail: function (res) {
        console.log("fail", res)
        wx.showToast({
          title: res.data.message,
          icon: "none"
        })
      }
    })
  },

  goedit: function(e) { //编辑
    console.log("goedit", e)
    var oridata = this.data.origindata ? this.data.origindata.items : []
    var new_info
    if (this.data.cur_status == "continuing_education") {
      if (e.currentTarget.id.indexOf('title') != -1) {
        new_info = oridata[0].title_items[e.currentTarget.id.replace('title', '')]
      }
      if (e.currentTarget.id.indexOf('profession') != -1) {
        new_info = oridata[0].profession_items[e.currentTarget.id.replace('profession', '')]
      }
    } else if (this.data.cur_status == "support_duty") {
      if (e.currentTarget.id.indexOf('support_duty') != -1) {
        new_info = oridata[0].support_duties[e.currentTarget.id.replace('support_duty', '')]
      }
      if (e.currentTarget.id.indexOf('co_supporter') != -1) {
        new_info = oridata[0].co_supporters[e.currentTarget.id.replace('co_supporter', '')]
        wx.navigateTo({
          url: '../adddupporters/adddupporters?datas=' + JSON.stringify(new_info) + '&status=' + this.data.cur_status + "&id=" + this.data.legal_entity_id,
        })
        return;
      }
    } else {
      new_info = oridata[e.currentTarget.id]
    }
    console.log("new_info", new_info)
    wx.navigateTo({
      url: '../addextrainfo/addextrainfo?datas=' + JSON.stringify(new_info) + '&status=' + this.data.cur_status + '&reducetype=' + this.data.reducetypeData[this.data.selected_reduceindex] + '&isedit=true',
    })
  },

  goadd: function(e) { //添加
    console.log("goadd", e)
    var that = this
    if (this.data.cur_status == 'support_duty' && !this.data.issinglechildData.disabled) {
      if (this.data.issinglechildData.selected.length < 1) {
        this.showToast("请选择是否独生子女")
        return
      }
      if (this.data.issinglechildData.selected == "否") {
        console.log("reduce_amount", this.data.reduce_amount)
        if (this.data.shareMethodData.selected.length < 1) {
          this.showToast("请选择分摊方式")
          return
        }
        if (this.data.reduce_amount == -1) {
          this.showToast("请输入扣除金额")
          return
        }
        if (!format.checkNumber(this.data.reduce_amount + "")) {
          this.showToast("请输入正确格式")
          return
        }
        if (this.data.reduce_amount < 0 || this.data.reduce_amount > 1000) {
          this.showToast("本年度月扣除金额不得大于1000")
          return
        }
      } else {
        this.setData({
          reduce_amount: 2000
        })
      }
      console.log("reduce_amount", this.data.reduce_amount)
    }
    var modalinfo, senddata
    if (this.data.cur_status == 'continuing_education' || this.data.cur_status == 'house_fund') {

      wx.navigateTo({
        url: '../addextrainfo/addextrainfo?datas=' + '' + '&status=' + this.data.cur_status + '&reducetype=' + this.data.reducetypeData[this.data.selected_reduceindex],
      })
    } else {
      if (this.data.cur_status == 'children_education') { //modalData
        modalinfo = this.data.children_modalData
      } else if (this.data.cur_status == 'support_duty') {
        modalinfo = this.data.support_older_modalData
      } else if (this.data.cur_status == 'medical_fund') {
        modalinfo = this.data.medical_modalData
      }
      senddata = JSON.stringify(modalinfo.datas[e.currentTarget.id])
      console.log("modalinfo", modalinfo)
      if (modalinfo.datas.length > 0) {
        this.showAddtionmodal(modalinfo)
      } else {
        wx.navigateTo({
          url: '../addextrainfo/addextrainfo?status=' + this.data.cur_status + '&datas=' + senddata + '&reducetype=' + this.data.reducetypeData[this.data.selected_reduceindex],
        })
      }
    }
  },

  getTaxList: function() {
    var that = this;
    wx.showLoading({
      title: '加载中',
    })
    var Authorization = app.globalData.Authorization;
    console.log('Authorization', Authorization)
    if (!Authorization || Authorization.length < 10) {
      return
    }
    var type = "all"
    if (this.data.cur_status == "children_education") {
      type = "children"
    } else if (this.data.cur_status == "support_duty") {
      type = "parents"
    }
    wx.request({
      url: baseUrl + 'persontax/v1/personal-taxes',
      method: "GET",
      header: {
        'content-type': 'application/json', // 默认值
        "Authorization": Authorization
      },
      data: {
        // 'all': true,
        "declare_unit_id":that.data.legal_entity_id,
        "category": type
      },
      success: function(res) {
        console.log('succ', res)
        if (res.statusCode == 200) {
          that.handleData(res.data);
        } else {
          wx.showToast({
            title: res.data.message,
            icon: "none"
          })
        }
      },
      fail: function(res) {
        console.log("fail", res)
        wx.showToast({
          title: res.data.message,
          icon: "none"
        })
      },
      complete() {
        wx.hideLoading()
        that.setData({
          load_finish: true
        })
      }
    })
  },

  handleData: function(data) {

    if (data.items && data.items.length > 0) {
      var childRelativelist = []
      var medicalRelativelist = []
      var olderRelativelist = []
      var spousedatalist = []
      var childmodal = this.data.children_modalData
      var oldermodal = this.data.support_older_modalData
      var medicalmodal = this.data.medical_modalData
      for (var i = 0; i < data.items.length; i++) {
        if (data.items[i].family_ties == '子' || data.items[i].family_ties == '女') {
          childRelativelist.push(data.items[i])
        }
        if (data.items[i].family_ties == '父母' || data.items[i].family_ties == '祖父母、外祖父母') {
          olderRelativelist.push(data.items[i])
        } else {
          medicalRelativelist.push(data.items[i])
        }
        if (data.items[i].family_ties == '配偶') {
          spousedatalist = data.items[i]
        }
      }
      childmodal.datas = childRelativelist
      oldermodal.datas = olderRelativelist
      medicalmodal.datas = medicalRelativelist
      this.setData({
        spousedataData: spousedatalist,
        children_modalData: childmodal,
        support_older_modalData: oldermodal,
        medical_modalData: medicalmodal
      })
    }
  },

  showModalImg: function(e) {
    console.log("showModalImg", e)
    this.setData({
      showModal_img: true,
    })
  },

  closeModalImg: function(e) {
    console.log("closeModalImg", e)
    this.setData({
      showModal_img: false,
      showModal_reducetype: false,
      showModal_addtype: false
    })
  },

  // 扣除类型
  showModalReducetype: function(e) {
    console.log("reducetype", e)
    this.setData({
      showModal_reducetype: true,
    })
  },

  showAddtionmodal: function(modalinfo) {
    this.setData({
      modalData: modalinfo,
      showModal_addtype: true,
    })
  },

  reduce_modalLeft: function() { //modal取消(扣除类型)
    this.setData({
      showModal_reducetype: false
    })
  },

  reduce_modalRight: function() { //modal确认(扣除类型)
    this.setData({
      showModal_reducetype: false
    })
  },

  modalLeft: function(e) { //modal(添加)
    this.setData({
      showModal_addtype: false
    })
    var senddata = ""
    if (this.data.cur_status == 'support_duty') {
      // senddata = JSON.stringify(this.data.additionInfo[0]);
    }
    wx.navigateTo({
      url: '../addextrainfo/addextrainfo?status=' + this.data.cur_status + '&datas=' + senddata + '&reducetype=' + this.data.reducetypeData[this.data.selected_reduceindex],
    })
  },

  modalRight: function(e) { //modal确认(添加)
    console.log("modalConfirm", e)
    this.setData({
      showModal_addtype: false
    })
    var senddata = JSON.stringify(this.data.modalData.datas[this.data.selected_addindex])
    console.log("senddata", senddata)
    wx.navigateTo({
      url: '../addextrainfo/addextrainfo?status=' + this.data.cur_status + '&datas=' + senddata + '&reducetype=' + this.data.reducetypeData[this.data.selected_reduceindex],
    })

  },

  goselect: function(e) {
    console.log("goselect", e)
    if (this.data.showModal_reducetype) {
      this.setData({
        selected_reduceindex: e.currentTarget.id
      })
    }
    if (this.data.showModal_addtype) {
      this.setData({
        selected_addindex: e.currentTarget.id
      })
    }
  },

  onPickerSelect: function(e) {
    console.log('picker发送选择改变,携带值为', e)
    switch (e.currentTarget.id) {
      case 'issingle_child':
        var issinglechildData = this.data.issinglechildData
        issinglechildData.selected = issinglechildData.values[e.detail.value]
        this.setData({
          issinglechildData: issinglechildData
        })
        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;
    }
  },

  formatDate(date) {
    if (date == 0 || date == -62135596800) {
      date = ""
    } else {
      date = format.formatTime_date(date)
    }
    console.log("formatDate", date)
    return date
  },

  formatIdNum: function(idnum) {
    if (idnum && idnum.length >= 6 && idnum.length < 10) {
      idnum = idnum.substring(0, 2) + '****' + idnum.substring(idnum.length - 2, idnum.length);
    }
    if (idnum && idnum.length >= 10) {
      idnum = idnum.substring(0, 4) + '****' + idnum.substring(idnum.length - 4, idnum.length);
    }

    console.log("formatIdNum", idnum)
    return idnum
  },

  bindinput: function(e) {
    console.log("bindinput", e.detail.value)
    var inputamount = parseFloat(e.detail.value)
    this.setData({
      reduce_amount: inputamount.toFixed(2)
    })
  },

  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() {

  }
})