agreement.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // pages/invoice/agreement/agreement.js
  2. const app = getApp();
  3. const api = app.api;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. agreementTypeList:{
  10. 0:'员工',
  11. 1:'企业',
  12. 2:'策展'
  13. },
  14. agreementType:0,
  15. agreement:false,
  16. isShowPop:false
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad: function (options) {
  22. this.setData({
  23. agreementType:options.id
  24. });
  25. },
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow: function () {
  30. this.getData()
  31. },
  32. getData() {
  33. app.post(api.getUserSettleInfo).then(res => {
  34. console.log(res);
  35. this.setData({
  36. settleInfo: res.data
  37. })
  38. })
  39. },
  40. back(){
  41. wx.navigateBack()
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady: function () {
  47. },
  48. saveData(){
  49. const {agreement}=this.data;
  50. if(!agreement){
  51. return false
  52. }
  53. const type=this.data.agreementType;
  54. app.post(api.agreement,{
  55. type:type
  56. }).then(res=>{
  57. this.nextStep()
  58. // //个人和策展身份验证
  59. // if(type==0||type==2){
  60. // wx.navigateTo({
  61. // url:`/pages/invoice/authentication/authentication?id=${type}`
  62. // });
  63. // }else{
  64. // //公司入驻
  65. // wx.navigateTo({
  66. // url:"/pages/settled/authenticationCompany/authenticationCompany"
  67. // });
  68. // }
  69. });
  70. },
  71. triggerAgree(){
  72. this.setData({
  73. agreement:!this.data.agreement
  74. })
  75. },
  76. nextStep(){
  77. const type = this.data.agreementType;
  78. if (this.data.settleInfo.isVerification === 0&&type!=1){
  79. this.showPop()
  80. }else{
  81. if (type == 0) {
  82. wx.redirectTo({
  83. url: "/pages/user/personalInfo/personalInfo"
  84. })
  85. } else if (type == 2) {
  86. wx.redirectTo({
  87. url: "/pages/user/personalInfo/personalInfo?type=2"
  88. })
  89. } else {
  90. wx.redirectTo({
  91. url: "/pages/settled/authenticationCompany/authenticationCompany"
  92. })
  93. }
  94. }
  95. /* app.post(api.).then(res=>{
  96. console.log(res)
  97. })*/
  98. },
  99. showPop(){
  100. this.setData({
  101. isShowPop:true
  102. });
  103. },
  104. hidePop(){
  105. this.setData({
  106. isShowPop:false
  107. });
  108. },
  109. /**
  110. * 生命周期函数--监听页面隐藏
  111. */
  112. onHide: function () {
  113. },
  114. /**
  115. * 生命周期函数--监听页面卸载
  116. */
  117. onUnload: function () {
  118. },
  119. /**
  120. * 页面相关事件处理函数--监听用户下拉动作
  121. */
  122. onPullDownRefresh: function () {
  123. },
  124. /**
  125. * 页面上拉触底事件的处理函数
  126. */
  127. onReachBottom: function () {
  128. },
  129. /**
  130. * 用户点击右上角分享
  131. */
  132. onShareAppMessage: function () {
  133. }
  134. })