weixin.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import request from '@/apis/utils/request'
  2. import requestWhite from '@/apis/utils/requestWhite.js';
  3. // import requestAli from '../utils/requestParking.js';
  4. import Qs from 'qs';
  5. //微信支付
  6. export function wxpay(data) {
  7. if(data){
  8. data.type="E"
  9. }
  10. if(data&&!data.recordId){
  11. data.recordId=''
  12. }
  13. return request({
  14. url: '/wxPay/wxJsapiPay',
  15. data: data,
  16. method: 'post',
  17. })
  18. }
  19. export function alpay(data) {
  20. if(data&&!data.recordId){
  21. data.recordId=''
  22. }
  23. return request({
  24. url: '/aliPay/tradePrecreatePay',
  25. data: data,
  26. method: 'post',
  27. })
  28. }
  29. //根据code换取openid
  30. export function getDataByCode(code) {
  31. return request({
  32. url: '/wechat/findUserInfo/' + code,
  33. params: {},
  34. method: 'get',
  35. })
  36. }
  37. // export function getDataByCodeALI(code) {
  38. // return requestAli({
  39. // url: '/aliPay/findUserInfo/' + code,
  40. // params: {},
  41. // method: 'get',
  42. // })
  43. // }
  44. //获得配置
  45. export function getConfig() {
  46. return requestWhite({
  47. url: '/wechat/getConfig',
  48. data: {
  49. url: window.location.href.split('#')[0]
  50. },
  51. method: 'get',
  52. })
  53. }
  54. export function checkSubscribe(data) {
  55. return requestWhite({
  56. url: '/wechat/checkSubscribe',
  57. data: data,
  58. method: 'post',
  59. })
  60. }