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. //微信支付
  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. }
  61. export function addPoint(data) {
  62. return request({
  63. url: '/mobile/points/addPoint',
  64. data: data,
  65. method: 'post',
  66. })
  67. }