Ver Fonte

修改跳转

付晓文。 há 2 meses atrás
pai
commit
93922648f3
2 ficheiros alterados com 43 adições e 6 exclusões
  1. 10 0
      pages/coupon/creatReduction.vue
  2. 33 6
      pages/groupMeal/goods/form-step2.vue

+ 10 - 0
pages/coupon/creatReduction.vue

@@ -515,6 +515,11 @@ export default {
 							});
 							});
 
 
 							this.goBackToList(0)
 							this.goBackToList(0)
+						}else{
+							uni.showToast({
+								title: res.data.message,
+								icon: 'none'
+							});
 						}
 						}
 					})
 					})
 				} else {
 				} else {
@@ -527,6 +532,11 @@ export default {
 							});
 							});
 							this.goBackToList(0)
 							this.goBackToList(0)
 
 
+						}else{
+							uni.showToast({
+								title: res.data.message,
+								icon: 'none'
+							});
 						}
 						}
 					})
 					})
 				}
 				}

+ 33 - 6
pages/groupMeal/goods/form-step2.vue

@@ -269,6 +269,33 @@ export default {
 				delta: 1
 				delta: 1
 			});
 			});
 		},
 		},
+		goBackToList() {
+			setTimeout(() => {
+				uni.redirectTo({
+					url: '/pages/groupMeal/goods/list'
+				});
+				// const pages = getCurrentPages();
+				// const listRoute = 'pages/groupMeal/goods/list';
+				// const listIndex = pages.findIndex(page => page.route === listRoute);
+				// if (listIndex >= 0) {
+				// 	const delta = pages.length - 1 - listIndex;
+				// 	if (delta > 0) {
+				// 		uni.navigateBack({
+				// 			delta,
+				// 			fail: () => {
+				// 				uni.redirectTo({
+				// 					url: '/pages/groupMeal/goods/list'
+				// 				});
+				// 			}
+				// 		});
+				// 		return;
+				// 	}
+				// }
+				// uni.redirectTo({
+				// 	url: '/pages/groupMeal/goods/list'
+				// });
+			}, 500);
+		},
 		buildDetails() {
 		buildDetails() {
 			const details = [];
 			const details = [];
 			this.form.dishCategories.forEach(category => {
 			this.form.dishCategories.forEach(category => {
@@ -309,15 +336,15 @@ export default {
 				};
 				};
 				console.log('表单校验成功, 提交的数据:', details, params);
 				console.log('表单校验成功, 提交的数据:', details, params);
 				this.$http.post('/groupmeal/gmMerchantPackage/submit', params).then(res => {
 				this.$http.post('/groupmeal/gmMerchantPackage/submit', params).then(res => {
-					let type = res.data.code === 200 ? 'success' : 'error';
-					this.$tip[type](res.data.message);
 					if (res.data.code === 200) {
 					if (res.data.code === 200) {
-						// 清除
 						uni.removeStorageSync('gm_goods');
 						uni.removeStorageSync('gm_goods');
-						// 返回列表
-						uni.navigateBack({
-							delta: 2
+						uni.showToast({
+							title: res.data.message || '提交成功',
+							icon: 'none'
 						});
 						});
+						this.goBackToList();
+					} else {
+						this.$tip.error(res.data.message);
 					}
 					}
 				});
 				});
 			}).catch(errors => {
 			}).catch(errors => {