// pages/classify/classify.js import regeneratorRuntime from '../../utils/runtime' const app = getApp(); const api = app.api; Page({ /** * 页面的初始数据 */ data: { isLogin:false, isShowPop:false, 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) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow:async function () { //hasLogins(); }, async hasLogins(){ if(!this.data.isLogin){ if(await app.authorization()){ this.notLoginGo(); } this.setData({ isLogin:true }); return }else { this.notLoginGo(); } }, getData(opt){ app.post(api.getUserSettleInfo,{ },{showLoading:false, needToken:false}).then(res=>{ console.log(res); this.setData({ settleInfo:res.data }) if(opt){ opt() } }) }, notLoginGo: async function(){ const userInfo = await app.getToken(); if (!userInfo.auth) { wx.switchTab({ url:"/pages/index/index", success:(res)=>{ this.setData({ isLogin:false }); } }) }else{ this.getData(); } }, handlerTap(e){ const that = this; that.getData(function(){ const {index}=e.currentTarget.dataset; const settleInfo = that.data.settleInfo; if(settleInfo.isVerification==0){ that.showPop() }else if(settleInfo.artistCaStatus && settleInfo.artistCaStatus === 2){ //艺术家认证通过 wx.navigateTo({ url: '/pages/user/artUpload/artUpload' }) }else if(settleInfo.curatorCaStatus && settleInfo.curatorCaStatus === 2){ //策展人认证通弄过过 wx.navigateTo({ // url: '/pages/user/artUpload/artUpload' url: '/pages/settled/contacts/contacts' }) }else if(settleInfo.companyCaStatus && settleInfo.companyCaStatus == 1){ //公司入驻审核中 wx.navigateTo({ url: '/pages/settled/success/success' }) }else if(settleInfo.companyCaStatus && settleInfo.companyCaStatus == 2){ //公司入驻审核通过 wx.navigateTo({ url: '/pages/settled/contacts/contacts' }) }else{ if(index==0){ this.artistGo(); }else if(index==1){ this.companyGo(); }else{ this.curatorGO(); } } }) }, artistGo(){ const {settleInfo}=this.data; if(!settleInfo.isVerification&&settleInfo.isArtistAgree){ wx.navigateTo({ url:"/pages/invoice/authentication/authentication?id=0" }) return }else if(settleInfo.isArtistAgree){ wx.navigateTo({ url:"/pages/user/personalInfo/personalInfo" }) }else{ wx.navigateTo({ url:`/pages/settled/agreement/agreement?id=0` }) } }, companyGo(){ // console.log(company) const {settleInfo}=this.data; if(settleInfo.isCompanyAgree){ wx.navigateTo({ url:"/pages/settled/authenticationCompany/authenticationCompany" }) }else{ wx.navigateTo({ url:`/pages/settled/agreement/agreement?id=1` }) } }, curatorGO(){ const {settleInfo}=this.data; if(!settleInfo.isVerification&&settleInfo.isArtistAgree){ wx.navigateTo({ url:"/pages/invoice/authentication/authentication?id=2" }) }else if(settleInfo.isArtistAgree){ wx.navigateTo({ // url:"/pages/settled/curatorInfo/curatorInfo" url:"/pages/user/personalInfo/personalInfo?type=2" }) }else{ wx.navigateTo({ url:`/pages/settled/agreement/agreement?id=2` }) } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, showPop(){ this.setData({ isShowPop:true }); }, hidePop(){ this.setData({ isShowPop:false }); } })