chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
{yun:}include file="$wapstyle/member/header.htm"{/yun}
<div id="yunvue">
    <div id='list'>
        <div class=" blacklist_show">
            <div class="search_com_text_box">
                <div class="search_com_text">
                    <input type="text" @input="bindKeywordInput" :value="searchKeyword" placeholder="请输入企业名称"/>
                    <div class="search_com_button">
                        <button @click="keywordSearch">搜索</button>
                    </div>
                </div>
            </div>
        </div>
 
        <div class="" v-show="showview">
            <div class="blacklist_show">
                <div class="blacklistadd_box">
                    <div class="blacklistadd_box_pp">企业名称匹配</div>
                    <ul class="mui-table-view" id="comullist">
                        <li v-for="(item,blkey) in blackList" :key="blkey">
                            <van-checkbox v-model="item.checked" shape="square" @click="checkCount(item.checked,item.uid)">{{item.name}}</van-checkbox>
                        </li>
                        <li class='mui-table-view-cell mui-indexed-list-item mui-checkbox mui-left'>
                            <van-checkbox v-model="select_all" shape="square" @click="selectall">全选</van-checkbox>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="search_com_tj">
                <span class="search_com_tjbut" @click="save">完成{{num}}</span>
            </div>
        </div>
        <div class=" blacklist_show">
            <div id="nonelist" class="blacklist_notip " v-show="noList">暂未匹配到相关企业</div>
        </div>
    </div>
</div>
 
<script type="text/javascript">
    var yunvue = new Vue({
        el: '#yunvue',
        data() {
            return {
                blackList: [],
                select_all: false,
                showview: false,
                batchIds: '',
                searchKeyword: '',
                count: 0,
                num: '',
                countlist: [],
                noList: false,
            };
        },
        created() {
 
        },
        methods: {
            selectall: function (e) {
                var that = this;
                var arr = []; //存放选中uid的数组
                for (let i = 0; i < that.blackList.length; i++) {
 
                    that.blackList[i].checked = (that.select_all)
 
                    if (that.blackList[i].checked == true) {
                        // 全选获取选中的值
                        arr = arr.concat(that.blackList[i].uid.split(','));
                    }
                    that.count = arr.length;
                    if (that.count > -1) {
                        that.num = '(' + that.count + ')';
                    }
                }
                that.select_all = (that.select_all);
                arr = arr.toString();
                that.batchIds = arr;
                if (arr == '') {
                    that.countlist = [];
                }
            },
            pageTo: function (url) {
                window.location.href = url;
            },
            checkCount: function (e, uid) {
 
                var that = this;
                if (e) {
                    that.countlist.push(uid);
                } else {
                    let index = that.countlist.indexOf(uid);
                    that.countlist.splice(index, 1);
                }
 
                that.batchIds = that.countlist;
                that.count = that.batchIds.length;
                if (that.count > -1) {
                    that.num = '(' + that.count + ')';
                }
                if (that.batchIds.length == that.blackList.length) {
                    that.select_all = true;
                } else {
                    that.select_all = false;
 
                }
            },
            bindKeywordInput: function (e) {
 
                this.searchKeyword = e.target.value
            },
            fetchSearchList: function () {
                let that = this;
                var param = {};
                showLoading('搜索中...');
                param['keyword'] = that.searchKeyword;
                $.post('{yun:}url d=wxapp h=user m=privacy c=searchcom{/yun}', {rand: Math.random()}, function (data) {
                    hideLoading();
                    if (data.error == 1) {
                        that.showview = true;
                        that.blackList = data.data;
 
                    } else {
                        if (!data.data) {
                            that.noList = true;
                            that.showview = false;
                        }
                    }
                }, 'json');
            },
            keywordSearch: function (e) {
                this.blackList = [];
                this.fetchSearchList();
            },
            save: function () {
                let that = this;
                var param = {};
                showLoading();
                param['p_uid'] = that.batchIds;
                if (that.batchIds.length == 0) {
                    return showToast('请选择要屏蔽的企业');
                }
                $.post('{yun:}url d=wxapp h=user m=privacy c=save{/yun}', param, function (data) {
                    hideLoading();
                    if (data.error == 1) {
                        showToast(data.msg, 2, function () {
                            window.location.href = "index.php?c=blacklist"
                        });
                    } else {
                        showToast(data.msg);
                    }
                }, 'json');
            }
        },
    });
</script>
</body>
</html>