// pages/member/presentationDetails/presentationDetails.js
var app = getApp();
Page({

  /**
	 * 页面的初始数据
	 */
  data: {
    language: '',
    record_id: '',
    //打款金额
    actual_amounts: 0,
    //打款手续费
    actual_poundage: 0,
    //类型
    type_name: '',
    withdraw_sn: '',
    created_at: '',
    poundage_name:'',
    actual_servicetax:0
  },

  /**
	 * 生命周期函数--监听页面加载
	 */
  onLoad: function(options) {
    if (options.record_id) {
      this.setData({
        record_id: options.record_id
      });
    }
    this._getData();
    this.customizeIncome();
  },
  //自定义提现收入语言
  customizeIncome() {
    try {
      var value = wx.getStorageSync('mailLanguage');
      if (value) {
        let mailLanguage = JSON.parse(value);
        // Do something with return value
        this.setData({
          poundage_name: mailLanguage.income.poundage_name
        });
      }
    } catch (e) {
      // Do something when catch error
    }
  },
  /**
	 * 生命周期函数--监听页面初次渲染完成
	 */
  onReady: function() {
    let language = wx.getStorageSync('langIndex');
    this.setData({ 'language': language.en});
  },

  /**
	 * 生命周期函数--监听页面显示
	 */
  onShow: function() {

  },

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

  },

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

  },

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

  },

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

  },

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

  },
  //获取数据
  _getData() {
    let that = this;
    let urlStr = app.getNetAddresss("finance.withdraw.withdraw-info");
    urlStr += '&id=' + this.data.record_id;
    app._getNetWork({
      url: urlStr,
      success: function(resdata) {
        var res = resdata.data;
        if (res.result == 1) {
          var mydata = res.data;
          that.setData({
            actual_poundage: mydata.actual_poundage,
            amounts: mydata.amounts,
            type_name: mydata.type_name,
            withdraw_sn: mydata.withdraw_sn,
            created_at: mydata.created_at,
            actual_amounts: mydata.actual_amounts,
            actual_servicetax:mydata.actual_servicetax,
          });
        } else {
          wx.showToast({
            icon: 'none',
            title: res.msg,
            duration: 1500
          });
        }
      },
      fail: function(res) {
        console.log(res);
      }
    });
  },
});
