shish 2 meses atrás
pai
commit
f80035dbdd

+ 4 - 0
ghsApp/src/api/auth/index.js

@@ -14,6 +14,10 @@ export const getApkVersion = data => {
 	return https.get('/auth/get-apk-version', data)
 }
 
+export const getMobile = data => {
+	return https.post('/auth/get-mobile', data)
+}
+
 //服务协议
 export const getRegisterAgreement = data => {
 	return https.get('/auth/register', data)

+ 92 - 10
ghsApp/src/pagesClient/official/apply.vue

@@ -62,11 +62,34 @@
               <view class="tui-title required">姓名</view>
               <input v-model="form.adminName" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="adminName" placeholder="申请人姓名" />
             </tui-list-cell>
-            <tui-list-cell class="line-cell" :hover="false">
+            <tui-list-cell class="line-cell code-wrap mobile-wrap" :hover="false">
               <view class="tui-title required">手机号</view>
-              <input v-model="form.mobile" type="number" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="mobile" placeholder="申请人手机号" />
+              <input
+                v-model="form.mobile"
+                type="number"
+                placeholder-class="phcolor"
+                placeholder-style="color:#CCCCCC"
+                class="tui-input tui-input--code"
+                :class="{ 'tui-input--filled': fillMobile == 0 }"
+                name="mobile"
+                :disabled="fillMobile == 0"
+                :placeholder="fillMobile == 0 ? '' : '申请人手机号'"
+              />
+              <!-- #ifdef MP-WEIXIN -->
+              <button
+                v-if="fillMobile == 1"
+                class="apply-code-btn apply-fill-btn"
+                open-type="getPhoneNumber"
+                @getphonenumber="getSj"
+              >帮我填</button>
+              <button
+                v-else
+                class="apply-code-btn apply-cancel-btn"
+                @click="cancelAutoMobile"
+              >取消</button>
+              <!-- #endif -->
             </tui-list-cell>
-            <tui-list-cell class="line-cell code-wrap" :hover="false">
+            <tui-list-cell v-if="fillMobile == 1" class="line-cell code-wrap" :hover="false">
               <view class="tui-title required">验证码</view>
               <input v-model="form.authCode" type="number" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input tui-input--code" name="authCode" placeholder="请填写验证码" />
               <button v-if="hasGet == false" class="apply-code-btn" @click="requestAuthCode()">获取</button>
@@ -124,6 +147,7 @@ import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
 import { APIHOST } from '@/config'
 import { getHasMap } from "@/api/express"
 import { mapNearby } from '@/api/map/index'
+import { getMobile } from '@/api/auth'
 // #ifdef APP-PLUS
 import permision from "@/utils/wa-permission_1.1/permission.js";
 // #endif
@@ -173,6 +197,7 @@ export default {
       headers:{token:''},
       currentImgData: [],
       uploadImgUrl:APIHOST+'/upload/save-file',
+      fillMobile: 1,
     };
   },
 	computed:{
@@ -248,12 +273,6 @@ export default {
       if (!item) {
         return false
       }
-      if (item.province) {
-        this.form.province = item.province
-      }
-      if (item.city) {
-        this.form.city = item.city
-      }
       if (item.district) {
         this.form.dist = item.district
       }
@@ -323,6 +342,43 @@ export default {
         uni.hideLoading()
       }
     },
+    cancelAutoMobile() {
+      this.$util.confirmModal({
+        content: '取消后将清空已获取的手机号,需重新填写并验证,是否确认?',
+        okText: '确认取消',
+        cancelText: '暂不取消'
+      }, () => {
+        this.resetAutoMobile()
+      })
+    },
+    resetAutoMobile() {
+      this.fillMobile = 1
+      this.form.mobile = ''
+      this.form.authCode = ''
+      if (this.INT) {
+        clearInterval(this.INT)
+        this.INT = false
+      }
+      this.hasGet = false
+      this.count = 120
+    },
+    getSj(e) {
+      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+      if (e.detail.errMsg === 'getPhoneNumber:ok') {
+        getMobile({ iv: e.detail.iv, encryptedData: e.detail.encryptedData, miniOpenId: currentMiniOpenId }).then(subRes => {
+          uni.hideLoading()
+          if (subRes.data.mobile && subRes.data.mobile != '') {
+            this.form.mobile = subRes.data.mobile
+            this.fillMobile = 0
+            this.form.authCode = ''
+          } else {
+            this.$msg('没获取到手机号')
+          }
+        })
+      } else {
+        this.$msg('获取失败')
+      }
+    },
     suggest(){
       let that = this
       that.$util.confirmModal({content:'请添加微信号:1528025347',okText:'复制'},() => {
@@ -437,6 +493,10 @@ export default {
           // 点击同意时,直接执行下一步
           this.agree = 1
           if (!checkRes) {
+            if (this.fillMobile == 1 && !this.form.authCode) {
+              this.$msg('请填写验证码')
+              return false
+            }
             uni.showLoading({mask:true})
             setTimeout(() => {
               this.confirmFn()
@@ -455,6 +515,10 @@ export default {
       // }
 
       if (!checkRes) {
+        if (this.fillMobile == 1 && !this.form.authCode) {
+          this.$msg('请填写验证码')
+          return false
+        }
         uni.showLoading({mask:true})
         setTimeout(() => {
           this.confirmFn()
@@ -473,7 +537,8 @@ export default {
         ...this.form,
         style: this.option.style || 0,
         from: this.option.from || 0,
-        miniOpenId:currentMiniOpenId
+        miniOpenId:currentMiniOpenId,
+        fillMobile: this.fillMobile
       }).then(res => {
         uni.hideLoading()
         this.$util.pageTo({
@@ -652,6 +717,23 @@ export default {
   }
 }
 
+.mobile-wrap {
+  .tui-input--filled {
+    color: #161819;
+  }
+}
+
+.apply-fill-btn {
+  min-width: 120upx;
+}
+
+.apply-cancel-btn {
+  min-width: 120upx;
+  color: #6b737c;
+  background: #f2f7f4;
+  border: 1upx solid #e3ebe6;
+}
+
 .apply-code-btn {
   flex-shrink: 0;
   min-width: 140upx;

+ 80 - 47
hdApp/src/pagesClient/official/apply.vue

@@ -3,46 +3,46 @@
     <form @submit="formSubmit">
       <view class="apply-body">
         <view class="apply-section">
-          <view class="apply-section-title">手机号</view>
-          <view class="module-com apply-card">
-            <!-- #ifdef MP-WEIXIN -->
-            <tui-list-cell class="line-cell" :hover="false">
-              <view class="tui-title">填手机号</view>
-              <view class="apply-mode-btns">
-                <view class="apply-mode-btn" :class="{ 'apply-mode-btn--active': fillMobile == 0 }" @click="oneGet">一键获取</view>
-                <view class="apply-mode-btn" :class="{ 'apply-mode-btn--active': fillMobile == 1 }" @click="manFill">手动填写</view>
-              </view>
-            </tui-list-cell>
-            <!-- #endif -->
-            <block v-if="fillMobile == 1">
-              <tui-list-cell class="line-cell" :hover="false">
-                <view class="tui-title required">手机号</view>
-                <input v-model="form.mobile" type="number" placeholder-class="phcolor" @blur="checkShopFn" placeholder-style="color:#CCCCCC" class="tui-input" name="mobile" placeholder="请填写手机号" />
-              </tui-list-cell>
-              <tui-list-cell class="line-cell code-wrap" :hover="false">
-                <view class="tui-title required">验证码</view>
-                <input v-model="form.authCode" type="number" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input tui-input--code" name="authCode" placeholder="请填写验证码" />
-                <button v-if="hasGet == false" class="apply-code-btn" @click="requestAuthCode()">获取</button>
-                <button v-else class="apply-code-btn apply-code-btn--disabled">{{ count }}</button>
-              </tui-list-cell>
-            </block>
-            <block v-else>
-              <tui-list-cell class="line-cell code-wrap" :hover="false">
-                <view class="tui-title required">手机号</view>
-                <input v-model="form.mobile" type="number" placeholder-class="phcolor" :disabled="true" placeholder-style="color:#CCCCCC" class="tui-input tui-input--code" name="mobile" placeholder="请点右边按钮获取" />
-                <button v-if="hasGet == false" class="apply-code-btn" open-type="getPhoneNumber" @getphonenumber="getSj">点击获取</button>
-              </tui-list-cell>
-            </block>
-          </view>
-        </view>
-
-        <view class="apply-section">
-          <view class="apply-section-title">基本信息</view>
+          <view class="apply-section-title">注册人信息</view>
           <view class="module-com apply-card">
             <tui-list-cell class="line-cell" :hover="false">
               <view class="tui-title required">姓名</view>
               <input v-model="form.adminName" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="adminName" placeholder="请填写姓名" />
             </tui-list-cell>
+            <tui-list-cell class="line-cell code-wrap mobile-wrap" :hover="false">
+              <view class="tui-title required">手机号</view>
+              <input
+                v-model="form.mobile"
+                type="number"
+                placeholder-class="phcolor"
+                @blur="checkShopFn"
+                placeholder-style="color:#CCCCCC"
+                class="tui-input tui-input--code"
+                :class="{ 'tui-input--filled': fillMobile == 0 }"
+                name="mobile"
+                :disabled="fillMobile == 0"
+                :placeholder="fillMobile == 0 ? '' : '请填写手机号'"
+              />
+              <!-- #ifdef MP-WEIXIN -->
+              <button
+                v-if="fillMobile == 1"
+                class="apply-code-btn apply-fill-btn"
+                open-type="getPhoneNumber"
+                @getphonenumber="getSj"
+              >帮我填</button>
+              <button
+                v-else
+                class="apply-code-btn apply-cancel-btn"
+                @click="cancelAutoMobile"
+              >取消</button>
+              <!-- #endif -->
+            </tui-list-cell>
+            <tui-list-cell v-if="fillMobile == 1" class="line-cell code-wrap" :hover="false">
+              <view class="tui-title required">验证码</view>
+              <input v-model="form.authCode" type="number" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input tui-input--code" name="authCode" placeholder="请填写验证码" />
+              <button v-if="hasGet == false" class="apply-code-btn" @click="requestAuthCode()">获取</button>
+              <button v-else class="apply-code-btn apply-code-btn--disabled">{{ count }}</button>
+            </tui-list-cell>
           </view>
         </view>
 
@@ -194,7 +194,7 @@ export default {
       currentImgData: [],
       isHd:1,
       uploadImgUrl:APIHOST+'/upload/save-file',
-      fillMobile:0,
+      fillMobile: 1,
     };
   },
 	computed:{
@@ -289,12 +289,6 @@ export default {
       if (!item) {
         return false
       }
-      if (item.province) {
-        this.form.province = item.province
-      }
-      if (item.city) {
-        this.form.city = item.city
-      }
       if (item.district) {
         this.form.dist = item.district
       }
@@ -368,13 +362,25 @@ export default {
       this.form.province = '云南省'
       this.form.city = '昆明市'
     },
-    manFill(){
-      this.fillMobile = 1
-      this.form.mobile = ''
+    cancelAutoMobile() {
+      this.$util.confirmModal({
+        content: '取消后将清空已获取的手机号,需重新填写并验证,是否确认?',
+        okText: '确认取消',
+        cancelText: '暂不取消'
+      }, () => {
+        this.resetAutoMobile()
+      })
     },
-    oneGet(){
-      this.fillMobile = 0
+    resetAutoMobile() {
+      this.fillMobile = 1
       this.form.mobile = ''
+      this.form.authCode = ''
+      if (this.INT) {
+        clearInterval(this.INT)
+        this.INT = false
+      }
+      this.hasGet = false
+      this.count = 120
     },
 		getSj(e){
 			let that = this
@@ -384,6 +390,8 @@ export default {
 					uni.hideLoading()
           if(subRes.data.mobile && subRes.data.mobile!=''){
             this.form.mobile = subRes.data.mobile
+            this.fillMobile = 0
+            this.form.authCode = ''
             this.checkShopFn({detail:{value:this.form.mobile}})
           }else{
             this.$msg("没获取到手机号")
@@ -511,6 +519,10 @@ export default {
         },() => {
           this.agree = 1
           if (!checkRes) {
+            if (this.fillMobile == 1 && !this.form.authCode) {
+              this.$msg('请填写验证码')
+              return false
+            }
             uni.showLoading({mask:true})
             setTimeout(() => {
               this.confirmFn()
@@ -524,6 +536,10 @@ export default {
       }
 
       if (!checkRes) {
+        if (this.fillMobile == 1 && !this.form.authCode) {
+          this.$msg('请填写验证码')
+          return false
+        }
         uni.showLoading({mask:true})
         setTimeout(() => {
           this.confirmFn()
@@ -739,6 +755,23 @@ export default {
   }
 }
 
+.mobile-wrap {
+  .tui-input--filled {
+    color: #161819;
+  }
+}
+
+.apply-fill-btn {
+  min-width: 120upx;
+}
+
+.apply-cancel-btn {
+  min-width: 120upx;
+  color: #6b737c;
+  background: #f2f7f4;
+  border: 1upx solid #e3ebe6;
+}
+
 .apply-code-btn {
   flex-shrink: 0;
   min-width: 140upx;