applyjoinapprovel.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. // pages/applyjoinapprovel/applyjoinapprovel.js
  2. var BASEURL = require('../../utils/wxconstant.js')
  3. var baseUrl = BASEURL.BaseUrl()
  4. var baseutils = require('../../utils/baseUtils.js')
  5. var netUtil = require('../../utils/network.js')
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. approvelStatus:2,
  12. applyName:'',
  13. applyPhone:'',
  14. enterDate:'',
  15. birthDate:'',
  16. applyMail:'',
  17. companyName:'',
  18. isapplyPoint:true, //积分审批
  19. applyStatus:'',
  20. applyTime: '',
  21. applyJob: '',
  22. applyNorm: '',
  23. applyPoint:'',
  24. fromType:1,
  25. isISend:false
  26. },
  27. /**
  28. * 生命周期函数--监听页面加载
  29. */
  30. onLoad: function (options) {
  31. var that = this
  32. var Itemdata = options.getItemdata
  33. var approvelStatus = JSON.parse(Itemdata).invoicesStatus
  34. var invoicesId = JSON.parse(Itemdata).invoicesId
  35. var fromType = options.getfromType
  36. var isISend
  37. console.log('fromType=', fromType)
  38. var title
  39. if (Itemdata){
  40. console.log('Itemdata=', JSON.parse(Itemdata))
  41. // console.log('approvelStatus=', approvelStatus)
  42. title = fromType == 1 ? '待审批' : (fromType == 2 ? '已审批' : '我发起的')
  43. isISend = fromType == 3 ? true : false
  44. that.setData({
  45. approvelStatus: approvelStatus,
  46. invoicesId: invoicesId,
  47. fromType: fromType,
  48. isISend: isISend,
  49. applyStatus: approvelStatus == 1 ? '待审批' : (approvelStatus == 2 ? '已审批' : '未通过')
  50. // applyStatus: approvelStatus ==
  51. })
  52. wx.setNavigationBarTitle({
  53. title: title
  54. })
  55. that.initDetailsView(invoicesId)
  56. }
  57. },
  58. /**
  59. * 根据invoicesId 获取加分单据详情数据
  60. */
  61. initDetailsView: function (invoicesId) {
  62. var that = this
  63. var data = { invoicesId: invoicesId }
  64. var url = baseUrl + BASEURL.getUrl.getInvoices
  65. netUtil.requestLoading(url, data, '正在加载数据...', 'GET', function (res) {
  66. if (res.data.success && res.data.data) {
  67. that.setData({
  68. applyTime: res.data.data.invoicesDate,
  69. applyName: res.data.data.fillName,
  70. applyJob: res.data.data.fillStation,
  71. applyNorm: res.data.data.normName,
  72. applyReason: res.data.data.reasons,
  73. applyPoint: res.data.data.score,
  74. adviceName: res.data.data.adviceName,
  75. auditName: res.data.data.auditName,
  76. beMinusPerson: res.data.data.adviceName
  77. })
  78. }
  79. }, function (res) {
  80. wx.showToast({
  81. title: '加载数据失败',
  82. icon: 'none',
  83. duration: 2000
  84. })
  85. })
  86. },
  87. agreeBtnClick:function(){
  88. this.doApprovel(1)
  89. },
  90. disagreeBtnClick:function(){
  91. this.doApprovel(2)
  92. },
  93. doApprovel: function (status){
  94. var that = this
  95. var data = { status: status, invoicesId: that.data.invoicesId }
  96. var url = baseUrl + BASEURL.getUrl.approval
  97. netUtil.requestLoading(url, data, '正在加载数据...', 'GET', function (res) {
  98. if(res.data.success && res.data.data){
  99. that.comToast(res.data.data)
  100. setTimeout(function () {
  101. wx.navigateBack({
  102. })
  103. }, 1000)
  104. }else{
  105. that.comToast(res.data.data)
  106. }
  107. }, function (res) {
  108. wx.showToast({
  109. title: '加载数据失败',
  110. icon: 'none',
  111. duration: 2000
  112. })
  113. })
  114. },
  115. comToast: function (title) {
  116. wx.showToast({
  117. title: title,
  118. icon: 'none',
  119. duration: 2000
  120. })
  121. },
  122. /**
  123. * 生命周期函数--监听页面初次渲染完成
  124. */
  125. onReady: function () {
  126. },
  127. /**
  128. * 生命周期函数--监听页面显示
  129. */
  130. onShow: function () {
  131. },
  132. /**
  133. * 生命周期函数--监听页面隐藏
  134. */
  135. onHide: function () {
  136. },
  137. /**
  138. * 生命周期函数--监听页面卸载
  139. */
  140. onUnload: function () {
  141. },
  142. /**
  143. * 页面相关事件处理函数--监听用户下拉动作
  144. */
  145. onPullDownRefresh: function () {
  146. },
  147. /**
  148. * 页面上拉触底事件的处理函数
  149. */
  150. onReachBottom: function () {
  151. },
  152. /**
  153. * 用户点击右上角分享
  154. */
  155. onShareAppMessage: function () {
  156. }
  157. })