From 22271e641e4505ba906c3770905b7e84e3ad8d85 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 02 四月 2024 17:05:57 +0800
Subject: [PATCH] mrshi

---
 wx/pages/addition_subtraction_application/addition_subtraction_application.vue |   78 ++++++++++++++++++++++++++-------------
 1 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/wx/pages/addition_subtraction_application/addition_subtraction_application.vue b/wx/pages/addition_subtraction_application/addition_subtraction_application.vue
index 651ef50..287c754 100644
--- a/wx/pages/addition_subtraction_application/addition_subtraction_application.vue
+++ b/wx/pages/addition_subtraction_application/addition_subtraction_application.vue
@@ -24,7 +24,7 @@
 						labelWidth="200"
 						label="閫夋嫨鏈熸湜鎵瑰崟鐢熸晥鏈燂細"
 						prop="startDate"
-						@click="show1 = true"
+						@click="openTime"
 					>
 						<u--input v-model="model.startDate" disabled disabledColor="#ffffff" placeholder="璇烽�夋嫨" border="none"></u--input>
 						<u-icon slot="right" name="arrow-right"></u-icon>
@@ -92,9 +92,16 @@
 			this.getCodeList()
 		},
 		methods: {
+			openTime() {
+				if (!this.model.code) return uni.showToast({
+					title: '璇烽�夋嫨淇濆崟鍙�',
+					icon: 'none'
+				})
+				this.show1 = true
+			},
 			getCodeList() {
 				this.$u.api.insuranceApplyFindListByDTO({
-					status: 5,
+					status: '5,27',
 					isEffective: 0
 				}).then(res => {
 					if (res.code === 200) {
@@ -105,42 +112,61 @@
 					}
 				})
 			},
-			confirm(e) {
-				this.model.id = e.value[0].solutionId
-				this.model.code = e.value[0].code
-				this.id = e.value[0].id
-				if ([1,3].includes(this.compareDates(this.getDate(), e.value[0].startTime)) && !e.value[0].lastChangeDate) {
-					// 褰撳墠鏃ユ湡澶т簬绛変簬鐢熸晥鏃ユ湡骞朵笖鏈�鍚庝竴娆℃搷浣滄椂闂寸瓑浜庣┖
-					this.minDate = new Date(this.getTomorrow()).getTime()
-					this.maxDate = new Date(e.value[0].endTime).getTime()
-				} else if (this.compareDates(this.getDate(), e.value[0].startTime) === 2 && !e.value[0].lastChangeDate) {
-					// 褰撳墠鏃ユ湡灏忎簬鐢熸晥鏃ユ湡骞朵笖鏈�鍚庝竴娆℃搷浣滄椂闂寸瓑浜庣┖
-					this.minDate = new Date(e.value[0].startTime).getTime()
-					this.maxDate = new Date(e.value[0].endTime).getTime()
-				} else if (e.value[0].lastChangeDate) {
-					// 鏈�鍚庝竴娆℃搷浣滄椂闂存湁鍊�
-					if ([1,3].includes(this.compareDates(this.getDate(), e.value[0].lastChangeDate))) {
-						// 褰撳墠鏃ユ湡澶т簬鏈�鍚庝竴娆℃搷浣滄椂闂�
-						this.minDate = new Date(this.getTomorrow()).getTime()
-						this.maxDate = new Date(e.value[0].endTime).getTime()
-					} else if (this.compareDates(this.getDate(), e.value[0].lastChangeDate) === 2) {
-						// 褰撳墠鏃堕棿灏忎簬鏈�鍚庝竴娆℃搷浣滄椂闂�
-						this.minDate = new Date(e.value[0].lastChangeDate).getTime()
-						this.maxDate = new Date(e.value[0].endTime).getTime()
+			async confirm(e) {
+				// 鑾峰彇鏈�鏂版柟妗坕d
+				let res = await this.$u.api.insuranceApplyById(e.value[0].id)
+				if (res.code === 200) {
+					this.model.id = res.data.newVersionSolutionId
+					this.model.code = e.value[0].code
+					this.id = e.value[0].id
+					if ([1,3].includes(this.compareDates(this.getDate(), e.value[0].startTime)) && !e.value[0].lastChangeDate) {
+						// 褰撳墠鏃ユ湡澶т簬绛変簬鐢熸晥鏃ユ湡骞朵笖鏈�鍚庝竴娆℃搷浣滄椂闂寸瓑浜庣┖
+						// this.minDate = new Date(this.getTomorrow()).getTime()
+						// this.maxDate = new Date(e.value[0].endTime).getTime()
+						this.minDate = this.formatTimeStamp(this.getTomorrow())
+						this.maxDate = this.formatTimeStamp(e.value[0].endTime)
+					} else if (this.compareDates(this.getDate(), e.value[0].startTime) === 2 && !e.value[0].lastChangeDate) {
+						// 褰撳墠鏃ユ湡灏忎簬鐢熸晥鏃ユ湡骞朵笖鏈�鍚庝竴娆℃搷浣滄椂闂寸瓑浜庣┖
+						// this.minDate = new Date(e.value[0].startTime).getTime()
+						// this.maxDate = new Date(e.value[0].endTime).getTime()
+						this.minDate = this.formatTimeStamp(e.value[0].startTime)
+						this.maxDate = this.formatTimeStamp(e.value[0].endTime)
+					} else if (e.value[0].lastChangeDate) {
+						// 鏈�鍚庝竴娆℃搷浣滄椂闂存湁鍊�
+						if ([1,3].includes(this.compareDates(this.getDate(), e.value[0].lastChangeDate))) {
+							// 褰撳墠鏃ユ湡澶т簬鏈�鍚庝竴娆℃搷浣滄椂闂�
+							// this.minDate = new Date(this.getTomorrow()).getTime()
+							// this.maxDate = new Date(e.value[0].endTime).getTime()
+							this.minDate = this.formatTimeStamp(this.getTomorrow())
+							this.maxDate = this.formatTimeStamp(e.value[0].endTime)
+						} else if (this.compareDates(this.getDate(), e.value[0].lastChangeDate) === 2) {
+							// 褰撳墠鏃堕棿灏忎簬鏈�鍚庝竴娆℃搷浣滄椂闂�
+							// this.minDate = new Date(e.value[0].lastChangeDate).getTime()
+							// this.maxDate = new Date(e.value[0].endTime).getTime()
+							this.minDate = this.formatTimeStamp(e.value[0].lastChangeDate)
+							this.maxDate = this.formatTimeStamp(e.value[0].endTime)
+						}
 					}
+					this.show = false
 				}
-				this.show = false
+			},
+			//灏佽鍑芥暟(data鏍煎紡涓�2017-11-11)
+			formatTimeStamp(date){
+				console.log(Date.parse(new Date(`${date}`)) || Date.parse(new Date(`${date.replace(/-/g,'/')}`)))
+			    return Date.parse(new Date(`${date}`)) || Date.parse(new Date(`${date.replace(/-/g,'/')}`))
 			},
 			// 閫夋嫨鏃堕棿
 			confirm1(e) {
 				this.model.startDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd') + ' 00:00:00'
 				this.$u.api.getChangeCountCyclePriceVO({
-					applyId: this.model.id,
+					applyId: this.id,
 					validTime: this.model.startDate
 				}).then(res => {
 					if (res.code === 200) {
 						this.model.cyclePrice = res.data.cyclePrice
 						this.show1 = false
+					} else {
+						this.model.startDate = ''
 					}
 				})
 			},

--
Gitblit v1.9.3