order.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. /**
  32. * 获取所有已购记录
  33. * @param {*} param0
  34. */
  35. listRecord({ page, size }) {
  36. return this.apiGet('/my/record/list', { page, size });
  37. }
  38. /**
  39. * 获取订单记录
  40. * @param {*} id
  41. */
  42. getRecord(id) {
  43. return this.apiGet('/my/record/detail', { id });
  44. }
  45. /**
  46. * 开通服务、课程等
  47. * @param {*} id
  48. */
  49. useRecord(id, isSubscribe) {
  50. return this.apiPost('/my/record/use', { id, isSubscribe });
  51. }
  52. }
  53. export const Order = new OrderStore({ key: 'order' });