// pages/invoice/agreement/agreement.js const app = getApp(); const api = app.api; Page({ /** * 页面的初始数据 */ data: { agreementTypeList:{ 0:'员工', 1:'企业', 2:'策展' }, agreementType:0, agreement:false, isShowPop:false }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ agreementType:options.id }); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getData() }, getData() { app.post(api.getUserSettleInfo).then(res => { console.log(res); this.setData({ settleInfo: res.data }) }) }, back(){ wx.navigateBack() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, saveData(){ const {agreement}=this.data; if(!agreement){ return false } const type=this.data.agreementType; app.post(api.agreement,{ type:type }).then(res=>{ this.nextStep() // //个人和策展身份验证 // if(type==0||type==2){ // wx.navigateTo({ // url:`/pages/invoice/authentication/authentication?id=${type}` // }); // }else{ // //公司入驻 // wx.navigateTo({ // url:"/pages/settled/authenticationCompany/authenticationCompany" // }); // } }); }, triggerAgree(){ this.setData({ agreement:!this.data.agreement }) }, nextStep(){ const type = this.data.agreementType; if (this.data.settleInfo.isVerification === 0&&type!=1){ this.showPop() }else{ if (type == 0) { wx.redirectTo({ url: "/pages/user/personalInfo/personalInfo" }) } else if (type == 2) { wx.redirectTo({ url: "/pages/user/personalInfo/personalInfo?type=2" }) } else { wx.redirectTo({ url: "/pages/settled/authenticationCompany/authenticationCompany" }) } } /* app.post(api.).then(res=>{ console.log(res) })*/ }, showPop(){ this.setData({ isShowPop:true }); }, hidePop(){ this.setData({ isShowPop:false }); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })