status-nav.vue
2.28 KB
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
<template>
<div class="order-status-nav-scroll-wrap">
<scroll ref="statusScroll" :data="statusList" direction="horizontal">
<ul class="list-wrapper">
<li
:class="
status === statusInfo.value ? 'list-item active' : 'list-item'
"
v-for="(statusInfo, i) in statusList"
:key="i"
@click="() => onHandleClick(statusInfo.value)"
>
{{ statusInfo.text }}
</li>
</ul>
</scroll>
</div>
</template>
<script>
import { Scroll } from "cube-ui";
import {
buyerOrderStatusList,
sellerOrderStatusList,
ownType
} from "constants/order-constants";
import { createNamespacedHelpers } from "vuex";
const { mapState, mapMutations, mapActions } = createNamespacedHelpers(
"order/orderList"
);
export default {
components: {
Scroll
},
computed: {
...mapState(["currentStatus", "routeParamStatus"]),
statusList: function() {
const { owner } = this.$route.params;
return owner === ownType.BUY
? buyerOrderStatusList
: sellerOrderStatusList;
},
status() {
return this.currentStatus || this.routeParamStatus;
}
},
methods: {
...mapMutations(["setOrderStatus", "resetPartialData"]),
...mapActions(["fetchOrderList"]),
onHandleClick(status) {
this.setOrderStatus(status);
this.resetPartialData();
const { owner } = this.$route.params;
this.fetchOrderList({ owner, status });
}
}
};
</script>
<style>
.order-status-nav-scroll-wrap .cube-scroll-content {
display: inline-block;
min-width: 100%;
}
</style>
<style lang="scss" scoped>
.order-status-nav-scroll-wrap {
transform: rotate(0deg); // fix 子元素超出边框圆角部分不隐藏的问题
position: relative;
z-index: 10;
.list-wrapper {
white-space: nowrap;
font-size: 28px;
color: #999;
background: #fff;
box-shadow: inset 0 -1px 0 0 #eee;
display: flex;
justify-content: space-between;
align-items: center;
.list-item {
display: inline-block;
padding: 20px 0;
margin-left: 38px;
&:last-child {
margin-right: 38px;
}
}
.list-item.active {
font-size: 40px;
color: #000;
font-weight: bold;
border-bottom: 6px solid #000;
}
}
}
</style>