order-list.vue
4.25 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
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
<template>
<layout-app :title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'">
<status-nav @change="change" :owner="owner" :status="currentStatus" />
<div class="content-wrapper">
<scroll
@pulling-up="fetchData"
@pulling-down="onRefresh"
:options="options"
:data="orderList"
class="order-list-scroll-wrap"
>
<ul class="list-wrapper">
<li v-for="order in orderList" :key="order.orderCode">
<order-item-header :order="order" />
<order-item :order="order" />
<!-- 订单操作 -->
<div class="footer-wrapper">
<count-down :leftTime="order.leftTime" />
<order-actions
class="actions"
pageName="list"
:order="order"
@on-action="
action => {
onAction({ action, order });
onInSaleOrderAction({ action, order });
}
"
@on-video="params => onVideoHandle(params)"
/>
</div>
<div class="video-wrapper">
<VideoPlayer
:ref="order.orderCode"
class="video-player"
:source="order.appraiseVideoUrl"
></VideoPlayer>
</div>
</li>
</ul>
<empty-list
@touch.prevent
class="empty-wrapper"
tip="这里什么都没有..."
v-show="isShowEmpty"
/>
</scroll>
</div>
</layout-app>
</template>
<script>
import { Scroll } from "cube-ui";
import { createNamespacedHelpers } from "vuex";
import OrderItem from "./components/order-item";
import StatusNav from "./components/status-nav";
import OrderItemHeader from "./components/order-item-header";
import VideoPlayer from "./components/video-player";
import EmptyList from "components//ufo-no-item";
import OrderActions from "../components/order-actions";
import CountDown from "../components/count-down";
import orderActionMixin from "../mixin/order-action";
import orderInSaleActionMixin from "../mixin/order-in-sale-action";
const STORE_PATH = "order/orderList";
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
STORE_PATH
);
export default {
// 订单操作
mixins: [orderActionMixin, orderInSaleActionMixin],
components: {
Scroll,
OrderItem,
StatusNav,
OrderItemHeader,
EmptyList,
OrderActions,
CountDown,
VideoPlayer
},
data() {
const { status = 1, owner } = this.$route.params;
return {
currentStatus: +status,
owner
};
},
computed: {
...mapState(["orderList", "pullUpLoad", "isShowEmpty"]),
options: function() {
return {
pullUpLoad: this.pullUpLoad,
bounce: this.isShowEmpty ? false : true,
pullDownRefresh: this.isShowEmpty
? false
: {
txt: "更新成功"
}
};
}
},
activated() {
this.resetData();
this.fetchData();
},
methods: {
...mapActions(["fetchOrderList", "confirmReceipt"]),
...mapMutations(["resetData"]),
change(status) {
this.currentStatus = status;
},
fetchData() {
const { owner, currentStatus: status } = this;
this.fetchOrderList({ owner, status });
},
onRefresh() {
this.resetData();
this.fetchData();
},
onVideoHandle({ videoUrl, orderCode }) {
if (!videoUrl) {
return;
}
const $video = this.$refs[`${orderCode}`][0];
if ($video) {
$video.parentHandleclick();
}
}
}
};
</script>
<style lang="scss" scoped>
.content-wrapper {
height: calc(100vh - 100px);
overflow-x: hidden;
overflow-y: auto;
-webkit-box-orient: vertical;
.footer-wrapper {
display: flex;
margin-top: 40px;
.actions {
flex: 1;
}
}
.empty-wrapper {
margin: 20vh 0;
}
.order-list-scroll-wrap {
.list-wrapper {
li {
padding: 40px 40px 0;
border-bottom: 1px solid #eee;
}
& :last-child {
border-bottom: 0;
}
}
}
.video-wrapper {
overflow: hidden;
}
.video-player {
display: block;
height: 40px;
opacity: 0;
}
}
</style>