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