index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import request from '../utils/request.js';
  2. import requestWhite from '../utils/requestWhite.js';
  3. import Qs from 'qs';
  4. export function codeOperation(res) {
  5. // res="jp_team51_charge_id:A_11111"
  6. if(res&&res.length>22){
  7. }else if(res == 'toLogin') {
  8. return '/pages/login/login'
  9. }else{
  10. return false
  11. }
  12. var str1 = res.slice(0,19);
  13. var str2 = res.slice(20,21);
  14. var id = res.slice(22);
  15. if(str1 == 'jp_team51_charge_id') {
  16. if(str2 == 'A') {
  17. return '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + id
  18. }
  19. if(str2 == 'B') {
  20. return '/pages/user/finance/rechargeRes?id=' + id
  21. }
  22. } else {
  23. return false;
  24. }
  25. }
  26. export function scanCode(res) {
  27. var url=codeOperation(res);
  28. if(url){
  29. uni.navigateTo({
  30. url:url
  31. })
  32. }else{
  33. uni.showToast({
  34. title: '请扫描充电桩上的二维码'
  35. })
  36. }
  37. }
  38. export function activityInfoList(data) {
  39. return requestWhite({
  40. method: 'post',
  41. data: data,
  42. url: '/mobile/activityInfo/activityInfoList'
  43. })
  44. }
  45. export function test(data) {
  46. return request({
  47. method: 'post',
  48. data: data,
  49. url: '/test/post'
  50. })
  51. }
  52. export function chargingData(data) {
  53. return request({
  54. method: 'post',
  55. data: data,
  56. url: '/mobile/charging/chargingData'
  57. })
  58. }
  59. export function marketingData(data) {
  60. return request({
  61. method: 'post',
  62. data: data,
  63. url: '/mobile/charging/marketingData'
  64. })
  65. }
  66. export function findChargeData(data) {
  67. return request({
  68. method: 'post',
  69. data: data,
  70. url: '/mobile/chargingCar/findChargeData'
  71. })
  72. }
  73. export function personalCenter(data) {
  74. return request({
  75. method: 'post',
  76. data: data,
  77. url: '/mobile/regUser/personalCenter'
  78. })
  79. }
  80. export function logout(data) {
  81. return request({
  82. method: 'get',
  83. data: data,
  84. url: '/mobile/regUser/logout'
  85. })
  86. }
  87. export function stopCharging(data) {
  88. return request({
  89. method: 'post',
  90. data: data,
  91. url: '/mobile/command/stopCharging'
  92. })
  93. }
  94. export function startCharging(data) {
  95. return request({
  96. method: 'post',
  97. data: data,
  98. url: '/mobile/command/startCharging'
  99. })
  100. }
  101. export function accountRecordData(data) {
  102. return request({
  103. method: 'post',
  104. data: data,
  105. url: '/mobile/accountRecord/accountRecordData'
  106. })
  107. }
  108. export function accountDetail(id) {
  109. return request({
  110. method: 'get',
  111. url: '/mobile/accountRecord/accountDetail?id='+id
  112. })
  113. }
  114. export function chargingRecordData(data) {
  115. return request({
  116. method: 'post',
  117. data: data,
  118. url: '/mobile/chargingCar/chargingRecordData'
  119. })
  120. }
  121. export function chargingDetail(id) {
  122. return request({
  123. method: 'get',
  124. url: '/mobile/chargingRecord/chargingDetail?id='+id
  125. })
  126. }
  127. export function passengerMessageNoReadNum(data) {
  128. return request({
  129. url: '/mobile/passengerApi/passengerMessageNoReadNum',
  130. data:data,
  131. method: 'post',
  132. })
  133. }
  134. export function chargingDeviceData(data) {
  135. return request({
  136. method: 'post',
  137. data: data,
  138. url: '/mobile/charging/chargingDeviceData'
  139. })
  140. }