Browse Source

企业注册地址选择

hangb 7 years ago
parent
commit
270cb3edd9

+ 13 - 4
assets/scss/mobileCommon.scss

@@ -274,9 +274,9 @@
 }
 .phone-btn-blank span.upload {
   margin-left: .15rem;
-  line-height: .94rem;
-  font-size: .32rem;
-  color: #c9c9c9;
+  line-height: 1.1rem;
+  font-size: .38rem;
+  color: #999;
 }
 .phone-btn-blank input[type='file']{
   position: absolute;
@@ -292,6 +292,11 @@
   background: #e6e6e6;
   color: #333;
 }
+.phone-btn-blank.isEmpty{
+  border-color: #c0c4cc;
+  background: #e6e6e6;
+  color: #333;
+}
 .phone-btn-blank:hover span.upload{
   color: #000;
 }
@@ -300,7 +305,7 @@
 .fa.fa-p {
   position: absolute;
   right: .42rem;
-  bottom: .2rem;
+  bottom: .35rem;
   font-size: .4rem;
   color: #888;
 }
@@ -358,3 +363,7 @@
   -ms-user-select: none;
   user-select: none;
 }
+
+.mint-toast.is-placemiddle {
+  z-index: 10000;
+}

+ 123 - 15
components/mobile/enterpriseCertification/addressChoose.vue

@@ -2,20 +2,26 @@
   <div class="distpicker-address-wrapper">
     <template>
       <div class="return">
-        <i class="fa fa-angle-left"></i>
+        <i class="fa fa-angle-left" @click="goBack"></i>
         填写企业注册地址
-        <span>完成</span>
+        <span @click="goFinish">完成</span>
       </div>
       <div class="choose">
-        <div class="form-group">
-          <label for="">选择地区</label>
+        <div class="form-group" @click="popupVisible = true">
+          <label for="addr">选择地区</label>
           <input readonly
+                 id="addr"
                  placeholder="地区信息"
-                 v-model="allAddress"
-                 @click="popupVisible = true">
+                 v-model="chooseAddress">
           <i class="fa fa-map-marker"></i>
         </div>
-        <textarea name="" id="" cols="30" rows="10" placeholder="街道、大厦、楼层信息"></textarea>
+        <div class="form-group">
+          <label for="addrs">详细信息</label>
+          <textarea placeholder="街道、大厦、楼层信息"
+                    id="addrs"
+                    v-model="detailAddress"
+                    @blur="out"></textarea>
+        </div>
       </div>
     </template>
     <mt-popup v-model="popupVisible" position="bottom" class="mint-popup">
@@ -91,12 +97,16 @@
       },
       disabled: { type: Boolean, default: false },
       addressHeader: { type: String, default: 'address-header' },
-      addressContainer: { type: String, default: 'address-container' }
+      addressContainer: { type: String, default: 'address-container' },
+      popAddress: {type: String},
+      regStreet: {type: String}
     },
     data () {
       return {
         popupVisible: false,
         allAddress: '',
+        detailAddress: '',
+        chooseAddress: '',
         tab: 1,
         showCityTab: false,
         showAreaTab: false,
@@ -109,6 +119,10 @@
       }
     },
     created () {
+      this.chooseAddress = this.popAddress
+      this.detailAddress = this.regStreet
+      console.log(this.regStreet)
+      this.allAddress = this.chooseAddress + this.detailAddress
       if (this.area && !this.hideArea && !this.onlyProvince) {
         this.tab = 3
         this.showCityTab = true
@@ -155,8 +169,85 @@
       },
       // 完成选择地址
       sure () {
-        this.allAddress = this.currentProvince + this.currentCity + this.currentArea
-        this.popupVisible = false
+        if (this.currentProvince.length <= 1) {
+          this.$toast({
+            message: '请选择省、市、区',
+            iconClass: 'el-icon-warning'
+          })
+          this.popupVisible = true
+        } else if (this.currentCity.length <= 1) {
+          this.$toast({
+            message: '请选择省、市、区',
+            iconClass: 'el-icon-warning'
+          })
+          this.popupVisible = true
+        } else if (this.currentArea.length <= 1) {
+          this.$toast({
+            message: '请选择省、市、区',
+            iconClass: 'el-icon-warning'
+          })
+          this.popupVisible = true
+        } else {
+          this.chooseAddress = this.currentProvince + this.currentCity + this.currentArea
+          this.popupVisible = false
+        }
+      },
+      // 监听textarea
+      out () {
+        if (!this.detailAddress) {
+          this.$toast({
+            message: '请输入详情地址',
+            iconClass: 'el-icon-warning'
+          })
+        } else {
+          let reg = /^(?=.*([\w\u4e00-\u9fa5]+)).*$/
+          if (!reg.test(this.detailAddress)) {
+            this.$toast({
+              message: '请输入详情地址',
+              iconClass: 'el-icon-warning'
+            })
+          }
+        }
+      },
+      // 返回注册页面
+      goBack () {
+        console.log(this.currentProvince)
+        console.log(this.currentCity)
+        console.log(this.currentArea)
+        console.log(this.detailAddress)
+        this.$emit('getAddress', '')
+        this.$emit('getProvince', '')
+        this.$emit('getCity', '')
+        this.$emit('getArea', '')
+        this.$emit('getDetailAddress', '')
+        this.$emit('popAddress', '')
+        this.$emit('showEvent', false)
+      },
+      goFinish () {
+        console.log(this.currentProvince)
+        console.log(this.currentCity)
+        console.log(this.currentArea)
+        console.log(this.detailAddress)
+        if (!this.chooseAddress) {
+          this.$toast({
+            message: '请选择省、市、区',
+            iconClass: 'el-icon-warning'
+          })
+        } else if (!this.detailAddress) {
+          this.$toast({
+            message: '请输入详情地址',
+            iconClass: 'el-icon-warning'
+          })
+        } else {
+          this.allAddress = this.chooseAddress + this.detailAddress
+          this.$emit('getAddress', this.allAddress)
+          this.$emit('getProvince', this.currentProvince)
+          this.$emit('getCity', this.currentCity)
+          this.$emit('getArea', this.currentArea)
+          this.$emit('getDetailAddress', this.detailAddress)
+          this.$emit('getPopAddress', this.chooseAddress)
+          this.$emit('showEvent', false)
+        }
       },
       setData (value, check = '') {
         return {
@@ -278,6 +369,9 @@
 </script>
 
 <style lang="scss" scoped>
+  .mint-toast.is-placemiddle {
+    z-index: 1000;
+  }
   .distpicker-address-wrapper {
     color: #9caebf;
   .handle {
@@ -307,14 +401,14 @@
     i{
       float: left;
       font-size: .5rem;
-      margin-top: .25rem;
+      margin-top: .2rem;
       font-weight: bold;
       color: #000;
     }
     span{
       float: right;
       font-size: .3rem;
-      color: #c7c7c7;
+      color: #999;
     }
   }
   .choose{
@@ -322,27 +416,41 @@
     div.form-group {
       padding: 0 .2rem;
       position: relative;
+      height: 1.5rem;
+      overflow: hidden;
       &:first-child{
         height: 1rem;
         line-height: 1rem;
         border-bottom: 1px solid #ddd;
        }
       label{
+        float: left;
         margin-right: .6rem;
         font-size: .3rem;
         font-weight: normal;
         color: #505050;
       }
       input{
-        height: .9rem;
+        float: left;
+        height: 1rem;
         color: #555;
         font-size: .28rem;
         border: none;
       }
+      textarea {
+        float: left;
+        /*width: 4.6rem;*/
+        height: 1.5rem;
+        font-size: .28rem;
+        color: #555;
+        border: none;
+        outline: none;
+        resize:none
+      }
       i{
         position: absolute;
-        top: 0;
-        right: 0;
+        top: .3rem;
+        right: .4rem;
         font-size: .4rem;
         color: #a0a0a0;
       }

+ 116 - 70
components/mobile/enterpriseCertification/stepOne.vue

@@ -1,70 +1,87 @@
 <template>
-  <div class="f-main">
-    <div class="content-top">
-      <p>企业认证</p>
-    </div>
-    <div class="f-form">
-      <div class="page-part">
-        <mt-field placeholder="企业名称"
-                  v-model="valid.spaceName"
-                  :state="state.spaceName"
-                  @blur.native.capture="validateSpaceName"
-        ></mt-field>
-      </div>
-      <div class="page-part">
-        <mt-field placeholder="营业执照号"
-                  v-model="valid.businessCode"
-                  auto-complete="off"
-                  :state="state.businessCode"
-                  @blur.native.capture="validateBusinessCode"
-        ></mt-field>
-      </div>
-      <div class="page-part">
-        <a class="phone-btn-blank" title="上传营业执照扫描件" v-bind:class="{ correct: uploadFileChecked }">
-          <i class="fa fa-picture-o fa-p"></i>
-          <span class="upload">上传营业执照扫描件</span>
-          <input type="file"
-                 class="form-control file-input"
-                 name="name"
-                 accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png,.pdf"
-                 @change="upload"/>
-        </a>
-        <a class="thumbnail" v-if="valid.businessCodeImage !== ''"><img class="previewImg" alt="" :src="isPdf ? '/images/all/timg.png' : valid.businessCodeImage"></a>
-      </div>
-      <div class="page-part">
-        <mt-field placeholder="法定代表人"
-                  v-model="valid.corporation"
-                  auto-complete="off"
-                  :state="state.corporation"
-                  @blur.native.capture="validateCorporation"
-        ></mt-field>
-      </div>
-      <div class="page-part" style="position: relative">
-        <!--// 注册地址-->
-        <mt-field readonly aria-haspopup="true" aria-expanded="false"
-                  placeholder="注册地址"
-                  v-model="valid.regAddress"
-                  @click.native="chooseAddress('choose')"></mt-field>
-        <i class="fa fa-map-marker fa-p"></i>
-      </div>
-      <div class="form-btn">
-        <div class="page-part">
-          <el-checkbox v-model="checked">我已阅读并同意 <a href="/common/agreement" class="rgba">《优软云服务条款》</a></el-checkbox>
+  <div>
+    <template v-if="!showChooseAddress">
+      <div class="f-main">
+        <div class="content-top">
+          <p>企业认证</p>
+        </div>
+        <div class="f-form">
+          <div class="page-part">
+            <mt-field placeholder="企业名称"
+                      v-model="valid.spaceName"
+                      :state="state.spaceName"
+                      @blur.native.capture="validateSpaceName"
+            ></mt-field>
+          </div>
+          <div class="page-part">
+            <mt-field placeholder="营业执照号"
+                      v-model="valid.businessCode"
+                      auto-complete="off"
+                      :state="state.businessCode"
+                      @blur.native.capture="validateBusinessCode"
+            ></mt-field>
+          </div>
+          <div class="page-part">
+            <a class="phone-btn-blank" title="上传营业执照扫描件" v-bind:class="{isEmpty: valid.businessCodeImage}">
+              <i class="fa fa-picture-o fa-p"></i>
+              <span class="upload">上传营业执照扫描件</span>
+              <input type="file"
+                     class="form-control file-input"
+                     name="name"
+                     accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png,.pdf"
+                     @change="upload"/>
+            </a>
+            <a class="thumbnail" v-if="valid.businessCodeImage !== ''"><img class="previewImg" alt="" :src="isPdf ? '/images/all/timg.png' : valid.businessCodeImage"></a>
+          </div>
+          <div class="page-part">
+            <mt-field placeholder="法定代表人"
+                      v-model="valid.corporation"
+                      auto-complete="off"
+                      :state="state.corporation"
+                      @blur.native.capture="validateCorporation"
+            ></mt-field>
+          </div>
+          <div class="page-part" style="position: relative">
+            <!--// 注册地址-->
+            <mt-field readonly aria-haspopup="true" aria-expanded="false"
+                      placeholder="注册地址"
+                      v-model="regAddress"
+                      @click.native="chooseAddress"></mt-field>
+            <i class="fa fa-map-marker fa-p"></i>
+          </div>
+          <div class="form-btn">
+            <div class="page-part">
+              <el-checkbox v-model="checked">我已阅读并同意 <a href="/common/agreement" class="rgba">《优软云服务条款》</a></el-checkbox>
+            </div>
+            <mt-button size="large" type="primary" @click="sureAccount('await')">提 交</mt-button>
+          </div>
         </div>
-        <mt-button size="large" type="primary" @click="sureAccount('await')">提 交</mt-button>
       </div>
-    </div>
+    </template>
+    <template v-else>
+      <address-choose
+        @getAddress="setAddress"
+        @getProvince="setProvince"
+        @getCity="setCity"
+        @getArea="setArea"
+        @getDetailAddress="setDetailAddress"
+        @getPopAddress="setPopAddress"
+        @showEvent="showAddress"
+        :popAddress="popAddress"
+        :regStreet="regStreet"/>
+    </template>
   </div>
 </template>
 
 <script>
+  import addressChoose from '~components/mobile/enterpriseCertification/addressChoose.vue'
   export default {
     name: 'step-one',
     data () {
       return {
         uploadFileChecked: false,
         isPdf: false,
-        popupVisible: false,
+        showChooseAddress: false,
         checked: true,
         state: {
           spaceName: 'error',
@@ -75,11 +92,19 @@
           spaceName: '',
           businessCode: '',
           businessCodeImage: '',
-          corporation: '',
-          regAddress: ''
-        }
+          corporation: ''
+        },
+        regAddress: '',
+        regProvince: '',
+        regCity: '',
+        regDistrict: '',
+        popAddress: '',
+        regStreet: ''
       }
     },
+    components: {
+      addressChoose
+    },
     methods: {
       // 弹窗处理
       downToast (type) {
@@ -89,9 +114,31 @@
         })
       },
       // 获取地址
-      chooseAddress (step) {
-        console.log(step)
-        this.$emit('stepEvent', step)
+      chooseAddress () {
+        this.showChooseAddress = true
+        // this.$emit('setRegAddress', this.regAddress)
+        // this.$emit('setRegStreet', this.regStreet)
+      },
+      setAddress (detail) {
+        this.regAddress = detail
+      },
+      setProvince (detail) {
+        this.regProvince = detail
+      },
+      setCity (detail) {
+        this.regCity = detail
+      },
+      setArea (detail) {
+        this.regDistrict = detail
+      },
+      setDetailAddress (detail) {
+        this.regStreet = detail
+      },
+      setPopAddress (detail) {
+        this.popAddress = detail
+      },
+      showAddress (info) {
+        this.showChooseAddress = info
       },
       // 验证企业名称
       validateSpaceName () {
@@ -110,10 +157,8 @@
                   this.downToast('该企业已被认证,请确认。')
                 } else {
                   this.state.spaceName = 'success'
-                  return Promise.reject(response.data)
                 }
               }).catch(err => {
-                this.$indicator.close()
                 this.downToast(err.errMsg)
               })
           }
@@ -138,9 +183,9 @@
                   } else {
                     this.state.businessCode = 'warning'
                     this.downToast('该企业已被认证,请确认')
-                    return Promise.reject(response.data)
                   }
                 }).catch(err => {
+                  console.log(err)
                   this.$message.error(err.errMsg)
                 })
             } else {
@@ -204,11 +249,12 @@
         }
       },
       sureAccount (type) {
+        console.log(this.regAddress)
         if (this.state.spaceName !== 'success' ||
           this.state.businessCode !== 'success' ||
           this.state.corporation !== 'success' ||
-          this.valid.businessCodeImage !== '' ||
-          this.valid.regAddress !== '') {
+          this.valid.businessCodeImage === '' ||
+          this.regAddress === '') {
           this.downToast('请确认填写部分是否有误')
         } else {
           if (!this.checked) {
@@ -220,11 +266,11 @@
             param.append('businessCode', this.valid.businessCode)
             param.append('corporation', this.valid.corporation)
             param.append('businessCodeImage', this.valid.businessCodeImage)
-            param.append('regAddress', this.valid.regAddress)
-            param.append('regProvince', this.address.regProvince)
-            param.append('regCity', this.address.regCity)
-            param.append('regDistrict', this.address.regDistrict)
-            param.append('regStreet', this.address.regStreet)
+            param.append('regAddress', this.regAddress)
+            param.append('regProvince', this.regProvince)
+            param.append('regCity', this.regCity)
+            param.append('regDistrict', this.regDistrict)
+            param.append('regStreet', this.regStreet)
             let config = {
               headers: {'Content-Type': 'multipart/form-data'}
             }

+ 4 - 6
pages/certification/enterpriseCertification.vue

@@ -1,9 +1,9 @@
 <template>
   <div>
     <template v-if="isMobile">
-      <step-one v-if="step === 'first'" @stepEvent="setStep"/>
+      <step-one v-if="step === 'first'"
+                @stepEvent="setStep"/>
       <step-last v-if="step === 'await'" :step="step"/>
-      <address-choose v-if="step === 'choose'" @stepEvent="setStep"/>
     </template>
     <template v-else>
       <accountCenter-header/>
@@ -14,7 +14,7 @@
 <script>
   import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
   import EnterpriseCertification from '~components/certification/EnterpriseCertification.vue'
-  import {stepOne, stepLast, addressChoose} from '~components/mobile/enterpriseCertification'
+  import {stepOne, stepLast} from '~components/mobile/enterpriseCertification'
   export default {
     layout (content) {
       return content.store.state.option.isMobile ? 'mobile' : 'default'
@@ -23,8 +23,7 @@
       AccountCenterHeader,
       EnterpriseCertification,
       stepOne,
-      stepLast,
-      addressChoose
+      stepLast
     },
     transition: {
       name: 'fade',
@@ -42,7 +41,6 @@
     },
     methods: {
       setStep (step) {
-        console.log(step)
         this.step = step
       }
     }