weixin.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. export function pay(data) {
  6. return request({
  7. url: '/wechat/pay',
  8. data: data,
  9. method: 'post',
  10. })
  11. }
  12. //微信支付
  13. export function wxpay(data) {
  14. // if(data){
  15. // data.type="E"
  16. // }
  17. // if(data&&!data.recordId){
  18. // data.recordId=''
  19. // }
  20. return request({
  21. url: '/wxPay/wxJsapiPay',
  22. data: data,
  23. method: 'post',
  24. })
  25. }
  26. export function alpay(data) {
  27. if(data&&!data.recordId){
  28. data.recordId=''
  29. }
  30. return request({
  31. url: '/aliPay/tradePrecreatePay',
  32. data: data,
  33. method: 'post',
  34. })
  35. }
  36. //根据code换取openid
  37. export function getDataByCode(code) {
  38. return request({
  39. url: '/wechat/findUserInfo/' + code,
  40. params: {},
  41. method: 'get',
  42. })
  43. }
  44. // export function getDataByCodeALI(code) {
  45. // return requestAli({
  46. // url: '/aliPay/findUserInfo/' + code,
  47. // params: {},
  48. // method: 'get',
  49. // })
  50. // }
  51. //获得配置
  52. export function getConfig() {
  53. return requestWhite({
  54. url: '/wechat/getConfig',
  55. data: {
  56. url: window.location.href.split('#')[0]
  57. },
  58. method: 'get',
  59. })
  60. }
  61. export function checkSubscribe(data) {
  62. return requestWhite({
  63. url: '/wechat/checkSubscribe',
  64. data: data,
  65. method: 'post',
  66. })
  67. }