浏览代码

修改客户手机验证码

mxx 3 年之前
父节点
当前提交
d05d3ea615

+ 4 - 2
src/api/V2/houseSelfCollect/index.js

@@ -24,6 +24,10 @@ export const API_POST_PURCHASEPRICE_ALLOWEDIT = '/purchasePrice/purchasePriceAll
 export const API_GET_WAREHOUSESELF = '/warehouseBaseInfo/selectWarehouseSelf'
 //客户修改
 export const API_POST_CUSTOMER_EDIT = '/identityAuthenticationInfo/api/editIdentityAuthenticationInfo'
+//客户获取验证码
+export const API_GET_CUSTOMER_CODE = '/commonUser/sendVerifyCode'
+//客户验证码校验
+export const API_GET_CUSTOMER_CODEJY = '/commonUser/loginVerifyCode'
 //质检添加
 export const API_POST_INSPECT_ADD = '/qualityInspectionManagement/api/addQualityInspection'
 //质检仓位下拉
@@ -70,5 +74,3 @@ export const API_POST_PAYMENT_DEL = '/paymentManagement/api/deleteInfo'
 export const API_POST_PAYMENT_AUDIT = '/paymentManagement/api/openAuditFlow'
 //付款提交
 export const API_POST_PAYMENT_PAYMENTSUBMIT = '/paymentManagement/api/payMoney'
-
-

+ 7 - 1
src/model/houseSelfCollect/index.js

@@ -37,7 +37,9 @@ import {
   API_GET_WEIGHTCHECK_GETPRINT,
   API_POST_PAYMENT_DEL,
   API_POST_PAYMENT_AUDIT,
-  API_POST_PAYMENT_PAYMENTSUBMIT
+  API_POST_PAYMENT_PAYMENTSUBMIT,
+  API_GET_CUSTOMER_CODE,
+  API_GET_CUSTOMER_CODEJY
 } from '@/api/V2/houseSelfCollect'
 //客户管理列表
 export const getCustomerManage = appRx.get(API_GET_CUSTOMER_MANAGE, errorCatcher, errorHandle, filter)
@@ -65,6 +67,10 @@ export const purchasePriceAllowEdit = appRx.post(API_POST_PURCHASEPRICE_ALLOWEDI
 export const selectWarehouseSelf = appRx.get(API_GET_WAREHOUSESELF, errorCatcher, errorHandle, filter)
 //客户查看
 export const CustomerEdit = appRx.post(API_POST_CUSTOMER_EDIT, errorCatcher, errorHandle, filter)
+// 获取验证码
+export const GetCustomerCode = appRx.get(API_GET_CUSTOMER_CODE, errorCatcher, errorHandle, filter)
+// 验证码校验
+export const GetCustomerCodeJY = appRx.get(API_GET_CUSTOMER_CODEJY, errorCatcher, errorHandle, filter)
 //质检添加
 export const inspectAdd = appRx.post(API_POST_INSPECT_ADD, errorCatcher, errorHandle, filter)
 //仓位下拉

+ 110 - 118
src/views/houseSelfCollect/customerManagementAdd.vue

@@ -85,33 +85,16 @@
             <ws-input v-model="customerList.customerPhone" placeholder="请输入手机号" maxlength="100" size="small"
               :disabled="disabled" />
           </ws-form-item>
-          <!-- 验证码 -->
-          <!-- <el-form-item prop="veriCode" :label="$t('login.register08')">
-          <el-input v-model="form.name"></el-input>
-             <div style="display: flex; justify-content: space-between">
-            <el-input
-              v-model="form.name"
-              :disabled="disabledFlag"
-              class="code_style"
-              :placeholder="$t('login.registerVerif08')"
-            />
-            <div>
-              <ws-button
-                v-show="verification"
-                type="primary"
-                @click="toSend"
-                >{{ $t('login.sendVerification') }}</ws-button
-              >
-              <ws-button v-show="!verification" class="retry" disabled
-                >{{ $t('login.retry') }}({{ count }})s</ws-button
-              >
-            </div>
-          </div>
-        </el-form-item> -->
           <ws-form-item label="联系地址" span="1" prop="compAddress">
             <ws-input v-model="customerList.compAddress" placeholder="请输入联系地址" maxlength="100" size="small"
               :disabled="disabled" />
           </ws-form-item>
+          <ws-form-item label="验证码" label-width="0px" span="1" prop="compAddress">
+            <el-button type="primary" class="veriCode" @click="toSend()" v-if="!sendDisabled">获取验证码</el-button>
+            <el-button type="warning" class="veriCode" v-if="sendDisabled">{{sendText}}</el-button>
+
+            <ws-input v-model="verifyCode" placeholder="请输入验证码" maxlength="100" size="small" :disabled="disabled" />
+          </ws-form-item>
         </ws-info-table>
         <div class="but">
           <el-button type="primary" @click="commit" v-if="switchType == 1 || switchType == 3">提交</el-button>
@@ -128,7 +111,9 @@
     getCustomerLook,
     CustomerEdit,
     getIdentity,
-    getBank
+    getBank,
+    GetCustomerCode,
+    GetCustomerCodeJY
   } from '@/model/houseSelfCollect/index'
 
   export default {
@@ -170,17 +155,20 @@
         identityLow: 'low',
         bankUps: 'bankUp',
         bankLows: 'bankLow',
+        sendText: '',
+        sendDisabled: false,
+        verifyCode: ""
       }
     },
     activated() {
       this.switchType = this.$route.query.types
       if (this.$route.query.types == null) {
         this.switchType = 1
-        this.imageUrl1=""
-        this.imageUrl2=""
-        this.imageUrl3=""
-        this.imageUrl4=""
-        this.customerList={}
+        this.imageUrl1 = ""
+        this.imageUrl2 = ""
+        this.imageUrl3 = ""
+        this.imageUrl4 = ""
+        this.customerList = {}
       }
       let id = this.$route.query.id
       if (this.switchType == 2) {
@@ -241,41 +229,30 @@
       },
       // 发送验证码
       toSend() {
-        if (this.registerForm.linkmanPhone) {
-          if (validUserCellPhone(this.registerForm.linkmanPhone)) {
-            this.disabledFlag = false
-            clearInterval(this.timer)
-            this.timer = null
-            const TIME_COUNT = 60
-            if (!this.timer) {
-              this.count = TIME_COUNT
-              this.verification = false
-              let data = {
-                mobilePhone: this.registerForm.linkmanPhone,
-              }
-              sendRegisterCode(data)
-                .toPromise()
-                .then((res) => {
-                  this.timer = setInterval(() => {
-                    if (this.count > 0 && this.count <= TIME_COUNT) {
-                      this.count--
-                    } else {
-                      this.verification = true
-                      clearInterval(this.timer)
-                      this.timer = null
-                    }
-                  }, 1000)
-                })
-                .catch((err) => {
-                  this.verification = true
-                })
-            }
-          } else {
-            EventBus.$emit('error', this.$t('login.registerVerif09'))
-          }
-        } else {
-          EventBus.$emit('error', this.$t('login.registerVerif05'))
+        let that = this;
+        if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.customerList.customerPhone)) {
+          GetCustomerCode({
+              phone: this.customerList.customerPhone
+            })
+            .toPromise().then((response) => {
+              console.log(response)
+              if (response == 'ok') {
+                that.sendDisabled = true
+                let sec = 60
+                let interval = setInterval(() => {
+                  sec--;
+                  that.sendText = sec + 'S后重发'
+                  if (sec <= 0) {
+                    that.sendDisabled = false
+                    that.sendText = "获取验证码"
+                    clearInterval(interval)
+                  }
+                }, 1000)
+              } else {}
+            })
         }
+
+
       },
       cancel() {
         this.$router.push({
@@ -352,54 +329,63 @@
           })
       },
       commit() {
-        this.customerList.compId = sessionStorage.getItem('ws-pf_compId')
-        this.customerList.cardAddressUrl = this.identity.toString()
-        this.customerList.payeeAddressUrl = this.bank.toString()
-        this.customerList.customerTypeFlag = 1
-        this.customerList.customerType = '个人'
-        if (this.switchType == 1) {
-          this.$confirm('确定提交客户信息?', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning',
-            })
-            .then(() => {
-              customerAdd(this.customerList)
-                .toPromise()
-                .then((response) => {
-                  // this.customerList.id = response
-                  // customerIdentity(this.customerList)
-                  //   .toPromise()
-                  //   .then((response) => {
-                  //     this.$message.success('添加成功')
-                  //     this.$router.push({ path: 'customerManagement' })
-                  //   })
-                  this.$router.go(-1)
+        // 验证码校验
+        GetCustomerCodeJY({
+            phone: this.customerList.customerPhone,
+            verifyCode: this.verifyCode
+          })
+          .toPromise()
+          .then((response) => {
+            debugger
+            this.customerList.compId = sessionStorage.getItem('ws-pf_compId')
+            this.customerList.cardAddressUrl = this.identity.toString()
+            this.customerList.payeeAddressUrl = this.bank.toString()
+            this.customerList.customerTypeFlag = 1
+            this.customerList.customerType = '个人'
+            if (this.switchType == 1) {
+              this.$confirm('确定提交客户信息?', '提示', {
+                  confirmButtonText: '确定',
+                  cancelButtonText: '取消',
+                  type: 'warning',
                 })
-            })
-            .catch(() => {
-              return false
-            })
-        } else if (this.switchType == 3) {
-          this.$confirm('确定修改客户信息?', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning',
-            })
-            .then(() => {
-              CustomerEdit(this.customerList)
-                .toPromise()
-                .then((response) => {
-                  this.$message.success('修改成功')
-                  this.$router.push({
-                    path: 'customerManagement'
-                  })
+                .then(() => {
+                  customerAdd(this.customerList)
+                    .toPromise()
+                    .then((response) => {
+                      // this.customerList.id = response
+                      // customerIdentity(this.customerList)
+                      //   .toPromise()
+                      //   .then((response) => {
+                      //     this.$message.success('添加成功')
+                      //     this.$router.push({ path: 'customerManagement' })
+                      //   })
+                      this.$router.go(-1)
+                    })
                 })
-            })
-            .catch(() => {
-              return false
-            })
-        }
+                .catch(() => {
+                  return false
+                })
+            } else if (this.switchType == 3) {
+              this.$confirm('确定修改客户信息?', '提示', {
+                  confirmButtonText: '确定',
+                  cancelButtonText: '取消',
+                  type: 'warning',
+                })
+                .then(() => {
+                  CustomerEdit(this.customerList)
+                    .toPromise()
+                    .then((response) => {
+                      this.$message.success('修改成功')
+                      this.$router.push({
+                        path: 'customerManagement'
+                      })
+                    })
+                })
+                .catch(() => {
+                  return false
+                })
+            }
+          })
       },
       getList(ids) {
         getCustomerLook({
@@ -415,10 +401,10 @@
             this.bank = this.customerList.payeeAddressUrl.split(',')
             // this.bankImgUp[0].url = this.bank[0]
             // this.bankImgLow[0].url = this.bank[1]
-            this.imageUrl1=this.identity[0]
-                this.imageUrl2=this.identity[1]
-                    this.imageUrl3=this.bank[0]
-                        this.imageUrl4=this.bank[1]
+            this.imageUrl1 = this.identity[0]
+            this.imageUrl2 = this.identity[1]
+            this.imageUrl3 = this.bank[0]
+            this.imageUrl4 = this.bank[1]
           })
       },
     },
@@ -440,9 +426,11 @@
   .avatar-uploader4 {
     background: url('../../../public/img/banklow.png');
   }
-/deep/.el-upload{
-  height: 200px;
-}
+
+  /deep/.el-upload {
+    height: 200px;
+  }
+
   .avatar-uploader {
     background-size: 100% 100%;
   }
@@ -469,8 +457,8 @@
   }
 
   .avatar {
-      width: 330px;
-      height: 103%;
+    width: 330px;
+    height: 103%;
     display: block;
   }
 
@@ -570,4 +558,8 @@
   .unload-img {
     margin: 20px 0;
   }
+
+  .veriCode {
+    margin-right: 20px;
+  }
 </style>