order.js 2.1 KB

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