index.js 4.5 KB

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