liangjin
2021-03-31 15dedf22b81b08e627dc3c176b32fadc75536dde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!--
 * @Author: 小明丶
 * @Date: 2020-11-09 11:44:43
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-11-11 16:51:59
 * @Description: 信息补充页面
-->
<template>
  <div class="information-supplement">
    <v-navbar title="信息补充"></v-navbar>
    <div class="content-box">
      <van-cell-group>
        <van-field
          v-model.trim="info.userName"
          label="姓名"
          input-align="right"
          placeholder="请填写真实姓名"
          clearable
        />
        <van-field
          v-model.trim="info.email"
          clearable
          input-align="right"
          label="邮箱"
          placeholder="请输入邮箱"
        />
        <van-field
          v-model.trim="info.orgName"
          is-link
          disabled
          label="归属门店"
          input-align="right"
          placeholder="请选择归属门店"
          @click="show=true"
        />
      </van-cell-group>
       <van-button round type="info" color="#896EDB" style="width:100%;margin-top:150px" @click="hanldClick">完成</van-button>
    </div>
    <van-popup v-model="show" position="bottom" :style="{ height: '40%' }">
        <van-picker
          title="选择归属门店"
          show-toolbar
          value-key="orgName"
          :columns="storeList"
          @confirm="onConfirm"
          @cancel="onCancel"
        />
    </van-popup>
  </div>
</template>
<script>
import Vue from 'vue';
import { Toast } from 'vant';
import { mapActions } from 'vuex';
Vue.use(Toast);
export default {
    data() {
        return {
            info:{
                orgId:'',
                orgName:'',
                email:'',
                userName:'',
            },
            show:false,
            storeList:[],
        }
    },
    created(){
        this.init()
    },
    methods:{
      ...mapActions(['loginByOpenId']),
        /**
         * @description:初始化
         * @returns void
         * **/ 
       init(){
          
          this.storeList = JSON.parse(this.$route.query.storeList) 
           
       },
       /**
         * @description:确认归属门店选择
         * @returns void
         * **/
       onConfirm(value){
           this.info.orgName = value.orgName
           this.info.orgId = value.orgId
           this.show = false
       },
       /**
         * @description:取消选择门店
         * @returns void
         * **/
       onCancel(){
           this.show = false
       },
       /**
         * @description:提交
         * @returns void
         * **/
       hanldClick(){
            let v = this.$tool;
            if (v.checkValEmpty(this.info.userName)) {
                Toast.fail('请输入姓名');
                return;
            }
            if (v.checkValEmpty(this.info.email)) {
                Toast.fail('请输入邮箱');
                return;
            }
            if (!v.checkEmail(this.info.email)) {
                Toast.fail('请输入正确的邮箱');
                return;
            }
            if (v.checkValEmpty(this.info.orgId)) {
                Toast.fail('请选择归属门店');
                return;
            }
            this.$api.userAddStoreManager({
                  email: this.info.email,
                  mblNo: localStorage.sib_wx_mblNo,
                  merId: sessionStorage.sib_wx_merId,
                  storeId: this.info.orgId,
                  username: this.info.userName,
                  wechatOpenId: localStorage.sib_wx_openId
            }).then(res=>{
                localStorage.sib_wx_userId = res.body.userId
                this.loginByOpenId({
                    vm: this,
                    loginType:2,
                    mblNo:localStorage.sib_wx_mblNo,
                    merId:sessionStorage.sib_wx_merId,
                    wechatOpenId:localStorage.sib_wx_openId,
                    userId:localStorage.sib_wx_userId
                })
 
 
                // this.$router.push({
                //   path:'/main/mine',
                //   query:{
                //       isLoginByOpenId:1
                //   }
                // })
            })
       }
    }
};
</script>
<style lang="less" scoped>
.information-supplement {
  & {
    background-color: #f5f5f5;
    min-height: 100vh;
  }
  .content-box{
      width: 96vw;
      margin: auto;
      margin-top: 10px;
  }
}
</style>