weixin.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import request from '@/utils/request'
  2. import requestWhite from '../utils/requestWhite.js';
  3. import requestAli from '../utils/requestParking.js';
  4. import Qs from 'qs';
  5. //微信支付
  6. export function wxpay(data) {
  7. if(data){
  8. data.type="E"
  9. }
  10. if(data&&!data.recordId){
  11. data.recordId=''
  12. }
  13. return request({
  14. url: '/wxPay/wxJsapiPay',
  15. data: data,
  16. method: 'post',
  17. })
  18. }
  19. export function alpay(data) {
  20. if(data&&!data.recordId){
  21. data.recordId=''
  22. }
  23. return request({
  24. url: '/aliPay/tradePrecreatePay',
  25. data: data,
  26. method: 'post',
  27. })
  28. }
  29. //根据code换取openid
  30. export function getDataByCode(code) {
  31. var url = process.car.wechatUrl+'/findUserInfo/' + code
  32. return request({
  33. url: url,
  34. params: {},
  35. method: 'get',
  36. })
  37. }
  38. export function getDataByCodeALI(code) {
  39. return requestAli({
  40. url: '/aliPay/findUserInfo/' + code,
  41. params: {},
  42. method: 'get',
  43. })
  44. }
  45. //获得配置
  46. export function getConfig() {
  47. return requestWhite({
  48. url: process.car.wechatUrl+'/getConfig',
  49. data: {
  50. url: window.location.href.split('#')[0]
  51. },
  52. method: 'get',
  53. })
  54. }
  55. export function checkSubscribe(data) {
  56. return requestWhite({
  57. url: process.car.wechatUrl+'/checkSubscribe',
  58. data: data,
  59. method: 'post',
  60. })
  61. }