소스 검색

fix: 优化门诊缴费时间选择问题

carver 2 년 전
부모
커밋
4424e7abec

+ 1 - 1
antbuilder/industry/hospitalV2/components/components/patient-tabs-pro/filters/index.js

@@ -88,7 +88,7 @@ Component({
 			});
 		},
 
-		onConfirmTime(date) {
+		onConfirmTime(date, load = false) {
 			const [start = "", end = ""] = this.judgeDate(date);
 			this.props.onChange({
 				startTime: start,

+ 0 - 2
antbuilder/industry/hospitalV2/components/components/patient-tabs-pro/filters/time-option/index.js

@@ -14,8 +14,6 @@ Component({
 		const nowDate = new Date();
 		const startTime = new Date(nowDate.getFullYear() - 1, 1, 1);
 		const endTime = new Date(nowDate.getFullYear() + 1, 11, 31);
-		console.log("startTime ====>", startTime);
-		console.log("endTime ====>", endTime);
 		this.setData({
 			minDate: startTime,
 			maxDate: endTime,

+ 31 - 21
antbuilder/industry/hospitalV2/components/hospital-payment/index.js

@@ -47,8 +47,39 @@ Component({
 
 	methods: {
 		onFilterHandel(filters) {
+			const { status: prevStatus } = this.filters || {};
+			const { status: curStatus } = filters || {};
+			console.log("status ===>", prevStatus, curStatus);
 			if (!this.hisPatientId) return;
 			this.filters = filters;
+			const { status, startTime, endTime } = this.filters || {};
+
+			// 当状态未改变时,做时间筛选校验,拦截请求;当状态被改变时,做时间校验的同时,不拦截请求
+
+			// 状态:已支付
+			if (status && status === "1") {
+				if (!startTime || this.getTimeChange(startTime, endTime, 15)) {
+					my.showToast({
+						type: "fail",
+						content: "请选择15天以内的时间",
+						duration: 1500,
+					});
+					if (prevStatus === curStatus) return;
+				}
+			}
+
+			// 状态:未支付
+			if (!status || status === "0") {
+				if (!startTime || this.getTimeChange(startTime, endTime, 3)) {
+					my.showToast({
+						type: "fail",
+						content: "请选择3天以内的时间",
+						duration: 1500,
+					});
+					if (prevStatus === curStatus) return;
+				}
+			}
+
 			this.scrollRef.refresh();
 		},
 
@@ -74,27 +105,6 @@ Component({
 		onService(page) {
 			const { status, startTime, endTime } = this.filters || {};
 			if (!this.hisPatientId) return;
-
-			if (status && status === "1") {
-				if (!startTime || this.getTimeChange(startTime, endTime, 15)) {
-					my.showToast({
-						type: "fail",
-						content: "请选择15天以内的时间",
-						duration: 1500,
-					});
-				}
-			}
-
-			if (!status || status === "0") {
-				if (!startTime || this.getTimeChange(startTime, endTime, 3)) {
-					my.showToast({
-						type: "fail",
-						content: "请选择3天以内的时间",
-						duration: 1500,
-					});
-				}
-			}
-
 			return payHistory({
 				...this.filters,
 				status: status || "0",