yujian
2019-01-22 88b54772dbcf5ecab1e2316e4e4626ac901b8908
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
<!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">
        <title>备选商品库</title>
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/maincontent.css" rel="stylesheet">
        <script  src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
        <style>
            .search {
                display: inline;
                width: auto;
            }
            
            #hometype input[type=checkbox] {
                height: 20px;
                width: 20px;
            }
            
            #hometype ul li {
                line-height: 30px;
            }
            
            #hometype ul li span {
                height: 30px;
                vertical-align: middle;
                margin-left: 5px;
            }
            
            #hometype table td {
                padding: 5px;
            }
            
            #special input[type=checkbox] {
                height: 20px;
                width: 20px;
            }
            
            #special ul li {
                line-height: 30px;
            }
            
            #special ul li span {
                height: 30px;
                vertical-align: middle;
                margin-left: 5px;
            }
            
            #special table td {
                padding: 5px;
            }
            
            #hometype-sure {
                padding: 20px;
                display: none;
            }
            
            #hometype-sure span {
                width: 100px;
                text-align: right;
            }
            
            #hometype-sure input[type=text] {
                width: 360px;
                display: inline;
            }
            
            #hometype-sure div {
                margin-bottom: 20px;
            }
            .img {
                width: 120px;
                height: 120px;
            }
        </style>
    </head>
 
    <body>
        <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        </nav>
        <div id="mainbody">
            <div id="sidebar">
                <dl>
                </dl>
            </div>
            <div id="neirong">
                <div class="erjidh">
                    <table class="table">
                        <tbody>
                            <tr>
                                <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>
                                <td>
                                    <div class="tianjia">
                                        <button class="btn btn-primary add" role="button">添加商品&nbsp;+</button>
                                        <button class="btn btn-primary xiajia" role="button">下架商品&nbsp;</button>
                                        <button class="btn btn-primary updateBtn" role="button">更新商品&nbsp;</button>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="zhuti">
                    <div class="liebiao">
                        <table class="table">
                            <thead>
                                <th width="7%">选择</th>
                                <th width="7%">编号</th>
                                <th width="17%">商品名称</th>
                                <th width="17%">商品图片</th>
                                <th width="6%">价格(元)</th>
                                <th width="6%">销量</th>
                                <th width="7%">更新时间</th>
                                <th width="5%">佣金比例</th>
                                <th width="7%">添加到推荐</th>
                                <th width="7%">添加每日任务</th>
                                <th width="7%">删除</th>
                                <th width="7%">编辑</th>
                            </thead>
                            <tbody>
                                <tr style="">
                                    <td width="7%">
                                        <div class="xuanze">
                                            <label> <input type="checkbox" class="check-item"
                                            value="#">
                                        </label>
                                        </div>
                                    </td>
                                    <td width="7%">
                                        <div class="bianhao bianhaoid">623</div>
                                    </td>
                                    <td width="24%">
                                        <a class="bianhao bianhaoname" target="view_window">m</a>
                                    </td>
                                    <td width="17%">
                                        <div class="imgDiv" style="text-align:center">
                                            <img alt src="#" class="img">
                                        </div>
                                    </td>
                                    <td width="6%">
                                        <div class="bianhao jiage"></div>
                                    </td>
                                    <td width="6%">
                                        <div class="bianhao xiaoliang"></div>
                                    </td>
                                    <td width="7%" style="text-align: center; line-height: 105px;" class="createtime"></td>
                                    <td width="5%">
                                        <div class="bianhao yjbl"></div>
                                    </td>
                                    <td width="7%">
                                        <div class="bianhao addrecommend">
                                            <a href="javascript:void(0)">添加推荐</a>
                                        </div>
                                    </td>
                                    <td width="8%">
                                        <div class="bianhao addEveryDayTask">
                                            <a href="javascript:void(0)">添加每日任务</a>
                                        </div>
                                    </td>
                                    <td width="7%">
                                        <div class="anniu delete">
                                            <img src="image/dustbin.png">
                                        </div>
                                    </td>
                                    <td width="7%">
                                        <div class="anniu">
                                            <a key="" class="edit"><img src="image/bianji.png"></a>
                                        </div>
                                    </td>
                                </tr>
 
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="bottom">
                    <div class="qx">
                        <div class="checkbox">
                            <label> <input type="checkbox" class="checkAll" value="#">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;全选
                        </label>
                        </div>
                    </div>
                    <button class="btn btn-warning batchDel" type="button">批量删除</button>
                    <button class="btn btn-primary pl-addrecommend" type="button">添加推荐</button>
                    <button class="btn btn-primary pl-addEveryDayTask" type="button">添加每日任务</button>
 
                    <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>
        </div>
            
        <div id="tuijian" style="display: none;">
            <div style="align-content: center;"></div>
            <div class="row" style="margin-left: 10px;">
                <span style="float: left;">选择版块</span>
                <select class="col-lg-5">
                </select>
            </div>
            <div class="row" style="margin-top: 170px;margin-left: 230px;">
                    <button class="btn btn-info sure">确定</button>
                    <button class="btn btn-default cancel">取消</button>
            </div>
        </div>
        
        <div id="remen" style="display: none;">
            <div style="align-content: center;"></div>
            <div class="row" style="margin-left: 10px;">
                <span style="float: left;">选择分类</span>
                <select class="col-lg-5">
                </select>
            </div>
            <div class="row" style="margin-top: 170px;margin-left: 230px;">
                    <button class="btn btn-info sure">确定</button>
                    <button class="btn btn-default cancel">取消</button>
            </div>
        </div>
        
        <table style="display: none" id="msgTable" class="table table-bordered">
            <thead>
                <tr>
                    <td>商品ID</td>
                    <td>添加信息</td>
                </tr>        
            </thead>
            <tbody>
            </tbody>
        </table>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/page.js"></script>
        <script src="js/nav.js"></script>
        <script src="layer/layer.js"></script>
        <script src="js/utli.js"></script>
        <script>
            var trHtml;
            var resultTrHtml;
            var state=0;
            $(function(){
                
                var curpageIndex = getArgsFromHref(location.href,"page");
                if(curpageIndex==""){
                    curpageIndex=1;
                }
                trHtml=$(".liebiao tbody").html();
                resultTrHtml =  $(".search-result > table tbody").html();
                $(".liebiao tbody").empty();
                
                getGoodsListData(curpageIndex);
                
                $(".searchBtn").bind("click", function(){
                        state=0;
                        getGoodsListData(1);
                });
                
                $(".pl-addrecommend").bind("click",function(){
                    var arr ="";
                    var selectAll = $(".xuanze input[type='checkbox']").each(function() {
                        var cur = $(this);
                        var ck = this.checked;
                        if(ck) {
                            var val = cur.attr("key");
                            arr += val+",";
                        }
                    });
                    if(arr.length == 0) {
                            layer.msg("请先选择数据!");
                            return;
                    }
                    $("#tuijian .sure").attr("key",arr);
                    addRecommedSection();
                });
                
                
                
                
                
                //批量添加每日任务
                $(".pl-addEveryDayTask").bind("click", function() {
                    var arr = "";
                    var selectAll = $(".xuanze input[type='checkbox']").each(function() {
                        var cur = $(this);
                        var ck = this.checked;
                        if(ck) {
                            var val = cur.attr("key");
                            arr += val+",";
                        }
                        if(arr.length == 0) {
                            layer.msg("请先选择数据!");
                            return;
                        }
                        layer.confirm('是否批量添加今日任务?', {
                            btn: ['否', '是']
                        }, function(index) {
                            layer.close(index);
                            return false;
                        }, function() {
                            addEveryDayTask(arr);
                            $(".checkAll").prop("checked", false);
                        });
                    });
                });        
                
                
                
                
                $(".checkAll").bind("click", function() {
                    if(this.checked) {
                        $(".xuanze > label >input ").prop('checked', true)
                    } else {
                        $(".xuanze > label >input ").prop('checked', false)
                    }
                });
                
                $(".batchDel").bind("click", function() {
                    var arr = new Array();
                    var selectAll = $(".xuanze input[type='checkbox']").each(function() {
                        var cur = $(this);
                        var ck = this.checked;
                        if(ck) {
                            var val = cur.attr("key");
                            arr.push(val);
                        }
                        if(arr.length == 0) {
                            layer.msg("请先选择数据!");
                            return;
                        }
                        layer.confirm('是否批量删除?', {
                            btn: ['否', '是']
                        }, function(index) {
                            layer.close(index);
                            return false;
                        }, function() {
                            deleteTBGoodsClass(arr);
                            $(".checkAll").prop("checked", false);
                        });
                    });
                });    
                
                
            });
            function getGoodsListData(pageIndex){
                var lay = layer.load(0, {
                        'shade': false
                    });
                var searchText = $(".searchText").val();
                
                $.post("api/v1/taobao/getTBGoodsList",{"pageIndex":pageIndex,"key":searchText},function(data){
                    if(data.code==0){
                        setGoodsListData(pageIndex,data);
                        fillPage(data.data.pe, function(pageindex) {
                            getGoodsListData(pageindex);
                        });
                    }else{
                        layer.msg("加载出错");
                    }
                    layer.close(lay);
                },'json')
            }
            
            function getInvalidGoodsListData(pageIndex){
                var lay = layer.load(0, {
                        'shade': false
                    });
                $.post("api/v1/taobao/getInvalidTaoBaoGoods",{"pageIndex":pageIndex},function(data){
                    if(data.code==0){
                        setGoodsListData(pageIndex,data);
                        fillPage(data.data.pe, function(pageindex) {
                            getInvalidGoodsListData(pageindex);
                        });
                    }else{
                        layer.msg("加载出错");
                    }
                    layer.close(lay);
                },'json')
            }
            
            function setGoodsListData(index,data){
                $(".liebiao tbody").empty();
                    index = index - 1;
                    var pageSize = data.data.pe.pageSize;
                    var totalCount = data.data.pe.totalCount;
                    var len = (pageSize < totalCount - (index * pageSize)) ? pageSize : totalCount - (index * pageSize);
                    len = (index * pageSize) + len;
                    var tt = index * pageSize;
                    for(var ii = 0; tt < len && tt <  totalCount < pageSize; ii++, tt++) {
                        var taoBaoGoodsBrief = data.data.taoBaoGoodsBriefList[ii];
                        var id = taoBaoGoodsBrief.id;
                        var zkPrice = taoBaoGoodsBrief.zkPrice;
                        var xiaoliang = taoBaoGoodsBrief.biz30day;
                        var name = taoBaoGoodsBrief.title;
                        var auctionUrl = taoBaoGoodsBrief.auctionUrl;
                        var createtime = taoBaoGoodsBrief.createtime;
                        var picture = taoBaoGoodsBrief.pictUrl;
                        var tkRate = taoBaoGoodsBrief.tkRate;
                        $(".liebiao tbody").append(trHtml);
                        var $curTr = $(".liebiao tbody tr").eq(ii);
                        $curTr.find(".xuanze input").attr("key", id);
                        $curTr.find(".bianhaoid").text(id);
                        $curTr.find(".bianhaoname").text(name.replace("</span>","").replace("<span class=H>",""));
                        $curTr.find(".bianhaoname").attr("href",auctionUrl);
                        $curTr.find(".imgDiv > img").attr("src",picture);
                        $curTr.find(".jiage").text(zkPrice);
                        $curTr.find(".yjbl").text(tkRate+"%");
                        $curTr.find(".xiaoliang").text(xiaoliang);
//                        $curTr.find(".remen a").attr("href","fenlei-jinriremen.html?key="+id);
                        $curTr.find("td a").attr("key", id);
                        $curTr.find(".anniu").attr("key", id);
                        $curTr.find(".anniu .edit").attr("href", "edit-goods.html?key="+id+"&page="+(index+1));
//                        var mydate = new Date(parseInt(createtime)).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
                        $curTr.find(".createtime").text(createtime);
                    }
                    $(".liebiao tbody .delete").bind("click",function(){
                        var $obj=$(this);
                        layer.confirm('是否删除?', {
                            btn: ['否', '是']
                        }, function(index) {
                            layer.close(index);
                            return false;
                        }, function() {
                            var key  = $obj.attr("key");
                            var array = new Array();
                            array.push(key);
                            deleteTBGoodsClass(array);
                        });
                    });
                    
                    $(".addrecommend a").bind("click",function(){
                        
                        var curKey = $(this).attr("key");
                        $("#tuijian .sure").attr("key",curKey);
                        addRecommedSection();
                    });
                    
                    //添加每日任务
                    $(".addEveryDayTask a").bind("click",function(){
                        var $obj=$(this);
                        layer.confirm('是否添加到今日任务?', {
                            btn: ['否', '是']
                        }, function(index) {
                            layer.close(index);
                            return false;
                        }, function() {
                            var key  = $obj.attr("key");
                            var arr = new Array();
                            arr.push(key);
                            addEveryDayTask(arr);
                        });
                    });
                    
            }
            
            //添加每日任务 方法
            function addEveryDayTask(arr) {
                $.ajax({
                    type:"post",
                    url:"api/v1/taobao/addEveryDayTask",
                    async:true,
                    data:{"tbids":arr},
                    dataType:'json',
                    traditional: true, //阻止深度序列化
                    success:function(data){
                        if(data.code==0){
                            layer.msg("添加成功");
                        }else{
                            layer.msg("添加失败");
                        }
                        layer.close(sindex);
                    },
                    error:function(data){
                        layer.msg("添加失败");
                        layer.close(sindex);
                    }
                });
            }
            
            function addRecommedSection(){
                $.post("api/v1/section/getSectionAll",{},function(data){
                            if(data.code==0){
                                var recommendSectionList = data.data.recommendSectionList;
                                var $select=$("#tuijian").find("select");
                                $select.empty();
                                var len =recommendSectionList.length;
                                for(var mm=0;mm<len;mm++ ){
                                    var section = recommendSectionList[mm];
                                    var html="<option rs='"+section.id+"'>"+section.name+"</option>";
                                    $select.append(html);
                                }
                            }
                        },'json')
                        
                        layindex = layer.open({
                            type: 1,
                            title: '添加',
                            shadeClose: true,
                            shade: 0.8,
                            area: ['400px', '300px'],
                            content: $("#tuijian")
                        });
            }
            
            function addGoodsClass(){
                $.post("api/v1/goodsclass/getGoodsClasAll",{},function(data){
                            if(data.code==0){
                                var goodsClassList = data.data.goodsClassList;
                                var $select=$("#remen").find("select");
                                $select.empty();
                                var len =goodsClassList.length;
                                for(var mm=0;mm<len;mm++ ){
                                    var goodsClass = goodsClassList[mm];
                                    var html="<option gc='"+goodsClass.id+"'>"+goodsClass.name+"</option>";
                                    $select.append(html);
                                }
                            }
                        },'json')
                        
                        rindex = layer.open({
                            type: 1,
                            title: '添加',
                            shadeClose: true,
                            shade: 0.8,
                            area: ['400px', '300px'],
                            content: $("#remen")
                        });
            }
            
            function deleteTBGoodsClass(arr){
                    $.ajax({
                        type:"post",
                        url:"api/v1/taobao/deleteTaoBaoGoods",
                        async:true,
                        data:{"ids":arr},
                        dataType:'json',
                        traditional: true, //阻止深度序列化
                        success:function(data){
                            if(data.code==0){
                                layer.msg("删除成功");
                                if(state==1){
                                    getInvalidGoodsListData(1);
                                }else{
                                    getGoodsListData(1);
                                }
                            }else{
                                layer.msg("删除失败");
                            }
                        },
                        error:function(data){
                            layer.msg("删除失败");
                        }
                    });
                }
            
        </script>
        
        
        
        
        
        <script>
                $(function(){
                
                $(".xiajia").click(function(){
                    state=1;
                    getInvalidGoodsListData(1);
                });
                
                $(".updateBtn").click(function(){
                    layer.alert('正在更新...');
                    $.post("api/v1/taobao/updateAllTaoBaoGoods",{},function(data){
                        if(data.code==0){
                            layer.alert('更新成功!');
                        }else{
                            layer.alert('更新失败!');
                        }
                    },'json')
                });
                
                $(".add").click(function() {
                    var h = ($("body").height() * 0.8 ) +"px";
                    var w = ($("body").width() * 0.8 ) +"px";
                    layer.open({
                      type: 2, 
                      title: '添加商品',
                      btn:['确定','取消'],
                      yes:function(index){
                            var arr = new Array();
                            layer.getChildFrame('.liebiao .myck', index).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: [w,h],
                      content: "searchGoods.html"
                    }); 
                });
 
                
                //搜索点击
                $("#container-video .search button").click(function() {
                    var key = $("#container-video .search input").val();
                    var index = layer.load(0, {
                        'shade': false
                    });
                    var type = $(".tbclass option:checked").val();
                    $.post('api/v1/sectiongoods/searchTaoBaoGoodsList', {
                        'pageIndex':1,
                        'type':type,
                        'key': key
                    }, function(data) {
                        layer.close(index);
                        if(data.code == 0) {
                            var $rtbody = $(".search-result 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").text(obj.title);
                                $curtr.find(".r-id").text(obj.auctionId);
                                $curtr.find(".r-tupian > img").attr("src",obj.pictUrl);
                                $curtr.find(".r-jiage").text(obj.reservePrice);
                                $curtr.find(".r-youhuijuan").text(obj.couponInfo);
                                $curtr.find(".checkbox").attr("key",obj.auctionId);
                            });
                        
                            }
 
                    }, 'json');
                });
                
                $("#tuijian .cancel").click(function() {
                    layer.close(layindex);
                });
                
                $("#remen .cancel").click(function() {
                    layer.close(rindex);
                });
                
                $("#tuijian .sure").bind("click",function(){
                    
                    var $curOption =  $("#tuijian select option:selected");
                    var rsid = $curOption.attr("rs");
                    var key = $(this).attr("key");
                    layer.close(layindex);
                    var sindex = layer.load(1, {
                          shade: false 
                    });
                    $.post("api/v1/taobao/addRecommendSectionGoods",{"rsid": rsid,"tbids":key},function(data){
                        if(data.code==0){
                            setMsgInfo(data);
                            layer.close(sindex);
                        }
                    },'json');
                
                });
                
                $("#remen .sure").click(function() {
                    var $curOption =  $("#remen select option:selected");
                    var gcid = $curOption.attr("gc");
                    var key = $(this).attr("key");
                    layer.close(rindex);
                    var sindex = layer.load(1, {
                          shade: false 
                    });
                    $.post("api/v1/taobao/addClassRecommendGoods",{"gcid": gcid,"tbids":key},function(data){
                        if(data.code==0){
                            setMsgInfo(data);
                            layer.close(sindex);
                        }
                    },'json');
                });
 
            });
            
            function setMsgInfo(data){
                $("#msgTable tbody").empty();
                var list = data.data.list;
                var len =list.length;
                for (var ii=0;ii<len;ii++) {
                    var id = list[ii].id;
                    var msg = list[ii].msg;
                    var msgTrhtml="<tr><td>"+id+"</td><td>"+msg+"</td></tr>";
                    $("#msgTable tbody").append(msgTrhtml);
                }
                mindex = layer.open({
                        type: 1,
                        title: '信息',
                        shadeClose: true,
                        shade: 0.8,
                        btn:['取消'],
                        area: ['800px', '600px'],
                        content: $("#msgTable")
                    });
            }
            
            </script>
    </body>
 
</html>