withdraw.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. // pages/withdraw/Withdraw.js
  2. const app = getApp();
  3. const api = require('../../api/api');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. navbarData: {
  10. showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
  11. title: '', //导航栏 中间的标题
  12. capsuleMode: 'navBack', //显示模式(navBack:返回上一页;navHome:返回首页)
  13. },
  14. actions: [{
  15. id: 0,
  16. name: "公司银行转账"
  17. }, {
  18. id: 1,
  19. name: "个人转账"
  20. }, {
  21. id: 2,
  22. name: "EMT"
  23. }, {
  24. id: 3,
  25. name: "联系客服"
  26. }],
  27. show: false,
  28. userinfo: {},
  29. wechat: ''
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. },
  36. /**
  37. * 生命周期函数--监听页面初次渲染完成
  38. */
  39. onReady: function () {
  40. },
  41. /**
  42. * 生命周期函数--监听页面显示
  43. */
  44. onShow: function () {
  45. let that = this;
  46. wx.showLoading({
  47. title: '加载中',
  48. mask: true
  49. })
  50. wx.request({
  51. url: api.user_info,
  52. header: {
  53. 'Authorization': wx.getStorageSync('token')
  54. },
  55. success(res) {
  56. console.log(res);
  57. if (res.data.code === 1) {
  58. that.setData({
  59. userinfo: res.data.data
  60. })
  61. } else {
  62. wx.showToast({
  63. title: res.data.msg,
  64. mask: true,
  65. icon: 'none'
  66. })
  67. }
  68. },
  69. fail(err) {
  70. wx.showToast({
  71. title: '发起网络请求失败',
  72. icon: 'none',
  73. mask: true
  74. })
  75. },
  76. complete() {
  77. wx.hideLoading()
  78. }
  79. })
  80. },
  81. /**
  82. * 生命周期函数--监听页面隐藏
  83. */
  84. onHide: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面卸载
  88. */
  89. onUnload: function () {
  90. },
  91. /**
  92. * 页面相关事件处理函数--监听用户下拉动作
  93. */
  94. onPullDownRefresh: function () {
  95. },
  96. /**
  97. * 页面上拉触底事件的处理函数
  98. */
  99. onReachBottom: function () {
  100. },
  101. /**
  102. * 用户点击右上角分享
  103. */
  104. onShareAppMessage: function () {
  105. },
  106. butsel(e) {
  107. let that = this;
  108. if (e.detail.id === 0) {
  109. // console.log('公司银行转账');
  110. wx.navigateTo({
  111. url: '/pages/corporatebanktransfer/corporatebanktransfer?withdrawal_method=' + e.detail.id + '&balance=' + this.data.userinfo.balance,
  112. })
  113. } else if (e.detail.id === 1) {
  114. // console.log('个人转账');
  115. wx.navigateTo({
  116. url: '/pages/corporatebanktransfer/corporatebanktransfer?withdrawal_method=' + e.detail.id + '&balance=' + this.data.userinfo.balance,
  117. })
  118. } else if (e.detail.id === 2) {
  119. // console.log('EMT');
  120. wx.navigateTo({
  121. url: '/pages/corporatebanktransfer/corporatebanktransfer?withdrawal_method=' + e.detail.id + '&balance=' + this.data.userinfo.balance,
  122. })
  123. } else if (e.detail.id === 3) {
  124. // console.log('联系客服');
  125. wx.showLoading({
  126. title: '加载中',
  127. mask: true
  128. })
  129. wx.request({
  130. url: api.Withdrawalmanagement_apply,
  131. header: {
  132. 'Authorization': wx.getStorageSync('token')
  133. },
  134. method: 'POST',
  135. data: {
  136. withdrawal_method: 3
  137. },
  138. success(res) {
  139. console.log(res);
  140. if (res.data.code === 1) {
  141. let key = 'actions[3].name'
  142. that.setData({
  143. wechat: res.data.data.wechat,
  144. [key]: '客服微信号:' + res.data.data.wechat
  145. })
  146. } else {
  147. wx.showToast({
  148. title: res.data.msg,
  149. mask: true,
  150. icon: 'none'
  151. })
  152. }
  153. },
  154. fail(err) {
  155. wx.showToast({
  156. title: '发起网络请求失败',
  157. icon: 'none',
  158. mask: true
  159. })
  160. },
  161. complete() {
  162. wx.hideLoading()
  163. }
  164. })
  165. }
  166. },
  167. record(e) {
  168. wx.navigateTo({
  169. url: '/pages/companyrecord/companyrecord',
  170. })
  171. },
  172. detail() {
  173. wx.navigateTo({
  174. url: '/pages/companydetailgroup/companydetailgroup',
  175. })
  176. },
  177. quxiao() {
  178. this.setData({
  179. show: false
  180. })
  181. },
  182. showsel() {
  183. this.setData({
  184. show: true
  185. })
  186. },
  187. })