You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-admin/src/views/sales/order/track.vue

70 lines
2.0 KiB

<template>
<el-dialog v-model="state.visible" title="物流跟踪">
<div v-loading="state.loading" class="track-container">
<h3>
<span class="name">{{ state.info.companyName }}</span>
<span class="no">{{ state.info.trackingNo }}</span>
<el-button type="text" @click="$copy(`${state.info.companyName} ${state.info.trackingNo}`)">
复制
</el-button>
</h3>
<el-scrollbar max-height="50vh">
<el-timeline>
<el-timeline-item
v-for="(item, index) in state.info.logisticsDataList"
:key="index"
placement="top"
:timestamp="item.time"
>
{{ item.context }}
</el-timeline-item>
</el-timeline>
</el-scrollbar>
</div>
<template #footer>
<el-button @click="close">关闭</el-button>
</template>
</el-dialog>
</template>
<script setup lang="jsx">
const store = useStore();
const opts = computed(() => store.state.order.opts);
if (!unref(opts).init) {
store.dispatch('order/load');
}
const state = reactive({
loading: false,
visible: false,
info: {
logisticsDataList: [],
},
});
const show = async (orderId) => {
state.visible = true;
state.loading = true;
let res = await store.dispatch('order/track', orderId);
Object.assign(state.info, res || {});
state.loading = false;
};
const close = () => {
state.visible = false;
};
defineExpose({
show,
close,
});
</script>
<style lang="less" scoped>
.track-container {
h3 {
margin-bottom: @layout-space;
.no {
margin: 0 @layout-space;
}
}
}
</style>