index.js 4.7 KB

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