diff --git a/src/pages/orderHall/addOrder.vue b/src/pages/orderHall/addOrder.vue index 2ee8215..5118a4f 100644 --- a/src/pages/orderHall/addOrder.vue +++ b/src/pages/orderHall/addOrder.vue @@ -162,6 +162,7 @@ morePer: true, perNumber: 1, fileList3: [], + ok: true, } }, onShow() { @@ -289,32 +290,99 @@ }) }, next() { - let image = [] - this.fileList3.forEach(function(item) { - image.push(item.url) - }) - let data = image.join(',') - this.http.request('/hall/addHall', { - activityTime: this.wTime, - content: this.text2, - deadline: this.eTime, - demand: this.text1, - isMultiple: this.morePer, - quantity: this.perNumber, - receiverType: this.userTypeValue, - title: this.name, - type: this.typeId, - enclosure: data - }, "POST").then(res => { - if (res.code == 200) { - uni.navigateBack() - } - }).catch(e => { + this.ok = true + if(this.name == ''){ uni.showToast({ - title: e.data.message, + title: '请输入名称', icon: "none", }); - }) + this.ok = false + return + } + if(this.typeId == ''){ + uni.showToast({ + title: '请选择类型', + icon: "none", + }); + this.ok = false + return + } + if(this.text1 == ''){ + uni.showToast({ + title: '请输入需求清单', + icon: "none", + }); + this.ok = false + return + } + if(this.text2 == ''){ + uni.showToast({ + title: '请输入具体内容', + icon: "none", + }); + this.ok = false + return + } + if(this.eTime == ''){ + uni.showToast({ + title: '请选择截止时间', + icon: "none", + }); + this.ok = false + return + } + if(this.wTime == ''){ + uni.showToast({ + title: '请请选择活动时间', + icon: "none", + }); + this.ok = false + return + } + if(this.userTypeValue == ''){ + uni.showToast({ + title: '请选择可接单用户', + icon: "none", + }); + this.ok = false + return + } + if(this.fileList3.length == 0){ + uni.showToast({ + title: '请上传附件', + icon: "none", + }); + this.ok = false + return + } + if(this.ok){ + let image = [] + this.fileList3.forEach(function(item) { + image.push(item.url) + }) + let data = image.join(',') + this.http.request('/hall/addHall', { + activityTime: this.wTime, + content: this.text2, + deadline: this.eTime, + demand: this.text1, + isMultiple: this.morePer, + quantity: this.perNumber, + receiverType: this.userTypeValue, + title: this.name, + type: this.typeId, + enclosure: data + }, "POST").then(res => { + if (res.code == 200) { + uni.navigateBack() + } + }).catch(e => { + uni.showToast({ + title: e.data.message, + icon: "none", + }); + }) + } } }