yj
2024-12-05 ac3234c308e86f20cc63465573f321561ee00690
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
<template>
  <div class="app-container">
    <!-- 查询和其他操作 -->
    <div class="filter-container">
      <!--<el-input v-model="listQuery.userId" clearable class="filter-item" style="width: 200px;" placeholder="请输入用户ID"/>-->
      <el-input
        v-model="listQuery.orderNo"
        clearable
        class="filter-item"
        style="width: 200px;"
        placeholder="请输入订单编号"
      />
      <el-select
        v-model="listQuery.status"
        clearable
        style="width: 200px"
        class="filter-item"
        placeholder="请选择订单状态"
      >
        <el-option v-for="(key, value) in statusMap" :key="key" :label="key" :value="value" />
      </el-select>
      <el-button
        v-permission="['operation:order:list']"
        class="filter-item"
        type="primary"
        icon="el-icon-search"
        @click="handleFilter"
      >查找</el-button>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <br>
      <el-date-picker
        v-model="downData.gmtStart"
        type="datetime"
        style="width: 200px"
        class="filter-item"
        default-time="00:00:00"
        placeholder="选择开始日期"
      />
      至
      <el-date-picker
        v-model="downData.gmtEnd"
        type="datetime"
        style="width: 200px"
        class="filter-item"
        default-time="00:00:00"
        placeholder="选择结束日期"
      />
      <el-select
        v-model="downData.status"
        style="width: 200px"
        class="filter-item"
        placeholder="待出库"
      >
        <el-option v-for="(key, value) in statusMap" :key="key" :label="key" :value="value" />
      </el-select>
      <el-button :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="downExcelBtn">导出</el-button>
      <el-button :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="downExcelStatisticsBtn">汇总</el-button>
    </div>
 
    <!-- 查询结果 -->
    <el-table
      v-loading="listLoading"
      :data="list"
      :cell-class-name="tableCellClassName"
      size="small"
      element-loading-text="正在查询中。。。"
      border
      fit
      highlight-current-row
    >
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form label-position="right" class="table-expand">
            <el-form-item label="父单编号">
              <span>{{ props.row.parentOrderNo }}</span>
            </el-form-item>
          </el-form>
          <el-form label-position="right" class="table-expand">
            <el-form-item label="联系人名">
              <span>{{ props.row.consignee }}</span>
            </el-form-item>
          </el-form>
          <el-form label-position="right" class="table-expand">
            <el-form-item label="联系电话">
              <span>{{ props.row.phone }}</span>
            </el-form-item>
          </el-form>
          <el-form label-position="right" class="table-expand">
            <el-form-item label="客服备注">
              <span>{{ props.row.adminMono ? props.row.adminMono : '无' }}</span>
            </el-form-item>
          </el-form>
          <el-form v-if="props.row.status === 60 || props.row.refundReason" label-position="right" class="table-expand">
            <el-form-item label="退款原因">
              <span>{{ props.row.refundReason ? props.row.refundReason : '未填写退款原因' }}</span>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
 
      <el-table-column align="center" width="210" label="订单编号" prop="orderNo" />
 
      <el-table-column align="center" width="80" label="用户ID" prop="userId" />
 
      <el-table-column align="center" width="120" label="订单状态" prop="status">
        <template slot-scope="scope">
          <el-tag :type="statusColor(scope.row.status)">{{ scope.row.status | orderStatusFilter }}</el-tag>
        </template>
      </el-table-column>
 
      <el-table-column align="center" width="110" label="支付渠道" prop="payChannel">
        <template slot-scope="scope">
          <el-tag :type="payChannelColor(scope.row.payChannel)">{{ scope.row.payChannel | payChannelFilter }}</el-tag>
        </template>
      </el-table-column>
 
      <el-table-column align="center" width="100" label="订单金额" prop="actualPrice">
        <template slot-scope="scope">¥ {{ scope.row.actualPrice / 100.0 }}</template>
      </el-table-column>
 
      <!--<el-table-column align="center" label="支付金额" prop="actualPrice"/>-->
 
      <el-table-column align="center" width="140" label="创建时间" prop="gmtCreate">
        <template slot-scope="scope">{{ scope.row.gmtCreate | formatTime }}</template>
      </el-table-column>
 
      <el-table-column align="center" width="140" label="物流渠道" prop="shipCode">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.status <= 20 || scope.row.status >= 80" type="info">未发货</el-tag>
          <el-tag v-else>{{ scope.row.shipCode | shipCodeFilter }}</el-tag>
        </template>
      </el-table-column>
 
      <el-table-column align="center" width="200" label="物流单号" prop="shipNo"/>
 
      <el-table-column align="center" width="200" label="备注" prop="mono"/>
 
      <el-table-column align="center" label="操作" width="300" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            v-permission="['operation:order:detail']"
            type="primary"
            size="mini"
            @click="handleDetail(scope.row)"
          >详情</el-button>
          <el-button
            v-permission="['operation:order:detail']"
            v-if="scope.row.status===20"
            type="primary"
            size="mini"
            @click="downOrderExcelBtn(scope.row)"
          >配送单</el-button>
          <el-button
            v-permission="['operation:order:ship']"
            v-if="scope.row.status===20"
            type="primary"
            size="mini"
            @click="handleShip(scope.row)"
          >发货</el-button>
          <el-button
            v-permission="['operation:order:refund']"
            v-if="scope.row.status===60"
            type="primary"
            size="mini"
            @click="handleRefund(scope.row)"
          >退款</el-button>
        </template>
      </el-table-column>
    </el-table>
 
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="listQuery.page"
      :limit.sync="listQuery.limit"
      @pagination="getList"
    />
 
    <!-- 订单详情对话框 -->
    <el-dialog :visible.sync="orderDialogVisible" title="订单详情" width="800">
      <el-form :data="orderDetail" label-position="left">
        <el-form-item label="订单编号">
          <span>{{ orderDetail.orderNo }}</span>
        </el-form-item>
        <el-form-item label="用户Id">
          <span>{{ orderDetail.userId }}</span>
        </el-form-item>
        <el-form-item label="订单渠道">
          <span>{{ orderDetail.channel }}</span>
        </el-form-item>
        <el-form-item label="订单状态">
          <template>
            <el-tag>{{ orderDetail.status | orderStatusFilter }}</el-tag>
          </template>
        </el-form-item>
        <el-form-item label="支付渠道">
          <template>
            <el-tag>{{ orderDetail.payChannel | payChannelFilter }}</el-tag>
          </template>
        </el-form-item>
        <el-form-item label="用户留言">
          <span>{{ orderDetail.mono }}</span>
        </el-form-item>
        <el-form-item label="客服备注">
          <span>{{ orderDetail.adminMono }}</span>
          <el-button type="primary" icon="el-icon-edit" @click="adminMonoDialogVisible = true">编辑</el-button>
        </el-form-item>
        <el-form-item label="配送费用">
          <template>
            {{ orderDetail.freightPrice > 0 ? (orderDetail.freightPrice / 100.0) : '免运费' }}
          </template>
        </el-form-item>
        <el-form-item label="收货信息">
          <span>(收货人){{ orderDetail.consignee }}</span>
          <span>(手机号){{ orderDetail.phone }}</span>
          <span>(地址){{ orderDetail.province }}{{ orderDetail.city }}{{ orderDetail.county }}{{ orderDetail.address }}{{ orderDetail.address }}</span>
        </el-form-item>
        <el-form-item label="商品信息">
          <el-table :data="orderDetail.skuList" size="small" border fit highlight-current-row>
            <el-table-column align="center" label="名称" prop="spuTitle" />
            <el-table-column align="center" label="规格" prop="title" />
            <el-table-column align="center" label="商品数量" prop="num" />
            <el-table-column align="center" label="单位" prop="unit" />
            <el-table-column align="center" label="总价(单价*数量)">
              <template slot-scope="scope">
                <span>{{ scope.row.price * scope.row.num / 100 }}</span>
              </template>
            </el-table-column>
          </el-table>
        </el-form-item>
      </el-form>
    </el-dialog>
 
    <el-dialog :visible.sync="adminMonoDialogVisible" title="客服备注">
      <el-form
        status-icon
        label-position="left"
        label-width="100px"
        style="width: 400px; margin-left:50px;"
      >
        <el-form-item label="等级" prop="adminMonoLevel">
          <el-radio-group v-model="orderDetail.adminMonoLevel">
            <el-radio :label="0">无色</el-radio>
            <el-radio :label="1">绿色</el-radio>
            <el-radio :label="2">橙黄</el-radio>
            <el-radio :label="3">红色</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="内容" prop="adminMono">
          <el-input v-model="orderDetail.adminMono" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="adminMonoDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="handleAdminMono">确定</el-button>
      </div>
    </el-dialog>
 
    <!-- 发货对话框 -->
    <el-dialog :visible.sync="shipDialogVisible" title="发货">
      <el-form
        ref="shipForm"
        :model="shipForm"
        :rules="shipRules"
        status-icon
        label-position="left"
        label-width="100px"
        style="width: 400px; margin-left:50px;"
      >
        <el-form-item label="快递公司" prop="shipCode">
          <el-select v-model="shipForm.shipCode" placeholder="请选择快递公司">
            <el-option v-for="(key, value) in shipCodeMap" :key="key" :label="key" :value="value"/>
          </el-select>
        </el-form-item>
        <el-form-item label="快递编号" prop="shipNo">
          <el-input :disabled="shipForm.shipCode === 'NONE'" v-model="shipForm.shipNo" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="shipDialogVisible = false">取消</el-button>
        <el-button :disabled="shipSubmiting" type="primary" @click="confirmShip">确定</el-button>
      </div>
    </el-dialog>
 
    <!-- 退款对话框 -->
    <el-dialog :visible.sync="refundDialogVisible" title="退款">
      <el-form
        ref="refundForm"
        :model="refundForm"
        :rules="refundRules"
        status-icon
        label-position="left"
        label-width="100px"
        style="width: 400px; margin-left:50px;"
      >
        <el-form-item label="tips">
          <span>允许退款后钱会退回对方账户,请确认您已经收到退货</span>
        </el-form-item>
        <el-form-item label="操作">
          <el-radio v-model="refundForm.type" :label="0">拒绝退款</el-radio>
          <el-radio v-model="refundForm.type" :label="1">允许退款</el-radio>
        </el-form-item>
        <el-form-item v-if="refundForm.type === 1" label="金额">
          <el-input v-model="refundForm.sum"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="refundDialogVisible = false">取消</el-button>
        <el-button :disabled="refundSubmiting" type="primary" @click="confirmRefund">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { listOrder, shipOrder, refundOrder, detailOrder, getExcelInfo, editAdminMono, getExcelStatistics } from '@/api/order'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import checkPermission from '@/utils/permission' // 权限判断函数
 
const statusMap = {
  10: '未付款',
  12: '正在拼团',
  20: '待出库',
  30: '待收货',
  40: '待评价',
  50: '已完成',
  60: '退款中',
  70: '已退款',
  80: '已取消',
  90: '已取消(系统)'
}
 
const shipCodeMap = {
  'NONE': '无需物流公司',
  'SF': '顺丰速运',
  'HTKY': '百世快递',
  'ZTO': '中通快递',
  'STO': '申通快递',
  'YTO': '圆通速递',
  'YD': '韵达速递',
  'YZPY': '邮政快递包裹',
  'EMS': 'EMS',
  'HHTT': '天天快递',
  'JD': '京东快递',
  'UC': '优速快递',
  'DBL': '德邦快递',
  'ZJS': '宅急送',
  'TNT': 'TNT快递'
}
 
const payChannelMap = {
  WX: '微信支付',
  ALI: '支付宝',
  OFFLINE: '线下支付'
}
 
export default {
  name: 'Order',
  components: { Pagination },
  filters: {
    orderStatusFilter(status) {
      return statusMap[status]
    },
    payChannelFilter(channel) {
      const str = payChannelMap[channel]
      if (str) {
        return str
      }
      return '未支付'
    },
    shipCodeFilter(shipCode) {
      if (shipCode) {
        return shipCodeMap[shipCode]
      }
      return '无需物流公司'
    }
  },
  data() {
    return {
      statusMap,
      shipCodeMap,
      excelData: {
        barcode: undefined,
        name: undefined,
        specifications: undefined,
        unit: undefined,
        num: undefined,
        address: undefined
      },
      excelDataList: [],
      downData: {
        status: '',
        gmtStart: undefined,
        gmtEnd: undefined
      },
      list: undefined,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 20,
        id: undefined,
        name: undefined
      },
      orderDialogVisible: false,
      orderDetail: {},
      refundForm: {
        orderNo: undefined,
        type: 0
      },
      refundDialogVisible: false,
      refundSubmiting: false,
      adminMonoDialogVisible: false,
      downloadLoading: false,
      shipForm: {
        orderNo: undefined,
        shipCode: 'NONE',
        shipNo: undefined
      },
      shipDialogVisible: false,
      shipSubmiting: false,
      refundRules: {
        orderNo: [
          { required: true, message: '请使用非IE浏览器重试', trigger: 'blur' }
        ],
        type: [
          { required: true, message: '请选择退货类型', trigger: 'blur' }
        ]
      },
      shipRules: {
        shipCode: [
          { required: true, message: '请选择物流类型', trigger: 'blur' }
        ],
        orderNo: [
          { required: true, message: '请使用非IE浏览器重试', trigger: 'blur' }
        ]
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    checkPermission,
    getList() {
      this.listLoading = true
      listOrder(this.listQuery)
        .then(response => {
          this.list = response.data.data.items
          this.total = response.data.data.total
          this.listLoading = false
        })
        .catch(() => {
          this.list = []
          this.total = 0
          this.listLoading = false
        })
    },
    handleFilter() {
      this.listQuery.page = 1
      this.getList()
    },
    handleDetail(row) {
      detailOrder(row.id).then(response => {
        this.orderDetail = response.data.data
      })
      this.orderDialogVisible = true
    },
    handleShip(row) {
      this.shipDialogVisible = true
      this.shipForm.orderNo = row.orderNo
      this.shipForm.shipCode = ''
      this.shipForm.shipNo = ''
    },
    confirmShip() {
      this.$refs['shipForm'].validate(valid => {
        if (valid) {
          if (this.shipForm.shipCode !== 'NONE' && !this.shipForm.shipNo) {
            this.$notify.error({
              title: '失败',
              message: '请填写运单号'
            })
          } else {
            this.shipSubmiting = true
            shipOrder(this.shipForm)
              .then(response => {
                this.shipSubmiting = false
                this.shipDialogVisible = false
                this.$notify.success({
                  title: '成功',
                  message: '确认发货成功!'
                })
                this.getList()
              })
              .catch(response => {
                this.shipSubmiting = false
                this.$notify.error({
                  title: '失败',
                  message: response.data.errmsg
                })
              })
          }
        }
      })
    },
    handleAdminMono() {
      if (!this.orderDetail) {
        this.$notify.error({
          title: '失败',
          message: '数据不对,请刷新页面重试'
        })
        return
      }
      editAdminMono(this.orderDetail.id, this.orderDetail.adminMonoLevel, this.orderDetail.adminMono)
        .then(res => {
          this.$notify.success({
            title: '成功',
            message: '客服备注成功!'
          })
          this.getList()
          this.adminMonoDialogVisible = false
        })
        .catch(response => {
          this.shipSubmiting = false
          this.$notify.error({
            title: '失败',
            message: response.data.errmsg
          })
        })
    },
    handleRefund(row) {
      const obj = {
        orderNo: row.orderNo,
        sum: row.payPrice / 100.0,
        type: 0
      }
      this.refundForm = Object.assign({}, obj)
      this.refundDialogVisible = true
      this.shipForm.shipCode = 'NONE'
    },
    confirmRefund() {
      this.$refs['refundForm'].validate(valid => {
        if (valid) {
          this.refundSubmiting = true
          const obj = {
            type: this.refundForm.type,
            orderNo: this.refundForm.orderNo
          }
          if (this.refundForm.sum) {
            obj['sum'] = parseInt(this.refundForm.sum * 100)
          }
          refundOrder(obj)
            .then(response => {
              this.refundSubmiting = false
              this.refundDialogVisible = false
              this.$notify.success({
                title: '成功',
                message: '确认退款成功!'
              })
              this.getList()
            })
            .catch(response => {
              this.refundSubmiting = false
              this.$notify.error({
                title: '失败',
                message: response.data.errmsg
              })
            })
        }
      })
    },
    // 订单表格中下载
    downOrderExcelBtn(row) {
      detailOrder(row.id).then(response => {
        var temp = response.data.data
        const obj = {}
        obj.address = temp.province + temp.city + temp.county + temp.address
        obj.orderNo = temp.orderNo
        obj.phone = temp.phone
        obj.mono = temp.mono
        obj.adminMono = temp.adminMono
        obj.area = temp.province + temp.city + temp.county
        obj.consignee = temp.consignee
        for (var j = 0; j < temp.skuList.length; j++) {
          var sku = temp.skuList[j]
          obj.unit = sku.unit
          obj.num = sku.num
          obj.specifications = sku.title
          obj.barcode = sku.barCode
          obj.name = sku.spuTitle
          var copy = Object.assign({}, obj)
          this.excelDataList.push(copy)
        }
        this.handleDownload(this.excelDataList)
        this.excelDataList = []
      })
    },
    // 选择条件下载
    downExcelBtn() {
      this.downloadLoading = true
      const dataInfo = Object.assign({}, {
        status: this.downData.status
      })
 
      if (this.downData.gmtStart) {
        dataInfo['gmtStart'] = this.downData.gmtStart.getTime()
      }
      if (this.downData.gmtEnd) {
        dataInfo['gmtEnd'] = this.downData.gmtEnd.getTime()
      }
      getExcelInfo(dataInfo).then(response => {
        if (response.data.data == null) {
          this.$notify.error({
            title: '失败',
            message: '没有信息可以打印'
          })
        }
 
        var data = response.data.data
        for (var i = 0; i < data.length; i++) {
          var temp = data[i]
          const obj = {}
          obj.address = temp.province + temp.city + temp.county + temp.address
          obj.orderNo = temp.orderNo
          obj.phone = temp.phone
          obj.mono = temp.mono
          obj.adminMono = temp.adminMono
          obj.area = temp.province + temp.city + temp.county
          obj.consignee = temp.consignee
          for (var j = 0; j < temp.skuList.length; j++) {
            var sku = temp.skuList[j]
            obj.unit = sku.unit
            obj.num = sku.num
            obj.specifications = sku.title
            obj.barcode = sku.barCode
            obj.name = sku.spuTitle
            var copy = Object.assign({}, obj)
            this.excelDataList.push(copy)
          }
        }
        this.handleDownload(this.excelDataList)
        this.excelDataList = []
        this.downloadLoading = false
      })
        .catch(response => {
          this.downloadLoading = false
          this.$notify.error({
            title: '失败',
            message: response.data.errmsg
          })
        })
    },
    statusColor(status) {
      switch (status) {
        case 10:
        case 80:
        case 90:
          return 'info'
        case 30:
        case 40:
        case 50:
          return 'success'
        case 20:
          return 'warning'
        case 60:
        case 70:
          return 'danger'
      }
      return 'primary'
    },
    payChannelColor(channel) {
      if (!channel) {
        return 'info'
      }
      if (channel === 'WX') {
        return 'success'
      } else if (channel === 'OFFLINE') {
        return 'warning'
      } else if (channel === 'ALI') {
        return 'primary'
      } else {
        return 'danger'
      }
    },
    handleDownload(data) {
      import('@/vendor/Export2Excel').then(excel => {
        const tHeader = [
          '订单编号',
          '商品名称',
          '规格',
          '单位',
          '配送数量',
          '配送地址',
          '收货人',
          '联系方式',
          '区域划分',
          '客服备注',
          '用户备注'
        ]
        const filterVal = [
          'orderNo',
          'name',
          'specifications',
          'unit',
          'num',
          'address',
          'consignee',
          'phone',
          'area',
          'mono',
          'adminMono'
        ]
        excel.export_json_to_excel2(tHeader, data, filterVal, '订单信息')
      })
    },
 
    // 订单汇总
    downExcelStatisticsBtn() {
      const param = {
      }
      if (this.downData.gmtStart) {
        param['gmtStart'] = this.downData.gmtStart.getTime()
      }
      if (this.downData.gmtEnd) {
        param['gmtEnd'] = this.downData.gmtEnd.getTime()
      }
      getExcelStatistics(param).then(response => {
        if (response.data.data == null || response.data.data.length === 0) {
          this.$notify.error({
            title: '失败',
            message: '没有信息可以打印'
          })
        } else {
          this.handleStatisticsDownload(response.data.data)
        }
      })
        .catch(response => {
          this.downloadLoading = false
          this.$notify.error({
            title: '失败',
            message: response.data.errmsg
          })
        })
    },
 
    handleStatisticsDownload(data) {
      import('@/vendor/Export2Excel').then(excel => {
        const tHeader = [
          '商品名称',
          'spuId',
          '规格',
          'skuId',
          '数量'
        ]
        const filterVal = [
          'spuTitle',
          'spuId',
          'skuTitle',
          'skuId',
          'num'
        ]
        excel.export_json_to_excel2(tHeader, data, filterVal, '统计信息')
      })
    },
 
    tableCellClassName({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 1) {
        if (row.adminMonoLevel) {
          if (row.adminMonoLevel === 1) {
            return 'success-row'
          } else if (row.adminMonoLevel === 2) {
            return 'warning-row'
          } else if (row.adminMonoLevel === 3) {
            return 'danger-row'
          }
        }
        return ''
      }
    }
  }
}
</script>
<style>
  .el-table .danger-row {
    background: rgb(201, 143, 143);
  }
 
  .el-table .warning-row {
    background: rgb(197, 175, 142);
  }
 
  .el-table .success-row {
    background: rgb(166, 202, 149);
  }
</style>