weixin.js 581 B

12345678910111213141516171819202122232425262728293031323334
  1. import request from '@/utils/request'
  2. import requestWhite from '../utils/requestWhite.js';
  3. import Qs from 'qs';
  4. //微信支付
  5. export function wxpay(data) {
  6. return request({
  7. url: '/wxPay/wxJsapiPay',
  8. data: data,
  9. method: 'post',
  10. })
  11. }
  12. //根据code换取openid
  13. export function getDataByCode(code) {
  14. return request({
  15. url: '/wechat/findUserInfo/' + code,
  16. params: {},
  17. method: 'get',
  18. })
  19. }
  20. //获得配置
  21. export function getConfig() {
  22. return requestWhite({
  23. url: '/wechat/getConfig',
  24. data: {
  25. url: window.location.href.split('#')[0]
  26. },
  27. method: 'get',
  28. })
  29. }