index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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: false,
  32. defaultLabel: "待支付",
  33. defaultName: "待支付",
  34. defaultStatus: "待支付",
  35. },
  36. didMount() {
  37. /* 服务预警,缴费记录查询 */
  38. reportCmPV_YL({
  39. title: "缴费记录查询",
  40. });
  41. },
  42. onInit() {
  43. },
  44. methods: {
  45. 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. const { type, status } = this.filters || {};
  58. if(!this.hisPatientId) return
  59. if(this.filters.status === '1'){
  60. this.setData({
  61. showTimeSelector: true
  62. })
  63. if(!this.filters.startTime){
  64. my.showToast({
  65. type: "fail",
  66. content: "请选择时间段",
  67. duration: 3000,
  68. });
  69. }
  70. return
  71. } else {
  72. this.setData({
  73. showTimeSelector: false
  74. })
  75. }
  76. return payHistory({
  77. ...this.filters,
  78. type: type || "9",
  79. status: status || "0",
  80. ...page,
  81. hisPatientId: this.hisPatientId
  82. });
  83. },
  84. onAutoFilter(patient) {
  85. if (patient) {
  86. this.hisPatientId = patient.hisPatientId;
  87. this.scrollRef.refresh();
  88. }
  89. },
  90. // 进入详情
  91. toDetail(e) {
  92. history.push({
  93. title: "缴费详情",
  94. query: e.target.dataset,
  95. pageType: "hospital-payment-detail",
  96. });
  97. },
  98. // 付款
  99. async onPayment(e) {
  100. const { medicareBinded = false, item } = e.target.dataset; // 同意订阅消息后发起支付
  101. // 挂号
  102. if (item.type === 1) {
  103. await tradePay(
  104. {
  105. type: item.type,
  106. idNum: item.outTradeNo,
  107. depName: item.depName,
  108. },
  109. {
  110. tradeType: "Appointment",
  111. }
  112. );
  113. } else if (item.type === 2) {
  114. // 充值
  115. await tradePay(
  116. {
  117. type: item.type,
  118. idNum: item.outTradeNo,
  119. amount: item.amount,
  120. },
  121. {
  122. tradeType: "Appointment",
  123. }
  124. );
  125. } else {
  126. // 门诊订单
  127. await tradePay(
  128. {
  129. useBalance: !medicareBinded,
  130. useMedicare: medicareBinded,
  131. outTradeNo: item.outTradeNo,
  132. },
  133. {
  134. tradeType: "Outpatient",
  135. }
  136. );
  137. } // 支付成功去订单详情页
  138. this.toDetail({
  139. target: {
  140. dataset: {
  141. outTradeNo: item.outTradeNo,
  142. type: item.type,
  143. },
  144. },
  145. }); // 发起消息订阅
  146. this.subscribe.subscribeMessage();
  147. },
  148. },
  149. });