index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // pages/my/index.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. nvabarData: {
  9. showCapsule: 0, //是否显示左上角图标,消息中心 1表示显示 0表示不显示
  10. showBack: 1, //返回
  11. title: '贷款产品',
  12. height: app.globalData.height * 2 + 20,
  13. },
  14. loanDetail:{},
  15. clamneedDetail:{},
  16. rateValue: 5,
  17. finpic:'',
  18. finalnum:'',
  19. finalecode:'',
  20. cpid:'',//产品ID
  21. claimid:'',//需求ID
  22. compname:'',
  23. compcode:'',
  24. remarks:'',
  25. },
  26. /**
  27. * 生命周期函数--监听页面加载
  28. */
  29. onLoad: function (options) {
  30. this.setData({
  31. finpic: options.img,
  32. finalnum: options.num,
  33. finalecode: options.ecode,
  34. cpid: options.proid,
  35. claimid: options.id,
  36. remarks:options.remarks
  37. });
  38. },
  39. /**
  40. * 生命周期函数--监听页面显示
  41. */
  42. onShow: function () {
  43. this.getclamneed()
  44. this.getcpnews()
  45. this.getcompnews()
  46. },
  47. getclamneed() {//需求信息
  48. wx.request({
  49. method: "GET",
  50. url: app.globalData.publicUrl + 'api/financial/claimneed/' + this.data.claimid,
  51. success: (res) => {
  52. //console.log("需求信息+=============================="+JSON.stringify(res))
  53. if (res.data.errcode == 0) {
  54. this.setData({
  55. clamneedDetail: res.data.data,
  56. })
  57. }
  58. }
  59. })
  60. },
  61. getcpnews(){//产品信息
  62. let finalid = this.data.cpid;
  63. wx.request({
  64. method: "get",
  65. url: app.globalData.publicUrl + 'api/financial/financeclaims/' + finalid,
  66. success: (res) => {
  67. if (res.data.errcode == 0) {
  68. this.setData({
  69. loanDetail: res.data.data,
  70. })
  71. }
  72. }
  73. })
  74. },
  75. getcompnews() {//企业信息
  76. let fiduid = wx.getStorageSync('user')._id;
  77. // wx.showLoading({
  78. // title: '加载中',
  79. // })
  80. wx.request({
  81. method: "get",
  82. url: app.globalData.publicUrl + 'api/financial/companyidentify',
  83. data:{
  84. uid: fiduid
  85. },
  86. success: (res) => {
  87. //console.log("企业信息================================================"+JSON.stringify(res))
  88. if (res.data.errcode == 0) {
  89. this.setData({
  90. compname: res.data.data[0].company_name,
  91. compcode: res.data.data[0].code
  92. })
  93. // wx.hideLoading();
  94. }
  95. }
  96. })
  97. },
  98. gofirst(){
  99. wx.redirectTo({
  100. url: '/pages/home/index'
  101. })
  102. }
  103. })