rechSuce.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. const util = require('../../../utils/utils.js')
  2. var app = getApp()
  3. Page({
  4. data: {
  5. code:'',
  6. rent:0
  7. },
  8. onLoad: function (options) {
  9. console.log(options)
  10. if(options.order){
  11. this.setData({ code: options.order,rent:options.rent })
  12. wx.setNavigationBarTitle({
  13. title: '订单支付',
  14. })
  15. }else{
  16. wx.setNavigationBarTitle({
  17. title: '余额充值',
  18. })
  19. }
  20. },
  21. scancode: util.throttle(function (e) {
  22. wx.scanCode({
  23. onlyFromCamera: true,
  24. success: function (res) {
  25. console.log(res)
  26. var index = res.result.lastIndexOf("\=");
  27. var code = res.result.substring(index + 1, res.path.length);
  28. wx.navigateTo({
  29. url: '/pages/sweep_code/sweep_code?code=' + code,
  30. })
  31. }, fail: function (err) {
  32. wx.showToast({
  33. title: '扫码失败',
  34. icon: 'none'
  35. })
  36. }
  37. })
  38. },1000),
  39. money: util.throttle(function (e) {
  40. wx.navigateTo({
  41. url: '/pages/personal/wallet/wallet',
  42. })
  43. },1000),
  44. home: util.throttle(function (e) {
  45. if(app.globalData.compatible){
  46. wx.reLaunch({
  47. url: '/pages/compatible/index/index',
  48. })
  49. }else{
  50. wx.reLaunch({
  51. url: '/pages/index/index',
  52. })
  53. }
  54. },1000),
  55. detail: util.throttle(function (e) {
  56. wx.navigateTo({
  57. url: '/pages/my_riding/my_riding?order='+this.data.code+'&index='+this.data.rent,
  58. })
  59. },1000),
  60. onReady: function () {
  61. },
  62. onShow: function () {
  63. },
  64. onHide: function () {
  65. },
  66. onUnload: function () {
  67. },
  68. onPullDownRefresh: function () {
  69. },
  70. onReachBottom: function () {
  71. },
  72. onShareAppMessage: function () {
  73. }
  74. })