98 lines
2.3 KiB
Vue
98 lines
2.3 KiB
Vue
<template>
|
|
<div class="archive-order-panel">
|
|
<div class="panel-toolbar">
|
|
<el-button size="small" type="primary" :loading="loading" @click="loadArchiveOrders">刷新归档订单</el-button>
|
|
</div>
|
|
<el-table :data="archiveList" border stripe size="small" v-loading="loading">
|
|
<el-table-column prop="delivery_order_code" label="发货单号" min-width="180" />
|
|
<el-table-column prop="order_code" label="订单号" min-width="180" />
|
|
<el-table-column prop="status" label="状态" min-width="110" />
|
|
<el-table-column prop="updated_at" label="归档时间" min-width="170" />
|
|
</el-table>
|
|
<div v-if="!loading && !archiveList.length" class="empty-tip">当前订单暂无归档记录</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, watch } from 'vue'
|
|
import { orderArchiveOrder } from '@/api/order.archiveorder/orderarchiveorder'
|
|
|
|
const props = defineProps<{
|
|
orderId?: number | string | null
|
|
deliveryOrderCode?: string
|
|
}>()
|
|
|
|
const loading = ref(false)
|
|
const archiveList = ref<any[]>([])
|
|
|
|
watch(
|
|
() => [props.orderId, props.deliveryOrderCode],
|
|
() => {
|
|
loadArchiveOrders()
|
|
},
|
|
{ immediate: true }
|
|
)
|
|
|
|
async function loadArchiveOrders() {
|
|
if (!props.orderId && !props.deliveryOrderCode) {
|
|
archiveList.value = []
|
|
return
|
|
}
|
|
|
|
loading.value = true
|
|
try {
|
|
const where: Record<string, any> = {}
|
|
if (props.deliveryOrderCode) {
|
|
where.delivery_order_code = {
|
|
operator: 'eq',
|
|
value: props.deliveryOrderCode,
|
|
type: 'text'
|
|
}
|
|
} else if (props.orderId) {
|
|
where.id = {
|
|
operator: 'eq',
|
|
value: props.orderId,
|
|
type: 'number'
|
|
}
|
|
}
|
|
|
|
const res = await orderArchiveOrder.list({
|
|
pagination: {
|
|
page: 1,
|
|
pageSize: 20
|
|
},
|
|
where
|
|
})
|
|
|
|
if (res && (res.code === 1 || res.code === 200)) {
|
|
archiveList.value = res.data?.list || []
|
|
return
|
|
}
|
|
archiveList.value = []
|
|
} catch (error) {
|
|
archiveList.value = []
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.archive-order-panel {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
}
|
|
|
|
.panel-toolbar {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.empty-tip {
|
|
color: #909399;
|
|
text-align: center;
|
|
padding: 8px 0;
|
|
}
|
|
</style>
|