quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
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
<template>
  <!--
        作者:lyzflash
        时间:2022-05-25
        描述:平台核销员列表-添加核销员
    -->
  <div class="product-add">
    <!--form表单-->
    <el-form size="small" ref="form" :model="form" label-width="200px">
      <!--添加核销员-->
      <div class="common-form">添加核销员</div>
 
      <el-form-item label="选择用户">
        <el-row>
          <el-button @click="addClick" icon="el-icon-plus">选择会员</el-button>
          <div v-if="form.user_id!=''" class="img">
            <img :src="user_info.avatarUrl" width="100" height="100" />
          </div>
          <div>
            <el-link :underline="false" disabled>选择后不可更改</el-link>
          </div>
        </el-row>
      </el-form-item>
      <el-form-item label="核销员姓名" prop="real_name" :rules="[{required: true,message: '请输入核销员姓名'}]">
        <el-input class="max-w460" v-model="form.real_name" placeholder="请输入核销员姓名"></el-input>
      </el-form-item>
      <el-form-item label="手机号" prop="mobile" :rules="[{required: true,message: '请输入手机号'}]">
        <el-input class="max-w460" v-model="form.mobile" placeholder="请输入手机号"></el-input>
      </el-form-item>
 
      <el-form-item label="状态">
        <el-radio-group v-model="form.status">
          <el-radio :label="1">启用</el-radio>
          <el-radio :label="0">禁用</el-radio>
        </el-radio-group>
      </el-form-item>
      <!--提交-->
      <div class="common-button-wrapper">
        <el-button size="small" type="info" @click="cancelFunc">取消</el-button>
        <el-button size="small" type="primary" @click="onSubmit" :loading="loading">提交</el-button>
      </div>
    </el-form>
 
    <!--添加-->
    <GetUser :is_open="open_add" @close="closeDialogFunc"></GetUser>
 
  </div>
</template>
 
<script>
  import UserApi from '@/api/user.js';
  import GetUser from '@/components/user/GetUser.vue';
  export default {
    components: {
      /*编辑组件*/
      GetUser
    },
    data() {
      return {
        /*切换菜单*/
        // activeIndex: '1',
        /*form表单数据*/
        form: {
          user_id: '',
          status: 1,
          real_name: '',
          mobile: '',
        },
        user_info: {},
        /*是否打开添加弹窗*/
        open_add: false,
        /*是否正在加载*/
        loading:false
      };
    },
    created() {
      /*获取列表*/
      this.getTableList();
    },
 
    methods: {
 
 
      /*添加用户*/
      onSubmit() {
        let self = this;
        let form = self.form;
        self.$refs.form.validate((valid) => {
          if (valid) {
            self.loading = true;
            UserApi.addClerk(form, true)
              .then(data => {
                self.loading = false;
                if (data.code == 1) {
                  self.$message({
                    message: '恭喜你,核销员添加成功',
                    type: 'success'
                  });
                  self.$router.push('/user/clerk/index');
                } else {
                  self.loading = false;
                }
              })
              .catch(error => {
                self.loading = false;
              });
          }
        });
 
 
      },
 
      /*打开弹出层*/
      addClick() {
        this.open_add = true;
      },
 
      /*关闭获取用户弹窗*/
      closeDialogFunc(e) {
        if (e.type != 'error') {
          this.user_info = e.params[0];
          this.form.user_id = e.params[0].user_id;
        }
        this.open_add = false;
      },
      
      /*取消*/
      cancelFunc() {
        this.$router.back(-1);
      }
 
 
    }
 
  };
</script>
 
<style lang="scss" scoped>
  .basic-setting-content {}
 
  .product-add {
    padding-bottom: 50px;
  }
 
  .img {
    margin-top: 10px;
  }
</style>