incomeDetail.js 1.8 KB
// pages/main/finalpay/incomeDetail/incomeDetail.js
var app = getApp();
var baseUrl = app.globalData.baseUrl;
Page({

  /**
   * Page initial data
   */
  data: {
    currentTab:1,
    year:2019,
    incomeInfo:{},
  },

  /**
   * Lifecycle function--Called when page load
   */
  onLoad: function (options) {
    this.getIncomeDetail()
  },

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

  },

  onShow: function () {

  },

  /** 
  * 点击tab切换 
  */
  swichNav: function (e) {
    var that = this;

    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current
      })
      this.getIncomeDetail()
    }
  },

  //获取收入明细
  getIncomeDetail:function(){
    var that = this
    this.Authorization = getApp().globalData.Authorization;
    wx.request({
      url: baseUrl + "payroll/v1/settlement-tax/record",
      header: {
        'Authorization': this.Authorization
      },
      data: {
        "years":that.data.year,
        "declaring_unit_status": that.data.currentTab
      },
      success: function (result) {
        console.log("incomeInfo", result)
        if (result.statusCode == 200) {
            that.setData({
              incomeInfo:result.data.item
            })
        }
      },
    })
  },

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

  }
})