liyaozhi
2025-10-28 1320688354fd168c51cf2e05f29a2253f4ed9c00
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<template>
 <!--
        作者:lyzflash
        时间:2021-11-20
        描述:设置商户通知人
    -->
  <div class="product-add">
    <!--form表单-->
    <el-form size="small" ref="form" :model="form" label-width="200px">
      <!--消息通知设置-->
      <div class="common-form">消息通知设置</div>
      <el-alert title="警告提示的文案" type="warning" :closable="false">
        <template slot="title">
          <div>需要成为公众号会员才能成为通知人。<a href="#" @click="dialogMpVisible = true">扫码成为公众号会员</a></div>
        </template>
      </el-alert>
      <el-form-item label="新订单通知">
        <el-row>
          <el-button type="primary" @click="addClick">选择会员</el-button>
          <div v-if="form.order__user_list && form.order__user_list.length > 0" class="d-s-c f-w">
            <div v-for="(item, index) in form.order__user_list" :key="index" class="img pr">
              <a href="javascript:void(0)" class="delete-btn" @click="deleteFunc(index)"><i class="el-icon-error"></i></a>
              <img :src="item.avatarUrl" width="100" height="100" />
              <p class="text-ellipsis">{{ item.nickName }}</p>
            </div>
          </div>
          <div>
            <el-link :underline="false" disabled>可以指定多人,不指定则不发送通知</el-link>
          </div>
        </el-row>
      </el-form-item>
 
      <!--提交-->
      <div class="common-button-wrapper"><el-button size="small" type="primary" @click="onSubmit" :loading="loading">提交</el-button></div>
    </el-form>
 
    <el-dialog title="扫码成为公众号会员" :visible.sync="dialogMpVisible" width="500px">
      <div class="qrcode">
        <img :src="qrcode" width="300" height="300" />
      </div>
      <div class="qrcode-note">请让通知人用微信扫一扫</div>
    </el-dialog>
 
    <!--添加-->
    <GetMpUser :is_open="open_add" @close="closeDialogFunc($event, 'add')"></GetMpUser>
 
  </div>
</template>
 
<script>
  import SettingApi from '@/api/setting.js';
  import GetMpUser from '@/components/user/GetMpUser.vue';
  export default {
    components: {
      /*编辑组件*/
      GetMpUser
    },
    data() {
      return {
        form: {
          order__user_ids: []
        },
 
        /*是否打开添加弹窗*/
        open_add: false,
        loading: false,
        open_mp: false,
        qrcode: '',
        dialogMpVisible: false
      };
    },
    created() {
      this.getParams()
    },
 
    methods: {
      getParams() {
        let self = this;
        SettingApi.getMessage({}, true).then(res => {
          self.form = res.data.vars.values;
          self.qrcode = res.data.vars.qrcode;
          if (!self.form.order__user_list) {
            self.form.order__user_list = [];
          }
        })
        .catch(error => {
 
        });
 
      },
      onSubmit() {
        let self = this;
        let params = this.form;
        self.loading = true;
        SettingApi.editMessage(params, true)
          .then(data => {
            self.loading = false;
            self.$message({
              message: '恭喜你,设置成功',
              type: 'success'
            });
            // self.$router.push('/setting/Printing');
 
          })
          .catch(error => {
            self.loading = false;
          });
      },
 
      /*删除会员*/
      deleteFunc(i) {
        this.form.order__user_ids.splice(i, 1);
        this.form.order__user_list.splice(i, 1);
      },
 
      /*打开弹出层*/
      addClick() {
        this.open_add = true;
      },
 
      /*关闭获取用户弹窗*/
      closeDialogFunc(e) {
        if (e.type != 'error') {
          //console.log(e.params);
          if (this.form.order__user_ids.indexOf(e.params.user_id) == -1) {
            this.form.order__user_ids.push(e.params.user_id);
            this.form.order__user_list.push({ user_id: e.params.user_id, avatarUrl: e.params.avatarUrl,nickName: e.params.nickName });
          } else {
            this.$message({
              message: '已选择该会员',
              type: 'warning'
            });
          }
        }
        this.open_add = false;
      },
 
      /*取消*/
      cancelFunc() {
        this.$router.back(-1);
      },
 
    }
 
  };
</script>
 
<style lang="scss" scoped>
  .basic-setting-content {}
 
  .product-add {
    padding-bottom: 50px;
  }
 
  .el-alert {
    margin-bottom: 20px;
  }
 
  .img {
    margin-top: 10px;
    margin-right: 10px;
  }
 
  .img img {
    border: 1px solid #eeeeee;
  }
 
  .delete-btn {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    right: -8px;
    top: -8px;
    color: red;
  }
 
  .qrcode {
    text-align: center;
  }
 
  .qrcode img {
    display: inline-block;
  }
 
  .qrcode-note {
    text-align: center;
    font-size: 16px;
    color: #999;
    padding: 10px 0;
  }
</style>