index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. 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 { status } = this.filters || {};
  57. if (!this.hisPatientId) return;
  58. return payHistory({
  59. ...this.filters,
  60. status: status || "0",
  61. ...page,
  62. hisPatientId: this.hisPatientId,
  63. });
  64. },
  65. onAutoFilter(patient) {
  66. if (patient) {
  67. this.hisPatientId = patient.hisPatientId;
  68. this.scrollRef.refresh();
  69. }
  70. },
  71. // 进入详情
  72. toDetail(e) {
  73. const {
  74. item: {
  75. type,
  76. outTradeNo,
  77. status,
  78. tradeNo,
  79. invoiceNo,
  80. hisPatientId,
  81. date,
  82. depName,
  83. amount,
  84. name,
  85. age,
  86. sex,
  87. prescribeDate,
  88. hisOrderNo,
  89. doctorName,
  90. doctorCode,
  91. total,
  92. hisClinicCode,
  93. deptName,
  94. },
  95. } = e.target.dataset;
  96. history.push({
  97. title: "缴费详情",
  98. query: {
  99. type: type || 0,
  100. outTradeNo,
  101. status,
  102. tradeNo,
  103. invoiceNo,
  104. hisPatientId,
  105. date,
  106. depName,
  107. amount,
  108. name,
  109. age,
  110. sex,
  111. prescribeDate,
  112. hisOrderNo,
  113. doctorName,
  114. doctorCode,
  115. total,
  116. hisClinicCode,
  117. deptName,
  118. },
  119. pageType: "hospital-payment-detail",
  120. });
  121. },
  122. // 付款
  123. async onPayment(e) {
  124. const { medicareBinded = false, item } = e.target.dataset; // 同意订阅消息后发起支付
  125. // 挂号
  126. if (item.type === 1) {
  127. await tradePay(
  128. {
  129. type: item.type,
  130. idNum: item.outTradeNo,
  131. depName: item.depName,
  132. },
  133. {
  134. tradeType: "Appointment",
  135. }
  136. );
  137. } else if (item.type === 2) {
  138. // 充值
  139. await tradePay(
  140. {
  141. type: item.type,
  142. idNum: item.outTradeNo,
  143. amount: item.amount,
  144. },
  145. {
  146. tradeType: "Appointment",
  147. }
  148. );
  149. } else {
  150. // 门诊订单
  151. await tradePay(
  152. {
  153. useBalance: !medicareBinded,
  154. useMedicare: medicareBinded,
  155. outTradeNo: item.outTradeNo,
  156. ...item,
  157. },
  158. {
  159. tradeType: "Outpatient",
  160. }
  161. );
  162. } // 支付成功去订单详情页
  163. this.toDetail({
  164. target: {
  165. dataset: {
  166. outTradeNo: item.outTradeNo,
  167. type: item.type ? item.type : 0,
  168. ...item,
  169. },
  170. },
  171. }); // 发起消息订阅
  172. // this.subscribe.subscribeMessage();
  173. },
  174. },
  175. });