Authored by lea guo

订单列表

<template>
<div class="count-down-wrapper">
<span></span>
<div class="count-down-wrapper" v-if="countDown !== ''">
<i class="time-icon"></i>
<span>{{ countDown }}</span>
</div>
</template>
... ... @@ -14,29 +15,33 @@ export default {
},
data() {
return {
remainTime: this.props.leftTime,
remainTime: this.$props.leftTime,
countDown: "",
timeoutId: null
};
},
mounted() {
this.countDown = this.formatTime();
this.countDown = this.formatTime().join(":");
this.timeoutId = setInterval(() => {
this.remainTime--;
this.countDown = this.formatTime();
this.countDown = this.formatTime().join(":");
}, 1000);
},
destroyed() {
clearInterval(this.timeoutId);
},
computed: {
timeList: function() {}
watch: {
countDown(val) {
if (val === "") {
clearInterval(this.timeoutId);
}
}
},
methods: {
formatTime() {
if (this.remainTime < 0) {
return ["00", "00", "00"];
if (this.remainTime <= 0) {
return [];
}
let remainTime = this.remainTime;
... ... @@ -49,7 +54,7 @@ export default {
const numberOfSeconds = remainTime - numberOfMinutes * 60;
return [numberOfHour, numberOfMinute, numberOfSeconds].map(time => {
return [numberOfHours, numberOfMinutes, numberOfSeconds].map(time => {
return time < 10 ? `0${time}` : `${time}`;
});
}
... ... @@ -60,5 +65,21 @@ export default {
<style lang="scss" scoped>
.count-down-wrapper {
display: flex;
font-size: 32px;
font-weight: bold;
align-items: center;
& > i {
width: 30px;
height: 30px;
display: block;
background: url("~statics/image/order/time-icon@3x.png");
background-size: contain;
background-position: center;
}
& > span {
padding: 0 9px;
}
}
</style>
\ No newline at end of file
... ...
... ... @@ -161,7 +161,6 @@ export default {
.actions-wrapper {
display: flex;
justify-content: flex-end;
margin-top: 40px;
button {
font-size: 24px;
... ...
... ... @@ -59,7 +59,7 @@
</div>
<!-- 操作 -->
<div v-if="actionList.length" class="actions">
<order-actions class="detail-actions" :order="orderDetail" />
<order-actions :order="orderDetail" />
</div>
</div>
</template>
... ... @@ -215,10 +215,6 @@ export default {
box-shadow: inset 0 1px 0 0 #eee;
padding: 20px;
z-index: 10;
.detail-actions {
margin-top: 0;
}
}
}
</style>
\ No newline at end of file
... ...
<template>
<div class="footer-wrapper">
<count-down :leftTime="order.leftTime" />
<order-actions class="actions" :order="order" />
</div>
</template>
<script>
import OrderActions from "../../components/order-actions";
import CountDown from "../../components/count-down";
export default {
props: {
order: {
type: Object,
default: {}
}
},
components: {
OrderActions,
CountDown
}
};
</script>
<style lang="scss" scoped>
.footer-wrapper {
display: flex;
margin-top: 40px;
.actions {
flex: 1;
}
}
</style>
\ No newline at end of file
... ...
... ... @@ -12,7 +12,7 @@
<order-info :order="order" />
<order-list-item :order="order" />
<!-- 订单操作 -->
<order-actions :order="order" />
<order-item-footer :order="order" />
</li>
</ul>
</scroll>
... ... @@ -27,8 +27,7 @@ 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";
import OrderItemFooter from "./components/order-footer";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers(
"order/inSaleOrderList"
... ... @@ -38,9 +37,9 @@ export default {
components: {
Scroll,
OrderListItem,
OrderActions,
OrderInfo,
EmptyList
EmptyList,
OrderItemFooter
},
computed: {
...mapState(["entryOrder", "notEntryOrder", "isShowEmpty"]),
... ...
... ... @@ -14,7 +14,7 @@
<order-info :order="order" />
<order-list-item :order="order" />
<!-- 订单操作 -->
<order-actions :order="order" />
<order-item-footer :order="order" />
</li>
</ul>
</scroll>
... ... @@ -31,8 +31,7 @@ import OrderListItem from "./components/order-item";
import StatusNav from "./components/status-nav";
import OrderInfo from "./components/order-info.vue";
import EmptyList from "./components/empty";
import OrderActions from "../components/order-actions";
import OrderItemFooter from "./components/order-footer";
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
"order/orderList"
... ... @@ -43,9 +42,9 @@ export default {
Scroll,
OrderListItem,
StatusNav,
OrderActions,
OrderInfo,
EmptyList
EmptyList,
OrderItemFooter
},
computed: {
...mapState(["orderList", "pullUpLoad", "isShowEmpty"]),
... ...
... ... @@ -82,7 +82,7 @@ export default function() {
});
if (res.code === 200) {
commit('setEntryOrder', res.data);
commit('setNotEntryOrder', res.data);
}
},
},
... ...