蓝色 贷款产品助手

application.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //index.js
  2. var app = getApp();
  3. var utils = require('../../utils/util.js');
  4. Page({
  5. data: {
  6. page: 0,
  7. dataList: [],
  8. cardList: [],
  9. // tabs: ["借款申请", "信用卡申请"],
  10. // activeIndex: 0,
  11. hidden: false,
  12. hiddenThis: true,
  13. appid: 0
  14. },
  15. onLoad: function () {
  16. this.initApplication();
  17. // this.data.page = 0;
  18. // this.initCardList();
  19. },
  20. onShow () {
  21. wx.stopPullDownRefresh()
  22. },
  23. initApplication () {
  24. var that = this, token = wx.getStorageSync('user').token, list = [];
  25. console.log(token);
  26. that.setData({hidden: false});
  27. if (that.data.page) {
  28. list = that.data.dataList
  29. }else{
  30. list = [];
  31. }
  32. wx.request({
  33. url: app.globalData.HOST + '/user/wx/myapply',
  34. method: "POST",
  35. data: Object.assign({}, app.globalData.common, {token: token, pageId: ++that.data.page}),
  36. success: function (res) {
  37. var data = res.data;
  38. // console.log(data);
  39. if (data.errno == '0') {
  40. list = list.concat(data.rst.list)
  41. that.setData({
  42. dataList: list
  43. })
  44. }else if(data.errno == '90001'){
  45. console.log('go');
  46. // wx.navigateTo({
  47. // url: '/pages/getPhone/getPhone'
  48. // })
  49. }
  50. },
  51. complete: function () {
  52. that.setData({ hidden:true});//加载成功
  53. wx.stopPullDownRefresh() //停止下拉刷新
  54. }
  55. });
  56. },
  57. showPanel (e) {
  58. var appid = e.currentTarget.dataset.id
  59. this.setData({hiddenThis: false, appid: appid})
  60. },
  61. initCardList() {
  62. var that = this, token = wx.getStorageSync('user').token, list = [];
  63. that.setData({hidden: false});
  64. if (that.data.page) {
  65. list = that.data.cardList
  66. }else{
  67. list = [];
  68. }
  69. // console.log('test');
  70. wx.request({
  71. url: app.globalData.HOST + '/user/wx/xykMyapply',
  72. method: "POST",
  73. data: Object.assign({}, app.globalData.common, {pageId: ++that.data.page}),
  74. success: function (res) {
  75. var data = res.data;
  76. // console.log(data);
  77. if (data.errno == '0') {
  78. list = list.concat(data.rst.list)
  79. that.setData({
  80. cardList: list
  81. })
  82. }else if(data.errno == '90001'){
  83. console.log('go');
  84. // wx.navigateTo({
  85. // url: '/pages/getPhone/getPhone'
  86. // })
  87. }
  88. },
  89. complete: function () {
  90. that.setData({ hidden:true});//加载成功
  91. wx.stopPullDownRefresh() //停止下拉刷新
  92. }
  93. });
  94. },
  95. /* tabClick: function (e) {
  96. var id = e.currentTarget.id;
  97. this.setData({
  98. activeIndex: id,
  99. page: 0,
  100. hiddenThis: true
  101. });
  102. // console.log(this.data.activeIndex);
  103. if (id == 0) {
  104. this.initApplication();
  105. }else{
  106. this.initCardList();
  107. }
  108. },*/
  109. onPullDownRefresh: function () {
  110. //下拉
  111. this.data.page = 0;
  112. setTimeout(() => {
  113. this.initApplication();
  114. // if (this.data.activeIndex == 0) {
  115. // }else{
  116. // this.initCardList();
  117. // }
  118. }, 600)
  119. },
  120. onReachBottom: function () {
  121. //上拉
  122. this.initApplication();
  123. // if (this.data.activeIndex == 0) {
  124. // }else{
  125. // this.initCardList();
  126. // }
  127. },
  128. onHide () {
  129. this.setData({hiddenThis: true})
  130. },
  131. //FormId
  132. formSubmit(e) {
  133. var formId = e.detail.formId;
  134. this.getFromid(formId);
  135. },
  136. getFromid(formId) {
  137. wx.request({
  138. url: app.globalData.HOST + '/user/wx/getFromid',
  139. method: "POST",
  140. data: Object.assign({}, app.globalData.common, { from_id: formId}),
  141. success: function (res) {
  142. },
  143. complete: function () {
  144. }
  145. });
  146. }
  147. })