| | |
| | | // } |
| | | self.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | self.loading = true; |
| | | form.content = this.$refs.ue.getUEContent(); |
| | | // 如果走访企业,则被走访企业就是场地提供者 |
| | | if (form.is_visit) { |
| | | form.space_supplier_id = ''; |
| | | } else { |
| | | form.visit_supplier_id = ''; |
| | | } |
| | | BranchApi.addActivity({formData: JSON.stringify(form)}, true) |
| | | .then(data => { |
| | | self.loading = false; |
| | | self.$message({ |
| | | message: data.msg, |
| | | type: 'success' |
| | | }); |
| | | self.$router.push('/activity/activity/index'); |
| | | }) |
| | | .catch(error => { |
| | | self.loading = false; |
| | | // 如果是走访活动,先检查差评 |
| | | if (form.is_visit && (form.visit_supplier_id || form.visit_supplier_name)) { |
| | | BranchApi.checkNegativeComment({ |
| | | visit_supplier_id: form.visit_supplier_id || 0, |
| | | visit_supplier_name: form.visit_supplier_name || '', |
| | | activity_id: 0 |
| | | }).then(res => { |
| | | if (res.data.has_warning) { |
| | | // 显示确认对话框 |
| | | self.$confirm(res.data.message, '提示', { |
| | | confirmButtonText: '继续走访', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | // 用户确认继续,直接提交 |
| | | self.submitForm(); |
| | | }).catch(() => { |
| | | // 用户取消 |
| | | }); |
| | | } else { |
| | | // 没有差评警告,直接提交 |
| | | self.submitForm(); |
| | | } |
| | | }).catch(error => { |
| | | // 检查失败,直接提交 |
| | | self.submitForm(); |
| | | }); |
| | | } else { |
| | | // 不是走访活动,直接提交 |
| | | self.submitForm(); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /*提交表单*/ |
| | | submitForm() { |
| | | let self = this; |
| | | self.loading = true; |
| | | let form = self.form; |
| | | form.content = this.$refs.ue.getUEContent(); |
| | | // 如果走访企业,则被走访企业就是场地提供者 |
| | | if (form.is_visit) { |
| | | form.space_supplier_id = ''; |
| | | } else { |
| | | form.visit_supplier_id = ''; |
| | | } |
| | | BranchApi.addActivity({formData: JSON.stringify(form)}, true) |
| | | .then(data => { |
| | | self.loading = false; |
| | | self.$message({ |
| | | message: data.msg, |
| | | type: 'success' |
| | | }); |
| | | self.$router.push('/activity/activity/index'); |
| | | }) |
| | | .catch(error => { |
| | | self.loading = false; |
| | | }); |
| | | }, |
| | | |
| | | /*选择的地址*/ |
| | | selectFromMap(e){ |
| | | this.form.coordinate = e.location.lat + ',' + e.location.lng; |