index.js 2.8 KB

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