rechSuce.js 1.8 KB

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