Administrator
2018-11-05 2d950dce7919a2bc39464f9d264f7b96b69f6d1e
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html lang="zh-cn">
 
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/maincontent.css" rel="stylesheet">
        <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
    </head>
 
    <body>
            <div id="container">
                <div class="erjidh">
                    <table class="table">
                        <tbody>
                            <tr>
                                <td class="xiala">
                                    <select class="form-control tbclass" style="width: 200px;display: inline;">
                                    <option value="0">全部</option>
                                    <option value="1">女装尖货</option>
                                    <option value="2">母婴热推</option>
                                    <option value="3">高佣活动</option>
                                    <option value="4">ifashion</option>
                                    <option value="5">亲宝贝</option>
                                    <option value="6">淘宝汇吃</option>
                                    <option value="7">潮电街</option>
                                    <option value="8">极有家</option>
                                    <option value="9">酷动城</option>
                                    <option value="10">淘宝DIY</option>
                                    <option value="11">超值9块9</option>
                                    <option value="12">20元封顶</option>
                                    <option value="13">特价好货</option>
                                </select>
                                </td>
                                <td>
                                    <form class="form-inline" role="form">
                                        <div class="form-group" role="search">
                                            <input type="text" class="form-control searchText" style="width:200px;" placeholder="搜索">
                                        </div>
                                        <button type="button" class="btn btn-default searchBtn">搜索</button>
                                    </form>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="zhuti">
                    <div class="zhutisousuo">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th width="33%">名称</th>
                                    <th width="7%">商品ID</th>
                                    <th width="10%">图片</th>
                                    <th width="10%">销量</th>
                                    <th width="10%">比例</th>
                                    <th width="7%">价格</th>
                                    <th width="15%">优惠卷信息</th>
                                    <th width="8%">选择</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="liebiao">
                        <table class="table">
                            <tbody>
                                <tr style="display: none;">
                                    <td class="r-mingcheng" width="33%" style="text-align: center;"><a target="_blank"></a></td>
                                    <td class="r-id" width="7%" style="text-align: center;"><div></div></td>
                                    <td class="r-tupian" width="10%" style="text-align: center;"><img style="width: 120px;height: 120px;"/></td>
                                    <td class="r-xiaoliang" width="10%" style="text-align: center;"></td>
                                    <td class="r-bili" width="10%" style="text-align: center;"></td>
                                    <td class="r-jiage" width="7%" style="text-align: center;"></td>
                                    <td class="r-youhuijuan" width="15%" style="text-align: center;"></td>
                                    <td style="text-align: center;" width="8%" ><input style="height: 20px;width: 20px;" class="checkbox myck" name="check" type="checkbox"/></td>
                                </tr>
                            </tbody>
                        </table>
                        <hr>
                    </div>
                </div>
                <div class="bottom">
                    <div class="page">
                        <ul class="pagination">
                            <li class="disabled pre">
                                <a href="#">&laquo;</a>
                            </li>
                            <li>
                                <a href="#" class="next">&raquo;</a>
                            </li>
                        </ul>
                        <div class="form-group">
                            <div class="tzan">
                                <button type="button" class="btn btn-primary">跳转</button>
                            </div>
                            <div class="tz">
                                <input class="form-control" type="text" id="customPage" placeholder="页数">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/page.js"></script>
        <script src="layer/layer.js"></script>
        <script>
            $(function(){
                
                $(".checkAll").bind("click", function() {
                    if(this.checked) {
                        $(".myck").prop('checked', this.checked);
                    }else{
                        $(".myck").prop('checked', this.checked);
                    }
                });
                
                resultTrHtml =  $(".liebiao > table tbody").html();
                //搜索点击
                $(".searchBtn").click(function() {
                    getTbDate(1);
                });
                
                var htmlAll = $("body").html();
                
//                layerLoad(htmlAll);
            });
        
        function layerLoad(htmlAll){
            layer.open({
              type: 2, 
              title: '添加商品',
              btn:['确定','取消'],
              yes:function(index){
                    var arr = new Array();
                    $(".liebiao .myck").each(function(){
                        if(this.checked){
                            var key = $(this).attr("key");
                            arr.push(key);
                        }
                    });
                    if(arr.length==0){
                        layer.msg("请先选择数据");
                        return;
                    }
                    var sindex = layer.load(1, {
                              shade: false 
                    });
                    $.ajax({
                        type:"post",
                        url:"api/v1/taobao/addTaoBaoGoodsBrief",
                        async:true,
                        data:{"ids":arr},
                        dataType:'json',
                        traditional: true, //阻止深度序列化
                        success:function(data){
                            if(data.code==0){
                                setMsgInfo(data);
                            }else{
                                layer.msg("添加失败");
                            }
                            layer.close(sindex);
                        },
                        error:function(data){
                            layer.msg("添加失败");
                            layer.close(sindex);
                        }
                    });
                },
                function(index){
                    layer.close(index);
                },
              area: ['1600px', '1000px'],
              content: htmlAll
            }); 
                
        }
        function getTbDate(pageIndex){
                var key = $(".searchText").val();
                var index = layer.load(0, {
                    'shade': false
                });
                var type = $(".tbclass option:checked").val();
                $.post('api/v1/sectiongoods/searchTaoBaoGoodsList', {
                    'pageIndex':pageIndex,
                    'type':type,
                    'key': key
                }, function(data) {
                    layer.close(index);
                    setTbDate(data);
                    if(data.code == 0) {
                        fillPage(data.data.pe, function(pageIndex) {
                            getTbDate(pageIndex);
                        });
                    }
 
                }, 'json');
            }
        
        function setTbDate(data){
            
            var $rtbody = $(".liebiao table tbody");
            $rtbody.empty();
            data.data.taoBaoGoodsList.forEach(function(obj){
                $rtbody.append(resultTrHtml);
                var $curtr = $rtbody.find("tr:last");
                $curtr.css("display","table-row");
                $curtr.find(".r-mingcheng a").text(obj.title);
                $curtr.find(".r-mingcheng a").attr("href",obj.auctionUrl);
                $curtr.find(".r-id").text(obj.auctionId);
                $curtr.find(".r-tupian > img").attr("src",obj.pictUrl);
                $curtr.find(".r-xiaoliang").text(obj.biz30day);
                $curtr.find(".r-bili").text(obj.tkRate);
                $curtr.find(".r-jiage").text("¥ "+obj.zkPrice);
                $curtr.find(".r-youhuijuan").text(obj.couponInfo);
                $curtr.find(".checkbox").attr("key",obj.auctionId);
            });
                    
        }
    
        </script>
 
    </body>
 
</html>