wangxy il y a 1 mois
Parent
commit
1c7db4bc0c
1 fichiers modifiés avec 28 ajouts et 25 suppressions
  1. 28 25
      pages/admin/Hetong/addSanfangHetong.vue

+ 28 - 25
pages/admin/Hetong/addSanfangHetong.vue

@@ -163,60 +163,63 @@
 	}
 
 	function handleAdd() {
-    if (data.timer) {
-      uni.showToast({
-        title: '合同正在创建'
-      })
-      return
-    }
-    data.timer = setTimeout(() => { },3000)
-    uni.showToast({
-      title: '提交中',
-    })
+    uni.showLoading({
+      title: '创建中...',
+      mask: true
+    });
 		const opt = Object.assign({}, {
 			...data.hetong,
 			htId: data.mobanList[data.mobanIndex].id
 		})
 		httpApi.getSanfangAdd(opt).then(res => {
 			if (res.data) {
+        uni.hideLoading()
 				uni.showToast({
 					title: "创建成功",
+          duration:2000,
 					success() {
-						uni.navigateBack()
+            setTimeout(() => {
+              uni.navigateBack()
+            },2000)
 					}
 				})
 			}
-		}).finally(() => {
+		}).catch(() => {
+      uni.hideLoading()
+    }).
+    finally(() => {
       clearTimeout(data.timer);
       data.timer = null;
     })
 	}
 
 	function handleUpdate() {
-    if (data.timer) {
-      uni.showToast({
-        title: '合同正在更新'
-      })
-      return
-    }
-    data.timer = setTimeout(() => { },3000)
+
+    uni.showLoading({
+      title: '更新中...',
+      mask: true
+    });
 		const opt = Object.assign({}, {
 			...data.hetong,
 			htId: data.mobanList[data.mobanIndex].id
 		})
-		
-		console.log('ccc', opt)
-		
 		httpApi.getSanfangUpdate(opt).then(res => {
 			if (res.data) {
+        uni.hideLoading()
 				uni.showToast({
-					title: "创建成功",
+					title: "更新成功",
+          duration:2000,
+          mask: true,
 					success() {
-						uni.navigateBack()
+            setTimeout(() => {
+              uni.navigateBack()
+            },2000)
 					}
 				})
 			}
-		})
+		}).catch(() => {
+      uni.hideLoading()
+    })
 	}
 
 	function handleConfirm() {