wgl 4 роки тому
батько
коміт
24cc6a73fc

+ 9 - 0
src/projects/business/apis/Other/return.js

@@ -10,6 +10,15 @@ export function submitReturnInfo(data) {
 	})
 }
 
+//确认提交返乡证明
+export function sureSubmitReturnInfo(data) {
+	return request({
+		url: '/mobile/personInfoApi/confirmReturnInfo',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
 //获取地区
 export function regionList(type) {
 	return request({

+ 72 - 17
src/projects/business/views/Other/Return/Questionnaire.vue

@@ -111,8 +111,9 @@
 				</div>
 			</form>
 			<div class="vongi-btn vongi-login-btn">
-				<button @click="submit" class="mui-btn mui-btn-primary" style="border-radius: 30px;">
-					提交
+				<button v-text="submitButtonText" @click="submit" :class="'mui-btn '+(subForm.enableUpdate?'mui-btn-primary':'mui-btn-grey')"
+				 style="border-radius: 30px;" :disabled="!subForm.enableUpdate">
+					保存
 				</button>
 			</div>
 		</div>
@@ -170,6 +171,8 @@
 					checkImageUrl: '',
 					travelImageUrl: '',
 					healthCodeUrl: '',
+					//是否可以提交更新
+					enableUpdate: true,
 				},
 
 				liveRegionIdCheckArr: [],
@@ -200,7 +203,15 @@
 						text: '其他',
 						dec: '',
 					},
-				]
+				],
+
+				submitButtonText: '保存',
+				//是否在提交确认过程中,0未保存1已保存确认中2已确认
+				isSubmitSureIng: 0,
+				sureForm: {
+					openId: '',
+					id: ''
+				}
 
 			}
 		},
@@ -361,24 +372,67 @@
 			},
 			//提交
 			submit() {
-				if (this.checkForm()) {
-					this.isLoading = true;
-					API_return.submitReturnInfo(this.subForm).then(response => {
-						this.isLoading = false;
+				if (this.isSubmitSureIng == 0) {
+					if (this.checkForm()) {
+						this.isLoading = true;
+						API_return.submitReturnInfo(this.subForm).then(response => {
+							this.isLoading = false;
+
+							this.sureForm.id = response.id;
 
-						var _this = this;
-						mui.alert('提交成功', '提示', function() {
-							_this.$router.push({
-								name: 'OtherReturnSuccess'
+							var _this = this;
+							mui.alert('保存成功,请重新查看并确认数据是否正确,确认后请再次点击提交按钮上传数据', '提示', function() {
+								_this.isSubmitSureIng = 1;
+								_this.enableUpdate = false;
+								//提交倒计时
+								_this.submitInterval();
 							});
-						});
 
-					}).catch(error => {
-						this.isLoading = false;
-						mui.toast(error);
-					})
+						}).catch(error => {
+							this.isLoading = false;
+							mui.toast(error);
+						})
+					}
+				} else if (this.isSubmitSureIng == 2) {
+					this.sureSubmit();
 				}
 			},
+			//确认提交
+			sureSubmit() {
+				this.isLoading = true;
+				API_return.sureSubmitReturnInfo(this.sureForm).then(response => {
+					this.isLoading = false;
+
+					//恢复初始值
+					this.isSubmitSureIng == 0;
+
+					var _this = this;
+					mui.alert('提交成功', '提示', function() {
+						_this.$router.push({
+							name: 'OtherReturnSuccess'
+						});
+					});
+
+				}).catch(error => {
+					this.isLoading = false;
+					mui.toast(error);
+				})
+			},
+			//提交倒计时
+			submitInterval() {
+				var time = 5;
+				var _this = this;
+				this.sub_timer = setInterval(() => {
+					if (time > 0) {
+						_this.submitButtonText = '提交(' + time-- + ')';
+					} else {
+						_this.enableUpdate = true;
+						_this.isSubmitSureIng = 2;
+						_this.submitButtonText = '提交';
+						clearInterval(_this.sub_timer)
+					}
+				}, 1000)
+			},
 			//获取详情
 			getInfo() {
 				this.isLoading = true;
@@ -387,7 +441,7 @@
 
 					if (response) {
 						for (let key in this.subForm) {
-							if (response[key]) {
+							if (response[key] != null) {
 								this.$set(this.subForm, key, response[key]);
 							}
 						}
@@ -471,6 +525,7 @@
 			asynCallBack() {
 				//赋值
 				this.subForm.openId = this.openId;
+				this.sureForm.openId = this.openId;
 				//获取详情
 				this.getInfo();
 			},