Ver Fonte

根据手机号码判断用户信息

Changpeng Duan há 5 anos atrás
pai
commit
705788b6d2
2 ficheiros alterados com 72 adições e 3 exclusões
  1. 6 0
      pc/src/api/getApiRes.js
  2. 66 3
      pc/src/views/Member.vue

+ 6 - 0
pc/src/api/getApiRes.js

@@ -789,3 +789,9 @@ export function ClassHourStatistics(postdata) {
     let url = headapi + 'v1/SchoolTimeTable/ClassHourStatistics ';
     return getApiBasic(url, postdata);
 }
+
+// 根据手机号码判断用户信息
+export function VipUserQueryByPhone(postdata) {
+    let url = headapi + 'v1/User/VipUserQueryByPhone ';
+    return getApiBasic(url, postdata);
+}

+ 66 - 3
pc/src/views/Member.vue

@@ -299,7 +299,7 @@
                         </el-form-item>
                     </el-form>
                 </div>
-                <div class="pull-right" v-if="form.btnType == 0">
+                <div class="pull-right" v-if="form.btnType == 0 && pullRight">
                     <el-form ref="form" :model="form" label-width="100px">
                         <el-form-item label="会员课程">
                             <el-transfer filterable v-model="form.classlist" :data="form.dialogdata"
@@ -309,7 +309,9 @@
                 </div>
             </div>
             <div class="dialogFooter">
-                <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
+                <el-button :disabled="addDisabled" type="primary" size="small" v-if="form.btnType == 0"
+                           @click="confirmMember">确定
+                </el-button>
                 <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
                 </el-button>
                 <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
@@ -393,6 +395,7 @@
         VipUserClassEdit,
         QueryTakeCustomerByName,
         BindTakeCustomer,
+        VipUserQueryByPhone,
         testTable,
         testSelect
     } from "../api/getApiRes";
@@ -405,6 +408,8 @@
                 token: {}, // 七牛云的上传地址,根据自己所在地区选择,我这里是华南区
                 domain: 'https://up-z1.qiniup.com', // 这是七牛云空间的外链默认域名
                 qiniuaddr: 'qjzpcd34v.hb-bkt.clouddn.com',
+                pullRight: true,//其他dialog
+                addDisabled: true,//禁止添加新用户
                 dialogVisible: false,//其他dialog
                 TakeVisible: false,//take dialog
                 dialogMemberVisible: false,//新增会员dialog
@@ -499,7 +504,65 @@
             //  1.新用户正常注册
             //  2.
 
-            getUsrInfoList(){},
+            getUsrInfoList() {
+
+                // 只有新增的时候启用当前功能
+                if(this.form.btnType == 1){
+                    return false
+                }
+
+                let that = this;
+                let param = {
+                    token: localStorage.token,
+                    phone: this.form.phone,
+                };
+                let postdata = qs.stringify(param);
+                VipUserQueryByPhone(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        let Status = json.Status;
+                        let Info = json.Info;
+                        // clear info
+                        that.pullRight = true;
+                        that.addDisabled = false;
+                        that.pullRight = true;
+                        that.form.name = '';
+                        that.form.height = '';
+                        that.form.weight = '';
+                        that.form.birthday = '';
+                        that.imageUrl = '';
+                        that.form.head = '';
+                        this.form.sex = 1;
+                        switch (parseInt(Status)) {
+                            case  1:
+                                that.$message.error('手机号已存在不能重复添加');
+                                that.addDisabled = true;
+                                break;
+                            case  2:
+                                that.$message.success('已读取到当前用户信息');
+                                // 关掉右侧
+                                that.pullRight = false;
+                                that.form.name = Info.Name;
+                                that.form.height = Info.Height;
+                                that.form.weight =  parseInt(Info.Weight) / 10;
+                                that.form.birthday = Info.Birthday;
+                                that.imageUrl = Info.Head;
+                                that.form.head = Info.Head;
+                                this.form.sex = Info.Sex;
+                                break;
+                            case  3:
+                                that.$message.error('手机号已经关联其他用户不能重复添加');
+                                that.addDisabled = true;
+                                break;
+                            case  4:
+                                // 手机号在本店不存在,在其他店也不存在,前台应允许用户填写
+                                break;
+                        }
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
             // 关联手机号跳转
             goRelevance(row) {
                 this.$router.push({path: '/relevancePhone', query: {userId: row.UserInfo.Id}});