ss
重庆迈尖科技有限公司
2020-06-16 b67f2c4fce992a818f287783ae7029a0b03509d3
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
<html>
    <head>
        <meta charset="utf-8">
        <title>团队订单</title>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <link rel="stylesheet" type="text/css" href="../teamFans/css/fansSearchMain.css" />
        <script>
            window.onresize = function() {
                document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
            };
            window.onresize();
        </script>
        <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
        <script src="http://img.flqapp.com/resource/js/app2019112217.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    </head>
    <body>
        <div id="root" style="display: none;">
            <div class="div_search">
                <div class="div_search_gary">
                    <img src="img/icon_search.png">
                    <form action="" v-on:submit.prevent>
                        <input id="input_result" class="inputc" type="search" autofocus="autofocus" placeholder="输入快省ID/订单号" />
                    </form>
                </div>
                <div class="div_search_button" @click="touchSearch">
                    搜索
                </div>
            </div>
 
            <div v-show="show" class="div_historySearch">
                <div class="historySearch">
                    历史搜索
                </div>
                <div class="clearSearch" @click="clearAll">
                    清空
                </div>
            </div>
 
            <div class="div_item_bg">
                <div class="items" v-for="(item, index) in dataList" @click="didSelect(item)">
                    <div class="div_topHeader" style="height: 0.16rem;"></div>
                    <div class="div_garyBG">
                        <p>{{item}}</p>
                    </div>
                    <img src="img/icon_close.png" class="imageClose">
                    <div class="div_closeClick" @click="deleteList(index)"></div>
                </div>
            </div>
        </div>
    </body>
 
    <script>
        var host = "http://api.flqapp.com";
        // "http://apph5.banliapp.com"    || "http://192.168.1.114:8848/flqFront/"
        var h5host = "http://apph5.banliapp.com/";
    
        $(function() {
            var app = new Vue({
                el: '#root',
                data: {
                    show: false,
                    dataList: [],
                },
                watch: {
                    dataList: function(val) {
                        if (val != null && val.length != 0) {
                            app.show = true;
                        }
                        $('#root').css('display', 'block');
                    }
                },
                methods: {
                    deleteList: function(index) {
                        var list = app.dataList;
                        list.splice(index, 1);
                        app.dataList = list;
                        if (list.length == 0 || list == null) {
                            app.show = false;
                        }
                        localStorage.setItem('orderResut', JSON.stringify(list));
                    },
 
                    didSelect: function(result) {
                        yesApp.jumpWeb(h5host + 'AppInside/teamOrder/orderSearchResult.html?key=' + result,
                            null)
                    },
 
                    touchSearch: function() {
                        var result = $('#input_result').val();
                        if (result == null || result.length == 0) {
                            yesApp.toast('请输入搜索关键字');
                            return;
                        }
 
                        var userJsonStr = localStorage.getItem('orderResut');
                        var userEntity = JSON.parse(userJsonStr);
 
                        var list = userEntity;
                        if (list == null || list.length == 0) {
                            list = [];
 
                        } else {
                            for (i = 0; i < list.length; i++) {
                                if (list[i] == result) {
                                    list.splice(i, 1);
                                }
                            }
                        }
                        list.unshift(result);
                        app.dataList = list;
 
                        localStorage.setItem('orderResut', JSON.stringify(list));
 
                        yesApp.jumpWeb(h5host + 'AppInside/teamOrder/orderSearchResult.html?key=' + result,
                            null)
                    },
 
                    clearAll: function() {
                        app.dataList = [];
                        app.show = false;
                        localStorage.removeItem("orderResut");
                    },
 
                    fetchData: function() {
                        var userJsonStr = localStorage.getItem('orderResut');
                        var userEntity = JSON.parse(userJsonStr);
 
                        var list = userEntity;
                        app.dataList = list;
                    }
                }
            });
            app.fetchData();
 
            setTimeout(function() {
                $('#input_result').focus();
            }, 1000);
 
            $("#input_result").keypress(function(e) {
                var key = $.trim($(this).val());
                if (e.keyCode === 13) {
 
                    if (key == null || key.length == 0) {
                        yesApp.toast('请输入搜索关键字');
                        return;
                    }
 
                    var userJsonStr = localStorage.getItem('orderResut');
                    var userEntity = JSON.parse(userJsonStr);
 
                    var list = userEntity;
                    if (list == null || list.length == 0) {
                        list = [];
 
                    } else {
                        for (i = 0; i < list.length; i++) {
                            if (list[i] == key) {
                                list.splice(i, 1);
                            }
                        }
                    }
                    list.unshift(key);
                    app.dataList = list;
 
                    localStorage.setItem('orderResut', JSON.stringify(list));
 
                    yesApp.jumpWeb(h5host + 'AppInside/teamOrder/orderSearchResult.html?key=' + key,
                        null)
                }
            })
        });
    </script>
</html>