Jelajahi Sumber

fix: 就诊记录添加时间判断

carver 2 tahun lalu
induk
melakukan
5b5f8a992d

+ 22 - 1
antbuilder/industry/hospitalV2/components/hospital-payment/index.js

@@ -59,9 +59,30 @@ Component({
 			this.subscribe = ref;
 		},
 
+		getTimeChange(startTime, endTime) {
+			if (!startTime || !endTime) {
+				return true;
+			}
+			const time1 = Date.parse(startTime);
+			const time2 = Date.parse(endTime);
+			const timeDiff = time2 - time1;
+			const duration = 15 * 24 * 60 * 60 * 1000;
+			return timeDiff < 0 || timeDiff > duration;
+		},
+
 		onService(page) {
-			const { status } = this.filters || {};
+			const { status, startTime, endTime } = this.filters || {};
 			if (!this.hisPatientId) return;
+			if (status && status === "1") {
+				if (!startTime || this.getTimeChange(startTime, endTime)) {
+					my.showToast({
+						type: "fail",
+						content: "请选择15天以内的时间",
+						duration: 1500,
+					});
+				}
+			}
+
 			return payHistory({
 				...this.filters,
 				status: status || "0",

+ 6 - 4
antbuilder/industry/hospitalV2/components/subscribe-record/index.js

@@ -47,10 +47,12 @@ Component(
 
 			/* 分页逻辑 */
 			async onService(params) {
-				return services.getSubscribeRecordList({
-					...this.filters,
-					...params,
-				});
+				return services.getSubscribeRecordList(
+					Object.assign({
+						...this.filters,
+						...params,
+					})
+				);
 			},
 		},
 	})