agreement.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // pages/invoice/agreement/agreement.js
  2. const app = getApp();
  3. const api = app.api;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. agreement:false,
  10. isShowPop:false,
  11. settleInfo:null
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. this.getData();
  18. },
  19. /**
  20. * 生命周期函数--监听页面初次渲染完成
  21. */
  22. onReady: function () {
  23. },
  24. /**
  25. * 生命周期函数--监听页面显示
  26. */
  27. onShow: function () {
  28. },
  29. getData(){
  30. app.post(api.getUserSettleInfo).then(res=>{
  31. console.log(res);
  32. this.setData({
  33. settleInfo:res.data
  34. })
  35. })
  36. },
  37. triggerAgree(){
  38. this.setData({
  39. agreement:!this.data.agreement
  40. })
  41. },
  42. prevStep(){
  43. wx.navigateBack()
  44. },
  45. nextStep(){
  46. if(!this.data.agreement){
  47. wx.showToast({
  48. title:"请先勾选协议",
  49. icon:'none',
  50. duration:2000
  51. })
  52. return false
  53. }
  54. if(this.data.agreement&&this.data.settleInfo.isVerification==0){
  55. this.showPop()
  56. }else{
  57. wx.redirectTo({
  58. url:"/pages/invoice/contract/contract"
  59. })
  60. }
  61. /* app.post(api.).then(res=>{
  62. console.log(res)
  63. })*/
  64. },
  65. showPop(){
  66. this.setData({
  67. isShowPop:true
  68. });
  69. },
  70. hidePop(){
  71. this.setData({
  72. isShowPop:false
  73. });
  74. },
  75. /**
  76. * 生命周期函数--监听页面隐藏
  77. */
  78. onHide: function () {
  79. },
  80. /**
  81. * 生命周期函数--监听页面卸载
  82. */
  83. onUnload: function () {
  84. },
  85. /**
  86. * 页面相关事件处理函数--监听用户下拉动作
  87. */
  88. onPullDownRefresh: function () {
  89. },
  90. /**
  91. * 页面上拉触底事件的处理函数
  92. */
  93. onReachBottom: function () {
  94. },
  95. /**
  96. * 用户点击右上角分享
  97. */
  98. onShareAppMessage: function () {
  99. }
  100. })