zhaoxiaoqiang
2021-08-30 151dcafcc9b5a91b544b65bd6a0e822cbd60e19b
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
 
<!--
    新增门店
-->
 
<template>
  <div class="stores-add-box h-100-g">
 
    <v-navbar title="新增店员" fixed></v-navbar>
    <div class="cell-group">
      <v-cell v-model="form.priName" :max="6" label='负责人姓名' placeholder='请输入负责人姓名'></v-cell>
      <v-cell v-model="form.priMblNo" :max="11" type="tel" label='负责人手机号' placeholder='请输入负责人手机号'></v-cell>
    </div>
    <p class="tip">*该手机号将作为登录用户名,密码将通过短信发至手机</p>
    <div class="cell-group">
      <v-cell v-model="form.priEmail" :max="50" label='联系邮箱' placeholder='请输入邮箱地址'></v-cell>
    </div>
 
    <footer class="flex-center-g footer">
      <van-button class="btn" @click="addStore">新增店员</van-button>
    </footer>
  </div>
</template>
 
<script>
  import { mapState } from 'vuex';
  export default {
    name: "stores-add",
    data(){
      return {
        queryStoreId:"",
        isShowArea:false,
        Btn:false,
        form:{
          priName:'',   //负责人姓名
          priEmail:'',  //联系邮箱
          priMblNo:'',  //负责人手机
        },
        rule:[
          {key:"priName",message:"请输入负责人姓名",type:"isEmpty"},
          {key:"priName",message:"请输入正确的负责人姓名",rule:/^[\u4e00-\u9fa50-9a-zA-Z]{1,6}$/},
          {key:"priMblNo",message:"请输入负责人手机号",type:"isEmpty"},
          {key:"priMblNo",message:"请输入正确的手机号",type:"isTel"},
          {key:"priEmail",message:"请输入联系邮箱",type:"isEmpty"},
          {key:"priEmail",message:"请输入正确的联系邮箱",type:"isEmail"},
        ]
 
      }
    },
    computed:{
      ...mapState(['areaList'])
    },
    created() {
        this.queryStoreId =this.$route.query.storeId;
    },
    methods:{
      // 验证form参数
      validatorForm(){
        return this.$validator(this.form,this.rule).check(item=>{
          this.$notify(item.message)
        })
      },
      // 新增门店
      addStore(){
        if(!this.validatorForm()) return
        if(this.Btn)return
        let list = {
          name: this.form.priName,
          mblNo: this.form.priMblNo,
          email: this.form.priEmail,
          orgId:this.queryStoreId
        };
        this.$api.agencyAddUser(list).then(() => {
          this.$notify('新增成功');
          this.Btn = true;
          setTimeout(() => this.$router.go(-1), 1000);
        });
      }
    }
  }
</script>
 
<style scoped lang="less">
.stores-add-box{
  background-color: @c-bg-f5;
  padding-top: 44px;
  .tip {
    margin: 10px 0 15px 21px;
    font-size: @font-12;
    color: @c-text-999;
  }
}
 
 
.cell-group {
  margin: 10px 8px 0;
}
 
.btn {
  width: 340px;
  height: 44px;
  border: none;
  font-size: @font-16;
  border-radius: 22px;
  background-color: @c-bg-default;
  color: @c-text-fff;
 
}
 
.footer {
  margin-top: 60px;
  padding-bottom: 30px;
}
 
 
</style>