order.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import BaseStore from '@src/stores/base';
  2. // import * as querystring from 'querystring';
  3. export default class OrderStore extends BaseStore {
  4. allCheckout() {
  5. return this.apiGet('/order/checkout/all');
  6. }
  7. addCheckout({ productType, productId, service, param, number }) {
  8. return this.apiPost('/order/checkout/add', { productType, productId, service, param, number });
  9. }
  10. removeCheckout(checkoutId) {
  11. return this.apiDelete('/order/checkout/delete', { checkoutId });
  12. }
  13. confirmPay() {
  14. return this.apiPost('/order/pay/confirm');
  15. }
  16. speedPay({ productType, productId, service, param, number }) {
  17. return this.apiPost('/order/pay/speed', { productType, productId, service, param, number });
  18. }
  19. wechatQr(orderId) {
  20. return this.apiPost('/order/wechat/qr', { orderId });
  21. }
  22. wechatJs(orderId) {
  23. return this.apiPost('/order/wechat/js', { orderId });
  24. }
  25. alipayQr(orderId) {
  26. return this.apiPost('/order/alipay/qr', { orderId });
  27. }
  28. query(orderId) {
  29. return this.apiGet('/order/pay/query', { orderId });
  30. }
  31. list({ page, size }) {
  32. return this.apiGet('/order/list', { page, size });
  33. }
  34. getOrder(id) {
  35. return this.apiGet('/order/detail', { id });
  36. }
  37. /**
  38. * 获取所有已购记录
  39. * @param {*} param0
  40. */
  41. listRecord({ page, size, productType, productId, service, isUsed, isExpire, filterChildren }) {
  42. return this.apiGet('/order/record/list', { page, size, productType, productId, service, isUsed, isExpire, filterChildren });
  43. }
  44. /**
  45. * 获取订单记录
  46. * @param {*} id
  47. */
  48. getRecord(id) {
  49. return this.apiGet('/order/record/detail', { id });
  50. }
  51. /**
  52. * 开通服务、课程等
  53. * @param {*} id
  54. */
  55. useRecord(id, isSubscribe) {
  56. return this.apiPost('/order/record/use', { id, isSubscribe });
  57. }
  58. }
  59. export const Order = new OrderStore({ key: 'order' });