order.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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(recordId, isSubscribe) {
  56. return this.apiPost('/order/record/use', { recordId, isSubscribe });
  57. }
  58. openInvoice({ orderId, invoiceType, title, identity }) {
  59. return this.apiPost('/order/invoice/open', { orderId, invoiceType, title, identity });
  60. }
  61. }
  62. export const Order = new OrderStore({ key: 'order' });