index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. statusOptions: [
  20. {
  21. value: "0",
  22. label: "待支付",
  23. },
  24. {
  25. value: "1",
  26. label: "已支付",
  27. },
  28. ],
  29. showAll: false,
  30. showTimeSelector: false,
  31. defaultLabel: "待支付",
  32. defaultName: "待支付",
  33. defaultStatus: "待支付",
  34. },
  35. didMount() {
  36. /* 服务预警,缴费记录查询 */
  37. reportCmPV_YL({
  38. title: "缴费记录查询",
  39. });
  40. },
  41. onInit() {
  42. },
  43. methods: {
  44. onFilterHandel(filters) {
  45. if (!this.hisPatientId) return
  46. this.filters = filters;
  47. this.scrollRef.refresh();
  48. },
  49. saveRef(ref) {
  50. this.scrollRef = ref;
  51. },
  52. saveSubscribe(ref) {
  53. this.subscribe = ref;
  54. },
  55. onService(page) {
  56. const { type, status } = this.filters || {};
  57. console.log('this.hisPatientId', this.hisPatientId);
  58. if(!this.hisPatientId) return
  59. return payHistory({
  60. ...this.filters,
  61. type: type || "9",
  62. status: status || "0",
  63. ...page,
  64. hisPatientId: this.hisPatientId
  65. });
  66. },
  67. onAutoFilter(patient) {
  68. if (patient) {
  69. this.hisPatientId = patient.hisPatientId;
  70. this.scrollRef.refresh();
  71. }
  72. },
  73. // 进入详情
  74. toDetail(e) {
  75. history.push({
  76. title: "缴费详情",
  77. query: e.target.dataset,
  78. pageType: "hospital-payment-detail",
  79. });
  80. },
  81. // 付款
  82. async onPayment(e) {
  83. const { medicareBinded = false, item } = e.target.dataset; // 同意订阅消息后发起支付
  84. // 挂号
  85. if (item.type === 1) {
  86. await tradePay(
  87. {
  88. type: item.type,
  89. idNum: item.outTradeNo,
  90. depName: item.depName,
  91. },
  92. {
  93. tradeType: "Appointment",
  94. }
  95. );
  96. } else if (item.type === 2) {
  97. // 充值
  98. await tradePay(
  99. {
  100. type: item.type,
  101. idNum: item.outTradeNo,
  102. amount: item.amount,
  103. },
  104. {
  105. tradeType: "Appointment",
  106. }
  107. );
  108. } else {
  109. // 门诊订单
  110. await tradePay(
  111. {
  112. useBalance: !medicareBinded,
  113. useMedicare: medicareBinded,
  114. outTradeNo: item.outTradeNo,
  115. },
  116. {
  117. tradeType: "Outpatient",
  118. }
  119. );
  120. } // 支付成功去订单详情页
  121. this.toDetail({
  122. target: {
  123. dataset: {
  124. outTradeNo: item.outTradeNo,
  125. type: item.type,
  126. },
  127. },
  128. }); // 发起消息订阅
  129. this.subscribe.subscribeMessage();
  130. },
  131. },
  132. });