weixin.js 1.3 KB

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