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
| <template>
| <div class="count">
| <div class="count_item" v-for="(item,index) in countList" :key="index">
| <div class="square" :style="{background: setBgColor(item.type)}"></div>
| <span>{{item.title}}</span>
| <!-- <span class="count_num">{{item.count}}</span> -->
| </div>
| <div class="page-count_item">
| <slot></slot>
| </div>
| </div>
| </template>
| <script lang="ts" setup>
| import { ref,defineProps, computed } from 'vue'
| const props = defineProps({
| countData: {
| type: Array,
| required: true
| }
| })
| //const countList: Record<any, any> = computed(() => props.countData)
| //统计的数据
| const countList = ref([
| {
| type: 0,
| title: '待收货',
| // count: 0
| },
| {
| type: 1,
| title: '延迟未收货',
| // count: 0
| },
| {
| type: 2,
| title: '收货中',
| // count: 0
| },
| {
| type: 3,
| title: '收货完成',
| // count: 0
| },
| {
| type: 4,
| title: '已取消',
| // count: 0
| },
| {
| type: 5,
| title: '已关闭',
| // count: 0
| }
| ]);
| //设置背景
| const setBgColor = (type: number): string => {
| let color = ''
| switch (type) {
| case 0:
| color = '#E6A23C';
| // color = '#fcd3d3';
| break;
| case 1:
| color = '#F56C6C';
| // color = '#f0f9eb';
| break;
| case 2:
| color = '#67C23A';
| // color = '#faecd8';
| break;
| case 3:
| color = '#409EFF';
|
| break;
| case 4:
| color = '#909399';
| break;
| case 5:
| color ='#800080';
| break;
| }
| return color;
| }
|
| </script>
| <style lang="less" scoped>
| .count {
| width: 100%;
| display: flex;
| box-sizing: border-box;
| justify-content: space-around;
| margin-bottom: 10px;
| font-size: 15px;
| flex-wrap: wrap;
| .count_item {
| // width: 10%;
| display: flex;
| justify-content: flex-start;
| align-items: center;
| margin-right: 20px;
| margin-bottom: 10px;
| .square {
| width: 20px;
| height: 20px;
| border-radius: 4px;
| margin-right: 10px;
| }
|
| .count_num {
| margin-left: 10px;
| font-weight: bold;
| font-size: 16px;
| }
| }
| .page-count_item{
| width: 55%;
| display: flex;
| justify-content: flex-end;
| align-items: center;
| margin-right: 20px;
| margin-bottom: 10px;
| }
| }
| </style>
|
|