apply.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. const app = getApp()
  2. const WXAPI = require('apifm-wxapi')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad: function (options) {
  13. },
  14. /**
  15. * 生命周期函数--监听页面初次渲染完成
  16. */
  17. onReady: function () {
  18. },
  19. /**
  20. * 生命周期函数--监听页面显示
  21. */
  22. onShow: function () {
  23. const _this = this
  24. WXAPI.userDetail(wx.getStorageSync('token')).then(res => {
  25. if (res.code === 0) {
  26. _this.setData({
  27. userDetail: res.data
  28. })
  29. }
  30. })
  31. },
  32. nameChange(e){
  33. this.data.name = e.detail.value
  34. },
  35. mobileChange(e){
  36. this.data.mobile = e.detail.value
  37. },
  38. bindSave(){
  39. wx.requestSubscribeMessage({
  40. tmplIds: ['7sO58VXh0T5a6SwB5c9hR43bnBPxW8E6v3d70QQXuIk'],
  41. success(res) {
  42. },
  43. fail(e) {
  44. console.error(e)
  45. },
  46. complete: (e) => {
  47. this.bindSaveDone()
  48. },
  49. })
  50. },
  51. bindSaveDone: function () {
  52. const name = this.data.name
  53. const mobile = this.data.mobile
  54. if (!name) {
  55. wx.showToast({
  56. title: '请输入真实姓名',
  57. icon: 'none'
  58. })
  59. return
  60. }
  61. if (!mobile) {
  62. wx.showToast({
  63. title: '请输入手机号码',
  64. icon: 'none'
  65. })
  66. return
  67. }
  68. WXAPI.fxApply(wx.getStorageSync('token'), name, mobile).then(res => {
  69. if (res.code != 0) {
  70. wx.showToast({
  71. title: res.msg,
  72. icon: 'none'
  73. })
  74. return
  75. }
  76. wx.navigateTo({
  77. url: "/pages/fx/apply-status"
  78. })
  79. })
  80. },
  81. })