baomiSignInfo.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. const app = getApp()
  2. const util = require("../../../utils/util");
  3. const api = require('../../../api/api.js');
  4. const user = require('../../../utils/user.js');
  5. import moment from 'moment'
  6. Page({
  7. data: {
  8. state:'',
  9. contractUrl:'',
  10. signTime:'',
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. },
  17. onReachBottom() {
  18. },
  19. /**
  20. * 生命周期函数--监听页面初次渲染完成
  21. */
  22. onReady: function () {
  23. },
  24. /**
  25. * 生命周期函数--监听页面显示
  26. */
  27. onShow: function () {
  28. this.getState();
  29. },
  30. getState(){
  31. let userInfo = wx.getStorageSync('userInfo');
  32. util.request(api.getBaomiContract, {
  33. workerNo:userInfo.workerNo
  34. }, 'GET').then(res=> {
  35. if (res.errno === 0) {
  36. this.setData({
  37. state:res.data.signContractState,
  38. contractUrl:res.data.contractUrl,
  39. signTime:moment(res.data.signTime).format('YYYY-MM-DD HH:mm:ss'),
  40. });
  41. }
  42. }).catch(err=>{
  43. });
  44. },
  45. signContract(){
  46. let userInfo = wx.getStorageSync('userInfo');
  47. wx.showLoading({
  48. title: '加载中...',
  49. });
  50. util.request(api.signBaoMiAndResign, {
  51. workerNo:userInfo.workerNo
  52. }, 'GET').then(res=> {
  53. wx.hideLoading();
  54. if (res.errno === 0) {
  55. this.getSignUrl(res.data);
  56. }else{
  57. wx.showToast({
  58. title: res.errmsg,
  59. icon:'none'
  60. })
  61. }
  62. }).catch(err=>{
  63. });
  64. },
  65. getSignUrl(id){
  66. wx.showLoading({
  67. title: '加载中...',
  68. });
  69. util.request(api.selectContractSignUrl, {
  70. procedureId:id
  71. }, 'GET').then(res=> {
  72. wx.hideLoading();
  73. if (res.errno === 0) {
  74. app.globalData.webViewUrl=res.data;
  75. wx.navigateTo({
  76. url: '/pages/upgrade/webView/webView',
  77. });
  78. }else{
  79. wx.showToast({
  80. title: res.errmsg,
  81. icon:'none'
  82. })
  83. }
  84. }).catch(err=>{
  85. });
  86. },
  87. viewContract(){
  88. app.globalData.webViewUrl=this.data.contractUrl;
  89. wx.navigateTo({
  90. url: '/pages/upgrade/webView/webView',
  91. })
  92. },
  93. onHide: function () {
  94. },
  95. onUnload: function () {
  96. },
  97. /**
  98. * 页面相关事件处理函数--监听用户下拉动作
  99. */
  100. onPullDownRefresh: function () {
  101. },
  102. /**
  103. * 页面上拉触底事件的处理函数
  104. */
  105. onReachBottom: function () {
  106. },
  107. /**
  108. * 用户点击右上角分享
  109. */
  110. onShareAppMessage: function () {
  111. },
  112. })