移动系统liao
2024-05-29 71e821ab5e6b3014fac9b691d6957bcc09704b70
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
<title>货品表</title>
<!--当前位置开始-->
<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
        </script>
    </div>
</div>
<!--当前位置结束-->
<style>
    /* 重写样式 */
</style>
<script type="text/html" template lay-type="Post" lay-url="Api/CoreCmsbaifenProducts/GetIndex" lay-done="layui.data.done(d);">
    
</script>
<div class="table-body">
    <table  id="LAY-app-CoreCmsbaifenProducts-tableBox" lay-filter="LAY-app-CoreCmsbaifenProducts-tableBox"></table>
</div>
 
<script type="text/html" id="LAY-app-CoreCmsbaifenProducts-toolbar">
    <div class="layui-form coreshop-toolbar-search-form">
        <div class="layui-form-item">
            
            <div class="layui-inline">
                <label class="layui-form-label" for="id">货品序列</label>
                <div class="layui-input-inline">
                    <input type="text" name="id"  placeholder="请输入货品序列" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="category">商品分类</label>
                <div class="layui-input-inline" style="width: 200px;">                   
                    <div id="sel_category_ptindes555" class="ew-xmselect-tree"  lay-reqText="请选择商品分类"></div>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="name">商品名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="name"  placeholder="请输入商品名称关键字" class="layui-input">
                </div>
            </div>
            <!-- <div class="layui-inline">
                <label class="layui-form-label" for="barcode">商品条码</label>
                <div class="layui-input-inline">
                    <input type="text" name="barcode"  placeholder="请输入商品条码" class="layui-input">
                </div>
            </div> -->
            <div class="layui-inline">
                <label class="layui-form-label" for="sn">货品编码</label>
                <div class="layui-input-inline">
                    <input type="text" name="sn"  placeholder="请输入货品编码" class="layui-input">
                </div>
            </div>
            <!-- <div class="layui-inline">
                <label class="layui-form-label" for="price">货品价格</label>
                <div class="layui-input-inline">
                    <input type="text" name="price"  placeholder="请输入货品价格" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="costprice">货品成本价</label>
                <div class="layui-input-inline">
                    <input type="text" name="costprice"  placeholder="请输入货品成本价" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="mktprice">货品市场价</label>
                <div class="layui-input-inline">
                    <input type="text" name="mktprice"  placeholder="请输入货品市场价" class="layui-input">
                </div>
            </div> -->
            <div class="layui-inline">
                <label class="layui-form-label" for="marketable">是否上架</label>
                <div class="layui-input-inline">
                    <select name="marketable">
                        <option value="">请选择</option>
                        <option value="True">是</option>
                        <option value="False">否</option>
                    </select>
                </div>
            </div>
 
 
 
            <!-- <div class="layui-inline">
                <label class="layui-form-label" for="pointsDeduction">积分可抵扣金额</label>
                <div class="layui-input-inline">
                    <input type="text" name="pointsDeduction"  placeholder="请输入积分可抵扣金额" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="points">赠送积分</label>
                <div class="layui-input-inline">
                    <input type="text" name="points"  placeholder="请输入赠送积分" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="weight">重量(克)</label>
                <div class="layui-input-inline">
                    <input type="text" name="weight"  placeholder="请输入重量(克)" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="stock">库存</label>
                <div class="layui-input-inline">
                    <input type="text" name="stock"  placeholder="请输入库存" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="freezeStock">冻结库存</label>
                <div class="layui-input-inline">
                    <input type="text" name="freezeStock"  placeholder="请输入冻结库存" class="layui-input">
                </div>
            </div> -->
            <div class="layui-inline">
                <label class="layui-form-label" for="spesDesc">规格值</label>
                <div class="layui-input-inline">
                    <input type="text" name="spesDesc"  placeholder="请输入规格值" class="layui-input">
                </div>
            </div>
            <!-- <div class="layui-inline">
                <label class="layui-form-label" for="isDefalut">是否默认货品</label>
                <div class="layui-input-inline">
                    <select name="isDefalut">
                        <option value="">请选择</option>
                        <option value="True">是</option>
                        <option value="False">否</option>
                    </select>
                </div>
            </div> -->
            <!-- <div class="layui-inline">
                <label class="layui-form-label" for="images">规格图片</label>
                <div class="layui-input-inline">
                    <input type="text" name="images"  placeholder="请输入规格图片" class="layui-input">
                </div>
            </div> -->
            <!-- <div class="layui-inline">
                <label class="layui-form-label" for="isDel">是否删除</label>
                <div class="layui-input-inline">
                    <select name="isDel">
                        <option value="">请选择</option>
                        <option value="True">是</option>
                        <option value="False">否</option>
                    </select>
                </div>
            </div> -->
            <!-- <div class="layui-inline">
                <label class="layui-form-label" for="distributionPrice"></label>
                <div class="layui-input-inline">
                    <input type="text" name="distributionPrice"  placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="cutMoney"></label>
                <div class="layui-input-inline">
                    <input type="text" name="cutMoney"  placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" for="distributionCutMoney"></label>
                <div class="layui-input-inline">
                    <input type="text" name="distributionCutMoney"  placeholder="请输入" class="layui-input">
                </div>
            </div> -->
            <div class="layui-inline">
                <label class="layui-form-label" for="isCustomizable">是否支持定制</label>
                <div class="layui-input-inline">
                    <select name="isCustomizable">
                        <option value="">请选择</option>
                        <option value="True">是</option>
                        <option value="False">否</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsbaifenProducts-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
            </div>
        </div>
    </div>
</script>
 
<script type="text/html" id="LAY-app-CoreCmsbaifenProducts-pagebar">
    <div class="layui-btn-container">
        <!-- <button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button> -->
        <!-- <button class="layui-btn layui-btn-sm" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i>批量删除</button> -->
        <button class="layui-btn layui-btn-sm" lay-event="selectExportExcel"><i class="layui-icon layui-icon-add-circle"></i>选择导出</button>
        <button class="layui-btn layui-btn-sm" lay-event="queryExportExcel"><i class="layui-icon layui-icon-download-circle"></i>查询导出</button>
    </div>
</script>
 
<script type="text/html" id="LAY-app-CoreCmsbaifenProducts-tableBox-bar">
    <!-- <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a> -->
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <!-- <a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsbaifenProductsTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a> -->
    <div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsbaifenProductsTbDelDrop{{d.LAY_INDEX}}"
         style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
        <div class="dropdown-anchor"></div>
        <div class="dropdown-popconfirm-title">
            <i class="layui-icon layui-icon-help"></i>
            确定要删除吗?
        </div>
        <div class="dropdown-popconfirm-btn" >
            <a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
            <a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
        </div>
    </div>
</script>
 
<script>
    var indexData;
    var debug= layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d); }
 
        indexData = d.data .data
 
  
        if (debug) { console.log(indexData); }
        layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper','xmSelect'],
            function () {
                var $ = layui.$
                    , admin = layui.admin
                    , table = layui.table
                    , form = layui.form
                    , laydate = layui.laydate
                    , setter = layui.setter
                    , coreHelper = layui.coreHelper
                    ,xmSelect = layui.xmSelect
                    , util = layui.util
                    , view = layui.view;
                
                var searchwhere;
                //监听搜索
                form.on('submit(LAY-app-CoreCmsbaifenProducts-search)',
                    function(data) {
                        var field = data.field;
                        searchwhere = field;
                        debugger
                        //执行重载
                        table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox',{ where: field });
                    });
 
                //数据绑定
                table.render({
                    elem: '#LAY-app-CoreCmsbaifenProducts-tableBox',
                    url: layui.setter.apiUrl + 'Api/CoreCmsbaifenProducts/GetPageList',
                    method: 'POST',
                    toolbar: '#LAY-app-CoreCmsbaifenProducts-toolbar',
                    pagebar: '#LAY-app-CoreCmsbaifenProducts-pagebar',
                    className: 'pagebarbox',
                    defaultToolbar: ['filter', 'print', 'exports'],
                    height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
                    page: true,
                    limit: 30,
                    limits: [10, 15, 20, 25, 30, 50, 100, 200],
                    text: {none: '暂无相关数据'},
                    cols: [
                        [
                            { type: "checkbox", fixed: "left" },    
                            { field: 'category', title: '商品分类', sort: false,width: 240 },                      
                            { field: 'name', title: '商品名称', sort: false,width: 240 },
                            { field: 'barcode', title: '商品条码', sort: false,width: 132 },
                            { field: 'spesDesc', title: '规格值', sort: false,width: 240 },
                            { field: 'sn', title: '货品编码', sort: false,width: 132 },
                            { field: 'images', title: '货品图片', width: 100, sort: false,
                                templet: function (d) {
                                    if (d.images) {
                                        return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.images + '")><image style="max-width:28px;max-height:28px;" src="' + d.images + '"/></a>';
                                    } else {
                                        return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + setter.noImagePicUrl + '")><image style="max-width:30px;max-height:30px;" src="' + setter.noImagePicUrl + '"/></a>';
                                    }
                                }
                            },
                            { field: 'mktprice', title: '建议零售价', sort: false,width: 105 },    
                            { field: 'price', title: '价格', sort: false,width: 105 },
 
                            { field: 'costprice', title: '成本价', sort: false,width: 105 },
                                                    
                            // { field: 'pointsDeduction', title: '积分可抵扣金额', sort: false,width: 105 },
                            { field: 'distributionPrice', title: '经销商价格', sort: false,width: 105 },
                            { field: 'distributionCutMoney', title: '推广经销商采购返现', sort: false,width: 140 },
                            { field: 'cutMoney', title: '推广用户购买返现', sort: false,width: 135 },
                           
                            // { field: 'marketable', title: '是否上架', width: 95, templet: '#switch_marketable', sort: false , unresize: true},
                            // { field: 'points', title: '赠送积分', sort: false,width: 105 },
                            { field: 'weight', title: '重量(克)', sort: false,width: 105 },
                            // { field: 'stock', title: '库存', sort: false,width: 105 },
                            // { field: 'freezeStock', title: '冻结库存', sort: false,width: 105 },
                        
                            // { field: 'isDefalut', title: '是否默认货品', width: 95, templet: '#switch_isDefalut', sort: false , unresize: true},
                            
                            // { field: 'isDel', title: '是否删除', width: 95, templet: '#switch_isDel', sort: false , unresize: true},
                            { field: 'isCustomizable', title: '是否支持定制', width: 100, sort: false,
                                templet: function (d) {
                                    if (d.isCustomizable==true) {
                                        return '<span style="color: red;">是</span>';
                                    } else {
                                        return '<span>否</span>';
                                    }
                                }
                            },
                            { width: 162, align: 'center', title:'操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsbaifenProducts-tableBox-bar' }
                        ]
                    ]
                });
                
            xmSelect.render({
                    el: '#sel_category_ptindes555',
                    height: '250px',
                    data: indexData,
                    //initValue: mData ? [mData.parentId] : [],
                    //model: { label: { type: 'text' } },
                    name: 'categoryId',
                    prop: {
                        name: 'title',
                        value: 'id'
                    },                
                    radio: true,
                    clickClose: true,
                    tree: {
                        show: true,
                        indent: 15,
                        strict: false,
                        expandedKeys: true
                    }
                });
                //监听排序事件
                table.on('sort(LAY-app-CoreCmsbaifenProducts-tableBox)', function(obj){
                    table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox', {
                        initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
                        where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
                            orderField: obj.field, //排序字段
                            orderDirection: obj.type //排序方式
                        }
                    });
                });
                //监听行双击事件
                // table.on('rowDouble(LAY-app-CoreCmsbaifenProducts-tableBox)', function (obj) {
                //     //查看详情
                //     doDetails(obj);
                // });
                //头工具栏事件
                table.on('pagebar(LAY-app-CoreCmsbaifenProducts-tableBox)', function (obj) {
                    var checkStatus = table.checkStatus(obj.config.id);
                    switch (obj.event) {
                    case 'addData':
                        doCreate();
                        break;
                    case 'batchDelete':
                        doBatchDelete(checkStatus);
                        break;
                    case 'selectExportExcel':
                        doSelectExportExcel(checkStatus);
                        break;
                    case 'queryExportExcel':
                        doQueryExportexcel();
                        break;
                    };
                });
                //监听工具条
                table.on('tool(LAY-app-CoreCmsbaifenProducts-tableBox)',
                    function(obj) {
                        if (obj.event === 'detail') {
                            doDetails(obj);
                        } else if (obj.event === 'del') {
                            doDelete(obj);
                        } else if (obj.event === 'edit') {
                            doEdit(obj)
                        }
                    });
                //执行创建操作
                function doCreate(){
                    coreHelper.Post("Api/CoreCmsbaifenProducts/GetCreate", null, function (e) {
                            if (e.code === 0) {
                                admin.popup({
                                    shadeClose: false,
                                    title: '创建数据',
                                    area: ['1200px', '90%'],
                                    id: 'LAY-popup-CoreCmsbaifenProducts-create',
                                    success: function (layero, index) {
                                        view(this.id).render('baifenbingfa/corecmsproducts/create', { data: e.data }).done(function () {
                                            //监听提交
                                            form.on('submit(LAY-app-CoreCmsbaifenProducts-createForm-submit)',
                                                function(data) {
                                                    var field = data.field; //获取提交的字段
                                                    
                                                    field.marketable = field.marketable == 'on';
                                                    field.isDefalut = field.isDefalut == 'on';
                                                    field.isDel = field.isDel == 'on';
 
                                                    if (debug) { console.log(field); } //开启调试返回数据
                                                    //提交 Ajax 成功后,关闭当前弹层并重载表格
                                                    coreHelper.Post("Api/CoreCmsbaifenProducts/DoCreate", field, function (e) {
                                                            console.log(e)
                                                            if (e.code === 0) {
                                                                layui.table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox'); //重载表格
                                                                layer.close(index); //再执行关闭
                                                                layer.msg(e.msg);
                                                            } else {
                                                                layer.msg(e.msg);
                                                            }
                                                        });
                                                });
                                        });
                                        // 禁止弹窗出现滚动条
                                        $(layero).children('.layui-layer-content').css('overflow', 'visible');
                                    }
                                    , btn: ['确定', '取消']
                                    , yes: function (index, layero) {
                                        layero.contents().find("#LAY-app-CoreCmsbaifenProducts-createForm-submit").click();
                                    }
                                });
                            } else {
                                layer.msg(e.msg);
                            }
                        });
                }
                //执行编辑操作
                function doEdit(obj){
                    coreHelper.Post("Api/CoreCmsbaifenProducts/GetEdit", {id:obj.data.id}, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '编辑数据',
                                area: ['1200px', '90%'],
                                id: 'LAY-popup-CoreCmsbaifenProducts-edit',
                                success: function (layero, index) {
                                    view(this.id).render('baifenbingfa/corecmsproducts/edit', { data: e.data }).done(function () {
                                        //监听提交
                                        form.on('submit(LAY-app-CoreCmsbaifenProducts-editForm-submit)',
                                            function(data) {
                                                var field = data.field; //获取提交的字段
                                                
                                                // field.marketable = field.marketable == 'on';
                                                // field.isDefalut = field.isDefalut == 'on';
                                                // field.isDel = field.isDel == 'on';
                                                if(field.isCustomizable=='on')
                                                {
                                                    field.isCustomizable=true
                                                }
                                                else
                                                {
                                                    field.isCustomizable=false
                                                }
 
                                                if (debug) { console.log(field); } //开启调试返回数据
                                                //提交 Ajax 成功后,关闭当前弹层并重载表格
                                                coreHelper.Post("Api/CoreCmsbaifenProducts/DoEdit", field, function (e) {
                                                        console.log(e)
                                                        if (e.code === 0) {
                                                            layui.table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox'); //重载表格
                                                            layer.close(index); //再执行关闭
                                                            layer.msg(e.msg);
                                                        } else {
                                                            layer.msg(e.msg);
                                                        }
                                                    });
                                            });
                                    })
                                    // 禁止弹窗出现滚动条
                                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                                }
                                 , btn: ['确定', '取消']
                                , yes: function (index, layero) {
                                     layero.contents().find("#LAY-app-CoreCmsbaifenProducts-editForm-submit").click();
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                }
                //执行预览操作
                function doDetails(obj) {
                    coreHelper.Post("Api/CoreCmsbaifenProducts/GetDetails", { id: obj.data.id }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '查看详情',
                                area: ['1200px', '90%'],
                                id: 'LAY-popup-CoreCmsbaifenProducts-details',
                                success: function (layero, index) {
                                    view(this.id).render('baifenbingfa/corecmsproducts/details', { data: e.data }).done(function () {
                                        form.render();
                                    });
                                    // 禁止弹窗出现滚动条
                                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                }
                //执行单个删除
                function doDelete(obj){
                    coreHelper.Post("Api/CoreCmsbaifenProducts/DoDelete", { id: obj.data.id }, function (e) {
                            if (debug) { console.log(e); } //开启调试返回数据
                            table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox');
                            layer.msg(e.msg);
                        });
                }
                //执行批量删除
                function doBatchDelete(checkStatus){
                    var checkData = checkStatus.data;
                    if (checkData.length === 0) {
                        return layer.msg('请选择要删除的数据');
                    }
                    layer.confirm('确定删除吗?删除后将无法恢复。',
                        function(index) {
                            var delidsStr = [];
                            layui.each(checkData,
                                function(index, item) {
                                    delidsStr.push(item.id);
                                });
                            coreHelper.Post("Api/CoreCmsbaifenProducts/DoBatchDelete", { id: delidsStr }, function (e) {
                                    if (debug) { console.log(e); } //开启调试返回数据
                                    table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox');
                                    layer.msg(e.msg);
                                });
                        });
                }
                //执行查询条件导出excel
                function doQueryExportexcel(){
                    layer.confirm('确定根据当前的查询条件导出数据吗?',
                        function(index) {
                            var field = searchwhere;
                            coreHelper.PostForm("Api/CoreCmsbaifenProducts/QueryExportExcel", field, function (e) {
                                    if (debug) { console.log(e); } //开启调试返回数据
                                    if (e.code === 0) {
                                        window.open(e.data);
                                    } else {
                                        layer.msg(e.msg);
                                    }
                                });
                        });
                }
                //执行选择目录导出数据
                function doSelectExportExcel(checkStatus){
                    var checkData = checkStatus.data;
                    if (checkData.length === 0) {
                        return layer.msg('请选择您要导出的数据');
                    }
                    layer.confirm('确定导出选择的内容吗?',
                        function(index) {
                            var delidsStr = [];
                            layui.each(checkData,
                                function(index, item) {
                                    delidsStr.push(item.id);
                                });
                            layer.close(index);
                            coreHelper.Post("Api/CoreCmsbaifenProducts/SelectExportExcel", { id: delidsStr }, function (e) {
                                    if (debug) { console.log(e); } //开启调试返回数据
                                    if (e.code === 0) {
                                        window.open(e.data);
                                    } else {
                                        layer.msg(e.msg);
                                    }
                                });
                        });
                }
 
                
 
                //监听 表格复选框操作
                
                layui.form.on('switch(switch_marketable)', function (obj) {
                    coreHelper.Post("Api/CoreCmsbaifenProducts/DoSetmarketable", { id: this.value, data: obj.elem.checked }, function (e) {
                        if (debug) { console.log(e); } //开启调试返回数据
                        //table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox');
                        layer.msg(e.msg);
                    });
                });
                
                layui.form.on('switch(switch_isDefalut)', function (obj) {
                    coreHelper.Post("Api/CoreCmsbaifenProducts/DoSetisDefalut", { id: this.value, data: obj.elem.checked }, function (e) {
                        if (debug) { console.log(e); } //开启调试返回数据
                        //table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox');
                        layer.msg(e.msg);
                    });
                });
                
                layui.form.on('switch(switch_isDel)', function (obj) {
                    coreHelper.Post("Api/CoreCmsbaifenProducts/DoSetisDel", { id: this.value, data: obj.elem.checked }, function (e) {
                        if (debug) { console.log(e); } //开启调试返回数据
                        //table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox');
                        layer.msg(e.msg);
                    });
                });
                
 
                //重载form
                form.render();
            });
    };
</script>
 
<!--设置是否上架-->
<script type="text/html" id="switch_marketable">
    <input type="checkbox" name="switch_marketable" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_marketable" {{ d.marketable ? 'checked' : '' }}>
</script>
 
<!--设置是否默认货品-->
<script type="text/html" id="switch_isDefalut">
    <input type="checkbox" name="switch_isDefalut" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isDefalut" {{ d.isDefalut ? 'checked' : '' }}>
</script>
 
<!--设置是否删除-->
<script type="text/html" id="switch_isDel">
    <input type="checkbox" name="switch_isDel" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isDel" {{ d.isDel ? 'checked' : '' }}>
</script>