weixin.js 737 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. id: orderId
  9. },
  10. method: 'get',
  11. })
  12. }
  13. //根据code换取openid
  14. export function getDataByCode(code) {
  15. return request({
  16. url: '/wechat/findUserInfo/' + code,
  17. params: {},
  18. method: 'get',
  19. })
  20. }
  21. //获取用户信息
  22. export function getDataByOpenId(openId) {
  23. return request({
  24. url: '/mobile/personInfoApi/findByOpenId',
  25. data: Qs.stringify({
  26. openId: openId
  27. }),
  28. method: 'post',
  29. })
  30. }
  31. //获得配置
  32. export function getConfig() {
  33. return request({
  34. url: '/wechat/getConfig',
  35. data: {
  36. url: window.location.href.split('#')[0]
  37. },
  38. method: 'get',
  39. })
  40. }