1
0

order.js 2.5 KB

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