|
|
@@ -269,6 +269,33 @@ export default {
|
|
|
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() {
|
|
|
const details = [];
|
|
|
this.form.dishCategories.forEach(category => {
|
|
|
@@ -309,15 +336,15 @@ export default {
|
|
|
};
|
|
|
console.log('表单校验成功, 提交的数据:', details, params);
|
|
|
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) {
|
|
|
- // 清除
|
|
|
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 => {
|