weixin.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. 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: '/wechat/findUserInfo/' + code,
  30. params: {},
  31. method: 'get',
  32. })
  33. }
  34. export function saveWechatInfo(data) {
  35. return request({
  36. url: '/mobile/tenantUser/saveWechatInfo' ,
  37. data:data,
  38. method: 'post',
  39. })
  40. }
  41. export function findByUnionId(code,otherUserId) {
  42. return requestWhite({
  43. url: '/mobile/tenantUser/findByUnionId?otherUserId='+otherUserId+'&unionId=' + code,
  44. params: {},
  45. method: 'get',
  46. })
  47. }
  48. // export function getDataByCodeALI(code) {
  49. // return requestAli({
  50. // url: '/aliPay/findUserInfo/' + code,
  51. // params: {},
  52. // method: 'get',
  53. // })
  54. // }
  55. //获得配置
  56. export function getConfig() {
  57. return requestWhite({
  58. url: '/wechat/getConfig',
  59. data: {
  60. url: window.location.href.split('#')[0]
  61. },
  62. method: 'get',
  63. })
  64. }
  65. export function checkSubscribe(data) {
  66. return requestWhite({
  67. url: '/wechat/checkSubscribe',
  68. data: data,
  69. method: 'post',
  70. })
  71. }
  72. export function addPoint(data) {
  73. return request({
  74. url: '/mobile/points/addPoint',
  75. data: data,
  76. method: 'post',
  77. })
  78. }