addUnitInfo.js 2.2 KB
// pages/main/finalpay/addUnitInfo/addUnitInfo.js

var app = getApp();
var baseUrl = app.globalData.baseUrl;
Page({


  data: {
    year: 2019,
    unit_id:"",
  },


  onLoad: function(options) {
    this.setData({
      unit_id:options.unit_id
    })
  },


  onReady: function() {

  },


  onShow: function() {

  },

  formSubmit: function(e) { //提交
    console.log("formSubmit", e);
    var formdata = e.detail.value
    if (formdata.total_salary || formdata.total_salary || formdata.remuneration_labor || formdata.author_payment || formdata.special_manage_cost || formdata.other_free_income || formdata.personal_endowment || formdata.personal_medical || formdata.personal_unemployment || formdata.personal_house_fund || formdata.childrens_education || formdata.continuing_education || formdata.housing_loan_interest || formdata.housing_rent || formdata.caring_old_people || formdata.serious_illness_medical || formdata.annuity || formdata.commercial_insurance || formdata.tax_extension || formdata.other_fee || formdata.donation_deducted || formdata.years_bouns || formdata.tax_savings || formdata.accumulated_withholding_tax){
      this.submitRequest(formdata)
    }else{
      this.showToast("请输入内容")
      return
    }
  },

  submitRequest: function(request_data) {
    var that = this
    this.Authorization = getApp().globalData.Authorization;
    wx.request({
      url: baseUrl + "payroll/v1/settlement-tax/record",
      header: {
        'Authorization': this.Authorization
      },
      method: "POST",
      data: {
        "declaring_unit_id":that.data.unit_id,
        "item": request_data,
        "years": that.data.year
      },
      success: function(result) {
        console.log("refund", result)
        if (result.statusCode == 200) {
            that.showToast("提交成功!")
        }
      },
    })
  },

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

  onHide: function() {

  },


  onUnload: function() {

  },


  onPullDownRefresh: function() {

  },


  onReachBottom: function() {

  },


  onShareAppMessage: function() {

  }
})