index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. import request from '@/apis/utils/request.js';
  2. import requestWhite from '@/apis/utils/requestWhite.js';
  3. import Qs from 'qs';
  4. import carhelp from '@/apis/utils/mixin.js'
  5. export function codeOperation(url) {
  6. //http://localhost:8080/#/?jpcode=jp_team51_charge_id:A_111
  7. var res=url
  8. if(url&&url.indexOf("#/?jpcode=")>-1){
  9. res=url.split("#/?jpcode=")[1]
  10. }
  11. if(url&&url.indexOf("#/?gunId=")>-1){
  12. var gunId=url.split("#/?gunId=")[1]
  13. res="jp_team51_charge_id:A_"+gunId
  14. }
  15. if(res&&res.length>22){
  16. }else if(res == 'toLogin') {
  17. return '/pages/login/login'
  18. }else{
  19. return false
  20. }
  21. var str1 = res.slice(0,19);
  22. var str2 = res.slice(20,21);
  23. var id = res.slice(22);
  24. if(str1 == 'jp_team51_charge_id') {
  25. if(str2 == 'A') {
  26. //carhelp.setGunId(id)
  27. return '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + id
  28. }
  29. if(str2 == 'B') {
  30. return '/pages/user/finance/rechargeRes?id=' + id
  31. }
  32. } else {
  33. return false;
  34. }
  35. }
  36. export function scanCode(res) {
  37. var url=codeOperation(res);
  38. if(url){
  39. uni.navigateTo({
  40. url:url
  41. })
  42. }else{
  43. uni.showToast({
  44. title: '请扫描充电桩上的二维码'
  45. })
  46. }
  47. }
  48. export function activityInfoList(data) {
  49. return requestWhite({
  50. method: 'post',
  51. data: data,
  52. url: '/mobile/activityInfo/activityInfoList'
  53. })
  54. }
  55. export function test(data) {
  56. return request({
  57. method: 'post',
  58. data: data,
  59. url: '/test/post'
  60. })
  61. }
  62. export function chargingData(data) {
  63. return request({
  64. method: 'post',
  65. data: data,
  66. url: '/mobile/charging/chargingData'
  67. })
  68. }
  69. export function marketingData(data) {
  70. return request({
  71. method: 'post',
  72. data: data,
  73. url: '/mobile/charging/marketingData'
  74. })
  75. }
  76. export function findChargeData(data) {
  77. return request({
  78. method: 'post',
  79. data: data,
  80. url: '/mobile/chargingCar/findChargeData'
  81. })
  82. }
  83. export function personalCenter(data) {
  84. return request({
  85. method: 'post',
  86. data: data,
  87. url: '/mobile/regUser/personalCenter'
  88. })
  89. }
  90. export function logout(data) {
  91. return request({
  92. method: 'get',
  93. data: data,
  94. url: '/mobile/regUser/logout'
  95. })
  96. }
  97. export function stopCharging(data) {
  98. return request({
  99. method: 'post',
  100. data: data,
  101. url: '/mobile/command/stopCharging'
  102. })
  103. }
  104. export function startCharging(data) {
  105. return request({
  106. method: 'post',
  107. data: data,
  108. url: '/mobile/command/startCharging'
  109. })
  110. }
  111. export function accountRecordData(data) {
  112. return request({
  113. method: 'post',
  114. data: data,
  115. url: '/mobile/accountRecord/accountRecordData'
  116. })
  117. }
  118. export function accountDetail(id) {
  119. return request({
  120. method: 'get',
  121. url: '/mobile/accountRecord/accountDetail?id='+id
  122. })
  123. }
  124. export function chargingRecordData(data) {
  125. return request({
  126. method: 'post',
  127. data: data,
  128. url: '/mobile/chargingCar/chargingRecordData'
  129. })
  130. }
  131. export function chargingDetail(id) {
  132. return request({
  133. method: 'get',
  134. url: '/mobile/chargingRecord/chargingDetail?id='+id
  135. })
  136. }
  137. export function passengerMessageNoReadNum(data) {
  138. return request({
  139. url: '/mobile/passengerApi/passengerMessageNoReadNum',
  140. data:data,
  141. method: 'post',
  142. })
  143. }
  144. export function chargingDeviceData(data) {
  145. return request({
  146. method: 'post',
  147. data: data,
  148. url: '/mobile/charging/chargingDeviceData'
  149. })
  150. }
  151. export function findActivity(data) {
  152. return requestWhite({
  153. method: 'post',
  154. data: data,
  155. url: '/mobile/chargingCouponApi/findActivity'
  156. })
  157. }
  158. export function changeFont(data) {
  159. return request({
  160. method: 'get',
  161. data: data,
  162. url: '/mobile/regUser/changeFont'
  163. })
  164. }
  165. export function getTips(data) {
  166. return requestWhite({
  167. method: 'post',
  168. data: data,
  169. url: '/mobile/dataDictionary/getTips'
  170. })
  171. }
  172. export function readCoupon(data) {
  173. return request({
  174. method: 'post',
  175. data: data,
  176. url: '/mobile/chargingCouponApi/readCoupon'
  177. })
  178. }