in-sell-order-list.vue
2.27 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="content-wrapper">
<scroll
@pulling-up="fetchData"
:options="options"
:data="orderList"
class="order-list-scroll-wrap"
v-show="!isShowEmpty"
>
<ul class="list-wrapper">
<li v-for="order in orderList" :key="order.orderCode">
<order-info :order="order" />
<order-list-item :order="order" />
<!-- 订单操作 -->
<order-actions :order="order" />
</li>
</ul>
</scroll>
<empty-list v-show="isShowEmpty" />
</div>
</template>
<script>
import { Scroll } from "cube-ui";
import { createNamespacedHelpers } from "vuex";
import OrderListItem from "./components/order-item";
import OrderInfo from "./components/order-info.vue";
import EmptyList from "./components/empty";
import OrderActions from "../components/order-actions";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers(
"order/inSaleOrderList"
);
export default {
components: {
Scroll,
OrderListItem,
OrderActions,
OrderInfo,
EmptyList
},
computed: {
...mapState(["entryOrder", "notEntryOrder", "isShowEmpty"]),
...mapGetters(["orderList", "pullUpload"]),
options: function() {
return {
pullUpload: this.pullUpload
};
},
isFetchEntryOrder() {
return this.entryOrder.pullUpload;
}
},
// 获取订单数据
asyncData({ store, router }) {
// const { owner, status } = router.params;
// store.dispatch("order/orderList/fetchOrderList", { owner, status });
},
mounted() {
this.fetchData();
},
methods: {
...mapActions(["fetchEntryOrderList", "fetchNotEntryOrderList"]),
fetchData() {
if (this.isFetchEntryOrder) {
this.fetchEntryOrderList();
} else {
this.fetchNotEntryOrderList();
}
}
},
watch: {
isFetchEntryOrder(val) {
if (!val) {
this.fetchData();
}
}
}
};
</script>
<style lang="scss" scoped>
.content-wrapper {
height: calc(100vh);
overflow-x: hidden;
overflow-y: auto;
-webkit-box-orient: vertical;
.order-list-scroll-wrap {
.list-wrapper {
li {
padding: 40px 40px;
border-bottom: 1px solid #eee;
}
& :last-child {
border-bottom: 0;
}
}
}
}
</style>