weixin.js 543 B

123456789101112131415161718192021222324252627282930313233343536
  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 getConfig() {
  23. return request({
  24. url: '/wechat/getConfig',
  25. data: {
  26. url: window.location.href.split('#')[0]
  27. },
  28. method: 'get',
  29. })
  30. }