in-sell-order-list.vue
2.92 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
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
<template>
<layout-app title="出售中">
<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, i) in orderList" :key="i">
<order-item :order="order" />
<!-- 订单操作 -->
<div class="footer-wrapper">
<count-down :leftTime="order.leftTime" />
<order-actions
class="actions"
:order="order"
@on-action="action => onSaleOrderAction({ action, order })"
/>
</div>
</li>
</ul>
</scroll>
<empty-list
class="empty-wrapper"
tip="这里什么都没有..."
v-show="isShowEmpty"
/>
</div>
</layout-app>
</template>
<script>
import { Scroll } from "cube-ui";
import { createNamespacedHelpers } from "vuex";
import OrderItem from "./components/in-sale-order-item";
import EmptyList from "components//ufo-no-item";
import OrderActions from "../components/order-actions";
import CountDown from "../components/count-down";
import orderSellActionMixin from "../mixin/order-sell";
const IN_SALE_STORE_PATH = "order/inSaleOrderList";
const {
mapActions,
mapState,
mapGetters,
mapMutations
} = createNamespacedHelpers(IN_SALE_STORE_PATH);
export default {
// 订单操作
mixins: [orderSellActionMixin],
components: {
Scroll,
OrderItem,
EmptyList,
OrderActions,
CountDown
},
computed: {
...mapState(["entryOrder", "notEntryOrder", "isShowEmpty"]),
...mapGetters(["orderList", "pullUpLoad"]),
options: function() {
return {
pullUpLoad: this.pullUpLoad,
pullDownRefresh: true
};
},
isFetchEntryOrder() {
return this.entryOrder.pullUpLoad;
}
},
// 获取订单数据
asyncData({ store, router }) {
store.commit(`${IN_SALE_STORE_PATH}/resetData`);
return store.dispatch(
`${IN_SALE_STORE_PATH}/fetchEntryOrderList`,
router.params
);
},
methods: {
...mapActions(["fetchEntryOrderList", "fetchNotEntryOrderList"]),
fetchData() {
if (this.isFetchEntryOrder) {
this.fetchEntryOrderList();
} else {
this.fetchNotEntryOrderList();
}
}
}
};
</script>
<style lang="scss" scoped>
.content-wrapper {
height: calc(100vh - 100px);
overflow-x: hidden;
overflow-y: auto;
-webkit-box-orient: vertical;
.empty-wrapper {
margin: auto 0;
position: absolute;
top: 0;
bottom: 0;
}
.footer-wrapper {
display: flex;
margin-top: 40px;
.actions {
flex: 1;
}
}
.order-list-scroll-wrap {
.list-wrapper {
li {
padding: 40px 40px;
border-bottom: 1px solid #eee;
}
& :last-child {
border-bottom: 0;
}
}
}
}
</style>