Selaa lähdekoodia

fix(注册):注册添加省市

sufan 7 kuukautta sitten
vanhempi
commit
3d54f24ab5
1 muutettua tiedostoa jossa 26 lisäystä ja 4 poistoa
  1. 26 4
      src/views/login/components/RegisterContent.vue

+ 26 - 4
src/views/login/components/RegisterContent.vue

@@ -21,7 +21,17 @@
         </el-input>
       </el-form-item>
       <el-form-item label="企业地址" prop="enterpriseAddress" style="width: 100%">
-        <el-input v-model="ruleForm.enterpriseAddress" size="medium" style="width: 100%" placeholder="请输入企业地址" />
+        <div style="display: flex;">
+          <el-cascader
+            v-model="ruleForm.provinceCityIds"
+            :options="regionList"
+            :props="{ value: 'id', label: 'name' }"
+            size="medium"
+            style="width: 80%"
+          />
+          <el-input v-model="ruleForm.enterpriseAddress" size="medium" placeholder="请输入详细地址" />
+        </div>
+
       </el-form-item>
       <el-form-item label="推荐码(选填)" prop="referralCode" style="width: 100%">
         <el-input v-model="ruleForm.referralCode" size="medium" style="width: 100%" placeholder="您的长银保理业务经理或支付渠道推荐码(选填)" />
@@ -54,6 +64,8 @@
 
 <script>
 import { register } from '@/api/user'
+import { getRegion } from '@/api/dictionary'
+import { treeChildrenEmpty } from '@/utils'
 export default {
   components: {
     VerificationCode: () => import('@/components/VerificationCode/index.vue')
@@ -69,7 +81,8 @@ export default {
         code: '',
         enterpriseAddress: '',
         referralCode: '',
-        checked: false
+        checked: false,
+        provinceCityIds: []
       },
       rules: {
         loginName: [{ required: true, message: '请输入会员名称', trigger: 'blur' }],
@@ -77,10 +90,19 @@ export default {
         confirmPassword: [{ required: true, message: '请输入确认密码', trigger: 'blur' }],
         mobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
         code: [{ required: true, message: '请输入验证码', trigger: 'blur' }]
-      }
+      },
+      regionList: []
     }
   },
+  created() {
+    this.getRegionList()
+  },
   methods: {
+    getRegionList() {
+      getRegion({ flag: true }).then(({ data }) => {
+        this.regionList = treeChildrenEmpty(data)
+      })
+    },
     protocolClick(type) {
       this.$emit('protocol', type)
     },
@@ -120,7 +142,7 @@ export default {
 <style lang="scss" scoped>
 .register-content {
   margin-top: 60px;
-  width: 450px;
+  width: 480px;
   margin-left: 40px;
   .checked {
     color: #2C4270;