http.api.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. import { apiurl } from './apiurl.js';
  2. // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
  3. const install = (Vue, vm) => {
  4. // 反馈提交
  5. let feedbackAdd = (params = {}) => vm.$u.post(apiurl.feedbackAddUrl, params);
  6. let getuseinfo = (params = {}) => vm.$u.get(apiurl.getuseinfourl + '/' + params);
  7. let createOrder = (params = {}) => vm.$u.post(apiurl.createOrderurl, params);
  8. let bindphone = (params = {}) => vm.$u.post(apiurl.bindphoneurl, params);
  9. let getPhoneLoginCode = (params = {}) => vm.$u.post(apiurl.phoneLoginCodeUrl, params);
  10. let phoneLoginAuth = (params = {}) =>
  11. vm.$u.post(
  12. apiurl.phoneLoginAuthUrl,
  13. {
  14. code: params.code
  15. },
  16. {
  17. Authorization: `Bearer ${params.accessToken}`,
  18. user_id: params.userId
  19. }
  20. );
  21. let getWXInfo = (params = {}) => vm.$u.get(apiurl.getWXInfoUrl + params);
  22. let getWxOpenidApi = (params = {}) => vm.$u.get(apiurl.getWxOpenidUrl + params.code);
  23. let wxPay = (params = {}) => vm.$u.post(apiurl.wxPayUrl, params);
  24. let getIndexData = (params = {}) => vm.$u.post(apiurl.getIndexDataUrl, params);
  25. let roadInfoById = (params = {}) => vm.$u.get(apiurl.roadInfoById + params.id);
  26. let getMycars = (params = {}) => vm.$u.get(apiurl.mycarsUrl, params);
  27. let addCar = (params = {}) => vm.$u.post(apiurl.mycarsUrl, params);
  28. let delCar = (params = {}) => vm.$u.delete(apiurl.mycarsUrl + '/' + params);
  29. let setDefaultCar = (params = {}) => vm.$u.put(apiurl.setDefaultCarUrl + params.id);
  30. let getOrderList = (params = {}) => vm.$u.get(apiurl.getOrderListUrl, params);
  31. //室内停车订单列表api
  32. let getRoomParkingApi = (params = {}) => vm.$u.get(apiurl.getRoomparkingList, params);
  33. let getOrderinfo = (params = {}) => vm.$u.get(apiurl.getOrderinfoUrl + params.id);
  34. let getRoomOrderDetail = (params = {}) =>
  35. vm.$u.get(apiurl.getRoomOrderDetailUrl + params.id, {
  36. showLoading: false
  37. });
  38. let getOrderDetail = (params = {}) =>
  39. vm.$u.get(apiurl.getOrderDetailUrl + params.id, {
  40. showLoading: false
  41. });
  42. let getMessageList = (params = {}) => vm.$u.get(apiurl.getMessageListUrl, params);
  43. let messageRead = (params = {}) => vm.$u.put(apiurl.messageReadUrl + params.newId);
  44. let nearRoadsl = (params = {}) => vm.$u.post(apiurl.nearRoadslUrl, params);
  45. let roadChargeRule = (params = {}) => vm.$u.get(apiurl.roadsChargeRuleUrl + params.roadNo);
  46. let nearParkingLot = (params = {}) => vm.$u.get(apiurl.nearParkingLotUrl, params);
  47. let parkingLotChargeRule = (params = {}) => vm.$u.get(apiurl.parkingLotChargeRuleUrl + params.parkNo, params);
  48. let monthInfo = (params = {}) => vm.$u.get(apiurl.monthInfoUrl, params);
  49. let createMonth = (params = {}) => vm.$u.post(apiurl.createMonthUrl, params);
  50. let monthPay = (params = {}) => vm.$u.post(apiurl.monthPayUrl, params);
  51. let getMonthPay = (params = {}) => vm.$u.get(apiurl.getMonthPayUrl + params.id);
  52. let getMonthList = (params = {}) => vm.$u.get(apiurl.getMonthListUrl, params);
  53. // 停车场包月列表
  54. let getParkMonthList = (params = {}) => vm.$u.get(apiurl.getParkMonthListUrl, params);
  55. let cancelMonth = (params = {}) => vm.$u.put(apiurl.cancelMonthUrl + params.monthId);
  56. let feePay = (params = {}) => vm.$u.put(apiurl.feePayUrl + params.vehicleId);
  57. let payGzbank = (params = {}) => vm.$u.post(apiurl.payGzbankUrl, params);
  58. let bindVehicleNo = (params = {}) => vm.$u.post(apiurl.bindVehicleNoApi, params);
  59. //贵州银行支付
  60. let gzbank = (params = {}) => vm.$u.post(apiurl.gzbankurl, params);
  61. // 订单查询
  62. let getOrderInfo = (params = {}) => vm.$u.get(apiurl.getOrderInfoApi + params.orderId);
  63. // 设备状态查询
  64. let getEquomentInfo = (params = {}) => vm.$u.get(apiurl.getEqupmentStatusApi + params.orderNo);
  65. // 订单退款(路段)
  66. let updateOrderRefund = (params = {}) => vm.$u.post(apiurl.updateOrderRefundApi, params);
  67. // 订单退款(停车场)
  68. let updateParkingOrderRefund = (params = {}) => vm.$u.post(apiurl.updateParkOrderRefundApi, params);
  69. // 获取订单退款详情
  70. let getOrderRefundDetails = (params = {}) => vm.$u.get(apiurl.getOrderRefundDetailsApi + params.orderId);
  71. // 普通微信支付
  72. let ordinaryWxPay = (params = {}) => vm.$u.post(apiurl.ordinaryWxPayApi, params);
  73. // 包月微信支付
  74. let monthlyWxPay = (params = {}) => vm.$u.post(apiurl.monthlyWxPayApi, params);
  75. // 获取自定义富文本内容: 0-包月须知 1-用户服务条款 2-隐私权政策信息 3-收费标准 4-退款温馨提示
  76. let getSystems = (params = {}) => vm.$u.get(apiurl.getSystermsApi + params.termsType);
  77. // 通过微信登录获取openid
  78. let codeV2Api = {
  79. // 发送验证码V2
  80. sendSmsCodeV2api: (params = {}) => vm.$u.post(apiurl.codeV2Url.sendSmsCodeV2Url, params),
  81. // 验证短信验证码V2
  82. verifyCodeV2Api: (params = {}) => vm.$u.post(apiurl.codeV2Url.verifyCodeV2Url, params),
  83. // 登出
  84. logoutApi: (params = {}) => vm.$u.post(apiurl.codeV2Url.logoutUrl, params)
  85. };
  86. let userLoginApi = {
  87. openidLoginApi: (params = {}) => vm.$u.post(apiurl.userLoginUrl.openidLoginUrl, params),
  88. sendSmsCodeApi: (params = {}) => vm.$u.post(apiurl.userLoginUrl.sendSmsCodeUrl, params),
  89. mobileLoginApi: (params = {}) => vm.$u.post(apiurl.userLoginUrl.mobileLoginUrl, params)
  90. };
  91. let geomaLockDetailsApi = (params = {}) => vm.$u.post(apiurl.geomaLockDetailsUrl, params);
  92. let getDetailEntranceApi = (params = {}) => vm.$u.post(apiurl.getDetailEntrance, params);
  93. let getDetailAdvanceApi = (params = {}) => vm.$u.post(apiurl.getDetailAdvance, params);
  94. let getDetailExportApi = (params = {}) => vm.$u.post(apiurl.getDetailExport, params);
  95. let entranceByNoVehicleApi = (params = {}) => vm.$u.post(apiurl.entranceByNoVehicle, params);
  96. let getAdvanceInfoApi = (params = {}) => vm.$u.post(apiurl.getAdvanceInfo, params);
  97. let getExportInfoApi = (params = {}) => vm.$u.post(apiurl.getExportInfo, params);
  98. let getOrderStateExportApi = (params = {}) => vm.$u.post(apiurl.getOrderStateExportUrl, params);
  99. let quickPayExportApi = (params = {}) => vm.$u.post(apiurl.quickPayExportUrl, params);
  100. let polyPayExportApi = (params = {}) => vm.$u.post(apiurl.polyPayExportUrl, params);
  101. let getDictApi = (params = {}) => vm.$u.get(apiurl.getDictUrl + params.type);
  102. let wechatPayApi = (params = {}) => vm.$u.post(apiurl.wechatPayUrl, params);
  103. let parkingWechatPayApi = (params = {}) => vm.$u.post(apiurl.parkingWechatPayUrl, params);
  104. let getParamsApi = (params = {}) => vm.$u.get(apiurl.getParamsUrl + params.key);
  105. let wechatMonthlyPayapi = (params = {}) => vm.$u.post(apiurl.wechatMonthlyPayUrl, params);
  106. let monthlyRuleDetailsApi = (params = {}) => vm.$u.get(apiurl.monthlyRuleDetailsUrl, params);
  107. let couponListApi = (params = {}) => vm.$u.get(apiurl.couponListUrl, params);
  108. let exchangeCouponApi = (params = {}) => vm.$u.put(apiurl.exchangeCouponUrl, params);
  109. let updateCouponStatusApi = (params = {}) => vm.$u.post(apiurl.updateCouponStatusUrl, params);
  110. let getCouponByOrderIdApi = (params = {}) => vm.$u.get(apiurl.getCouponByOrderIdUrl, params);
  111. let getVehicleInquiryListApi = (params = {}) => vm.$u.post(apiurl.getVehicleInquiryListUrl, params);
  112. let getOrderInfoByParknoApi = (params = {}) => vm.$u.post(apiurl.getOrderInfoByParknoUrl, params);
  113. let indoorPaymentApi = (params = {}) => vm.$u.post(apiurl.indoorPaymentUrl, params);
  114. let adBannerModuleApi = {
  115. getAdBannerListApi: (params = {}) => vm.$u.get(apiurl.adBannerModule.getAdBannerListUrl, params),
  116. getAdBannerDetailsApi: (params = {}) => vm.$u.get(apiurl.adBannerModule.getAdBannerDetailsUrl, params)
  117. };
  118. // 发票模块api
  119. let invoiceModuleApi = {
  120. // 获取符合发票订单
  121. getInvoiceOrderListApi: (params = {}) => vm.$u.get(apiurl.invoiceModule.getInvoiceOrderListUrl, params),
  122. // 获取发票列表
  123. getInvoiceListApi: (params = {}) => vm.$u.get(apiurl.invoiceModule.getInvoiceListUrl, params),
  124. // 新增发票
  125. addInvoiceApi: (params = {}) => vm.$u.post(apiurl.invoiceModule.addInvoiceUrl, params),
  126. // 修改发票
  127. updateInvoiceApi: (params = {}) => vm.$u.post(apiurl.invoiceModule.updateInvoiceUrl, params),
  128. // 删除发票
  129. deleteInvoiceApi: (params = {}) => vm.$u.delete(apiurl.invoiceModule.deleteInvoiceUrl, params),
  130. // 获取发票详情
  131. getInvoiceDetailsApi: (params = {}) => vm.$u.get(apiurl.invoiceModule.getInvoiceDetailsUrl + params.id),
  132. // 获取发票开头列表
  133. getInvoiceHeadListApi: (params = {}) => vm.$u.get(apiurl.invoiceModule.getInvoiceHeadListUrl, params),
  134. // 获取发票开头下拉
  135. getInvoiceHeadSelectApi: (params = {}) => vm.$u.get(apiurl.invoiceModule.getInvoiceHeadSelectUrl, params),
  136. // 获取发票开头详情
  137. getInvoiceHeadDetailsApi: (params = {}) => vm.$u.get(apiurl.invoiceModule.getInvoiceHeadDetailsUrl + params.id),
  138. // 新增发票开头
  139. addInvoiceHeaderApi: (params = {}) => vm.$u.post(apiurl.invoiceModule.addInvoiceHeaderUrl, params),
  140. // 修改发票开头
  141. updateInvoiceHeaderApi: (params = {}) => vm.$u.put(apiurl.invoiceModule.updateInvoiceHeaderUrl, params),
  142. // 删除发票开头
  143. deleteInvoiceHeaderApi: (params = {}) => vm.$u.delete(apiurl.invoiceModule.deleteInvoiceHeaderUrl + params.id)
  144. };
  145. // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
  146. vm.$u.api = {
  147. feedbackAdd,
  148. getuseinfo,
  149. createOrder,
  150. bindphone,
  151. getPhoneLoginCode,
  152. phoneLoginAuth,
  153. getWXInfo,
  154. getWxOpenidApi,
  155. wxPay,
  156. getIndexData,
  157. getMycars,
  158. addCar,
  159. delCar,
  160. setDefaultCar,
  161. roadInfoById,
  162. getOrderinfo,
  163. getOrderList,
  164. getOrderDetail,
  165. gzbank,
  166. nearRoadsl,
  167. roadChargeRule,
  168. nearParkingLot,
  169. parkingLotChargeRule,
  170. getMessageList,
  171. payGzbank,
  172. monthInfo,
  173. createMonth,
  174. monthPay,
  175. getMonthPay,
  176. getMonthList,
  177. getParkMonthList,
  178. cancelMonth,
  179. messageRead,
  180. feePay,
  181. getOrderInfo,
  182. getEquomentInfo,
  183. updateOrderRefund,
  184. updateParkingOrderRefund,
  185. getOrderRefundDetails,
  186. ordinaryWxPay,
  187. monthlyWxPay,
  188. getSystems,
  189. bindVehicleNo,
  190. codeV2Api,
  191. userLoginApi,
  192. geomaLockDetailsApi,
  193. getDetailEntranceApi,
  194. getDetailAdvanceApi,
  195. getDetailExportApi,
  196. entranceByNoVehicleApi,
  197. getAdvanceInfoApi,
  198. getExportInfoApi,
  199. getOrderStateExportApi,
  200. quickPayExportApi,
  201. polyPayExportApi,
  202. getRoomParkingApi,
  203. getRoomOrderDetail,
  204. getDictApi,
  205. wechatPayApi,
  206. parkingWechatPayApi,
  207. getParamsApi,
  208. wechatMonthlyPayapi,
  209. monthlyRuleDetailsApi,
  210. couponListApi,
  211. exchangeCouponApi,
  212. updateCouponStatusApi,
  213. getCouponByOrderIdApi,
  214. getVehicleInquiryListApi,
  215. getOrderInfoByParknoApi,
  216. indoorPaymentApi,
  217. adBannerModuleApi,
  218. invoiceModuleApi
  219. };
  220. };
  221. export default {
  222. install
  223. };