classify.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. // pages/classify/classify.js
  2. import regeneratorRuntime from '../../utils/runtime'
  3. const app = getApp();
  4. const api = app.api;
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. isLogin:false,
  11. isShowPop:false,
  12. settleInfo:{
  13. artistCaStatus: 0, //艺术家认证状态 0未提交,1已提交,2认证通过,3认证不通过
  14. companyCaStatus: 0, //司认证状态 0未提交,1已提交,2认证通过,3认证不通过
  15. curatorCaStatus: 0, //策展人认证状态 0未提交,1已提交,2认证通过,3认证不通过
  16. isArtist: 0,
  17. isArtistAgree: 0, // 艺术家协议 0未同意,1已同意
  18. isArtistInvoiceAgree: 0, //发票协议
  19. isCompany: 0,
  20. isCompanyAgree: 0, //公司认证协议 0未同意,1已同意
  21. isCurator: 0,
  22. isCuratorAgree: 0, // 策展人协议 0未同意,1已同意
  23. isVerification: null, //身份认证
  24. isWeChatLogin: null
  25. }
  26. },
  27. /**
  28. * 生命周期函数--监听页面加载
  29. */
  30. onLoad: function (options) {
  31. },
  32. /**
  33. * 生命周期函数--监听页面初次渲染完成
  34. */
  35. onReady: function () {
  36. },
  37. /**
  38. * 生命周期函数--监听页面显示
  39. */
  40. onShow:async function () {
  41. //hasLogins();
  42. },
  43. async hasLogins(){
  44. if(!this.data.isLogin){
  45. if(await app.authorization()){
  46. this.notLoginGo();
  47. }
  48. this.setData({
  49. isLogin:true
  50. });
  51. return
  52. }else {
  53. this.notLoginGo();
  54. }
  55. },
  56. getData(opt){
  57. app.post(api.getUserSettleInfo,{
  58. },{showLoading:false, needToken:false}).then(res=>{
  59. console.log(res);
  60. this.setData({
  61. settleInfo:res.data
  62. })
  63. if(opt){
  64. opt()
  65. }
  66. })
  67. },
  68. notLoginGo: async function(){
  69. const userInfo = await app.getToken();
  70. if (!userInfo.auth) {
  71. wx.switchTab({
  72. url:"/pages/index/index",
  73. success:(res)=>{
  74. this.setData({
  75. isLogin:false
  76. });
  77. }
  78. })
  79. }else{
  80. this.getData();
  81. }
  82. },
  83. handlerTap(e){
  84. const that = this;
  85. that.getData(function(){
  86. const {index}=e.currentTarget.dataset;
  87. const settleInfo = that.data.settleInfo;
  88. if(settleInfo.isVerification==0){
  89. that.showPop()
  90. }else if(settleInfo.artistCaStatus && settleInfo.artistCaStatus === 2){
  91. //艺术家认证通过
  92. wx.navigateTo({
  93. url: '/pages/user/artUpload/artUpload'
  94. })
  95. }else if(settleInfo.curatorCaStatus && settleInfo.curatorCaStatus === 2){
  96. //策展人认证通弄过过
  97. wx.navigateTo({
  98. // url: '/pages/user/artUpload/artUpload'
  99. url: '/pages/settled/contacts/contacts'
  100. })
  101. }else if(settleInfo.companyCaStatus && settleInfo.companyCaStatus == 1){
  102. //公司入驻审核中
  103. wx.navigateTo({
  104. url: '/pages/settled/success/success'
  105. })
  106. }else if(settleInfo.companyCaStatus && settleInfo.companyCaStatus == 2){
  107. //公司入驻审核通过
  108. wx.navigateTo({
  109. url: '/pages/settled/contacts/contacts'
  110. })
  111. }else{
  112. if(index==0){
  113. this.artistGo();
  114. }else if(index==1){
  115. this.companyGo();
  116. }else{
  117. this.curatorGO();
  118. }
  119. }
  120. })
  121. },
  122. artistGo(){
  123. const {settleInfo}=this.data;
  124. if(!settleInfo.isVerification&&settleInfo.isArtistAgree){
  125. wx.navigateTo({
  126. url:"/pages/invoice/authentication/authentication?id=0"
  127. })
  128. return
  129. }else if(settleInfo.isArtistAgree){
  130. wx.navigateTo({
  131. url:"/pages/user/personalInfo/personalInfo"
  132. })
  133. }else{
  134. wx.navigateTo({
  135. url:`/pages/settled/agreement/agreement?id=0`
  136. })
  137. }
  138. },
  139. companyGo(){
  140. // console.log(company)
  141. const {settleInfo}=this.data;
  142. if(settleInfo.isCompanyAgree){
  143. wx.navigateTo({
  144. url:"/pages/settled/authenticationCompany/authenticationCompany"
  145. })
  146. }else{
  147. wx.navigateTo({
  148. url:`/pages/settled/agreement/agreement?id=1`
  149. })
  150. }
  151. },
  152. curatorGO(){
  153. const {settleInfo}=this.data;
  154. if(!settleInfo.isVerification&&settleInfo.isArtistAgree){
  155. wx.navigateTo({
  156. url:"/pages/invoice/authentication/authentication?id=2"
  157. })
  158. }else if(settleInfo.isArtistAgree){
  159. wx.navigateTo({
  160. // url:"/pages/settled/curatorInfo/curatorInfo"
  161. url:"/pages/user/personalInfo/personalInfo?type=2"
  162. })
  163. }else{
  164. wx.navigateTo({
  165. url:`/pages/settled/agreement/agreement?id=2`
  166. })
  167. }
  168. },
  169. /**
  170. * 生命周期函数--监听页面隐藏
  171. */
  172. onHide: function () {
  173. },
  174. /**
  175. * 生命周期函数--监听页面卸载
  176. */
  177. onUnload: function () {
  178. },
  179. /**
  180. * 页面相关事件处理函数--监听用户下拉动作
  181. */
  182. onPullDownRefresh: function () {
  183. },
  184. /**
  185. * 页面上拉触底事件的处理函数
  186. */
  187. onReachBottom: function () {
  188. },
  189. /**
  190. * 用户点击右上角分享
  191. */
  192. onShareAppMessage: function () {
  193. },
  194. showPop(){
  195. this.setData({
  196. isShowPop:true
  197. });
  198. },
  199. hidePop(){
  200. this.setData({
  201. isShowPop:false
  202. });
  203. }
  204. })