移动系统liao
2024-04-26 9496fec9e6054f6af6b5ddcc81a808f77f041d1d
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
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
<title>订单表</title>
<style>
    .layui-tab-content { padding: 0; }
    .table-body .layui-btn .iconfont { font-size: 17px !important; }
    .table-body { background-color: #fff; margin: 5px; padding: 0px; border: 0px solid #e6e6e6; }
    .layui-card-body { background-color: #fff; padding: 0px; margin: 5px; border: 0px solid #e6e6e6; }
    .layui-tab-content { padding: 5px; }
    .layui-table,
    .layui-table-view { margin: 0; }
    .cursor { cursor: pointer; }
    .coreshop-toolbar-search-form { border: 0px solid #e6e6e6; padding: 10px; margin: 10px 10px 0 10px; }
    .layui-tab-card { border-width: 1px; border-style: solid; border-radius: 0px; box-shadow: none; }
</style>
<script type="text/html" template lay-type="Post" lay-url="{{ layui.setter.apiUrl }}Api/CoreCmsOrder/GetIndex" lay-done="layui.data.done(d);">
    <div class="layui-card-body">
        <div class="layui-tab  layui-tab-card order-tab-card" lay-filter="order-tab">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="all">全部订单<span class="layui-badge layui-bg-green" id="countAll">{{d.data.all}}</span></li>
                <li lay-id="payment">待支付<span class="layui-badge layui-bg-danger" id="countPayment">{{d.data.payment}}</span></li>
                <li lay-id="delivered">待发货<span class="layui-badge layui-bg-black" id="countDelivered">{{d.data.delivered}}</span></li>
                <li lay-id="receive">待收货<span class="layui-badge layui-bg-blue" id="countReceive">{{d.data.receive}}</span></li>
                <!--<li lay-id="evaluated">已评价<span class="layui-badge layui-bg-orange" id="countNoevaluat">{{d.data.evaluated}}</span></li>-->
                <li lay-id="noevaluat">待评价<span class="layui-badge layui-bg-orange" id="countNoevaluat">{{d.data.noevaluat}}</span></li>
                <li lay-id="cancel">已取消<span class="layui-badge layui-bg-cyan" id="countCancel">{{d.data.cancel}}</span></li>
                <li lay-id="complete">已完成<span class="layui-badge layui-bg-gray" id="countComplete">{{d.data.complete}}</span></li>
                <li lay-id="delete">已删除<span class="layui-badge layui-bg-red" id="countDelete">{{d.data.delete}}</span></li>
            </ul>
            <!--<div style="position: absolute;top: 7px;right: 10px;">
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-sm" lay-active="payOrderArray">批量支付</button>
                    <button class="layui-btn layui-btn-sm" lay-active="shipOrderArray">合并发货</button>
                    <button class="layui-btn layui-btn-sm" lay-active="batchCancelOrder">取消订单</button>
                    <button class="layui-btn layui-btn-sm" lay-active="batchDeleteOrder">批量删除</button>
                </div>
            </div>-->
            <div class="layui-tab-content order-table">
                <table id="LAY-app-CoreCmsOrder-tableBox" lay-filter="LAY-app-CoreCmsOrder-tableBox" lay-data="{id:'order'}"></table>
            </div>
        </div>
    </div>
</script>
 
<script type="text/html" id="LAY-app-CoreCmsOrder-pagebar">
    <div class="layui-btn-container">
        <!-- <button class="layui-btn layui-btn-sm" lay-event="payOrderArray"><i class="layui-icon layui-icon-cart"></i>批量支付</button> -->
        <button class="layui-btn layui-btn-sm" lay-event="shipOrderArray"><i class="layui-icon layui-icon-templeate-1"></i>合并发货</button>
        <button class="layui-btn layui-btn-sm" lay-event="batchCancelOrder"><i class="layui-icon layui-icon-close"></i>取消订单</button>
        <button class="layui-btn layui-btn-sm" lay-event="batchDeleteOrder"><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 layui-btn-normal" lay-event="queryExportExcel"><i class="layui-icon layui-icon-download-circle"></i>导出查询结果</button>
    </div>
</script>
 
<script type="text/html" id="LAY-app-CoreCmsOrder-toolbar">
    <div class="layui-form  coreshop-toolbar-search-form order-form">
        <div class="layui-form-item">
 
            <div class="layui-row">
                <div class="layui-col-md12">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="orderType" id="orderType">
                                <option value="">请选择订单类型</option>
                                {{# layui.each(indexData.orderType, function(index, item){ }}
                                <option value="{{ item.value }}">{{ item.description }}</option>
                                {{# }); }}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="source" id="source">
                                <option value="">请选择订单来源</option>
                                {{# layui.each(indexData.source, function(index, item){ }}
                                <option value="{{ item.value }}">{{ item.description }}</option>
                                {{# }); }}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="status" id="status">
                                <option value="">请选择订单状态</option>
                                {{# layui.each(indexData.orderStatus, function(index, item){ }}
                                <option value="{{ item.value }}">{{- item.description }}</option>
                                {{# }); }}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="payStatus" id="payStatus">
                                <option value="">请选择付款状态</option>
                                {{# layui.each(indexData.payStatus, function(index, item){ }}
                                <option value="{{ item.value }}">{{ item.description }}</option>
                                {{# }); }}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="shipStatus" id="shipStatus">
                                <option value="">请选择发货状态</option>
                                {{# layui.each(indexData.shipStatus, function(index, item){ }}
                                <option value="{{ item.value }}">{{ item.description }}</option>
                                {{# }); }}
                            </select>
                        </div>
                    </div>
 
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="receiptType" id="shipStatus">
                                <option value="">请选择订单属性</option>
                                {{# layui.each(indexData.receiptType, function(index, item){ }}
                                <option value="{{ item.value }}">{{- item.description }}</option>
                                {{# }); }}
                            </select>
                        </div>
                    </div>
 
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="paymentCode" id="paymentCode">
                                <option value="">请选择支付方式</option>
                                {{# layui.each(indexData.paymentCode, function(index, item){ }}
                                <option value="{{ item.title }}">{{ item.description }}</option>
                                {{# }); }}
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-md12">
                    <div class="layui-inline layui-input-wrap">
                        <div class="layui-input-inline">
                            <input type="text" name="orderId" id="orderId" placeholder="请输入订单号" class="layui-input" lay-affix="clear">
                        </div>
                    </div>
                    <div class="layui-inline layui-input-wrap">
                        <div class="layui-input-inline">
                            <input type="text" name="goodName" id="goodName" placeholder="请输入商品名称" class="layui-input" lay-affix="clear">
                        </div>
                    </div>
                    <div class="layui-inline layui-input-wrap">
                        <div class="layui-input-inline">
                            <input type="text" name="goodSn" id="goodSn" placeholder="请输入商品编码" class="layui-input" lay-affix="clear">
                        </div>
                    </div>
                    <div class="layui-inline layui-input-wrap">
                        <div class="layui-input-inline">
                            <input type="text" name="shipName" id="shipName" placeholder="请输入收货人姓名" class="layui-input" lay-affix="clear">
                        </div>
                    </div>
                    <div class="layui-inline layui-input-wrap">
                        <div class="layui-input-inline">
                            <input type="text" name="shipMobile" id="shipMobile" placeholder="请输入收货电话" class="layui-input" lay-affix="clear">
                        </div>
                    </div>
                    <div class="layui-inline layui-input-wrap">
                        <div class="layui-input-inline">
                            <input type="text" name="shipAddress" id="shipAddress" placeholder="请输入收货地址" class="layui-input" lay-affix="clear">
                        </div>
                    </div>
                    <div class="layui-inline layui-input-wrap">
                        <div class="layui-input-inline core-time-input">
                            <input type="text" name="createTime" id="searchTime-CoreCmsOrder-createTime" placeholder="请选择时间" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsOrder-search" id="LAY-app-CoreCmsOrder-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
                    </div>
                </div>
            </div>
 
        </div>
    </div>
</script>
 
<div id="printImageBox" style="display: none;"></div>
 
 
<script src="/lib/render-html-to-pdf/html2canvas.js"></script>
<script src="/lib/render-html-to-pdf/jsPdf.debug.js"></script>
 
<script>
    var CreatedOKLodopObject, CLodopIsLocal, CLodopJsState;
    var LODOP;
    var $;
    var indexData;
    var debug = layui.setter.debug;
    var orderStatus = [];
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d); }
        indexData = d.data;
        layui.use(['index', 'table', 'laydate', 'util', 'coreHelper', 'element'],
            function () {
                $ = layui.$;
                var admin = layui.admin
                    , table = layui.table
                    , form = layui.form
                    , laydate = layui.laydate
                    , setter = layui.setter
                    , coreHelper = layui.coreHelper
                    , element = layui.element
                    , util = layui.util
                    , view = layui.view;
 
                orderStatus = d.data.orderStatus;
 
                var searchwhere = {};
                //监听搜索
                form.on('submit(LAY-app-CoreCmsOrder-search)',
                    function (data) {
                        var tempfilter = $.extend({}, searchwhere, data.field);//合并tab筛选和普通搜索
                        searchwhere = tempfilter;
                        //执行重载
                        table.reloadData('LAY-app-CoreCmsOrder-tableBox', { where: tempfilter });
                    });
 
                //tab切换事件
                element.on('tab(order-tab)', function (data) {
                    var type = this.getAttribute('lay-id');
                    if (type === 'all') {
                        searchwhere.orderUnifiedStatus = 0;
                    } else if (type === 'payment') {
                        searchwhere.orderUnifiedStatus = 1;
                    } else if (type === 'delivered') {
                        searchwhere.orderUnifiedStatus = 2;
                    } else if (type === 'receive') {
                        searchwhere.orderUnifiedStatus = 3;
                    } else if (type === 'evaluated') {
                        searchwhere.orderUnifiedStatus = 4;
                    } else if (type === 'noevaluat') {
                        searchwhere.orderUnifiedStatus = 5;
                    } else if (type === 'cancel') {
                        searchwhere.orderUnifiedStatus = 7;
                    } else if (type === 'complete') {
                        searchwhere.orderUnifiedStatus = 6;
                    } else if (type === 'delete') {
                        searchwhere.orderUnifiedStatus = 999;
                    }
                    var basefilter = $(".coreshop-toolbar-search-form").serializeArray();
                    $.each(basefilter, function (i, obj) {
                        if (!searchwhere.hasOwnProperty(obj.name)) {
                            searchwhere[obj.name] = obj.value;
                        }
                    });
                    table.reloadData('LAY-app-CoreCmsOrder-tableBox', {
                        where: searchwhere,
                        page: { curr: 1 }
                    });
                });
 
                //数据绑定
                table.render({
                    //id: 'orderTable',
                    elem: '#LAY-app-CoreCmsOrder-tableBox',
                    url: layui.setter.apiUrl + 'Api/CoreCmsOrder/GetPageList',
                    method: 'POST',
                    height: 'full-150', //无面包屑127,搜索框189,1行62
                    //lineStyle: 'min-height: 100px;',
                    toolbar: '#LAY-app-CoreCmsOrder-toolbar',
                    pagebar: '#LAY-app-CoreCmsOrder-pagebar',
                    className: 'pagebarbox',
                    defaultToolbar: null,
                    page: true,
                    even: false,
                    totalRow: true,
                    limit: 30,
                    limits: [10, 15, 20, 25, 30, 50, 100, 200],
                    text: { none: '暂无相关数据' },
                    cols: [
                        [
                            { type: 'checkbox' },
                            {
                                field: 'operating', title: '操作', width: 90, align: 'center', templet: function (data) {
                                    return data.operating;
                                }
                            },
                            {
                                field: 'orderId',
                                title: '订单号',
                                width: 120,
                                align: 'center',
                                templet: function (data) {
                                    if (data.mark) {
                                        return "<span style='color:#FF7159;' title=" + data.mark + ">" + data.orderId + "</span><br>备注:" + data.mark;
                                    } else {
                                        return data.orderId;
                                    }
                                }
                            },
                            { field: 'orderAmount', title: '订单总额', width: 120, align: 'center', templet: '#orderAmount', totalRow: true },
                            {
                                field: 'item', title: '货品', align: 'center', width: 330, templet: "#orderItems"
                            },
                            {
                                field: 'orderAmount',
                                title: '类型',
                                width: 60,
                                align: 'center',
                                templet: function (data) {
                                    for (var i = 0; i < d.data.orderType.length; i++) {
                                        if (data.orderType == d.data.orderType[i].value) {
                                            return d.data.orderType[i].description;
                                        }
                                    }
                                    return "";
                                }
                            },
                            {
                                field: 'orderId',
                                title: '打印',
                                align: 'center',
                                width: 80,
                                templet: function (data) {
                                    var html = '';// '<a class="layui-btn  layui-btn-warm layui-btn-xs" lay-active="shoppingPrintCloud" data-id="' + data.orderId + '" class="cursor">打小票单</a><br>';
                                    html += '<a class="layui-btn layui-btn-primary layui-btn-xs" lay-active="shoppingPrint" data-id="' + data.orderId + '" class="cursor">打购物单</a><br>';
                                    html += '<a class="layui-btn layui-btn-primary layui-btn-xs" lay-active="distributionPrint" data-id="' + data.orderId + '" class="cursor">打配送单</a><br>';
                                    html += '<a class="layui-btn layui-btn-primary layui-btn-xs" lay-active="unionPrint" data-id="' + data.orderId + '" class="cursor">打联合单</a><br>';
                                    return html;
                                }
                            },
                            { field: 'createTime', title: '下单时间/支付时间', width: 150, align: 'center', templet: '#orderTime' },
                            //{ field: 'paymentTime', title: '付款时间', width: 130, align: 'center' },
                            //{ field: 'paymentTime', title: '付款时间', width: 130, align: 'center' },
                            {
                                field: 'StatusText',
                                title: '订单状态',
                                width: 80,
                                align: 'center',
                                templet: function (data) {
                                    var html = '';
                                    for (var i = 0; i < d.data.orderStatus.length; i++) {
                                        if (data.status == d.data.orderStatus[i].value) {
                                            html += d.data.orderStatus[i].description;
                                        }
                                    }
                                    return html;
                                }
                            },
                            //{
                            //    field: 'payStatus',
                            //    title: '支付状态',
                            //    width: 65,
                            //    align: 'center',
                            //    templet: function (data) {
                            //        for (var i = 0; i < d.data.payStatus.length; i++) {
                            //            if (data.payStatus == d.data.payStatus[i].value) {
                            //                return d.data.payStatus[i].description;
                            //            }
                            //        }
                            //        return "";
                            //    }
                            //},
                            {
                                field: 'paymentCode',
                                title: '支付方式',
                                width: 65,
                                align: 'center',
                                templet: function (data) {
                                    for (var i = 0; i < d.data.paymentCode.length; i++) {
                                        if (data.paymentCode == d.data.paymentCode[i].title) {
                                            return d.data.paymentCode[i].description;
                                        }
                                    }
                                    return "";
                                }
                            },
                            {
                                field: 'shipStatus',
                                title: '发货状态',
                                width: 65,
                                align: 'center',
                                templet: function (data) {
                                    for (var i = 0; i < d.data.shipStatus.length; i++) {
                                        if (data.shipStatus == d.data.shipStatus[i].value) {
                                            return d.data.shipStatus[i].description;
                                        }
                                    }
                                    return "";
                                }
                            }, {
                                field: 'confirmStatus',
                                title: '收货状态',
                                width: 80,
                                align: 'center',
                                templet: function (data) {
                                    for (var i = 0; i < d.data.confirmStatus.length; i++) {
                                        if (data.confirmStatus == d.data.confirmStatus[i].value) {
                                            return d.data.confirmStatus[i].description;
                                        }
                                    }
                                    return "";
                                }
                            },
                            {
                                field: 'storeId',
                                title: '订单属性',
                                width: 80,
                                align: 'center',
                                templet: function (data) {
                                    for (var i = 0; i < d.data.receiptType.length; i++) {
                                        if (data.receiptType == d.data.receiptType[i].value) {
                                            return d.data.receiptType[i].description;
                                        }
                                    }
                                    return "";
                                }
                            },
                            {
                                field: 'afterSaleStatus',
                                title: '售后状态',
                                width: 75,
                                align: 'center',
                                templet: function (data) {
                                    return '<a style="color:red">' + data.afterSaleStatus + '</a>';
                                }
                            },
                            {
                                field: 'shipMobile', title: '地址', width: 350, align: 'left', templet: "#orderShip"
                            },
                            //{
                            //    field: 'userNickName',
                            //    title: '来源',
                            //    width: 120,
                            //    align: 'left',
                            //},
                            //{
                            //    field: 'source', title:
                            //        '订单来源', width:
                            //        80, align:
                            //        'center', templet:
                            //        function (data) {
                            //            for (var i = 0; i < d.data.source.length; i++) {
                            //                if (data.source == d.data.source[i].value) {
                            //                    return d.data.source[i].description;
                            //                }
                            //            }
                            //            return "";
                            //        }
                            //}
                        ]
                    ]
                });
                //重载form
                form.render();
                //处理属性 为 lay-active 的所有元素事件
                layui.util.event('lay-active', {
                    //查看
                    viewOrder: function () {
                        var id = $(this).attr('data-id');
                        viewOrder(id);
                    },
                    //支付
                    payOrder: function () {
                        var id = $(this).attr('data-id');
                        doPayOrder(id, 0);
                    },
                    //发货
                    shipOrder: function () {
                        var id = $(this).attr('data-id');
                        doShip(id, 1);
                    },
                    //秒发货
                    secondsShipOrder: function () {
                        var id = $(this).attr('data-id');
                        doSecondsShip(id);
                    },
                    //编辑
                    editOrder: function () {
                        var id = $(this).attr('data-id');
                        doEdit(id)
                    },
                    //完成
                    completeOrder: function () {
                        var id = $(this).attr('data-id');
                        doCompleteOrder(id);
                    },
                    //取消
                    cancelOrder: function () {
                        var id = $(this).attr('data-id');
                        doCancelOrder(id);
                    },
                    //删除
                    delOrder: function () {
                        var id = $(this).attr('data-id');
                        delOrder(id);
                    },
                    //还原订单
                    restoreOrder: function () {
                        var id = $(this).attr('data-id');
                        restoreOrder(id);
                    },
                    //打印购物订单
                    shoppingPrint: function () {
                        var id = $(this).attr('data-id');
                        shoppingPrint(id)
                    },
                    //重新打印小票
                    shoppingPrintCloud: function () {
                        var id = $(this).attr('data-id');
                        shoppingPrintCloud(id)
                    },
                    //打印配货清单
                    distributionPrint: function () {
                        var id = $(this).attr('data-id');
                        distributionPrint(id)
                    },
                    //打印联合购物清单
                    unionPrint: function () {
                        var id = $(this).attr('data-id');
                        unionPrint(id)
                    },
                    //打印快递单
                    printExpress: function () {
                        var id = $(this).attr('data-id');
                        printExpress(id)
                    },
                    //通过接口获取远端交易组件订单信息
                    refreshDelivery: function () {
                        var id = $(this).attr('data-deliveryId');
                        refreshDelivery(id);
                    },
                });
 
                //头工具栏事件
                table.on('pagebar(LAY-app-CoreCmsOrder-tableBox)', function (obj) {
                    var checkStatus = table.checkStatus(obj.config.id);
                    switch (obj.event) {
                        case 'payOrderArray':
                            doPayOrder(checkStatus, 1);
                            break;
                        case 'shipOrderArray':
                            doShip(checkStatus, 0);
                            break;
                        case 'batchCancelOrder':
                            doCancelOrderArray(checkStatus);
                            break;
                        case 'batchDeleteOrder':
                            doDeleteOrderArray(checkStatus);
                            break;
                        case 'selectExportExcel':
                            doSelectExportExcel(checkStatus);
                            break;
                        case 'queryExportExcel':
                            doQueryExportexcel();
                            break;
                    };
                });
 
                //取消订单
                function doreLoadOrderCount() {
                    coreHelper.Post("Api/CoreCmsOrder/GetIndex", null, function (e) {
                        if (e.code == 0) {
                            console.log(e);
                            $('#countAll').html(e.data.all);
                            $('#countPayment').html(e.data.payment);
                            $('#countDelivered').html(e.data.delivered);
                            $('#countReceive').html(e.data.receive);
                            $('#countNoevaluat').html(e.data.noevaluat);
                            $('#countCancel').html(e.data.cancel);
                            $('#countComplete').html(e.data.complete);
                            $('#countDelete').html(e.data.delete);
                        }
                    });
                }
 
                //还原订单
                function restoreOrder(id) {
                    layer.confirm('确认还原:' + id + ' 的订单吗?', {
                        title: '提示', btn: ['确认', '取消'] //按钮
                    }, function () {
                        coreHelper.Post("Api/CoreCmsOrder/DoRestore", { id: id }, function (e) {
                            layer.msg(e.msg, { time: 1300 }, function () {
                                layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                doreLoadOrderCount();
                            });
                        });
                    });
                    return false;
                }
 
                //秒发货
                function doSecondsShip(id) {
                    layer.confirm('确认秒发货:' + id + ' 的订单吗?', {
                        title: '提示', btn: ['确认', '取消'] //按钮
                    }, function () {
                        coreHelper.Post("Api/CoreCmsOrder/DoSecondsShip", { id: id }, function (e) {
                            layer.msg(e.msg, { time: 1300 }, function () {
                                layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                doreLoadOrderCount();
                            });
                        });
                    });
                    return false;
                }
 
                //取消订单
                function doCancelOrder(id) {
                    layer.confirm('确认取消订单号:' + id + ' 的订单吗?', {
                        title: '提示', btn: ['确认', '取消'] //按钮
                    }, function () {
                        var delidsStr = [];
                        delidsStr.push(id);
                        coreHelper.Post("Api/CoreCmsOrder/CancelOrder", { id: delidsStr }, function (e) {
                            layer.msg(e.msg, { time: 1300 }, function () {
                                layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                doreLoadOrderCount();
                            });
                        });
                    });
                    return false;
                }
 
                //批量取消订单
                function doCancelOrderArray(checkStatus) {
                    var checkData = checkStatus.data;
                    if (checkData.length === 0) {
                        return layer.msg('请选择您要取消的数据');
                    }
                    var delidsStr = [];
                    layui.each(checkData,
                        function (index, item) {
                            delidsStr.push(item.orderId);
                        });
                    //提交 Ajax 成功后,关闭当前弹层并重载表格
                    layer.confirm('确认取消' + delidsStr.length + ' 个已选订单吗?', function (index) {
                        coreHelper.Post("Api/CoreCmsOrder/CancelOrder", { id: delidsStr }, function (e) {
                            layer.msg(e.msg, { time: 1300 }, function () {
                                layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                doreLoadOrderCount();
                            });
                        });
                    });
                    return false;
                };
 
                //批量删除订单
                function doDeleteOrderArray(checkStatus) {
                    var checkData = checkStatus.data;
                    if (checkData.length === 0) {
                        return layer.msg('请选择您要取消的数据');
                    }
                    var delidsStr = [];
                    layui.each(checkData,
                        function (index, item) {
                            delidsStr.push(item.orderId);
                        });
                    //layer.msg('已选择' + ids);
                    layer.confirm('确认删除' + delidsStr.length + ' 个已选订单吗?', function (index) {
                        //提交 Ajax 成功后,关闭当前弹层并重载表格
                        coreHelper.Post("Api/CoreCmsOrder/DeleteOrder", { id: delidsStr }, function (e) {
                            layer.msg(e.msg, { time: 1300 }, function () {
                                layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                doreLoadOrderCount();
                            });
                        });
                    });
                    return false;
                };
 
                //打印方法
                function htmlToPDF(printDiv, filesName) {
                    html2canvas(printDiv, {
                        foreignObjectRendering: true, // 是否在浏览器支持的情况下使用ForeignObject渲染
                        useCORS: true, // 是否尝试使用CORS从服务器加载图像
                        async: false, // 是否异步解析和呈现元素
                        // 以下字段必填
                        background: "#ffffff", // 一定要添加背景颜色,否则出来的图片,背景全部都是透明的
                        dpi: 300, // 处理模糊问题
                        onrendered: function (canvas) {
                            document.getElementById("printImageBox").appendChild(canvas);
                            //printDiv.appendChild(canvas);
 
                            var contentWidth = canvas.width;
                            var contentHeight = canvas.height;
 
                            //一页pdf显示html页面生成的canvas高度;
                            var pageHeight = contentWidth / 592.28 * 841.89;
                            //未生成pdf的html页面高度
                            var leftHeight = contentHeight;
                            //页面偏移
                            var position = 0;
                            //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
                            var imgWidth = 595.28;
                            var imgHeight = 592.28 / contentWidth * contentHeight;
 
                            var pageData = canvas.toDataURL('image/png', 1.0)
 
                            var pdf = new jsPDF('', 'pt', 'a4');
 
                            //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
                            //当内容未超过pdf一页显示的范围,无需分页
                            if (leftHeight < pageHeight) {
                                pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight);
                            } else {
                                while (leftHeight > 0) {
                                    pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
                                    leftHeight -= pageHeight;
                                    position -= 841.89;
                                    //避免添加空白页
                                    if (leftHeight > 0) {
                                        pdf.addPage();
                                    }
                                }
                            }
                            pdf.save(filesName);
                        }
                    })
                }
 
                //==判断是否需要CLodop(那些不支持插件的浏览器):==
                function needCLodop() {
                    try {
                        var ua = navigator.userAgent;
                        if (ua.match(/Windows\sPhone/i))
                            return true;
                        if (ua.match(/iPhone|iPod|iPad/i))
                            return true;
                        if (ua.match(/Android/i))
                            return true;
                        if (ua.match(/Edge\D?\d+/i))
                            return true;
 
                        var verTrident = ua.match(/Trident\D?\d+/i);
                        var verIE = ua.match(/MSIE\D?\d+/i);
                        var verOPR = ua.match(/OPR\D?\d+/i);
                        var verFF = ua.match(/Firefox\D?\d+/i);
                        var x64 = ua.match(/x64/i);
                        if ((!verTrident) && (!verIE) && (x64))
                            return true;
                        else if (verFF) {
                            verFF = verFF[0].match(/\d+/);
                            if ((verFF[0] >= 41) || (x64))
                                return true;
                        } else if (verOPR) {
                            verOPR = verOPR[0].match(/\d+/);
                            if (verOPR[0] >= 32)
                                return true;
                        } else if ((!verTrident) && (!verIE)) {
                            var verChrome = ua.match(/Chrome\D?\d+/i);
                            if (verChrome) {
                                verChrome = verChrome[0].match(/\d+/);
                                if (verChrome[0] >= 41)
                                    return true;
                            }
                        }
                        return false;
                    } catch (err) {
                        return true;
                    }
                }
 
                //==加载引用CLodop的主JS,用双端口8000和18000(以防其中一个被占):==
                function loadCLodop() {
                    if (CLodopJsState == "loading" || CLodopJsState == "complete") return;
                    CLodopJsState = "loading";
                    var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
                    var JS1 = document.createElement("script");
                    var JS2 = document.createElement("script");
                    JS1.src = "http://localhost:8000/CLodopfuncs.js?priority=1";
                    JS2.src = "http://localhost:18000/CLodopfuncs.js";
                    JS1.onload = JS2.onload = function () { CLodopJsState = "complete"; }
                    JS1.onerror = JS2.onerror = function (evt) { CLodopJsState = "complete"; }
                    head.insertBefore(JS1, head.firstChild);
                    head.insertBefore(JS2, head.firstChild);
                    CLodopIsLocal = !!((JS1.src + JS2.src).match(/\/\/localho|\/\/127.0.0./i));
                }
 
                if (needCLodop()) { loadCLodop(); }//加载
 
                //==获取LODOP对象主过程,判断是否安装、需否升级:==
                function getLodop(oOBJECT, oEMBED) {
                    var strHtmInstall = "<font color='#FF00FF'>打印控件未安装!点击这里<a href='/lib/lodop/install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
                    var strHtmUpdate = "<font color='#FF00FF'>打印控件需要升级!点击这里<a href='/lib/lodop/install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
                    var strHtm64_Install = "<font color='#FF00FF'>打印控件未安装!点击这里<a href='/lib/lodop/install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
                    var strHtm64_Update = "<font color='#FF00FF'>打印控件需要升级!点击这里<a href='/lib/lodop/install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
                    var strHtmFireFox = "<font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>";
                    var strHtmChrome = "<font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>";
                    var strCLodopInstall_1 = "<font color='#FF00FF'>Web打印服务CLodop未安装启动,点击这里<a href='/lib/lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
                    var strCLodopInstall_2 = "(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>)";
                    var strCLodopInstall_3 = ",成功后请刷新本页面。</font>";
                    var strCLodopUpdate = "<font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='/lib/lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>";
                    var LODOP;
                    try {
                        var ua = navigator.userAgent;
                        var isIE = !!(ua.match(/MSIE/i)) || !!(ua.match(/Trident/i));
                        if (needCLodop()) {
                            try {
                                LODOP = getCLodop();
                            } catch (err) { }
                            if (!LODOP && CLodopJsState !== "complete") {
                                if (CLodopJsState == "loading") {
                                    layer.alert("网页还没下载完毕,请稍等一下再操作.")
                                } else {
                                    layer.alert("没有加载CLodop的主js,请先调用loadCLodop过程.")
                                }
                                return false;
                            }
                            if (!LODOP) {
                                layer.alert(strCLodopInstall_1 + (CLodopIsLocal ? strCLodopInstall_2 : "") + strCLodopInstall_3);
                                return false;
                            } else {
                                if (CLODOP.CVERSION < "4.1.0.4") {
                                    layer.alert(strCLodopUpdate);
                                }
                                if (oEMBED && oEMBED.parentNode) {
                                    oEMBED.parentNode.removeChild(oEMBED); //清理旧版无效元素
                                }
                                if (oOBJECT && oOBJECT.parentNode) {
                                    oOBJECT.parentNode.removeChild(oOBJECT);
                                }
                            }
                        } else {
                            var is64IE = isIE && !!(ua.match(/x64/i));
                            //==如果页面有Lodop就直接使用,否则新建:==
                            if (oOBJECT || oEMBED) {
                                if (isIE) {
                                    LODOP = oOBJECT;
                                } else {
                                    LODOP = oEMBED;
                                }
                            } else if (!CreatedOKLodopObject) {
                                LODOP = document.createElement("object");
                                LODOP.setAttribute("width", 0);
                                LODOP.setAttribute("height", 0);
                                LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
                                if (isIE) {
                                    LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
                                } else {
                                    LODOP.setAttribute("type", "application/x-print-lodop");
                                }
                                document.documentElement.appendChild(LODOP);
                                CreatedOKLodopObject = LODOP;
                            } else {
                                LODOP = CreatedOKLodopObject;
                            }
                            //==Lodop插件未安装时提示下载地址:==
                            if ((!LODOP) || (!LODOP.VERSION)) {
                                if (ua.indexOf('Chrome') >= 0) {
                                    layer.alert(strHtmChrome);
                                }
                                if (ua.indexOf('Firefox') >= 0) {
                                    layer.alert((is64IE ? strHtm64_Install : strHtmInstall) + strHtmFireFox);
                                }
                                return LODOP;
                            }
                        }
                        if (LODOP.VERSION < "6.2.2.6") {
                            if (!needCLodop()) {
                                layer.alert(is64IE ? strHtm64_Update : strHtmUpdate);
                            }
                        }
                        //===如下空白位置适合调用统一功能(如注册语句、语言选择等):==
 
 
                        //=======================================================
                        return LODOP;
                    } catch (err) {
                        alert("getLodop出错:" + err);
                    }
                }
 
                //重打小票
                function shoppingPrintCloud(orderId) {
                    layer.confirm('确认打印订单号:' + orderId + ' 的订单小票吗?', function (index) {
                        coreHelper.Post("Api/CoreCmsOrder/GetPrintCloud", { id: orderId }, function (e) {
                            layer.msg(e.msg);
                        });
                    });
                };
 
                //打印购物订单
                function shoppingPrint(orderId) {
                    coreHelper.Post("Api/CoreCmsOrder/GetPrintTpl", { id: orderId, data: 1 }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '打印购物订单',
                                area: ['1000px', '90%'],
                                id: 'LAY-popup-CoreCmsOrder-shoppingPrint',
                                success: function (layero, index) {
                                    view(this.id).render('order/orders/shopping', { data: e.data }).done(function () {
                                        form.on('submit(LAY-app-order-shoppingPrint-submit)', function (data) {
                                            LODOP = getLodop();
                                            LODOP.ADD_PRINT_HTM(20, "5%", "90%", "100%", document.getElementById("printDiv").innerHTML);
                                            LODOP.PREVIEW();
                                            form.render();
                                        });
 
                                        form.on('submit(LAY-app-order-shoppingPrint-htmltopdf-submit)', function (data) {
                                            var printDiv = document.getElementById('printDiv');
                                            htmlToPDF(printDiv, "购物订单" + orderId)
                                            form.render();
                                        });
 
 
                                    });
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                };
                //打印配送订单
                function distributionPrint(orderId) {
                    coreHelper.Post("Api/CoreCmsOrder/GetPrintTpl", { id: orderId, data: 2 }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '打印配货清单',
                                area: ['1000px', '90%'],
                                id: 'LAY-popup-CoreCmsOrder-distribution',
                                success: function (layero, index) {
                                    view(this.id).render('order/orders/distribution', { data: e.data }).done(function () {
                                        form.on('submit(LAY-app-order-distributionPrint-submit)', function (data) {
                                            LODOP = getLodop();
                                            LODOP.ADD_PRINT_HTM(20, "5%", "90%", "100%", document.getElementById("printDiv").innerHTML);
                                            LODOP.PREVIEW();
                                        });
 
                                        form.on('submit(LAY-app-order-distributionPrint-htmltopdf-submit)', function (data) {
                                            var printDiv = document.getElementById('printDiv');
                                            htmlToPDF(printDiv, "配送订单" + orderId)
                                        });
 
 
                                        form.render();
                                    });
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                };
                //打印联合购物清单
                function unionPrint(orderId) {
                    coreHelper.Post("Api/CoreCmsOrder/GetPrintTpl", { id: orderId, data: 3 }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '打印联合购物清单',
                                area: ['1000px', '90%'],
                                id: 'LAY-popup-CoreCmsOrder-union',
                                success: function (layero, index) {
                                    view(this.id).render('order/orders/union', { data: e.data }).done(function () {
                                        form.on('submit(LAY-app-order-unionPrint-submit)', function (data) {
                                            LODOP = getLodop();
                                            LODOP.ADD_PRINT_HTM(20, "5%", "90%", "100%", document.getElementById("printDiv").innerHTML);
                                            LODOP.PREVIEW();
                                        });
 
                                        form.on('submit(LAY-app-order-unionPrint-htmltopdf-submit)', function (data) {
                                            var printDiv = document.getElementById('printDiv');
                                            htmlToPDF(printDiv, "联合购物清单" + orderId)
                                        });
 
                                        form.render();
                                    });
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                };
                //打印快递单
                function printExpress(orderId) {
                    layer.msg("打印快递单" + orderId);
                };
 
                //查看订单
                function viewOrder(ids) {
                    coreHelper.Post("Api/CoreCmsOrder/GetDetails", { id: ids }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '查看详情',
                                area: ['1200px', '90%'],
                                id: 'LAY-popup-CoreCmsOrder-details',
                                success: function (layero, index) {
                                    view(this.id).render('order/orders/details', { data: e.data }).done(function () {
                                        //监听提交
                                        form.on('submit(LAY-app-order-saveMark-submit)',
                                            function (data) {
                                                var field = data.field; //获取提交的字段
                                                if (debug) { console.log(field); } //开启调试返回数据
                                                //提交 Ajax 成功后,关闭当前弹层并重载表格
                                                coreHelper.Post("Api/CoreCmsOrder/DoUpdateMark", field, function (e) {
                                                    console.log(e)
                                                    if (e.code === 0) {
                                                        layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                                        doreLoadOrderCount();
                                                        layer.close(index); //再执行关闭
                                                        layer.msg(e.msg);
                                                    } else {
                                                        layer.msg(e.msg);
                                                    }
                                                });
                                            });
                                        form.render();
                                    });
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                }
                //执行编辑操作
                function doEdit(ids) {
                    coreHelper.Post("Api/CoreCmsOrder/GetEdit", { id: ids }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '编辑数据',
                                area: ['640px', '400px'],
                                id: 'LAY-popup-CoreCmsOrder-edit',
                                success: function (layero, index) {
                                    view(this.id).render('order/orders/edit', { data: e.data }).done(function () {
                                        //监听提交
                                        form.on('submit(LAY-app-CoreCmsOrder-editForm-submit)',
                                            function (data) {
                                                var field = data.field; //获取提交的字段
 
                                                if (debug) { console.log(field); } //开启调试返回数据
                                                //提交 Ajax 成功后,关闭当前弹层并重载表格
                                                coreHelper.Post("Api/CoreCmsOrder/DoEdit", field, function (e) {
                                                    console.log(e)
                                                    if (e.code === 0) {
                                                        layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                                        doreLoadOrderCount();
                                                        layer.close(index); //再执行关闭
                                                        layer.msg(e.msg);
                                                    } else {
                                                        layer.msg(e.msg);
                                                    }
                                                });
                                            });
                                    })
                                }
                                , btn: ['确定', '取消']
                                , yes: function (index, layero) {
                                    layero.contents().find("#LAY-app-CoreCmsOrder-editForm-submit").click();
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                }
                //执行发货操作
                function doShip(checkStatus, type) {
                    var delidsStr = [];
                    if (type == 0) {
                        var checkData = checkStatus.data;
                        if (checkData.length === 0) {
                            return layer.msg('请选择您要发货的数据');
                        }
                        layui.each(checkData,
                            function (index, item) {
                                delidsStr.push(item.orderId);
                            });
                    } else if (type == 1) {
                        delidsStr.push(checkStatus);
                    }
 
 
                    coreHelper.Post("Api/CoreCmsOrder/GetShip", { id: delidsStr }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '发货',
                                area: ['1000px', '90%'],
                                id: 'LAY-popup-CoreCmsOrder-edit',
                                success: function (layero, index) {
                                    view(this.id).render('order/orders/ship', { data: e.data }).done(function () {
                                        //监听提交
                                        form.on('submit(LAY-app-CoreCmsOrder-shipForm-submit)',
                                            function (data) {
                                                var field = data.field; //获取提交的字段
 
                                                var keys = Object.keys(field);
                                                var keysCount = 0;
                                                for (var i = 0; i < keys.length; i++) {
                                                    if (keys[i].indexOf('itemsValue') != -1) {
                                                        keysCount++;
                                                    }
                                                }
                                                var items = {};
                                                if (keysCount > 0) {
                                                    for (var i = 0; i < keysCount; i++) {
                                                        var keyName = 'items[' + i + ']';
                                                        var keyValue = 'itemsValue[' + i + ']';
                                                        var keyNameValue = field[keyName];
                                                        var keyValueValue = field[keyValue];
                                                        items[keyNameValue] = keyValueValue;
                                                    }
                                                }
                                                field.items = items;
 
                                                if (debug) { console.log(field); } //开启调试返回数据
                                                //提交 Ajax 成功后,关闭当前弹层并重载表格
                                                coreHelper.Post("Api/CoreCmsOrder/DoShip", field, function (e) {
                                                    console.log(e)
                                                    if (e.code === 0) {
                                                        layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                                        doreLoadOrderCount();
                                                        layer.close(index); //再执行关闭
                                                        layer.msg(e.msg);
                                                    } else {
                                                        layer.msg(e.msg);
                                                    }
                                                });
                                            });
                                    })
                                }, btn: ['确定', '取消']
                                , yes: function (index, layero) {
                                    layero.contents().find("#LAY-app-CoreCmsOrder-shipForm-submit").click();
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                }
                //执行支付操作
                function doPayOrder(checkStatus, type) {
                    var delidsStr = [];
                    if (type == 0) {
                        delidsStr.push(checkStatus);
                    } else if (type == 1) {
                        var checkData = checkStatus.data;
                        if (checkData.length === 0) {
                            return layer.msg('请选择您要支付的数据');
                        }
                        layui.each(checkData,
                            function (index, item) {
                                delidsStr.push(item.orderId);
                            });
                    } else {
                        return layer.msg('您的支付模式有问题,请核实');
                    }
                    coreHelper.Post("Api/CoreCmsOrder/GetPay", { id: delidsStr, data: 1 }, function (e) {
                        if (e.code === 0) {
                            admin.popup({
                                shadeClose: false,
                                title: '支付',
                                area: ['400px', '300px'],
                                id: 'LAY-popup-CoreCmsOrder-edit',
                                success: function (layero, index) {
                                    view(this.id).render('order/orders/pay', { data: e.data }).done(function () {
                                        //监听提交
                                        form.on('submit(LAY-app-CoreCmsOrder-payForm-submit)',
                                            function (data) {
                                                var field = data.field; //获取提交的字段
                                                if (debug) { console.log(field); } //开启调试返回数据
                                                //提交 Ajax 成功后,关闭当前弹层并重载表格
                                                coreHelper.Post("Api/CoreCmsOrder/DoToPay", field, function (e) {
                                                    console.log(e)
                                                    if (e.code === 0) {
                                                        layui.table.reloadData('LAY-app-CoreCmsOrder-tableBox'); //重载表格
                                                        doreLoadOrderCount();
                                                        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-CoreCmsOrder-payForm-submit").click();
                                }
                            });
                        } else {
                            layer.msg(e.msg);
                        }
                    });
                }
 
                //删除订单
                function delOrder(id) {
                    layer.confirm('确认删除订单号:' + id + ' 的订单吗?', function (index) {
                        coreHelper.Post("Api/CoreCmsOrder/DoDelete", { id: id }, function (e) {
                            if (debug) { console.log(e); } //开启调试返回数据
                            table.reloadData('LAY-app-CoreCmsOrder-tableBox');
                            doreLoadOrderCount();
                            layer.msg(e.msg);
                        });
                    });
                }
 
                //同步发货订单到微信交易组件远端
                function refreshDelivery(id) {
                    layer.confirm('确认同步发货订单吗?', function (index) {
                        coreHelper.Post("Api/CoreCmsOrder/RefreshDelivery", { id: id }, function (e) {
                            if (debug) { console.log(e); } //开启调试返回数据
                            table.reloadData('LAY-app-CoreCmsOrder-tableBox');
                            doreLoadOrderCount();
                            layer.msg(e.msg);
                        });
                    });
                }
 
                //完成订单
                function doCompleteOrder(id) {
                    coreHelper.Post("Api/CoreCmsOrder/GetDoHaveAfterSale", { id: id }, function (e) {
                        if (e.code == 0) {
                            layer.msg("存在未处理的售后,请先处理");
                        } else {
                            layer.confirm('确认设置订单号:' + id + ' 为完成吗?<br /><font style="color:#f00">完成订单后将不能再对订单进行任何操作。</font>', {
                                title: '提示', btn: ['确认', '取消'] //按钮
                            }, function () {
                                coreHelper.Post("Api/CoreCmsOrder/DoComplete", { id: id }, function (e) {
                                    if (debug) { console.log(e); } //开启调试返回数据
                                    table.reloadData('LAY-app-CoreCmsOrder-tableBox');
                                    doreLoadOrderCount();
                                    layer.msg(e.msg);
                                });
                            });
                        }
                    });
                }
 
                //执行查询条件导出excel
                function doQueryExportexcel() {
                    layer.confirm('确定根据当前的查询条件导出数据吗?',
                        function (index) {
                            var field = searchwhere;
                            coreHelper.PostForm("Api/CoreCmsOrder/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.orderId);
                                });
                            layer.close(index);
                            coreHelper.Post("Api/CoreCmsOrder/SelectExportExcel", { id: delidsStr }, function (e) {
                                if (debug) { console.log(e); } //开启调试返回数据
                                if (e.code === 0) {
                                    window.open(e.data);
                                } else {
                                    layer.msg(e.msg);
                                }
                            });
                        });
                }
 
 
 
                laydate.render({
                    elem: '#searchTime-CoreCmsOrder-createTime',
                    type: 'datetime',
                    range: '到',
                });
 
 
            });
    };
 
</script>
 
<!--时间-->
<script type="text/html" id="orderTime">
    <i class="layui-icon layui-icon-time layui-font-14"></i>
    {{d.createTime}}
    <br />
    <i class="layui-icon layui-icon-refresh layui-font-14"></i>
    {{d.paymentTime || '未支付'}}
</script>
 
<!--订单来源-->
<script type="text/html" id="orderItems">
    <div class="order-min-table">
        <table class="layui-table" lay-size="sm">
            <colgroup>
                <col width="40">
                <col width="200">
                <col width="40">
                <col width="40">
                <col width="40">
            </colgroup>
            <thead>
                <tr>
                    <th colspan="2" style="width: 200px;">货品</th>
                    <th style="width: 40px;">数量</th>
                    <th style="width: 40px;">单价</th>
                    <th style="width: 40px;">优惠</th>
                    <th style="width: 40px;">合计</th>
                </tr>
            </thead>
            <tbody>
                {{# layui.each(d.items, function(index, item){ }}
                <tr lay-tips="{{item.name}}">
                    <td>
                        <a href="javascript:void(0);" onclick="layui.coreHelper.viewImage('{{item.imageUrl}}')"><image style="max-width: 30px; max-height: 30px;" src="{{item.imageUrl}}" /></a>
                    </td>
                    <td style="text-align: left">
                        <div class="title"> {{item.addon || item.name}}</div>
                    </td>
                    <td>{{item.nums}}</td>
                    <td>{{item.price}}</td>
                    <td>{{item.promotionAmount}}</td>
                    <td>{{item.amount}}</td>
                </tr>
                {{# }); }}
            </tbody>
        </table>
    </div>
</script>
 
 
<!--金额-->
<script type="text/html" id="orderAmount">
    <font class="layui-font-12" style="color: red">¥</font>
    <font class="layui-font-14" style="color: red;font-weight: bolder;">{{d.orderAmount}}</font>
</script>
 
 
<!--用户地址-->
<script type="text/html" id="orderShip">
    <div class="orderShip">
        联系方式:【{{d.shipName}}】【{{d.shipMobile}}】<br />
        {{d.storeId > 0?'自提配送:':'物流地址:'}}  {{d.shipAreaName}}
    </div>
    <!--<button type="button" class="layui-btn  layui-btn-normal  layui-btn-xs">复制</button>-->
</script>