...
|
...
|
@@ -14,7 +14,16 @@ |
|
|
<order-info :order="order" />
|
|
|
<order-list-item :order="order" />
|
|
|
<!-- 订单操作 -->
|
|
|
<order-item-footer :order="order" />
|
|
|
<!-- <order-item-footer :order="order" /> -->
|
|
|
|
|
|
<div class="footer-wrapper">
|
|
|
<count-down :leftTime="order.leftTime" />
|
|
|
<order-actions
|
|
|
class="actions"
|
|
|
:order="order"
|
|
|
@on-action="action => onAction({ action, order })"
|
|
|
/>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</scroll>
|
...
|
...
|
@@ -28,16 +37,27 @@ |
|
|
import { Scroll } from "cube-ui";
|
|
|
import { createNamespacedHelpers } from "vuex";
|
|
|
|
|
|
import {
|
|
|
orderActionsMap,
|
|
|
ownType
|
|
|
} from "../../../../constants/order-constants";
|
|
|
|
|
|
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 OrderItemFooter from "./components/order-footer";
|
|
|
|
|
|
import OrderActions from "../components/order-actions";
|
|
|
import CountDown from "../components/count-down";
|
|
|
import CancelConfirmInfo from "../components/order-list/cancel-confirm-info";
|
|
|
|
|
|
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
|
|
|
"order/orderList"
|
|
|
);
|
|
|
|
|
|
const { mapMutations: orderMapMutations } = createNamespacedHelpers("order");
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
Scroll,
|
...
|
...
|
@@ -45,7 +65,9 @@ export default { |
|
|
StatusNav,
|
|
|
OrderInfo,
|
|
|
EmptyList,
|
|
|
OrderItemFooter
|
|
|
OrderItemFooter,
|
|
|
OrderActions,
|
|
|
CountDown
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(["orderList", "pullUpLoad", "isShowEmpty"]),
|
...
|
...
|
@@ -61,15 +83,14 @@ export default { |
|
|
// const { owner, status } = router.params;
|
|
|
// store.dispatch("order/orderList/fetchOrderList", { owner, status });
|
|
|
},
|
|
|
mounted() {
|
|
|
this.fetchData();
|
|
|
},
|
|
|
activated() {
|
|
|
this.reset("orderList");
|
|
|
this.fetchData();
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(["fetchOrderList"]),
|
|
|
...mapActions(["fetchOrderList", "cancelTradeConfirmInfo", "cancelTrade"]),
|
|
|
...mapMutations(["setOrderStatus"]),
|
|
|
...orderMapMutations(["reset"]),
|
|
|
fetchMore() {
|
|
|
this.fetchOrderList(this.$route.params);
|
|
|
},
|
...
|
...
|
@@ -80,23 +101,93 @@ export default { |
|
|
this.setOrderStatus(status);
|
|
|
}
|
|
|
this.fetchOrderList(params);
|
|
|
},
|
|
|
async onAction({ action, order }) {
|
|
|
console.log("----------action---------", action);
|
|
|
const { owner = ownType.SELL } = this.$route.params;
|
|
|
const {
|
|
|
orderCode,
|
|
|
earnestMoney = 0,
|
|
|
realPrice = "",
|
|
|
priceInfo = {}
|
|
|
} = order;
|
|
|
|
|
|
const { productId, storageId, skup } = order.goodsInfo;
|
|
|
|
|
|
switch (action.name) {
|
|
|
// 删除订单
|
|
|
case orderActionsMap.DEL_ORDER.name:
|
|
|
this.$createDialog({
|
|
|
type: "confirm",
|
|
|
content: "确认删除订单?",
|
|
|
onConfirm: async () => {
|
|
|
const isOk = await this.deleteOrder({
|
|
|
orderCode,
|
|
|
owner
|
|
|
});
|
|
|
const txt = isOk ? "删除成功" : "删除失败";
|
|
|
this.$createToast({ txt, type: "txt" }).show();
|
|
|
}
|
|
|
}).show();
|
|
|
break;
|
|
|
|
|
|
case orderActionsMap.CANCEL_ORDER.name:
|
|
|
const confirmInfo = await this.cancelTradeConfirmInfo({
|
|
|
orderCode,
|
|
|
owner
|
|
|
});
|
|
|
this.$createDialog(
|
|
|
{
|
|
|
type: "confirm",
|
|
|
confirmBtn: { text: "取消订单" },
|
|
|
cancelBtn: { text: "保留订单" },
|
|
|
onConfirm: async () => {
|
|
|
const isOk = await this.cancelTrade({
|
|
|
orderCode,
|
|
|
owner
|
|
|
});
|
|
|
if (isOk) {
|
|
|
this.reset("orderList");
|
|
|
this.fetchData(this.$route.params);
|
|
|
}
|
|
|
const txt = isOk ? "取消成功" : "取消失败";
|
|
|
this.$createToast({ txt, type: "txt" }).show();
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
$route() {
|
|
|
// console.log("---------route change----------");
|
|
|
// this.fetchOrderList(this.$route.params);
|
|
|
createElement => {
|
|
|
return [
|
|
|
createElement(CancelConfirmInfo, {
|
|
|
slot: "content",
|
|
|
props: { confirmInfo }
|
|
|
})
|
|
|
];
|
|
|
}
|
|
|
).show();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
$route() {}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.content-wrapper {
|
|
|
height: calc(100vh - 300px);
|
|
|
height: calc(100vh - 200px);
|
|
|
overflow-x: hidden;
|
|
|
overflow-y: auto;
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
|
.footer-wrapper {
|
|
|
display: flex;
|
|
|
margin-top: 40px;
|
|
|
|
|
|
.actions {
|
|
|
flex: 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.order-list-scroll-wrap {
|
|
|
.list-wrapper {
|
|
|
li {
|
...
|
...
|
|