From 7b65e5800e6a730959d30515ff81e20d17b4dfb2 Mon Sep 17 00:00:00 2001 From: xubinxcode Date: Tue, 23 Nov 2021 21:41:53 +0800 Subject: [PATCH] init --- src/components/HelloWorld.vue | 81 ++++++++---- src/components/hotel.vue | 292 ++++++++++++++++++++++++++---------------- src/components/hotelother.vue | 226 +++++++++++++++++++------------- 3 files changed, 373 insertions(+), 226 deletions(-) diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index c9b2626..2bc82a0 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -81,7 +81,8 @@ - @@ -96,7 +97,8 @@ - @@ -178,7 +180,7 @@ cost: '', count: '', customer_comments: '', - supplier_id: 0 + supplier_id: null }] }, hotelList: [], @@ -204,7 +206,7 @@ cost: '', count: '', customer_comments: '', - supplier_id: 0 + supplier_id: null }] }, hotelotherList: [], @@ -243,19 +245,42 @@ console.log('submit!'); this.$refs['form'].validate((valid) => { if (valid) { - let data = {} - let subOrderList = [...this.hotelList, ...this.hotelotherList] - data = Object.assign({}, this.orderMain, {'subOrderList': subOrderList}) - axios.post("/hotel.php/order_main/save", data).then((res) => { - this.$alert('新增成功', '提示', { - confirmButtonText: '确定', - callback: action => { - Fast.api.close() + let flagArr = [] + for (let i in this.hotelList) { + console.log(this.$refs['formhotel' + i]) + this.$refs['formhotel' + i][0].$refs['form'].validate((valid) => { + if (valid) { + flagArr.push('true') + } else { + flagArr.push('false') } - }); - }).catch((err) => { - console.log(err) - }) + }) + } + for (let i in this.hotelotherList) { + this.$refs['formhotelother' + i][0].$refs['form'].validate((valid) => { + if (valid) { + flagArr.push('true') + } else { + flagArr.push('false') + } + }) + } + if (flagArr.indexOf('false') < 0) { + let data = {} + let subOrderList = [...this.hotelList, ...this.hotelotherList] + data = Object.assign({}, this.orderMain, {'subOrderList': subOrderList}) + axios.post("/hotel.php/order_main/save", data).then((res) => { + this.$alert('新增成功', '提示', { + confirmButtonText: '确定', + callback: action => { + Fast.api.close() + } + }); + }).catch((err) => { + console.log(err) + }) + } + } else { console.log('error submit!!'); return false; @@ -267,16 +292,24 @@ save() { this.editSingle = false; let data = this.orderMain - axios.post("/hotel.php/order_main/save", data).then((res) => { - if (res.data.flag) { + this.$refs['form'].validate((valid) => { + if (valid) { + axios.post("/hotel.php/order_main/save", data).then((res) => { + if (res.data.flag) { + } + this.$alert(res.data.msg, '提示', { + confirmButtonText: '确定', + }); + }).catch((err) => { + console.log(err) + }) + } else { + console.log('error submit!!'); + return false; } - this.$alert(res.data.msg, '提示', { - confirmButtonText: '确定', - }); - }).catch((err) => { - console.log(err) - }) + }); + }, cancel() { this.editSingle = false; diff --git a/src/components/hotel.vue b/src/components/hotel.vue index b374414..700d28e 100644 --- a/src/components/hotel.vue +++ b/src/components/hotel.vue @@ -18,11 +18,11 @@ - + - + @@ -36,7 +36,7 @@ - + - + - + - + - + @@ -104,36 +104,42 @@ prop="price" label="售卖价"> - + - + 未发单 已发单 @@ -165,7 +171,7 @@ - + @@ -182,7 +188,7 @@ - + @@ -191,10 +197,10 @@ - + - + - + - + - + @@ -55,12 +55,12 @@ - + - + @@ -83,36 +83,42 @@ prop="price" label="售卖价"> - + - + - + 未发单 已发单 @@ -156,7 +162,7 @@ - + @@ -164,10 +170,10 @@