瀏覽代碼

上线会所地址校验

zhengjinyi 5 年之前
父節點
當前提交
cf7f5b1ef8
共有 2 個文件被更改,包括 25 次插入2 次删除
  1. 8 1
      src/components/Ctiy/index.vue
  2. 17 1
      src/views/club/form.vue

+ 8 - 1
src/components/Ctiy/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="address">
     <el-form :rules="rules" :model="from" :label-width="'130px'" style="width: 670px;text-align: right;">
-      <el-form-item label="会所地址:" prop="province" style="float: left;width: 300px;margin-right: 8px;">
+      <el-form-item label="会所地址:" prop="province" style="float: left;width: 300px;margin-right: 8px;position: relative">
         <el-select
           v-model="from.province"
           placeholder="请选择"
@@ -15,6 +15,7 @@
             :value="item.provinceID"
           />
         </el-select>
+        <span v-show="isAddress" class="span-tip">会所地址不能为空</span>
       </el-form-item>
       <el-form-item prop="city" style="float: left;margin-left: 0;margin-right: 8px;">
         <el-select
@@ -60,6 +61,12 @@ export default {
       default: function() {
         return {}
       }
+    },
+    isAddress: {
+      type: Boolean,
+      default: function() {
+        return false
+      }
     }
   },
   data() {

+ 17 - 1
src/views/club/form.vue

@@ -10,7 +10,8 @@
       <el-form-item label="手机号:" prop="contractMobile" style="width: 500px; text-align: right;">
         <el-input v-model="form.contractMobile" placeholder="请填写你的常用号码" maxlength="11" />
       </el-form-item>
-      <City :address-data="addList" @addlist="handleCity" />
+      <City :address-data="addList" :is-address="isAddress" @addlist="handleCity" />
+
       <el-form-item label="" prop="address" style="width: 500px; text-align: right;float:left;">
         <el-input v-model="form.address" placeholder="请填写会所详细的地址" />
       </el-form-item>
@@ -113,6 +114,7 @@ export default {
         cityID: '',
         townID: ''
       },
+      isAddress: false,
       loadingbut: false,
       loadingbuttext: '保存'
     }
@@ -134,6 +136,7 @@ export default {
       this.addList.provinceID = data.provinceid
       this.addList.cityID = data.cityid
       this.addList.townID = data.townid
+      this.isAddress = false
     },
     // 上传图标事件
     handleAvatarSuccess(response, file) {
@@ -159,6 +162,10 @@ export default {
     onSubmite() {
       this.$refs['dataForm'].validate((valid) => {
         if (valid) {
+          if (this.addList.provinceID === '') {
+            this.isAddress = true
+            return
+          }
           const Formobj = Object.assign(this.form, { id: this.organizeID })
           const params = Object.assign(this.addList, Formobj)
           this.loadingbut = true
@@ -230,6 +237,15 @@ export default {
 .address .el-form-item__content{
   margin-left: 0 !important;
 }
+.span-tip{
+  position: absolute;
+  right: 70px;
+  bottom: -21px;
+  font-size: 12px;
+  line-height: 20px;
+  color: red;
+  text-align: left;
+}
 /*清除浮动*/
 .clearfix:before,.clearfix:after {
   content: "";