quanwei
14 hours ago b90b528cb5c6eaebe03fba972fef658a741ce896
shop_vue/src/views/branch/activity/add.vue
@@ -320,30 +320,66 @@
      // }
      self.$refs.form.validate(valid => {
        if (valid) {
          self.loading = true;
          self.form.content = this.$refs.ue.getUEContent();
          // 如果走访企业,则被走访企业就是场地提供者
          if (self.form.is_visit) {
            self.form.space_supplier_id = '';
          } else {
            self.form.visit_supplier_id = '';
          }
          BranchApi.addActivity(form, true)
            .then(data => {
              self.loading = false;
              self.$message({
                message: data.msg,
                type: 'success'
              });
              self.$router.push('/branch/activity/index');
            })
            .catch(error => {
              self.loading = false;
          // 如果是走访活动,先检查差评
          if (self.form.is_visit && (self.form.visit_supplier_id || self.form.visit_supplier_name)) {
            BranchApi.checkNegativeComment({
              visit_supplier_id: self.form.visit_supplier_id || 0,
              visit_supplier_name: self.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;
      self.form.content = this.$refs.ue.getUEContent();
      // 如果走访企业,则被走访企业就是场地提供者
      if (self.form.is_visit) {
        self.form.space_supplier_id = '';
      } else {
        self.form.visit_supplier_id = '';
      }
      BranchApi.addActivity(self.form, true)
        .then(data => {
          self.loading = false;
          self.$message({
            message: data.msg,
            type: 'success'
          });
          self.$router.push('/branch/activity/index');
        })
        .catch(error => {
          self.loading = false;
        });
    },
    /*选择的地址*/
    selectFromMap(e){
      this.form.coordinate = e.location.lat + ',' + e.location.lng;