weixin.js 799 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import request from '@/utils/request'
  2. import Qs from 'qs';
  3. //微信支付
  4. export function wxpay(orderId) {
  5. return request({
  6. url: '/wxPay/wxJsapiPay',
  7. data: {
  8. chargingMarketingId: orderId,
  9. type:"D"
  10. },
  11. method: 'post',
  12. })
  13. }
  14. export function wxpay2(data) {
  15. if(data){
  16. data.type="D"
  17. }
  18. if(data&&!data.recordId){
  19. data.recordId=''
  20. }
  21. return request({
  22. url: '/wxPay/wxJsapiPay',
  23. data: data,
  24. method: 'post',
  25. })
  26. }
  27. //根据code换取openid
  28. export function getDataByCode(code) {
  29. return request({
  30. url:process.car.wechatUrl+ '/findUserInfo/' + code,
  31. params: {},
  32. method: 'get',
  33. })
  34. }
  35. //获得配置
  36. export function getConfig() {
  37. return request({
  38. url:process.car.wechatUrl+ '/getConfig',
  39. data: {
  40. url: window.location.href.split('#')[0]
  41. },
  42. method: 'get',
  43. })
  44. }