zhaoxiaoqiang
2021-05-15 c36a033b53860a67286ca6653a871ef980731ad1
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
<template>
    <div class='addclerk_page'>
         <NavTop title="店员详情" @click-left="backlast"></NavTop>
         <div class="content">
            <div class="must-has-box">
                <van-field v-model="formData.name" label="店员姓名" readonly placeholder="请输入店员姓名" />
                <van-field v-model="formData.mblNo" label="店员手机号" readonly placeholder="请输入店员手机号" />
                <van-field v-model="formData.email" label="联系邮箱" readonly placeholder="请输入联系邮箱" />
            </div>
            <div class="must-has-box must-has-box-btn">
                <van-cell left title="停启用">
                    <template #right-icon>
                        <van-switch v-model="checked" @change='changeStatus'  active-color="#00B578" size="24" />
                    </template>
                </van-cell>
            </div>
            <!-- <Button class='save_btn' @click="savePassworde">保存</Button> -->
        </div>
    </div>
</template>
 
<script>
import { Cell, CellGroup,Toast,Field,Switch } from "vant";
import Vue from 'vue';
Vue.use(Switch);
export default {
    name:'',
     components: {
        Cell,
        CellGroup,
        Field,
    },
    data() {
        return {
          formData:{
              mblNo:"",
              name:"",
              email:""
          },
          checked:false,
          id:''
        };
    },
    computed: {
        userInfo(){
            return this.$store.state.userInfo
        }
    },
    created() {
       this.id =this.$route.query.id;
       this.getDetail(this.$route.query.id);
    },
    mounted() {
 
    },
    methods: {
     backlast(){ this.$router.go(-1);},
     savePassworde(){
        if(!this.formData.mblNo){
            Toast.fail('请输入手机号');
            return false
        }
        if(!this.formData.name){
            Toast.fail('请输入姓名');
            return false
        }
        if(!this.formData.email){
            Toast.fail('请输入邮箱');
            return false
        }
        this.$api.post('/store/addStoreClient',this.formData).then(res=>{
            Toast.success({
                message:'添加成功',
                 onClose:()=>{
                        this.$router.go(-1)
                    }
            })
        })
     },
     getDetail(id){
        let {platId} = this.userInfo;
        let data ={platId};
        data.mgrId = this.id*1;
        this.$api.post('/store/storeClientDtl',data).then(res=>{
          this.formData =res.body;
          res.body.status==1?this.checked =true:this.checked=false;     
        })
     },
     changeStatus(){
        let {platId} = this.userInfo;
        let data ={platId};
        data.mgrId = this.id*1;
        this.$api.post('/user/freezeMgr',data).then(res=>{
            Toast.success({
                message:this.checked?"已启用":"已停用",
            })
        })
     }
    }
};
</script>
 
<style scoped lang="less">
.addclerk_page{
    background-color: #FAFAFC;
    height: 100vh;
    padding-top: 44px;
    box-sizing: border-box;
    .content {
        box-sizing: border-box;
        padding: 16px 16px 21px;
        .tit-class {
            text-align: left;
            color: #333;
            font-size: 14px;
            margin-left: 12px;
        }
        .maybe-has-box {
          margin-bottom: 12px;
        }
        .must-has-box {
            border-radius: 8px;
            background: #fff;
            .iconfont {
                font-size: 18px;
            }
        }
  }
  .tips{
      color: #999999;
      font-size: 12px;
      margin-bottom: 20px;
      text-align: left;
  }
  .save_btn{
      margin-top: 40px;
  }
  .van-field{
      border-radius: 8px;
  }
  .van-cell__title{
    text-align: left;
  }
  .van-field__control{
    text-align: right;
  }
  .must-has-box-btn{
      margin-top: 12px;
  }
}
</style>