order.js 1.8 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. changeCheckout(id, number) {
  11. return this.apiPut('/order/checkout/number', { id, number });
  12. }
  13. removeCheckout(id) {
  14. return this.apiDel('/order/checkout/delete', { id });
  15. }
  16. confirmPay() {
  17. return this.apiPost('/order/pay/confirm');
  18. }
  19. speedPay({ productType, productId, service, param, number }) {
  20. return this.apiPost('/order/pay/speed', { productType, productId, service, param, number });
  21. }
  22. wechatQr(orderId) {
  23. return this.apiPost('/order/pay/wechat/qr', { orderId });
  24. }
  25. wechatJs(orderId) {
  26. return this.apiPost('/order/pay/wechat/js', { orderId });
  27. }
  28. alipayQr(orderId) {
  29. return this.apiPost('/order/pay/alipay/qr', { orderId });
  30. }
  31. query(orderId) {
  32. return this.apiGet('/order/pay/query', { orderId });
  33. }
  34. list({ page, size }) {
  35. return this.apiGet('/order/list', { page, size });
  36. }
  37. getOrder(id) {
  38. return this.apiGet('/order/detail', { id });
  39. }
  40. /**
  41. * 获取所有已购记录
  42. * @param {*} param0
  43. */
  44. listRecord({ page, size }) {
  45. return this.apiGet('/order/record/list', { page, size });
  46. }
  47. /**
  48. * 获取订单记录
  49. * @param {*} id
  50. */
  51. getRecord(id) {
  52. return this.apiGet('/order/record/detail', { id });
  53. }
  54. /**
  55. * 开通服务、课程等
  56. * @param {*} id
  57. */
  58. useRecord(recordId, isSubscribe) {
  59. return this.apiPost('/order/record/use', { recordId, isSubscribe });
  60. }
  61. }
  62. export const Order = new OrderStore({ key: 'order' });