index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. import request from '../utils/request.js';
  2. import requestWhite from '../utils/requestWhite.js';
  3. import Qs from 'qs';
  4. import carhelp from '@/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. if(str2 == 'C') {
  33. return '/pages/user/discountCard/paymentSuccess?id=' + id
  34. }
  35. } else {
  36. return false;
  37. }
  38. }
  39. export function scanCode(res) {
  40. var url=codeOperation(res);
  41. if(url){
  42. uni.navigateTo({
  43. url:url
  44. })
  45. }else{
  46. uni.showToast({
  47. title: '请扫描充电桩上的二维码'
  48. })
  49. }
  50. }
  51. export function activityInfoList(data) {
  52. return requestWhite({
  53. method: 'post',
  54. data: data,
  55. url: '/mobile/activityInfo/activityInfoList'
  56. })
  57. }
  58. export function test(data) {
  59. return request({
  60. method: 'post',
  61. data: data,
  62. url: '/test/post'
  63. })
  64. }
  65. export function chargingData(data) {
  66. return request({
  67. method: 'post',
  68. data: data,
  69. url: '/mobile/charging/chargingData'
  70. })
  71. }
  72. export function marketingData(data) {
  73. return request({
  74. method: 'post',
  75. data: data,
  76. url: '/mobile/charging/marketingData'
  77. })
  78. }
  79. export function findChargeData(data) {
  80. return request({
  81. method: 'post',
  82. data: data,
  83. url: '/mobile/chargingCar/findChargeData'
  84. })
  85. }
  86. export function personalCenter(data) {
  87. return request({
  88. method: 'post',
  89. data: data,
  90. url: '/mobile/regUser/personalCenter'
  91. })
  92. }
  93. export function logout(data) {
  94. return request({
  95. method: 'get',
  96. data: data,
  97. url: '/mobile/regUser/logout'
  98. })
  99. }
  100. export function stopCharging(data) {
  101. return request({
  102. method: 'post',
  103. data: data,
  104. url: '/mobile/command/stopCharging'
  105. })
  106. }
  107. export function startCharging(data) {
  108. return request({
  109. method: 'post',
  110. data: data,
  111. url: '/mobile/command/startCharging'
  112. })
  113. }
  114. export function accountRecordData(data) {
  115. return request({
  116. method: 'post',
  117. data: data,
  118. url: '/mobile/accountRecord/accountRecordData'
  119. })
  120. }
  121. export function accountDetail(id) {
  122. return request({
  123. method: 'get',
  124. url: '/mobile/accountRecord/accountDetail?id='+id
  125. })
  126. }
  127. export function chargingRecordData(data) {
  128. return request({
  129. method: 'post',
  130. data: data,
  131. url: '/mobile/chargingCar/chargingRecordData'
  132. })
  133. }
  134. export function chargingDetail(id) {
  135. return request({
  136. method: 'get',
  137. url: '/mobile/chargingRecord/chargingDetail?id='+id
  138. })
  139. }
  140. export function passengerMessageNoReadNum(data) {
  141. return request({
  142. url: '/mobile/passengerApi/passengerMessageNoReadNum',
  143. data:data,
  144. method: 'post',
  145. })
  146. }
  147. export function chargingDeviceData(data) {
  148. return request({
  149. method: 'post',
  150. data: data,
  151. url: '/mobile/charging/chargingDeviceData'
  152. })
  153. }
  154. export function findActivity(data) {
  155. return requestWhite({
  156. method: 'post',
  157. data: data,
  158. url: '/mobile/chargingCouponApi/findActivity'
  159. })
  160. }
  161. export function changeFont(data) {
  162. return request({
  163. method: 'get',
  164. data: data,
  165. url: '/mobile/regUser/changeFont'
  166. })
  167. }
  168. export function getTips(data) {
  169. return requestWhite({
  170. method: 'post',
  171. data: data,
  172. url: '/mobile/dataDictionary/getTips'
  173. })
  174. }
  175. export function readCoupon(data) {
  176. return request({
  177. method: 'post',
  178. data: data,
  179. url: '/mobile/chargingCouponApi/readCoupon'
  180. })
  181. }
  182. export function personCardList(data) {
  183. return request({
  184. method: 'post',
  185. data: data,
  186. url: '/mobile/regUser/personCardList'
  187. })
  188. }