zhaoxiaoqiang
2021-08-31 20365ba048f4042dfdc223cf2a6fa8c2d5a699f3
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
<template>
<div class="stores-detail h-100-g">
 
  <v-navbar title="店员详情" fixed rightText='保存' @right-click="Save"></v-navbar>
  <div class="cell-group">
    <v-cell v-model="form.priName" :max="6" label='负责人姓名' :readonly="true" placeholder='负责人姓名'></v-cell>
    <v-cell v-model="form.priMblNo" :max="11" type="tel" label='负责人手机号' :readonly="true" placeholder='负责人手机号'></v-cell>
    <v-cell v-model="form.priEmail" :max="50" label='联系邮箱'  placeholder='联系邮箱'></v-cell>
  </div>
   <footer class="flex-center-g footer">
      <van-button class="btn" @click="freeze">{{menText}}</van-button>
    </footer>
  <van-dialog
      class="setting-box-dialog"
      v-model="dialogShow"
      show-cancel-button
      :message='Msg'
      @confirm="onConfirm"
  >
  </van-dialog>
</div>
</template>
 
<script>
  import { mapState } from 'vuex';
  export default {
    name: "stores-detail",
    computed: {
      ...mapState(["userinfo"]),       
    },
    data(){
      return {
        orgType:"",
        isShowArea:false,
        dialogShow:false,
        menText:'冻结店员',
        Status:null,
        Msg:'',
        Btn:false,
        form:{
          priName:'',   //负责人姓名
          priEmail:'',  //联系邮箱
          priMblNo:'',  //负责人手机号
        },
        rule:[
          {key:"priEmail",message:"请输入邮箱",type:"isEmpty"},
        ]
      }
    },
    created(){
      this.orgType = this.userinfo.orgType;
      this.init();
    },
    methods:{
      init(){
        let mgrId =this.$route.query.mgrId;
        this.$api.getUserDetail(mgrId).then((res) => {
          let data = res.body;
          this.Status = data.status;
          data.status ? this.menText = '冻结店员':this.menText = '启用店员';
          this.form = {
            priName:data.name,   //负责人姓名
            priEmail:data.email,  //联系邮箱
            priMblNo:data.mblNo  //负责人手机
          }
        })
      },
      freeze(){
        this.dialogShow = !this.dialogShow;
        this.Msg = `请问是否确认${this.Status ? '冻结' : '启用'}该店员?`;
      },
 
      //冻结/启用  门店
      onConfirm() {
        if(this.Btn2){return}
        this.Btn2 = true;
        this.$api.userFreezeMgr(this.$route.query.mgrId).then((res) => {
            this.Btn2 = false;
            this.$notify_success(`${ this.Status ? '冻结' : '启用'}店员成功`)
            this.Status =  this.Status ? 0 : 1;
            this.menText = this.Status ? '冻结店员' :'启用店员';
          });
      },
      // 保存门店
      Save(){
        if(this.Btn){return}
        this.Btn = true;
        let list = {
          name: this.form.priName,
          mblNo: this.form.priMblNo,
          email: this.form.priEmail,
          orgId:this.queryStoreId,
          id:this.$route.query.mgrId
        };
        list.menuPower = [100001, 100006]
        if(this.$validator(this.form,this.rule).check(item=>{
          this.$notify(item.message);
        })){
        this.$api.userUpdate(list).then((res) => {
            this.Btn = false;
            this.$notify_success('保存成功!');
        });
        }
      },
      //关闭地区弹窗
      closeAreaModal(){
        this.isShowArea = false;
        this.$refs.Area.reset()
      },
      //保存 地区选择
      setAreaValue(arr){
        this.form.areaText = arr[0].name + '-' +arr[1].name +'-'+ arr[2].name;
        this.form.provCode= arr[0].code;
        this.form.cityCode= arr[1].code;
        this.form.areaCode= arr[2].code;
        this.isShowArea = false;
        this.$refs.Area.reset()
      },
 
 
 
    }
  }
</script>
 
<style scoped lang="less">
.stores-detail{
  background-color: @c-bg-f5;
  padding-top: 44px;
 
  .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>