index.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. import { getSubscribeAuth } from "../../../../core/utils/ywtService";
  6. import { createSubscribe } from "applet-page-component";
  7. Component(
  8. createSubscribe({
  9. async onShow() {
  10. this.scrollRef.refresh();
  11. },
  12. })({
  13. props: {},
  14. data: {
  15. empty: true,
  16. clinicCard: {},
  17. filterParams: {
  18. type: "9",
  19. cardNum: "",
  20. endTime: "",
  21. startTime: "",
  22. medicCards: [],
  23. timeShow: false,
  24. },
  25. /* 赛选项目 */
  26. typeOptions: [],
  27. statusOptions: [
  28. {
  29. value: "0",
  30. label: "待支付",
  31. },
  32. {
  33. value: "1",
  34. label: "已支付",
  35. },
  36. ],
  37. showAll: false,
  38. showTimeSelector: false,
  39. showCardSelector: false,
  40. defaultLabel: "待支付",
  41. defaultName: "待支付",
  42. defaultStatus: "待支付",
  43. alertTitle: "",
  44. },
  45. didMount() {
  46. /* 服务预警,缴费记录查询 */
  47. reportCmPV_YL({
  48. title: "门诊缴费",
  49. });
  50. },
  51. onInit() {},
  52. methods: {
  53. onFilterHandel(filters) {
  54. const { status: prevStatus } = this.filters || {};
  55. const { status: curStatus } = filters || {};
  56. if (!this.hisPatientId) return;
  57. this.filters = filters;
  58. const { status, startTime, endTime } = this.filters || {};
  59. // 当状态未改变时,做时间筛选校验,拦截请求;当状态被改变时,做时间校验的同时,不拦截请求
  60. // 状态:已支付
  61. // if (status && status === "1") {
  62. // if (!startTime || this.getTimeChange(startTime, endTime, 15)) {
  63. // my.showToast({
  64. // type: "fail",
  65. // content: "请选择15天以内的时间",
  66. // duration: 1500,
  67. // });
  68. // if (prevStatus === curStatus) return;
  69. // }
  70. // }
  71. // 状态:未支付
  72. // if (!status || status === "0") {
  73. // if (!startTime || this.getTimeChange(startTime, endTime, 3)) {
  74. // my.showToast({
  75. // type: "fail",
  76. // content: "请选择3天以内的时间",
  77. // duration: 1500,
  78. // });
  79. // if (prevStatus === curStatus) return;
  80. // }
  81. // }
  82. this.scrollRef.refresh();
  83. },
  84. saveRef(ref) {
  85. this.scrollRef = ref;
  86. },
  87. saveSubscribe(ref) {
  88. this.subscribe = ref;
  89. },
  90. getTimeChange(startTime, endTime, len) {
  91. if (!startTime || !endTime) {
  92. return true;
  93. }
  94. const time1 = Date.parse(startTime);
  95. const time2 = Date.parse(endTime);
  96. const timeDiff = time2 - time1;
  97. const duration = len * 24 * 60 * 60 * 1000;
  98. return timeDiff < 0 || timeDiff > duration;
  99. },
  100. onService(page) {
  101. const { status, startTime, endTime } = this.filters || {};
  102. if (!this.hisPatientId) return;
  103. return payHistory({
  104. ...this.filters,
  105. status: status || "0",
  106. ...page,
  107. hisPatientId: this.hisPatientId,
  108. });
  109. },
  110. onAutoFilter(patient) {
  111. if (patient) {
  112. this.hisPatientId = patient.hisPatientId;
  113. this.scrollRef.refresh();
  114. }
  115. },
  116. // 进入详情
  117. toDetail(e) {
  118. const {
  119. item: {
  120. type,
  121. outTradeNo,
  122. status,
  123. tradeNo,
  124. invoiceNo,
  125. hisPatientId,
  126. date,
  127. depName,
  128. amount,
  129. name,
  130. age,
  131. sex,
  132. prescribeDate,
  133. hisOrderNo,
  134. doctorName,
  135. doctorCode,
  136. total,
  137. hisClinicCode,
  138. deptName,
  139. orderItems,
  140. orderInsType,
  141. medInsFee,
  142. selfFee,
  143. payName,
  144. patName,
  145. },
  146. } = e.target.dataset;
  147. history.push({
  148. title: "缴费详情",
  149. query: {
  150. type: type || 0,
  151. outTradeNo,
  152. status,
  153. tradeNo,
  154. invoiceNo,
  155. hisPatientId,
  156. date,
  157. depName,
  158. amount,
  159. name,
  160. age,
  161. sex,
  162. prescribeDate,
  163. hisOrderNo,
  164. doctorName,
  165. doctorCode,
  166. total,
  167. hisClinicCode,
  168. deptName,
  169. orderInsType,
  170. orderItems: encodeURIComponent(JSON.stringify(orderItems || "")),
  171. medInsFee,
  172. selfFee,
  173. payName,
  174. patName,
  175. },
  176. pageType: "hospital-payment-detail",
  177. });
  178. },
  179. // 付款
  180. async onPayment(e) {
  181. this.toDetail(e);
  182. },
  183. },
  184. })
  185. );