C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.2 KiB

  1. // pages/passCar/passCar.js
  2. const app = getApp();
  3. Component({
  4. properties: {
  5. },
  6. data: {
  7. parkVendor: 1,
  8. park: null,
  9. carList: [],
  10. etcpToken: null,
  11. },
  12. methods: {
  13. jumpToAdd: function() {
  14. wx.redirectTo({
  15. url: '/pages/addPark/addPark'
  16. });
  17. },
  18. jumpToPay: function() {
  19. wx.redirectTo({
  20. url: '/pages/pay/pay',
  21. })
  22. },
  23. passb: function() {
  24. wx.showToast({
  25. title: '货物在路上~',
  26. })
  27. },
  28. passc: function() {
  29. wx.showToast({
  30. title: '宝宝最可爱~',
  31. })
  32. },
  33. orderPay: function() {
  34. wx.redirectTo({
  35. url: '/pages/pay/pay'
  36. });
  37. },
  38. unbindCar: function() {
  39. var that = this
  40. // ETCP
  41. var etcpData = {
  42. etcpToken: that.data.etcpToken,
  43. carNumber: null,
  44. }
  45. // 停简单
  46. var tjdData = {
  47. carNumber: null,
  48. carNumColor: null,
  49. outCarId: null,
  50. }
  51. var postData = (parkVendor == 1) ? etcpData : tjdData
  52. Http.post({
  53. url: config.api.unbindCar,
  54. data: postData,
  55. })
  56. .then(res => {
  57. console.log(res)
  58. wx.showModal({
  59. title: '提示',
  60. showCancel: false,
  61. content: "解绑车牌成功!",
  62. success: function() {}
  63. })
  64. })
  65. .catch(error => {
  66. wx.showModal({
  67. title: '提示',
  68. showCancel: false,
  69. content: "解绑车牌失败!",
  70. success: function () { }
  71. })
  72. })
  73. },
  74. },
  75. ready() {
  76. var that = this
  77. initCallback = token => {
  78. // 车场信息获取
  79. Http.get({
  80. url: config.api.getParkInfo,
  81. data: {}
  82. })
  83. .then(res => {
  84. console.log(res)
  85. that.setData({
  86. tabs: res.data
  87. })
  88. })
  89. //绑定车获取
  90. Http.get({
  91. url: config.api.getUserCarList,
  92. data: {}
  93. }).then(res => {
  94. console.log(res);
  95. that.setData({
  96. carList: res.data
  97. })
  98. })
  99. }
  100. if (app.globalData.token && app.globalData.token != null) {
  101. initCallback(app.globalData.token)
  102. } else {
  103. initCallback(app.globalData.token)
  104. }
  105. }
  106. })