index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import { payHistory } from './service';
  2. import history from '../../utils/history';
  3. import { tradePay } from '../../utils/tradePay';
  4. import { reportCmPV_YL } from '../../utils/cloudMonitorHelper';
  5. Component({
  6. props: {},
  7. data: {
  8. empty: true,
  9. clinicCard: {},
  10. filterParams: {
  11. type: '9',
  12. cardNum: '',
  13. endTime: '',
  14. startTime: '',
  15. medicCards: []
  16. },
  17. /* 赛选项目 */
  18. typeOptions: [{
  19. value: '1',
  20. label: '挂号订单'
  21. }, {
  22. value: '2',
  23. label: '充值订单'
  24. }, {
  25. value: '3',
  26. label: '诊间订单'
  27. }],
  28. statusOptions: [{
  29. value: '0',
  30. label: '待支付'
  31. }, {
  32. value: '1',
  33. label: '已支付'
  34. }, {
  35. value: '9',
  36. label: '已取消'
  37. }]
  38. },
  39. didMount() {
  40. /* 服务预警,缴费记录查询 */
  41. reportCmPV_YL({
  42. title: '缴费记录查询'
  43. });
  44. },
  45. methods: {
  46. onFilterHandel(filters) {
  47. this.filters = filters;
  48. this.scrollRef.refresh();
  49. },
  50. saveRef(ref) {
  51. this.scrollRef = ref;
  52. },
  53. saveSubscribe(ref) {
  54. this.subscribe = ref;
  55. },
  56. onService(page) {
  57. const {
  58. type
  59. } = this.filters || {};
  60. return payHistory({ ...this.filters,
  61. type: type || '9',
  62. ...page
  63. });
  64. },
  65. // 进入详情
  66. toDetail(e) {
  67. history.push({
  68. title: '缴费详情',
  69. query: e.target.dataset,
  70. pageType: 'hospital-payment-detail'
  71. });
  72. },
  73. // 付款
  74. async onPayment(e) {
  75. const {
  76. medicareBinded = false,
  77. item
  78. } = e.target.dataset; // 同意订阅消息后发起支付
  79. // 挂号
  80. if (item.type === 1) {
  81. await tradePay({
  82. type: item.type,
  83. idNum: item.outTradeNo,
  84. depName: item.depName
  85. }, {
  86. tradeType: 'Appointment'
  87. });
  88. } else if (item.type === 2) {
  89. // 充值
  90. await tradePay({
  91. type: item.type,
  92. idNum: item.outTradeNo,
  93. amount: item.amount
  94. }, {
  95. tradeType: 'Appointment'
  96. });
  97. } else {
  98. // 门诊订单
  99. await tradePay({
  100. useBalance: !medicareBinded,
  101. useMedicare: medicareBinded,
  102. outTradeNo: item.outTradeNo
  103. }, {
  104. tradeType: 'Outpatient'
  105. });
  106. } // 支付成功去订单详情页
  107. this.toDetail({
  108. target: {
  109. dataset: {
  110. outTradeNo: item.outTradeNo,
  111. type: item.type
  112. }
  113. }
  114. }); // 发起消息订阅
  115. this.subscribe.subscribeMessage();
  116. }
  117. }
  118. });