payment.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import request from '@/utils/request';
  2. /**
  3. * 获取支付配置
  4. */
  5. export const getPaymentConfig = () => {
  6. return request.get('/edu-app/open/paramConfig/queryByParamNameList', {
  7. requestType: 'form',
  8. params: {
  9. paramNames: 'vip_payment_service_provider,teacher_vip_purchase_list'
  10. }
  11. });
  12. };
  13. /**
  14. * 创建VIP订单
  15. */
  16. export const createVipOrder = (params: {
  17. orderType: string;
  18. paymentType: string;
  19. paymentChannel?: string;
  20. paymentCashAmount: number;
  21. paymentCouponAmount: number;
  22. goodsInfos: any[];
  23. orderName: string;
  24. orderDesc: string;
  25. }) => {
  26. return request.post('/edu-app/userPaymentOrder/executeOrder', {
  27. data: params
  28. });
  29. };
  30. /**
  31. * 执行支付
  32. */
  33. export const executePayment = (params: {
  34. merOrderNo: string;
  35. paymentChannel: string;
  36. userId: string | number;
  37. wxPubAppId?: string;
  38. code?: string;
  39. }) => {
  40. return request.post('/edu-app/open/userOrder/executePayment', {
  41. data: params
  42. });
  43. };
  44. /**
  45. * 获取订单详情
  46. */
  47. export const getOrderDetail = (orderNo: string) => {
  48. return request.get(`/edu-app/userPaymentOrder/detail/${orderNo}`);
  49. };