Pay.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import APIConfig from './api.js';
  2. import efunRequest from '../utils/efunRequest';
  3. import request from '../utils/request';
  4. import commonUitl from '../utils/commonutil';
  5. export default class PayUtil {
  6. static async getMember() {
  7. return request(APIConfig.getMemberUrl() + '?appCode=' + commonUitl.getAppCode(), { method: 'GET' });
  8. }
  9. static async getVoucher() {
  10. return request(APIConfig.getVoucherUrl(), { method: 'GET' });
  11. }
  12. static async payByAli(params) {
  13. return request(
  14. APIConfig.getPayUrl() +
  15. '/aliPay/pay?productCode=' +
  16. params.productCode +
  17. '&type=' +
  18. params.type +
  19. '&preferentialIds=' +
  20. params.preferentialIds +
  21. '&useVoucher=' +
  22. params.useVoucher,
  23. { method: 'GET' }
  24. );
  25. }
  26. static async payByWechat(params) {
  27. return request(
  28. APIConfig.getPayUrl() +
  29. '/wxPay/prePay?productCode=' +
  30. params.productCode +
  31. '&type=' +
  32. params.type +
  33. '&preferentialIds=' +
  34. params.preferentialIds +
  35. '&useVoucher=' +
  36. params.useVoucher,
  37. { method: 'GET' }
  38. );
  39. }
  40. }