index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { createSubscribe } from 'applet-page-component';
  2. import { getOrderList, getVisitList, getPayList } from '../utils/service';
  3. import { navigateTo } from '../utils/index';
  4. import { reportCmPV_YL } from '../utils/cloudMonitorHelper';
  5. const config = {
  6. order: {
  7. title: '预约记录'
  8. },
  9. visit: {
  10. title: '就诊记录'
  11. },
  12. charge: {
  13. title: '充值记录'
  14. }
  15. };
  16. Component(createSubscribe({
  17. onShow() {
  18. const {
  19. type
  20. } = this.data;
  21. if (type === 'order' && getApp().globalData.cancelReservation) {
  22. getApp().globalData.cancelReservation = false;
  23. this.scrollFetch && this.scrollFetch.fetchList({
  24. pageIndex: 1
  25. }, true, true);
  26. }
  27. }
  28. })({
  29. data: {
  30. type: ''
  31. },
  32. didMount() {
  33. const {
  34. type,
  35. serviceCode
  36. } = getCurrentPages().pop().options;
  37. reportCmPV_YL({
  38. title: config[type].title,
  39. query: {
  40. serviceCode,
  41. type
  42. }
  43. });
  44. this.setData({
  45. type
  46. });
  47. },
  48. methods: {
  49. saveRef(ref) {
  50. this.scrollFetch = ref;
  51. },
  52. onService({
  53. pageIndex,
  54. pageSize,
  55. ...other
  56. }) {
  57. const {
  58. type
  59. } = this.data;
  60. if (type === 'order') {
  61. my.setNavigationBar({
  62. title: '预约记录'
  63. });
  64. return getOrderList({
  65. pageIndex,
  66. pageSize,
  67. ...other
  68. });
  69. } else if (type === 'visit') {
  70. my.setNavigationBar({
  71. title: '就诊记录'
  72. });
  73. return getVisitList({
  74. pageIndex,
  75. pageSize,
  76. ...other
  77. });
  78. } else if (type === 'charge') {
  79. my.setNavigationBar({
  80. title: '充值记录'
  81. });
  82. return getPayList({
  83. status: 1,
  84. type: 2,
  85. pageIndex,
  86. pageSize,
  87. ...other
  88. });
  89. }
  90. },
  91. toDetail(orderId) {
  92. navigateTo({
  93. url: `/pages/page-detail/index?queryId=${orderId}&type=${this.data.type}`
  94. });
  95. }
  96. }
  97. }));