// pages/invoice/index/index.js
const app = getApp();
const api = app.api;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    agree:true,

    settleInfo:{

     artistCaStatus: 0, //艺术家认证状态 0未提交,1已提交,2认证通过,3认证不通过
     companyCaStatus: 0, //司认证状态 0未提交,1已提交,2认证通过,3认证不通过
     curatorCaStatus: 0, //策展人认证状态 0未提交,1已提交,2认证通过,3认证不通过
     isArtist: 0,
     isArtistAgree: 0, // 艺术家协议 0未同意,1已同意
     isArtistInvoiceAgree: 0, //发票协议
     isCompany: 0,
     isCompanyAgree: 0, //公司认证协议 0未同意,1已同意
     isCurator: 0,
     isCuratorAgree: 0, // 策展人协议 0未同意,1已同意
     isVerification: null,  //身份认证
     isWeChatLogin: null
    }
  },

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

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

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getData()
  },
  getData(){
    
  },
  goService(){
    app.post(api.getUserSettleInfo).then(res=>{
      console.log(res);
      // this.setData({
      //   settleInfo:res.data
      // })
      const data = res.data
      if(data.isArtistInvoiceAgree==0){
        wx.navigateTo({
          url: '/pages/invoice/agreement/agreement'
        })
      }else if(data.isArtistInvoiceAgree!=0&&!data.isVerification){
        wx.navigateTo({
          url: '/pages/invoice/authentication/authentication'
        })
      }else if(data.isArtistInvoiceAgree!=0&&data.isVerification){
        wx.navigateTo({
          url: '/pages/invoice/contract/contract'
        })
      }else{
        wx.navigateTo({
          url: '/pages/invoice/myInvoice/myInvoice'
        })
      }
    })
  },

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

  },

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

  },

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

  },

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

  },

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

  }
})