x
This commit is contained in:
@@ -10,6 +10,8 @@ const {
|
||||
formatDateTime,
|
||||
formatDate,
|
||||
getPurchaseOrderStatusLabel,
|
||||
getReceiptStatusLabel,
|
||||
getPaymentStatusLabel,
|
||||
isPurchaseOrderLocked,
|
||||
loadPurchaseOrders,
|
||||
loadSuppliers,
|
||||
@@ -218,6 +220,23 @@ async function markAsPaid(orderId: number) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateStatus(orderId: number, status: string) {
|
||||
const label = status === 'cancelled' ? '作废' : status
|
||||
if (!confirm(`确认${label}该订单?`)) return
|
||||
try {
|
||||
await apiRequest(`/api/purchase-orders/${orderId}/status`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify({ status })
|
||||
})
|
||||
addNotification(`订单已${label}`, 'success')
|
||||
loadPurchaseOrders()
|
||||
loadMovements()
|
||||
loadInventory()
|
||||
} catch (e) {
|
||||
handleApiError(e, '更新状态')
|
||||
}
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
showModal.value = false
|
||||
editingItem.value = null
|
||||
@@ -267,9 +286,16 @@ onMounted(() => {
|
||||
<el-table-column prop="supplier_name" label="供应商" />
|
||||
<el-table-column label="状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === 'received' ? 'success' : row.status === 'paid' ? 'info' : 'warning'">
|
||||
{{ getPurchaseOrderStatusLabel(row.status) }}
|
||||
</el-tag>
|
||||
<div style="display: flex; gap: 4px;">
|
||||
<el-tag
|
||||
:type="row.receipt_status === 'received' ? 'success' : row.receipt_status === 'partial_received' ? 'warning' : row.receipt_status === 'cancelled' ? 'danger' : 'info'"
|
||||
size="small"
|
||||
>{{ getReceiptStatusLabel(row.receipt_status) }}</el-tag>
|
||||
<el-tag
|
||||
:type="row.payment_status === 'paid' ? 'success' : 'info'"
|
||||
size="small"
|
||||
>{{ getPaymentStatusLabel(row.payment_status) }}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单创建">
|
||||
@@ -309,7 +335,7 @@ onMounted(() => {
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'pending'"
|
||||
v-if="row.receipt_status === 'pending' || row.receipt_status === 'partial_received'"
|
||||
type="success"
|
||||
size="small"
|
||||
@click="openReceiveDialog(row)"
|
||||
@@ -317,13 +343,21 @@ onMounted(() => {
|
||||
到货入库
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'received'"
|
||||
v-if="row.receipt_status === 'received' && row.payment_status !== 'paid'"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="markAsPaid(row.id)"
|
||||
>
|
||||
标记为已付款
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.payment_status !== 'paid' && row.receipt_status !== 'cancelled'"
|
||||
type="info"
|
||||
size="small"
|
||||
@click="updateStatus(row.id, 'cancelled')"
|
||||
>
|
||||
作废
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
Reference in New Issue
Block a user