weixin.js 1.0 KB

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