weixin.js 705 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. export function alpay(data) {
  13. return request({
  14. url: '/aliPay/tradePrecreatePay',
  15. data: data,
  16. method: 'post',
  17. })
  18. }
  19. //根据code换取openid
  20. export function getDataByCode(code) {
  21. return request({
  22. url: '/wechat/findUserInfo/' + code,
  23. params: {},
  24. method: 'get',
  25. })
  26. }
  27. //获得配置
  28. export function getConfig() {
  29. return requestWhite({
  30. url: '/wechat/getConfig',
  31. data: {
  32. url: window.location.href.split('#')[0]
  33. },
  34. method: 'get',
  35. })
  36. }